Here's my dilema. I noticed that the LINE function from QB differs a little than most custom libs. I tried Cosmox, Rellib and Blast and they aren't as acurate as QB's LINE. Does QB use a different algorithm than bresenham's? So, since I need a layer for my current project, I need to use SCREEN 7 because it has more than one page. I want to use SCREEN 13, but if I do, I need to set up a layer for flickerless animation. But I can't, because the LINE routine only draws onto the screen. Anyways, is there a way to use QB's drawing primitives directly to a layer instead of to the screen. It's not that neccesary because I'm managing alright with screen 7, but if I want a speed increase from using screen 13 libs and a 256 color palette, I need a way to draw directly to a layer. Any suggestions?
Yep, sure is. All you have to do is change QB's default drawing segment to your layer:
Code:
' VideoSeg by Plasma357
' Changes QB's active video segment for SCREEN 13
'
' (Works both compiled and in the IDE)
'
' Note: Text is still output to segment A000, but all graphics functions will
' use the new segment specified.
DEFINT A-Z
DECLARE SUB SetVideoSeg (Segment)
' Here's a useless example that just shifts the segment 16 bytes. Not very
' useful, but you get the picture. ;) You can easily change the segment to
' the EMS pageframe or a buffer in conventional memory.
SCREEN 13
SetVideoSeg &HA000
PSET (0, 0), 15
SetVideoSeg &HA001
PSET (0, 0), 15
k$ = INPUT$(1)
END
SUB SetVideoSeg (Segment) STATIC
DEF SEG
IF VideoAddrOff& = 0 THEN ' First time the sub is called
' We need to find the location of b$AddrC, which holds the graphics
' offset (b$OffC) and segment (b$SegC). Since b$AddrC is in the default
' segment, we can find it by setting it to a certain value, and then
' searching for that value.
SCREEN 13 ' Set b$SegC to A000 (00A0 in memory)
PSET (160, 100), 0 ' Set b$OffC to 7DA0 (not needed in the IDE)
FOR Offset& = 0 TO 32764 ' Search for b$AddrC, which is
IF PEEK(Offset&) = &HA0 THEN ' in the default segment and
IF PEEK(Offset& + 1) = &H7D THEN ' should have a value of
IF PEEK(Offset& + 2) = &H0 THEN ' A0 7D 00 A0.
IF PEEK(Offset& + 3) = &HA0 THEN
VideoAddrOff& = Offset& + 2 ' If we found it, record the
EXIT FOR ' offset of b$SegC and quit
END IF ' looking. (Oddly, changing
END IF ' the b$OffC doesn't seem to
END IF ' do anything, so this is why
END IF ' this sub only changes b$SegC)
NEXT
END IF
' Change b$SegC to the specified Segment
POKE VideoAddrOff&, Segment AND &HFF
POKE VideoAddrOff& + 1, (Segment AND &HFF00&) \ &H100
END SUB
If your layer is a base layer, you have to get the segment of the layer (depends on the lib, I know there's a function in DQB at least). If your layer is an EMS layer, you have to get the EMS pageframe segment (the lib might have a function to do this, otherwise you can do it with an interrupt).
Then you just use:
SetVideoSeg layersegment%
To set the drawing segment back to the screen (video memory), use &HA000 for the segment.
Also, as stated in the code, this only works for graphics routines...text still goes to the screen.
excellent, thanks a lot :bounce:
That's whacked. I had no idea you could set QB's primatives to draw on other layers... crazy.
Quote:That's whacked. I had no idea you could set QB's primatives to draw on other layers... crazy.
LOL. I've been spamming SetvideoSeg on this forum for almost a year by making some Effects. Look at my 3d rotator. :*)
plasma only discovered that trick a few months ago, so i dont think it's a big deal if didnt know about it
Heh, it was almost a year ago
I still haven't used it for what it was originally intended...
What do you wait for? A Toshi's demo contest?
when will the 2003 contest begin, anyhow
Actually, I didn't even enter the last one...I had too much crap going on.
Maybe I'll put something together this summer...
But yeah, that was the original plan 8)