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 / Backspace

Author
Message
Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 10th Feb 2008 04:05
i have seen it several times in the dbpro boards something about entry (1) tried that no arguments accepted, blah blah blah. even if i dbkeystate(14) the backspace button i still havnt found a way to actually allow it to remove the last symbol typed. is there a command to do this, or a chunk of code that will do the same thing?

i am still a bit new to this (NoOb)
Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 10th Feb 2008 16:31
Currently i have something like this for code.




I just want to make a simple login screen for now. none of the dbPro codesnips or tutorials seem to conver over to gdk. realy starting to get agrivated. i was able to make a simple AI system in a few hours ove spent 3 days on a friken text box and i dont even have a box yet lol
Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 11th Feb 2008 15:56
or is ther no way to do this in gdk? am i suposed to use normal cpp for these aspects. i had realy wanted to keep everything in game.


????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Wonders if no one is helping because they them selves dont know. or is there another reason?

i mean im not asking for your soul. a simple hi sorry i cant help would work. and maybe the next person will say the same thing in which case i ditch gdk. its of no use to me if i cant input text in a normal manner.
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 11th Feb 2008 19:28
You should use GDK for visual and then C++ for normal file, in/out-put

Niels Henriksen
Working on a (MMO)RPG right now in LightEngine (thanks kBessa)
tobi453
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location:
Posted: 11th Feb 2008 19:47 Edited at: 11th Feb 2008 19:49
Your must call dbCLS() at the beginning of your loop.


Try this:


FINAL VERSION RELEASED!!!!
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 11th Feb 2008 21:48 Edited at: 11th Feb 2008 21:49
I've just glanced over this post whilst eating a sandwhich quickly but as long as I understand you right then you may gain the knowledge you need from this snippet from Iro's console code:



the variables with the word Timer in them are simply integers used to stop the same command repeating really fast when a user holds down a key.
the KEY_blah variables are constants holding the scan codes of the keys im checking. (Backspace = 14, enter/return = 28)

Hopefully that helps. If you dont understand some part, just ask

EDIT:

should point out that szUserInput is a c++ string object.

Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 11th Feb 2008 22:23
Hey thanx Everyone ill give it a shot. i appreciate your help
Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 12th Feb 2008 00:57 Edited at: 12th Feb 2008 03:22
ok i first tried Sephnroth's code, but the .size and .resize commands were throwing me off. when ever i tried to compile it vis c++ 08 says they were not defined. not sure why. but reading the code i can see its rely useful and pretty much what i need to get to work.

on the other hand tobi453's added dbCls. does work but it clears the entire line of text.

so i gues the question is whats the deal with the .function saying this error

.........left of '.clear' must have class/struct/union
type is ''unknown-type''

EDIT:
Quote: "
should point out that szUserInput is a c++ string object.
"

So i need to include the string.h file? i tried that and it doesn't work. i also searched all the include directory's on my comp and cant locate szUserInput
Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 12th Feb 2008 05:16 Edited at: 12th Feb 2008 05:17
ok i have something that works.



I found it in a topic aboutr dbInput somewhere deep in the gdk forum alows the entry of text and backspace works. there realy should be a gdk section in the code base would make life nice.

anywho thank you everyone who helped
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 12th Feb 2008 18:25
.clear() and .resize() are members of the c++ string class.

to use it you must first include the header with:

include <string>

at the top of your file. then to declare your string variable, in this case called szUserInput, just write:

string szUserInput;

somewhere, either before the DarkGDK() function if you want it global or inside the function you use it in for a local string.

You will find c++ strings to be much easier to work with than char arrays - but not always as flexiable!

Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 13th Feb 2008 01:56 Edited at: 13th Feb 2008 12:05
EDIT: I tried using include <string> didnt change anything. is there a sdk i need to have the file? sounds pretty common so im guessing not
Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 14th Feb 2008 12:24
ok im a bit slow. but i got that worked out >> was realy stupid didnt have the using namespace std; in the file.

i currently get one error the doConsoleCommand. i have to leave for work at the moment so i cant play with that. but i assume i need to change that to some command that will print (obviously dbPrint, and dbText failed) or convert the string to a char. not sure.

Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 14th Feb 2008 17:58
sorry, I should of mentioned the std namespace! It didnt even cross my mind, my bad!

yes, replace doConsoleCommand with whatever. You can get a char array (const) from a c++ string by saying myString.c_str(); - myString being the name of the string variable.

you could, for example, draw the string to the screen with dbText - but dont do it where I do doConsoleCommand because that only fires when the user presses enter. Do it after all the code so its always there

Login to post a reply

Server time is: 2024-11-20 01:24:55
Your offset time is: 2024-11-20 01:24:55