Retro Print functions for window or fullscreen...

BlitzMax Forums/BlitzMax Beginners Area/Retro Print functions for window or fullscreen...

Shortwind(Posted 2009) [#1]
BLITZMAX Code request!!!

Has anyone posted code or a mod to make easy usage of retro print functions? I know of libtcod, but I'd rather not create my own screen, font, and print functions if I can avoid it.

All I want to do is something simple like:

(fake code... Some of the commands that need to be included....) :)

Graphics 640,480
SetFont("Arial",10,Normal) 'Set Font to Arial@font size 10, Normal style (If this needs to be a .bmp or .png etc. that's ok.)
SetViewPort(1,1,40,640,400) 'Viewport 1 size (box) @ x1,y40 to x640, y400
SetViewPort(2,1,420,640,480) 'Viewport 2 size (box) @ x1,y420 to x640,y480
SetViewPortBackGroundColor(1,Black) 'Set Viewport 1 default background color to Black.
SetViewPortForeGroundColor(1,White) 'Set Viewport 1 default foreground color to White.
ClsViewPort(1) 'Clears ViewPort 1
ShowViewPort(1,1) 'Shows viewport 1 on screen and plots it's window and current contents...
SetTextBackground(1,Blue) 'Sets next print command Text background color to Blue
SetTextForeground(1,White) 'Sets next print command Text foreground color to White
SetPrintLocation(1,1,1) 'Set current cursor position to viewport 1, @ location 1,1 in the viewport which is adjusted for font size.
This of course is a function with variable parameters. IE. SetPrintLocation(2) would just set the viewport to viewport 2 and keep it's current cursor location without a reset.
PrintText("This is a test.~n") 'This will print the text string in viewport 1, @ location 1,1 :: Because of the provious SetLocation() command.
PrintText("Another test.~n") 'This will print the text on the next logical line in the current selected viewport.
SetInputLocation(2,1,1)'Sets current location for the input text prompt.
And of course, SetInputLocation(2) would just set the viewport to viewport 2 keeping the current cursor location.
SetInputText(Block,30) 'This will sets the cursor for input to a block and blinks on/off every half second.
InputText("Enter your command: ",inputtext) 'This will print the text on the next logical line in the current selected viewport with a blinking cursor and except keyboard input from the user and place the information in said string variable...
Flip
Repeat
Until KeyDown(key_escape)
End

!!Now the print function should automagically move to the next line when it hits the end of the viewport...And when at the bottom of the screen it should automagically scroll all text upwards, inside the viewport. Retro style... hee hee.

It of course needs to keep track of where the last print command ended. (In case you wish to change text colors in the middle of a line... etc...)

It should also automagically adjust for differing font sizes, so as not to over run the viewport and print anything "off screen".... (ie. Autowrap...) ((As Stated Above...))

Also, there NEEDS to be a cursor and blink routine for the INPUT prompt... of course. :D

:)

*I think I thunk a thought that thunk a thought to think.


P.S. I'd be grateful if someone could also add a function with ESP so I can just think about what I want the program to do and the function will automatically place the proper, fully optimized code into my code editor. An automagic debugger would be nice, but not necessary!


TaskMaster(Posted 2009) [#2]
It would probably be easier to create a pixmap, draw everything you want on it, then print it.


Shortwind(Posted 2009) [#3]
What???

I'm not talking about a "Printer" print function... Have you never used a old computer? C64, Apple II, etc?? :)

As far as I can tell, the default DrawText function is very, very limited.

I suppose I'll have to dive into libtcod and just create my own Retro screen functions. I was hoping that someone out there had already created such a system.

I suppose I could use a GUI like MaxGUI.... But to be honest, I hate it.

Or was your response suppose to be a joke? :(


xlsior(Posted 2009) [#4]
Doesn't Brucey have a text module like this?


Brucey(Posted 2009) [#5]
Possibly.

Hard to keep track these days...


TaskMaster(Posted 2009) [#6]
You are just talking about drawing boxes on the screen, and then printing text on them? That is such a simple thing to whip up.

I guess my confusion is that I thought you were asking for something difficult, like actually printing.

You could probably whip that whole thing together in an hour or two. Just need a type that is for each viewport that keeps cursor location.

And then a singleton to manage each of those viewports.