|
Post by johnno56 on Mar 27, 2022 0:23:41 GMT -6
The text printed to the 'console', via the PrintS() command... 1. What is the font used and 2. Can it be changed? Reason: This is meant to be a text-based game. A bit hard to play if it is difficult to read... lol Also, I added a 'prints("")' between lines and it had no effect... xmax = 640 ymax = 480 title$ = "Super Star Trek" center_x = windowpos_centered center_y = windowpos_centered WindowOpen(1,title$,center_x,center_y,xmax,ymax,WindowMode(1,0,0,0,0),1) SetWindowAutoClose(1, 0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0)
nklingon = 8 nbase = 2 laststardate = 3254.6
ClearCanvas setColor(rgb(255,128,0)) prints("Super Star Trek") prints("") prints("") setColor(rgb(255, 255, 255)) prints("Your orders are as follows:") prints("Destroy the " + str(nklingon) + " klingons which have") prints("invaded the galaxy before they can attack Federation") prints("headquarters on stardate " + str$(laststardate) + ".") prints("") prints("") prints("There are " + str(nbase) + " starbases in the galaxy for resupplying your ship.") prints("") prints("") prints("Remember, helm commands are available by typing HEL.") prints("") prints("") prints("Press 'Y' to accept this commission.")
if Not WindowExists(1) Or WindowEvent_Close(1) Then end end if update() waitkey
|
|
|
Post by rosy on Mar 27, 2022 2:20:22 GMT -6
You must use DrawText. There is GPrint at BasiC, which does everything you want You can also try PrintS ("\n") .. What does "commission" mean? Job ?
|
|
|
Post by johnno56 on Mar 27, 2022 5:08:05 GMT -6
The main reason for printing to the console is that the text will scroll as the display fills. After all, it is based on a 1978 computer game... Commission? Ah yes. Assignment; task; mission... But 'job' will do nicely.
|
|
|
Post by johnno56 on Mar 27, 2022 5:18:34 GMT -6
Oh nuts!! Completely disregard the entire post... I don't know how I completely forgot that, printing to the "console", does NOT use 'prints("")' but just simply 'print ""'. But, you are correct, drawtext() is better when printing to the 'screen'.... Doh!
|
|
|
Post by rosy on Mar 27, 2022 10:59:48 GMT -6
Well, in the console I did not try to change the font ...
|
|
|
Post by johnno56 on Mar 27, 2022 12:23:05 GMT -6
I finally found out how to change the console font and size... The console can even have its own colour theme... Who knew? Not me! Open a console. Right-click inside the console. Select preferences. Font style (limited), size, colour etc can be modified... Cool...
|
|
|
Post by rosy on Mar 27, 2022 13:29:21 GMT -6
But how to do it from the program ...
|
|
|
Post by johnno56 on Mar 27, 2022 14:10:23 GMT -6
As I am relatively new to console themes, I am not sure, but my first guess is that the console is modified by manually adjusting its setting. I do not thing RC can do that because the console is 'owned' by the system? But I have been known to be wrong on more than one occasion... lol
|
|
|
Post by n00b on Mar 28, 2022 9:06:28 GMT -6
I agree with rosy on using DrawText(). It gives you control over the font, font size, and color. The other advantage is that you have full control over when the screen updates. For input, you should use ReadInput_Text$() in combination with DrawText(). I can try to post an example of how to accomplish this later today. As far as changing console themes, you might be able to do it with the System() function. That function gives you full access to everything you could do through console commands. You would have to do some research on how to accomplish that for your operating system.
|
|
|
Post by n00b on Mar 28, 2022 21:52:24 GMT -6
Here is the Example I said I would provide on how to use ReadInput and DrawText to make a console window. GFX_Console_Example.zip (289.82 KB) The attached zip is the code with the project file and font but here is the code if you just want to use this for a reference: screen_width = 640 screen_height = 480 window_mode = WindowMode(1,0,0,0,0) vsync = 1
WindowOpen(0, "GFX Console Demo", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, screen_width, screen_height, window_mode, vsync) CanvasOpen(0, 640, 480, 0, 0, 640, 480, 0)
'Mono type fonts are easier to deal with because we can assume all characters will be close to the same width LoadFont(0, "FreeMono.ttf", 12)
char_width = 0 : char_height = 0
'Getting the width and height of "A" with the font we loaded GetTextSize(0, "A", char_width, char_height)
'Getting the max characters per row based on the width of "A" 'Note: This is an approximation but you can adjust this to suit your needs MAX_CHAR_PER_ROW = screen_width / char_width
SetColor(RGB(255,255,255))
'Start Reading Input from keyboard ReadInput_Start()
While Not Key(K_ESCAPE) ClearCanvas() 'Store input in a variable. Also adding the "_" character as the text cursor t$ = ReadInput_Text$() + "_" 'Check to see if variable has any text in it If t$ <> "" Then 'Split String up into substrings based on the number of characters we want on each line For i = 0 to (Len(t$) * char_width) / screen_width 'Store the text for line #i in a variable line_text$ = Mid(t$, i*(screen_width / char_width), screen_width / char_width) 'If line #i has text then we draw it to the screen If line_text$ <> "" Then 'Note: I am adding an additional 2 pixels of spacing on top of the character height to each line but you can adjust this to whatever you want DrawText(Mid(t$, i*(screen_width / char_width), screen_width / char_width), 0, (i * char_height) + 2) End If Next End If Update() Wend
ReadInput_Stop()
|
|
|
Post by johnno56 on Mar 28, 2022 22:15:06 GMT -6
Cool... Reference material... Nicely done!
|
|