QB64 Phoenix Edition
cprint and cfprint text mode routines - 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: cprint and cfprint text mode routines (/showthread.php?tid=2024)

Pages: 1 2


RE: cprint and cfprint text mode routines - SMcNeill - 09-23-2023

(09-23-2023, 08:22 PM)bplus Wrote: Interesting how you did checking on/off with subs!

But you left out comparing to standard way with Color + Locate + Print

I am weighing the cost of extra lines of code for subs and ease of typing one line instead of 3 with standard 3 maybe try good ole CLP sub:

Sub CLP(fg, bg, row, col, text$)
color fg, bg
locate row, col
print text$;
end sub

Remember though, part of the idea here is: "without altering global color values or background colors".

For the "not alter global colors", you could:
OFG = _DEFAULTCOLOR
OBG = _BACKGROUNDCOLOR
....stuff
COLOR OFG, OBG
END SUB

But to maintain background colors, you'd need to get POINT (x, y)....

Which ends up with what's going on in these routines, but with _Mem commands.


RE: cprint and cfprint text mode routines - James D Jarvis - 09-23-2023

Well darn. I watch a movie with my wife, take a nap and take a look at the forum before working on making the routines a little faster...and the work has been done while I slept!  Thank you.

There a few other routines related to this I'm also working on that I can see how to speed up.


RE: cprint and cfprint text mode routines - bplus - 09-23-2023

Ha! best way to do "work". But is it work?


RE: cprint and cfprint text mode routines - SMcNeill - 09-24-2023

(09-23-2023, 10:01 PM)James D Jarvis Wrote: Well darn. I watch a movie with my wife, take a nap and take a look at the forum before working on making the routines a little faster...and the work has been done while I slept!  Thank you.

There a few other routines related to this I'm also working on that I can see how to speed up.

The best way to speed something up is to remove as much of it as possible from your loops.  Look at the math in your loops with those MEMPUT statements, and then look at mine.  See the difference in number of calculations we end up doing?


RE: cprint and cfprint text mode routines - bplus - 09-24-2023

Quote:Remember though, part of the idea here is: "without altering global color values or background colors".

Oops yes OK but honestly I don't see why. If I had a color, locate and print text line why would I do it the long way ever again ;-)) In screen 0 that's all you can do is print Text or _PutImages with hardware?