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.

Newcomers DBPro Corner / Smooth keyboard input

Author
Message
Dracula
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: DBP Recreation of Castle Csejthe
Posted: 6th Nov 2006 03:05
I know DPB is about making 3d games, but for those of us nerds who love RPGs there's an element of text that needs to be incorporated into the game. Thus have I written this little bit of code to help anyone who needs a start in the text area.

This code allows smooth KB entry, smooth backspace, and has a save function (F12). At also disallows junk characters from taking up space, and it only allows for 5 lines of text (about 492 chars), but you could easily change the parameters to make pages or add additional characters. I'll be modifying this for my quest generator, and I'll share that once it's through.

If you run this, please let me know how it works for you. Especially if you type words with double letters and if you press backspace multiple times. No media required.

Thanks and Happy coding!!!

D

the code:
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 7th Nov 2006 22:27
hey thats pretty cool well done

BM

Our aim is to keep the loo's clean, your aim can help.

3.0ghz pentium dual core processor, 2gb ds ram, 250gb HD
Dracula
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: DBP Recreation of Castle Csejthe
Posted: 8th Nov 2006 13:11
Thank you Big Man

I've been reworking it to deal with a set of text fields, but time is short this week. Hopefully I'll have it up and done this weekend!

D
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 8th Nov 2006 20:17
I like your code, but have made some adjustments.
-Backspace doesn't take as long
-You can backspace to go back to previous lines
-Letters cannot be missed with the way entry is now used
-The length of the lines is now done by actual width instead of characters



Dracula
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: DBP Recreation of Castle Csejthe
Posted: 8th Nov 2006 21:38
Daemon, thanks for your upgrades!!

I knew there had to be a way!!! That is much more efficient!





This is great as long as you want the whole length of the screen.

Many thanks!

D
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 9th Nov 2006 03:26
Quote: "This is great as long as you want the whole length of the screen. "


Well, you could change the width in the test. The main reason I changed it to this was because in some fonts some letters are wider than others.

If you change the font to "Gungsuh" in your first piece of code, then make one line of "m" and one line of "f" the line of "m" will be longer.

Dracula
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: DBP Recreation of Castle Csejthe
Posted: 9th Nov 2006 04:53
Ahh, yes! I hadn't thought of that. I mainly use the default font, for fear of changing to one that someone may not have and throwing everything out of alignment...

But thank you for explaining the reason. Once I get a grip on embedding fonts, I may change the way I display text.

Best Regards,,

D
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Nov 2006 08:55
Back in August we had a DBP challenge to create a text editor.
If you guys are interested in seeing various input routines you might want to check out the entries.

http://forum.thegamecreators.com/?m=forum_view&t=48011&b=1&p=108

My entry displays text in a resizable, scrollable window and you can even highlight text. Check near the bottom of the page linked above for the most up to date release of the code.

Dracula
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: DBP Recreation of Castle Csejthe
Posted: 11th Nov 2006 03:32 Edited at: 11th Nov 2006 03:35
Phaelax,

Thank you for sharing your editor. That is a bit ambitious for what I need, but the priciples you use are great.

Here is look at the nearly final DB that I made for my game.



It doesn't save yet, because I haven't decided what the best format will be. But here is the non-media code, if anyone is interested.

You <tab> forward, <shift-tab> back, or mouse-click in the fields to access.

Let me know what you think. I know it can be optimized, but that's for later.



Thanks,

D

Login to post a reply

Server time is: 2024-09-25 11:31:00
Your offset time is: 2024-09-25 11:31:00