03-07-2024, 11:44 PM
In the meantime, I was going back in time, looking through some old notes and prior to PE, I dug up this, mildly modified...
Did you code that for me for Valentines Day? Oh wait, I did admit to modifying it.. a bit. Maybe a couple of bits, but anyway. I'm glad to see your reply example is FREE of _MEM. I was hoping it would be less complicated, and it appears that is so. Nice!
Thanks Professor Steve!
Pete
Code: (Select All)
Screen 0 'just to highlight that this is going to be a scren 0 underlay
Color 0, 14
Cls , 14
For y = 1 To 50
Locate y, 1: Print "*"; String$(78, 32); "*";
Next
Locate 1, 1: Print String$(80, "*");
Locate 2, 40 - Len("Hello Pete! I'm a SCREEN 0 Underlay!") \ 2: Print "Hello Pete! I'm a SCREEN 0 Underlay!"
Color 4, 0: Locate 3, 1: Print String$(_Width * (_Height - 3), Chr$(3));
HW = _CopyImage(TextScreenToImage32(0), 33)
'Now that we've created our screen that we want to use as a hardware underlay,
'We now need to do at least a little tweaking to our normal screen 0 palette
_PaletteColor 1, 0 'set color 1 to become 0 alpha, 0 red, 0 blue, 0 green -- transparent black instead of solid black!
'note that 0 is still the same old solid black as usual.
Color 7, 1 ' white on transparent black
_DisplayOrder _Hardware , _Software 'draw the hardware screen under the software screen
toggle = Not toggle
Do
k = _KeyHit
If k = 32 Then toggle = Not toggle
Cls , 1 'clear the screen with a transparent black
If toggle Then _PutImage (0, 0), HW 'and now our
x = x - 1
If x < 2 Then x = 66
Locate 5, x: Print "HELLO SCROLL! ";
_Limit 10
_Display
Loop Until k = 27
Function TextScreenToImage32& (image&)
d& = _Dest: s& = _Source
Dim Plt(15) As Long
_Source image&
For i = 0 To 15: Plt(i) = _PaletteColor(i, image&): Next
f& = _Font(image&)
_Font f&
fw& = _FontWidth
fh& = _FontHeight
w& = _Width * _FontWidth
h& = _Height * _FontHeight '+ _HEIGHT
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
tempscreen& = _NewImage(w&, h& + _Height, 32)
Screen0to32& = _NewImage(w&, h&, 32)
_Dest tempscreen&
Dim m As _MEM, b As _Unsigned _Byte, t As String * 1
Dim o As _Offset
m = _MemImage(image&)
o = m.OFFSET
_Font f&
For i = 0 To l& - 2 Step 2
_MemGet m, m.OFFSET + i, t
_MemGet m, m.OFFSET + i + 1, b
If b > 127 Then b = b - 128
fgc = b Mod 16: bgc = b \ 16
Color _RGB32(_Red(fgc, image&), _Green(fgc, image&), _Blue(fgc, image&)), _RGB32(_Red(bgc, image&), _Green(bgc, image&), _Blue(bgc, image&))
Print t;
Next
_PutImage , tempscreen&, Screen0to32&, (0, 0)-(w&, h&)
_FreeImage tempscreen&
_Dest d&: _Source s&
_MemFree m
TextScreenToImage32 = Screen0to32&
End Function
Did you code that for me for Valentines Day? Oh wait, I did admit to modifying it.. a bit. Maybe a couple of bits, but anyway. I'm glad to see your reply example is FREE of _MEM. I was hoping it would be less complicated, and it appears that is so. Nice!
Thanks Professor Steve!
Pete