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.

Dark GDK / Best way to receive string input?

Author
Message
BDev338
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location:
Posted: 19th Dec 2010 12:56
Hi game developers!
In my game, an online multiplayer 3D shooter, the first thing you'll be presented with is the login screen, where you enter your account information, and choose which map you want to play on and then it'll log you in.
But what is the best way to receive string input, in an application like mine?
I've already tried 'dbInput()', running a loop displaying the value of dbInput(), with 'dbText()'. But that caused my program to crash, it also caused lag and screen flickering .

Best regards,
Benjamin.

In the world of Computer science the term user, means idiot.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 20th Dec 2010 19:49 Edited at: 20th Dec 2010 19:52
Try out my GetInput function which is posted towards the end of this thread (second post from bottom):

http://forum.thegamecreators.com/?m=forum_view&t=160546&b=22&msg=1893761

It puts user input into a char array, which you can display on the screen in whatever position and format you want, and it won't interfere with other program operations. The function should be called every loop until the user finishes typing (e.g. presses return or a button on the graphic interface, when you consider typing finished is up to your program).
BDev338
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location:
Posted: 20th Dec 2010 21:06
Thanks, Mireben. That function of yours works great .
My only concern is the screen flickering !
I have one thread that calls my 'handle_keyboard_input()' function, one that'll call my 'handle_mouse_input()' function, and one that'll draw the login screen, - if appropiate... (using dbSprite()). The main thread syncs using dbSync(), at a frame rate of 60. But I can still see the login screen, and the user input, being painted in a black flickering. What causes this?

In the world of Computer science the term user, means idiot.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 21st Dec 2010 08:02 Edited at: 21st Dec 2010 08:24
I don't know, maybe if you post the whole code (or better: the shortest code with which you can reproduce the flickering) then we'll find out.
BDev338
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location:
Posted: 21st Dec 2010 14:33
Hmm... I've optimized it further, so that it'll only repaint the username (dbText()) if the user has actually entered some new characters. Also, the login screen (consisting of a username field, a password field, a "map selector" field and a login button, is never updated, so would there by any chance a way of making it necessary to only paint the login screen once?

In the world of Computer science the term user, means idiot.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 22nd Dec 2010 19:57
To my experience, sprites are "persistent" on the screen. Once you issue a dbSprite command, the sprite will stay displayed, without explicit redrawing. Nevertheless it shouldn't cause any problem if you do repeat the dbSprite command every loop.

Login to post a reply

Server time is: 2024-11-19 14:43:05
Your offset time is: 2024-11-19 14:43:05