Author Topic: Is this at all possible in SCREEN 0?  (Read 6506 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Is this at all possible in SCREEN 0?
« on: October 15, 2021, 10:49:43 pm »
Is there anyway in SCREEN 0 to make a screen overlay, and I'll attempt to explain.

A program has a window with a black background and multi-colored ascii images on it. Next step, make the characters on the screen grey, that's the easy part.... Next somehow make this grey on black screen a background image. Final step, write on top of that scree with translucent lettering, so the background bleeds through. This is easy to accomplish in HTML. Any chance it can be done in QB64?

Note: This is different than using two screens to make a popup window, although if that popup window could have a translucent background, I don't know, maybe that would work. But as a solid background, it's just a popup window that obliterates everything behind it. That I could do, but I'd rather have the overlay effect, if possible.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Is this at all possible in SCREEN 0?
« Reply #1 on: October 15, 2021, 11:30:07 pm »
You can do this by rendering a hardware screen over the software one, but only the software will be screen 0.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #2 on: October 15, 2021, 11:40:38 pm »
So I'll check out hardware images, here: http://www.qb64.org/wiki/Hardware_images

It may not work for me, as it sounds backwards to what I was thinking about, being the hardware screen being the background image, and the screen as the overlay. I've got so RA file stuff to do first, so I may not get to this for a day or two. This would be a neat effect, if it can be pulled off.

Thanks,

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Is this at all possible in SCREEN 0?
« Reply #3 on: October 16, 2021, 06:27:14 am »
Give this demo a quick whirl, @Pete.

Code: QB64: [Select]
  1. Screen0 = _NewImage(80, 40, 0)
  2. Screen Screen0
  3.  
  4. 'font usage here is just because my laptop has an insane resolution
  5. 'of almost 4000x2000 pixels, and without it, everything is microscopic
  6. 'on my machine.  Feel free to disable this if it makes the screen too
  7. 'large for your PC to display properly.
  8. font = _LoadFont("courbd.ttf", 48, "monospace")
  9. If font <= 0 Then font = 16
  10. _Font font
  11.  
  12. 'This is going to be the screen I use as an overlay.
  13.  
  14. 'Now,I'm going to print something pretty on my Screen0.
  15. _PaletteColor 1, Orange
  16. _PaletteColor 2, SlateGray
  17. Color 1, 2
  18. For x = 20 To 60
  19.     Locate 10, x: Print "*"
  20.     Locate 30, x: Print "*"
  21. For y = 11 To 29
  22.     Locate y, 20
  23.     Print "*"; String$(39, " "); "*"
  24.  
  25. 'Now the above is just Pete's background in Screen0.
  26. 'Now I'm going to create the Overly
  27.  
  28. _Dest Overlay
  29. For i = 200 To 1 Step -.25
  30.     Circle (_Width \ 2, _Height \ 2), i, Orange
  31. Color MidnightBlue, 0
  32. If font <= 0 Then font = 16
  33. _Font font
  34. text$ = "This is text wrote over the background"
  35. _PrintString ((_Width - _PrintWidth(text$)) \ 2, _Height \ 2), text$
  36.  
  37. _Dest 0 'reset our dest back to the normal screen 0 screen
  38.  
  39. 'Turn our software overlay into a hardware image
  40. Overlay_Hardware = _CopyImage(Overlay, 33)
  41.  
  42. 'And then my impressive main program to toggle between showing and not
  43. 'showing the overlay.
  44.     k = _KeyHit
  45.     If k = 32 Then Show_Overlay = Not Show_Overlay
  46.     If Show_Overlay Then _PutImage (0, 0), Overlay_Hardware
  47.     _Display
  48.     _Limit 30
  49. Loop Until k = 27
  50.  
  51.  
  52.  

Now note, I wrote this on my laptop while still in bed, so there's some unnecessary crap in there that you might need to remove first.  My laptop is one of those with a stupid 3840x2048 resolution, which then scales all windows by 200% to effectively give itself 1920x1024 resolution....  Why the hell it doesn't just go with 1920x1024 and ignore the need for scaling, I don't have a clue!  Unfortunately, QB64 and the programs we write in it, are ones that ignore that automatic "scale to 200%) command, so the screen is too bleeping small to read or interact with on the monitor!  To fix that, I've had to use a font which will be larger than heck on normal resolution systems, so you might need to comment out that line with the _loadfont statement.

Otherwise, this is just a very simple little demo of using a hardware screen as an overlay for your SCREEN 0 screen. 

Hit space to toggle the overlay on or off.
Hit ESC to end the demo.

My Overlay here is nothing more than a simple "pumpkin" on the screen and a little text which will center itself over the Screen 0 background.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #4 on: October 16, 2021, 11:27:01 am »
Having trouble visualizing just what it is your after Pete, do you have a screen shot?

if HTML does it I doubt screen 0 will, you will probably need a graphical screen mode. Unless your just referring to having a background "image" and the text overlaid upon it? Of course then you can just use the memory pages in screen 0 to Pcopy over top so that is probably not what you mean, since I know you have probably more knowledge of screen 0 than I ever will and would just do that if it was the effect you wanted.
Granted after becoming radioactive I only have a half-life!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #5 on: October 17, 2021, 01:35:07 pm »
@Cobalt The code below will give you some more insight into what I'm talking about...

@SMcNeill HELP HELP, I'm stuck in a graphics screen and can't get out!

Code: QB64: [Select]
  1. Screen0 = _NEWIMAGE(80, 25, 0)
  2. SCREEN Screen0
  3.  
  4.  
  5. COLOR 0, 7
  6. FOR x = 1 TO 25
  7.     LOCATE x, 1: PRINT STRING$(80, 176);
  8.  
  9. _DEST Overlay
  10. COLOR MidnightBlue, 0
  11.  
  12. REDIM text$(5)
  13. text$(1) = "This is a SCREEN 0 overlay method"
  14. text$(2) = "used by the Amazing Steve and"
  15. text$(3) = "modified by me to create a simple"
  16. text$(4) = "text to screen overlay on a dotted"
  17. text$(5) = "SCREEN 0 background!"
  18.  
  19. font = _LOADFONT("lucon.ttf", 25, "bold")
  20. IF font <= 0 THEN font = 16
  21. _FONT font
  22.  
  23. FOR k = 1 TO 5
  24.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(text$(k))) \ 2, 40 + k * 40), text$(k)
  25.  
  26.     Overlay_Hardware = _COPYIMAGE(Overlay, 33)
  27.  
  28.     _PUTIMAGE (0, 0), Overlay_Hardware
  29.     _DISPLAY
  30.     _DELAY 1.75
  31.  
  32. _FONT 16 'select inbuilt 8x16 default font
  33.  
  34. msg$ = "Press any key to remove text."
  35. _PRINTSTRING (10, 380), msg$
  36.  
  37. Overlay_Hardware = _COPYIMAGE(Overlay, 33)
  38.  
  39. _PUTIMAGE (0, 0), Overlay_Hardware
  40. WHILE LEN(INKEY$): WEND ' Clear keyboard buffer in case user pressed a key during program run.
  41.  
  42. _DISPLAY ' Removes text.
  43.  
  44. _DEST 0 'Reset dest back to the normal screen 0.
  45.  
  46.  
  47. REM SCREEN 0 ' From here down it needs to function like SCREEN 0 again.
  48. COLOR 0, 7
  49. msg$ = "Press any key to end..."
  50. LOCATE 25, 1: PRINT msg$;
  51. a$ = INPUT$(1)
  52.  


It's so cool, well, right up to the point where I noticed it doesn't really go back to a functioning SCREEN 0 text mode screen. Is there a way to get it back, for real? I tried combinations of _DEST _SOURCE, and just SCREEN 0, but so far, nothing I tried would print the black on white "Press any key to end..." message at the bottom right corner of the screen. Oh, let's just jump ahead and get the joke to just use... "END" out of the way! Haha.

Pete
« Last Edit: October 17, 2021, 01:52:48 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Is this at all possible in SCREEN 0?
« Reply #6 on: October 17, 2021, 02:05:01 pm »
Are you talking about adding an _AUTODISPLAY command after your last SLEEP statement?  That's not related to hardware imaging at all; it's just you swapping over to manual screen updates with _DISPLAY.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #7 on: October 17, 2021, 02:39:09 pm »
Wait a minute. I may be getting it worked out with your _AUTODISPLAY recommendation. I needed to change the old way of clearing the key buffer for the input$(1) statement...

Code: QB64: [Select]
  1. Screen0 = _NEWIMAGE(80, 25, 0)
  2. SCREEN Screen0
  3.  
  4.  
  5. COLOR 0, 7
  6. FOR x = 1 TO 25
  7.     LOCATE x, 1: PRINT STRING$(80, 176);
  8.  
  9. _DEST Overlay
  10. COLOR MidnightBlue, 0
  11.  
  12. REDIM text$(5)
  13. text$(1) = "This is a SCREEN 0 overlay method"
  14. text$(2) = "used by the Amazing Steve and"
  15. text$(3) = "modified by me to create a simple"
  16. text$(4) = "text to screen overlay on a dotted"
  17. text$(5) = "SCREEN 0 background!"
  18.  
  19. font = _LOADFONT("lucon.ttf", 25, "bold")
  20. IF font <= 0 THEN font = 16
  21. _FONT font
  22.  
  23. FOR k = 1 TO 5
  24.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(text$(k))) \ 2, 40 + k * 40), text$(k)
  25.  
  26.     Overlay_Hardware = _COPYIMAGE(Overlay, 33)
  27.  
  28.     _PUTIMAGE (0, 0), Overlay_Hardware
  29.     _DISPLAY
  30.     ' _DELAY 1.75
  31.  
  32. _FONT 16 'select inbuilt 8x16 default font
  33.  
  34. msg$ = "Press any key to remove overlay, and press again to end."
  35. _PRINTSTRING (10, 380), msg$
  36.  
  37. Overlay_Hardware = _COPYIMAGE(Overlay, 33)
  38.  
  39. _PUTIMAGE (0, 0), Overlay_Hardware
  40.  
  41.  
  42. _DISPLAY ' Removes text.
  43.  
  44. _DEST 0 'Reset dest back to the normal screen 0.
  45.  
  46. COLOR 0, 7
  47. LOCATE 25, 1: msg$ = "Press any key to end..."
  48. PRINT msg$;
  49. WHILE LEN(INKEY$): WEND ' Clear keyboard buffer in case user pressed a key during program run.
  50. a$ = INPUT$(1)
  51.  

So I tripped myself up for a bit using statements I don't often use, input$(1) with SLEEP, and the old key buffer clear routine, but I like to code them in, once in awhile, so I never completely forget them and other ways to code results, as well.

Anyway, thanks for the help with the overlay part. I'm certainly going to enjoy this effect!

Pete
« Last Edit: October 17, 2021, 03:03:33 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #8 on: October 17, 2021, 03:00:21 pm »
This?
Code: QB64: [Select]
  1. Screen0 = _NewImage(80, 25, 0)
  2. Screen Screen0
  3.  
  4.  
  5. Color 0, 7
  6. For x = 1 To 25
  7.     Locate x, 1: Print String$(80, 176);
  8.  
  9. _Dest Overlay
  10. Color MidnightBlue, 0
  11.  
  12. ReDim text$(5)
  13. text$(1) = "This is a SCREEN 0 overlay method"
  14. text$(2) = "used by the Amazing Steve and"
  15. text$(3) = "modified by me to create a simple"
  16. text$(4) = "text to screen overlay on a dotted"
  17. text$(5) = "SCREEN 0 background!"
  18.  
  19. font = _LoadFont("lucon.ttf", 25, "bold")
  20. If font <= 0 Then font = 16
  21. _Font font
  22.  
  23. For k = 1 To 5
  24.     _PrintString ((_Width - _PrintWidth(text$(k))) \ 2, 40 + k * 40), text$(k)
  25.  
  26.     Overlay_Hardware = _CopyImage(Overlay, 33)
  27.  
  28.     _PutImage (0, 0), Overlay_Hardware
  29.     _Display
  30.     _Delay 1.75
  31.  
  32. _Font 16 'select inbuilt 8x16 default font
  33.  
  34. msg$ = "Press any key to remove text."
  35. _PrintString (10, 380), msg$
  36.  
  37. Overlay_Hardware = _CopyImage(Overlay, 33)
  38.  
  39. _PutImage (0, 0), Overlay_Hardware
  40. While Len(InKey$): Wend ' Clear keyboard buffer in case user pressed a key during program run.
  41.  
  42. _FreeImage Overlay_Hardware
  43. _Dest 0 'Reset dest back to the normal screen 0.
  44. Color 15, 0
  45.  
  46.  
  47.  

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #9 on: October 17, 2021, 03:07:31 pm »
@bplus Yes, I was editeding my post while you were posting this, so I got I got it working.

So _FREEIMAGE Overlay_Hardware is something I hadn't thought about yet. Thanks for bringing it up. I didn't need it for getting back into SCREEN 0 function, but I will need it to properly free up memory going forward, so thanks a HEAP, excuse the pun, for that!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #10 on: October 17, 2021, 03:08:31 pm »
OK don't need Screen 0 again at end. I am assuming you are trying to normal Screen 0 conditions.

_AutoDisplay deactivates _Display, once you are in _Display Mode you have to say _Display everytime you want a screen update, _AutoDisplay cancels that.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #11 on: October 17, 2021, 03:14:37 pm »
Yep. Anyway, I just added your _FREEIMAGE part, and this cake is baked!

Code: QB64: [Select]
  1. Screen0 = _NEWIMAGE(80, 25, 0)
  2. SCREEN Screen0
  3.  
  4.  
  5. COLOR 0, 7
  6. FOR x = 1 TO 25
  7.     LOCATE x, 1: PRINT STRING$(80, 176);
  8.  
  9. _DEST Overlay
  10. COLOR MidnightBlue, 0
  11.  
  12. REDIM text$(5)
  13. text$(1) = "This is a SCREEN 0 overlay method"
  14. text$(2) = "used by the Amazing Steve and"
  15. text$(3) = "modified by me to create a simple"
  16. text$(4) = "text to screen overlay on a dotted"
  17. text$(5) = "SCREEN 0 background!"
  18.  
  19. font = _LOADFONT("lucon.ttf", 25, "bold")
  20. IF font <= 0 THEN font = 16
  21. _FONT font
  22.  
  23. FOR k = 1 TO 5
  24.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(text$(k))) \ 2, 40 + k * 40), text$(k)
  25.  
  26.     Overlay_Hardware = _COPYIMAGE(Overlay, 33)
  27.  
  28.     _PUTIMAGE (0, 0), Overlay_Hardware
  29.     _DISPLAY
  30.     _DELAY 1.75
  31.  
  32. _FONT 16 'select inbuilt 8x16 default font
  33.  
  34. msg$ = "Press any key to remove text."
  35. _PRINTSTRING (10, 380), msg$
  36.  
  37. Overlay_Hardware = _COPYIMAGE(Overlay, 33)
  38.  
  39. _PUTIMAGE (0, 0), Overlay_Hardware
  40.  
  41.  
  42. _FREEIMAGE Overlay_Hardware
  43. _DEST 0 'Reset dest back to the normal screen 0.
  44.  
  45. msg$ = "We are now back in pure SCREEN 0! Press any key to end."
  46. LOCATE 12, 41 - LEN(msg$) \ 2
  47. PRINT msg$;
  48.  
  49. WHILE LEN(INKEY$): WEND ' Clear keyboard buffer in case user pressed a key during program run.
  50. a$ = INPUT$(1)
  51. COLOR 7, 0
  52.  

I actually recall the need for _AUTODISPLAY. It was 6 months ago I used it to put a couple of nice graphics buttons in my SCREEN 0 WP app. Apparently SSD's aren't the only form of memory storage devices that are adversely affected by aging!

Thanks guys!

Pete
« Last Edit: October 18, 2021, 06:02:32 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Is this at all possible in SCREEN 0?
« Reply #12 on: October 17, 2021, 07:43:31 pm »
And here's something just a tad bit more complicated for you Pete -- I'm going to create a SCREEN 0 image and then use it as an UNDERLAY for a second SCREEN 0!!

Code: QB64: [Select]
  1. Screen 0 'just to highlight that this is going to be a scren 0 underlay
  2.  
  3.  
  4. Color 0, 14
  5. Cls , 14
  6. For y = 1 To 50
  7.     Locate y, 1: Print "*"; String$(78, 32); "*";
  8.  
  9. Locate 1, 1: Print String$(80, "*");
  10. Locate 2, 40 - Len("Hello Pete!  I'm a SCREEN 0 Underlay!") \ 2: Print "Hello Pete!  I'm a SCREEN 0 Underlay!"
  11. Locate 3, 1: Print String$(80, "*");
  12. Locate 50, 1: Print String$(80, "*");
  13.  
  14. HW = _CopyImage(TextScreenToImage32(0), 33)
  15. 'Now that we've created our screen that we want to use as a hardware underlay,
  16. 'We now need to do at least a little tweaking to our normal screen 0 palette
  17.  
  18. _PaletteColor 1, 0 'set color 1 to become 0 alpha, 0 red, 0 blue, 0 green -- transparent black instead of solid black!
  19. 'note that 0 is still the same old solid black as usual.
  20. Color 31, 1 'I'm setting the text color to be blinking bright white on transparent black
  21.  
  22. _DisplayOrder _Hardware , _Software 'draw the hardware screen under the software screen
  23.  
  24.     k = _KeyHit
  25.     If k = 32 Then toggle = Not toggle
  26.     Cls , 1 'clear the screen with a transparent black
  27.     If toggle Then _PutImage (0, 0), HW 'and now our
  28.     x = x - 1
  29.     If x < 2 Then x = 66
  30.     Locate 5, x: Print "HELLO SCROLL! ";
  31.     _Limit 10
  32.     _Display
  33. Loop Until k = 27
  34.  
  35.  
  36.  
  37. Function TextScreenToImage32& (image&)
  38.     d& = _Dest: s& = _Source
  39.     Dim Plt(15) As Long
  40.     _Source image&
  41.     For i = 0 To 15: Plt(i) = _PaletteColor(i, image&): Next
  42.     f& = _Font(image&)
  43.     _Font f&
  44.     fw& = _FontWidth
  45.     fh& = _FontHeight
  46.     w& = _Width * _FontWidth
  47.     h& = _Height * _FontHeight '+ _HEIGHT
  48.     l& = (_Width * _Height) * 2 'The screen is width * height in pixels.  (80X25) = 2000 X 2 bytes each = 4000 total bytes to hold a page of screen 0 text and color
  49.     tempscreen& = _NewImage(w&, h& + _Height, 32)
  50.     Screen0to32& = _NewImage(w&, h&, 32)
  51.     _Dest tempscreen&
  52.  
  53.     Dim m As _MEM, b As _Unsigned _Byte, t As String * 1
  54.     Dim o As _Offset
  55.     m = _MemImage(image&)
  56.     o = m.OFFSET
  57.  
  58.     _Font f&
  59.  
  60.     For i = 0 To l& - 2 Step 2
  61.         _MemGet m, m.OFFSET + i, t
  62.         _MemGet m, m.OFFSET + i + 1, b
  63.         If b > 127 Then b = b - 128
  64.         fgc = b Mod 16: bgc = b \ 16
  65.         Color _RGB32(_Red(fgc, image&), _Green(fgc, image&), _Blue(fgc, image&)), _RGB32(_Red(bgc, image&), _Green(bgc, image&), _Blue(bgc, image&))
  66.         Print t;
  67.     Next
  68.     _PutImage , tempscreen&, Screen0to32&, (0, 0)-(w&, h&)
  69.     _FreeImage tempscreen&
  70.     _Dest d&: _Source s&
  71.     _MemFree m
  72.     TextScreenToImage32 = Screen0to32&
  73.  

Very similar to what we did before, with one main exception -- if you look closely, you'll see that I'm making my hardware screen render first, so it's going UNDER the SCREEN 0 screen that I'm then using and printing on like usual.  Heck, I'm even using BLINKING text on my screen here, and as you can tell, it's NOT affecting my screen background at all!  My nice colorful orange remains a nice colorful orange, with the scrolling text not affecting it at all.

Hit the SPACEBAR to toggle the underlay on/off, and ESC will end the  demo.  ;)

You don't have to just settle with using hardware images as an overlay, as I showed you before.  You can use them as an underlay as well.

(And once you add in GL images to the mix, then you get 3 layers which you can order as you want to suit your needs.)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Is this at all possible in SCREEN 0?
« Reply #13 on: October 17, 2021, 10:02:14 pm »
I can see a number of uses for overlays and underlays, and GL sideways lays! It's a lot more to get comfortable with though. I think remembering the keywords and order of use won't be too difficult, but what I suspect will be a hold up is trying to picture where to use _PUTIMAGE. In my mind, if you say LOCATE 15,40, I cant point to exactly on the screen where the next character will be displayed. I just don't have anywhere's close to that "feel" with PUTIMAGE, so coding is sure to become painstakingly when I work with a couple of these effects.

So what I plan to do next is check out using this to make a little nicer high score display for ASCII Invaders, Halloween Edition. I hope to have some time to do that this coming week.

Thanks,

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Is this at all possible in SCREEN 0?
« Reply #14 on: October 17, 2021, 10:08:32 pm »
I can see a number of uses for overlays and underlays, and GL sideways lays! It's a lot more to get comfortable with though. I think remembering the keywords and order of use won't be too difficult, but what I suspect will be a hold up is trying to picture where to use _PUTIMAGE. In my mind, if you say LOCATE 15,40, I cant point to exactly on the screen where the next character will be displayed. I just don't have anywhere's close to that "feel" with PUTIMAGE, so coding is sure to become painstakingly when I work with a couple of these effects.

So what I plan to do next is check out using this to make a little nicer high score display for ASCII Invaders, Halloween Edition. I hope to have some time to do that this coming week.

Thanks,

Pete

Just _PUTIMAGE the same as LOCATE:

LOCATE 15,40
_PUTIMAGE (40 * _FONTWIDTH, 15 * _FONTHEIGHT)...

Or with a SUB to convert automatically.

SUB PutImageLoc (y , x, image)
    _PUTIMAGE (x * _FONTWIDTH, y * _FONTHEIGHT), image
END SUB

LOCATE 14,40
PutImageLoc 14, 40, Hardware_Image
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!