QB64 Phoenix Edition
Change font size / Maintain screen size. - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Utilities (https://qb64phoenix.com/forum/forumdisplay.php?fid=8)
+---- Thread: Change font size / Maintain screen size. (/showthread.php?tid=1103)

Pages: 1 2


RE: Change font size / Maintain screen size. - SMcNeill - 11-12-2022

Code: (Select All)
Dim f(-1 To 0) As Long
f(-1) = _LoadFont("lucon.ttf", 32, "monospace")
f(0) = _LoadFont("lucon.ttf", 34, "monospace")

Do
    f = Not f
    _Font f(f)
    Print "Hello World, I'm looking for a memory leak!"
Loop Until _KeyHit

Simple code, and I can confirm -- it does indeed leak memory. Looks like it's something the team will have to look into. Smile


RE: Change font size / Maintain screen size. - SMcNeill - 11-12-2022

Note that the following does *NOT* cause a memory leak:

Code: (Select All)
Dim f(-1 To 0) As Long
f(-1) = _LoadFont("lucon.ttf", 32, "monospace")
f(0) = _LoadFont("lucon.ttf", 34, "monospace")
Screen _NewImage(640, 480, 32)


Do
    f = Not f
    _Font f(f)
    Print "Hello World, I'm looking for a memory leak!"
Loop Until _KeyHit

This must be some glitch which occurs in SCREEN 0 from the resize routine and how font is interacting with it. In 32-bit screens, there's no leak with memory with the above code.


RE: Change font size / Maintain screen size. - SMcNeill - 11-12-2022

@Pete -- That's it!  I've had it with your *voodoo snoodoo poopoo* glitches.  Watch the video below and explain to me how the heck a program can behave in such a manner!!  Pay close attention to the memory usage in task manager as the program does its thing in the background...



You've broke what little brain I had left.  What the heck type of glitch are you and SCREEN 0 pulling here?  And why can't half the other people in the world seem to duplicate the process and run into the same issue??

Code: (Select All)
Dim f(-1 To 0) As Long
f(-1) = _LoadFont("lucon.ttf", 32, "monospace")
f(0) = _LoadFont("lucon.ttf", 34, "monospace")
'Screen _NewImage(640, 480, 32)
Do
    f = Not f
    _Font f(f)
    Print "Hello World!"
    _Display
Loop Until _KeyHit


^ Code used to generate the lovely little results we see above on my laptop.  Tongue


RE: Change font size / Maintain screen size. - Pete - 11-12-2022

Yeah, I'm on a roll today. Found something else goofy in the IDE, too.

https://qb64phoenix.com/forum/showthread.php?tid=1109

Pete


RE: Change font size / Maintain screen size. - grymmjack - 12-27-2022

(11-11-2022, 08:12 PM)MasterGy Wrote: You cannot use _printstring in hardware mode. Text output will be slow. If you include _display and use the font as a hardware image, it will be safer and much faster

I can't figure out how to quote properly, if this looks funky I apologize.

Sorry for posing this question (jeez am I Canadian? apologized twice already). 

Any way, do you have any examples of using hardware images?

I tried to do it myself and it wasn't working. I was using the wiki example I think like this:

Code: (Select All)
SCREEN _NEWIMAGE(640, 480, 32)
my_hardware_handle = _COPYIMAGE(_SCREENIMAGE, 33) 'take a screenshot and use it as our texture
_MAPTRIANGLE (0, 0)-(500, 0)-(250, 500), my_hardware_handle TO _
    (-1, 0, -1)-(1, 0, -1)-(0, 5, -10), , _SMOOTH
_DISPLAY
DO: _LIMIT 30: LOOP UNTIL INKEY$ <> "

So many questions Smile 

How does this LOOP UNTIL INKEY$ <> (a single double quote) even not register as a syntax error? But anyway, I just get a black screen on this.