myqly
New Member
Posts: 6
|
Post by myqly on Jun 30, 2016 22:14:02 GMT -6
I am working on an incredibly simple demo with RC Basic (which is awesome, btw) and working through the language like I did QBasic forever ago by starting with a text game.
I wrote the following code but had a question about it:
'Window Variables Title$ = "Text Program" windowW = 720 windowH = 480
WindowOpen(0, Title$, windowpos_centered, windowpos_centered, windowW, windowH, 0) CanvasOpen(0, windowW, windowH, 0, 0, windowW, windowH, 0)
userInput$ = ""
SetColor(RGB(255,255,255))
while UCase$(userInput$) <> "QUIT" userinput$ = InputS$ ( "What would you like to do? " ) wend My question is on the userInput$ = InputS$ line it appears that the window pauses for an input before displaying the prompt. Is this expected and if so, is there code I should be using so that it displays the prompt immediately? I noted that when I pressed a key to cause the prompt to appear the character was taken into the input queue so my "QUIT" check would fail unless I backspace/delete the character I entered.
Thanks in advance!
|
|
|
Post by n00b on Jun 30, 2016 23:58:39 GMT -6
It seems to work just fine for me. What OS are you on?
|
|
myqly
New Member
Posts: 6
|
Post by myqly on Jul 1, 2016 7:41:56 GMT -6
I am using Windows 10 Pro. As a note I did some additional testing from my side. It appears to wait for any type of input. This includes mouse movement and clicks. I'm not sure if using the renamed rb_rt against the compiled cbc is any different but it behaves the same way. The window and canvas appear and wait for what I assume is an on-focus event to fire before rendering the input prompt. I recorded a video demonstrating the behavior in the hope that it will help.
|
|
myqly
New Member
Posts: 6
|
Post by myqly on Jul 1, 2016 9:34:00 GMT -6
Just adding some additional detail...
I added a simple print within the While/Wend block just to test and the print statement renders as soon as canvas appears but the window still requires some sort of action on my part (mouse over, click within window [if mouse is completely still], or keypress) in order to render the InputS$ prompt.
|
|
|
Post by n00b on Jul 1, 2016 13:43:03 GMT -6
I can't view the video from my phone. I will check it out when I get home. The solution could be as simple as compiling for Windows 10. Also are you running 32 or 64 bit Windows.
|
|
|
Post by rick3137 on Jul 1, 2016 16:08:30 GMT -6
It does the same thing on my computer. I would not have noticed, because I do not often use text mode. (Windows10, 64 bit)
|
|
|
Post by n00b on Jul 1, 2016 18:26:41 GMT -6
I just discovered the issue. In the last update I made a change to the input function to use SDL_WaitEvent() rather than SDL_PollEvent. This change was neccesary to lower the amount of overhead on the CPU. However, I did not output the prompt before waiting for events so the prompt does not show unless an event is detected. I will fix this in the v2.0.6 release which I will hopefully have up in a few hours. I have finally finished the changes I needed to make to the compiler. I just need to add some of the changes to the documentation.
|
|
myqly
New Member
Posts: 6
|
Post by myqly on Jul 1, 2016 19:38:38 GMT -6
That's awesome n00b. Once you have it pushed up I'll pull it down and give it a whirl. Thanks for being awesome!
|
|
|
Post by n00b on Jul 2, 2016 9:50:18 GMT -6
I just uploaded the latest release if you want to check it out. I cannot get static linking to work on my new machine so all the DLL files in the distro folder have to be distributed with programs until I can get it fixed. It really isn't a bad thing as any updates to those libraries can be shipped with your program without the need for me to rebuild RCBasic with them.
|
|
myqly
New Member
Posts: 6
|
Post by myqly on Jul 2, 2016 10:08:29 GMT -6
Tested and confirmed working with 2.0.6! Thank you for turning that around so rapidly.
|
|
|
Post by n00b on Jul 2, 2016 10:27:34 GMT -6
Awesome. Thanks for letting me know about that issue. I don't get to test every feature as much as I should so I would have never found that. Also on a side note, If you want to use your own font and set text sizes you should use the ReadInput API. Just look at text edit in the manual.
|
|