|
Post by johnno56 on Nov 6, 2020 3:03:58 GMT -6
Window and Canvas experiment.
I am converting my sdlbasic version of super star trek to rcbasic. Sdl uses windows in a similar way to rc's canvases.
The following example creates 3 canvases. The use of the canvas() command will channel drawtext() to that canvas. Although the destination canvas has been set, all of the prints() commands seems to only apply to the main Window.
Notice the drawtext() commands all have the same x, y coordinates and are displayed correctly within each canvas. The same cannot be said for prints().
Is there a way that the prints() command can place the text in the 1,1 position of each canvas? Perhaps rendertext() could be used to store the text in a 'slot' then use drawimage() to place the 'text'...
I am open to suggestion.
xmax = 990 ymax = 750 title$ = "Window and Multiple Canvases?"
WindowOpen(1,title$,0,0,xmax,ymax,0) CanvasOpen(1,570,420,20,20,570,420,0) CanvasOpen(2,370,420,600,20,370,420,0) CanvasOpen(3,950,280,20,450,950,280,0)
arial = 1: loadFont(1,"arial.ttf",14) Font(arial)
Canvas(1) setColor(rgb(30,30,30)) RectFill(0,0,570,420) setColor(rgb(160,160,160)) DrawText("Canvas(1)",50,50) prints("Canvas(1)")
Canvas(2) setColor(rgb(0,30,0)) RectFill(0,0,370,420) setColor(rgb(0,255,0)) DrawText("Canvas(2)",50,50) prints("Canvas(2)")
Canvas(3) setcolor(rgb(0,0,30)) RectFill(0,0,950,280) setColor(rgb(0,100,255)) DrawText("Canvas(3)",50,50) prints("Canvas(3)")
update()
waitkey arial.ttf (358.5 KB)
|
|
|
Post by tbird on Nov 6, 2020 8:52:55 GMT -6
Just curious, why not just use DrawText? Making it jump to a new line is very easy, and making it scroll is very easy as well, just a couple variables, I would ignore Print altogether. Just my thoughts.
|
|
|
Post by johnno56 on Nov 6, 2020 14:55:21 GMT -6
I just knew you were going to suggest that... lol It's a little extra work but may be the easiest method.
Scrolling may or may not be needed. In the past, the most text needed for reporting in canvas3, has been during battles. I haven't had an issue with scrolling but, that could be due to the fact that, power and photons are greatly increased (testing purposes) and the enemy is quickly dispatched. This will probably change using 'normal' weapons and power.
But first... Drawtext()
|
|
|
Post by johnno56 on Nov 6, 2020 15:29:47 GMT -6
Forgot to mention... Prints() is not the only problem. Keyboard responses are also required. eg: Entering orders, course headings, etc...
To get around that, I suppose that could be accomplished by, using the mouse to click buttons... It could be done but it will effect the 'simple' look... Making buttons is not to hard... But creating an interactive keypad for entering numbers and decimals.... I see what you mean by 'feature creep'... lol
|
|
|
Post by tbird on Nov 7, 2020 8:30:29 GMT -6
If I remember correctly this was talked about before, is there not examples on this forum of entering commands. I have a function for this in my engine and it works great, n00b does as well in his engine.
|
|
|
Post by johnno56 on Nov 7, 2020 14:41:47 GMT -6
I would not be surprised if this was discussed before... They say it's always the memory that goes first in old age... Any input() alternative would be appreciated... Thanks for the suggestion, George.
J
|
|
|
Post by tbird on Nov 7, 2020 23:54:51 GMT -6
You should already have the start of one in your game jam submission, for the highscore names, correct?
|
|
|
Post by Rosy on Nov 8, 2020 1:53:11 GMT -6
Don't you worry about not changing the font?
|
|
|
Post by johnno56 on Nov 8, 2020 4:30:51 GMT -6
Tbird,
Well spotted... Grey-matter failure strikes again...
Rosy,
Not sure if I understand your point. I selected a basic font for "drawing" text (arial.ttf) just to test a concept. Print() seems to only use the default system font (No. I do not know the font type...). If I have misunderstood your intention, I appolgise.
J
|
|
|
Post by Rosy on Nov 8, 2020 6:25:16 GMT -6
In print, neither the font nor the size change.
|
|
|
Post by johnno56 on Nov 8, 2020 13:57:29 GMT -6
Yeah... Part of my problem... When I first wrote the game, using sdlbasic, it too had the same problem. 'Print()' would print to the console and 'PrintS()' would print to the screen. But, in both cases, only the fixed-size system font was used. RC uses DrawText() and RenderText() to 'draw' text on the screen using whatever font and size desired.
But, you are correct, the system font seems to be of a fixed size and type. I seriously doubt that it can be changed. N00b would be able to answer that one.
J
|
|
|
Post by johnno56 on Nov 8, 2020 15:44:29 GMT -6
Tbird, Your idea about using the 'highscore' input from Asterocks inspired the attached example. I through together a simple 'login' routine that could be used for Trek. Please ignore the sloppy coding... lol Just focusing on the keyboard input at the moment... If this takes off (no pun intended) then I will probably move from 'help needed' to 'Projects'. Opinions and suggestions are always welcome. J login2.zip (815.15 KB) ps: Modified the login. Please suggest any changes needed.
|
|
|
Post by tbird on Nov 8, 2020 19:25:07 GMT -6
That was actually pretty cool, I like it. Worked great.
|
|
|
Post by johnno56 on Nov 9, 2020 5:31:15 GMT -6
I have always wanted to tackle an LCARS themed Star Trek game. Unfortunately, I cannot publish anything that I can make, as CBS Television Studios claims to hold the copyright to LCARS... But, I did make an LCARS based Vocabulary game, some years back in sdlbasic. One day I might convert it to RC...
I am researching the art of LCARS, colour palettes and shapes (Okudagrams), then I will work on some simple screen layouts. Looks like Gimp is going to get a serious workout. Scrolling still might be an issue, if I keep all three 'screens', on screen at the same time. Maybe the three 'screens' can be larger but 'float'... Not sure if I am explaining that very well. This could be a LOT of work and may not develop into anything worthwhile, but who said it can't be fun trying anyway? lol
J
|
|
|
Post by tbird on Nov 9, 2020 6:34:50 GMT -6
Fun, definitely! Well scrolling would be easy, either shift the viewport on the canvas or use a y variable to position the text.
|
|