Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hard time with hardware acceleration.
#6
Aren't you just working yourself to death again, just from never stepping past SCREEN 0 stuff?  Tongue

Code: (Select All)
        Color 0, 7
        Locate 8, 15
        Print Space$(6)
        Locate , 15
        Print Space$(6)
        Locate , 15
        Print Space$(6)
        Color 7, 0

The above is supposed to be a 6x3 white box.  Right?

Try this instead:
Code: (Select All)
sw_box = _NEWIMAGE (6 * _fontwidth, 3 * _fontheight, 32)
_DEST sw_box: CLS, _RGB32(128,128,128) 'software box is now made!
hw_box = _COPYIMAGE(sw_box, 33) 'hardware box is now made!
_DEST 0' restore DEST
_FREEIMAGE sw_box 'software box is now gone forevermore

Now just _PUTIMAGE that hardware box wherever you needs it to go on the screen, whenever you needs a hardware box on the screen.

Take this little example as a starting point:

Code: (Select All)
temp1 = _NewImage(100, 100, 32)
temp2 = _NewImage(26, 18, 32) '8 x 16, 3 characters,with 2 added for a border if wanted

_Dest temp1: Cls , _RGB32(0, 0, 255) 'deep blue box
_Dest temp2
Cls , _RGB32(255, 0, 0) 'a red button
Line (0, 0)-(25, 15), _RGB32(255, 255, 255), B 'with a white border
Color _RGB32(255, 255, 255), 0 'white text with transparent background
_PrintString (1, 1), "FOO" 'and foo wrote on the button
_Dest 0 'back to the screen 0 default screen

hw1 = _CopyImage(temp1, 33)
hw2 = _CopyImage(temp2, 33)
_FreeImage temp1
_FreeImage temp2

'and now to bring it all together
Do
    i = i + 1
    Print i;
    _PutImage (100, 100), hw1 'this goes to the main hardware layer
    _PutImage (120, 120), hw2, 1 'and the one here goes to hardware layer 1
    _Limit 30
    _Display
Loop Until InKey$ = Chr$(17) 'escape to quit

See me printing and scrolling text on the screen 0 software layer?  Notice the TWO other hardware layers?  (The second one has the ,1 at the end of it.)

That's all there basically is to it.  Wink
Reply


Messages In This Thread
Hard time with hardware acceleration. - by Pete - 03-21-2025, 06:54 PM
RE: Hard time with hardware acceleration. - by SMcNeill - 03-21-2025, 09:04 PM



Users browsing this thread: 1 Guest(s)