Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / text input and window size

Author
Message
the Hutchinator
19
Years of Service
User Offline
Joined: 11th Aug 2005
Location:
Posted: 12th Aug 2005 00:53
Okay. I have two(2) questions. Firstly, is there any possible way to have a text command input? I mean like even as you type the input part in, it displays the type of text you want? (input without the PRINT command) And secondly, is there any way to change the size of the darkBASIC window when you want to execute the program? As in, make it smaller? Any hepl would be greatly appreciated.

It takes 17 muscles to smile and 43 muscles to frown, but it doesn't take any to sit there with a dumb look on your face.
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 12th Aug 2005 10:59 Edited at: 12th Aug 2005 11:02
Yes to all of the above.

1. To do the text, there are two things that may need answering: Are you using 3D or 2D? If 3D, inside you do loop, you can include some kind of code like this:

That makes it so if you press the F8 key, it saves the contents of the inputted text into a string. If you press backspace once, it clears the entry buffer, so, you have to start typing over if you mess up. More code can be added to this if you want it to just take away one letter.

If you're using 2D, you could use the same thing as in 3D, but if you don't mind the game freezing so you can input something, use this:

That is also assuming you want the returnkey pressed. You can press backspace to erase the last letter, which is better than the 3D use, but, this freeze all game play until you press enter when inputting.

2. To change the windows size, you must use something like this (you can change the size of pixels):

All of that code should be in the DB Manual.

Well, there you go.....if you need more help just post again

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 12th Aug 2005 18:21 Edited at: 12th Aug 2005 18:22
I think he means is it possible to have an Input command which uses the current text font and style.

The answer is yes, but you have to write your own input routine - you can't use DB's Input command because as you mentioned, it uses Print and the Print command ignores the current font face and size you set with Set Font. The only thing it responds to is the Ink command.

Text input functions have been written by a few of us over the years, so check out the code snippets board or do a search for 'Text Input' - or write your own!

TDK_Man
the Hutchinator
19
Years of Service
User Offline
Joined: 11th Aug 2005
Location:
Posted: 23rd Sep 2005 01:48
Awesomeness. Thanks but now i have yet another predicament: why will the text not appear in the window after I have changed the size of the window?

It takes 17 muscles to smile and 43 muscles to frown, but it doesn't take any to sit there with a dumb look on your face.

Login to post a reply

Server time is: 2025-05-22 17:28:26
Your offset time is: 2025-05-22 17:28:26