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 / DarkForm : A Simple Form, Label, Textbox and Button Library

Author
Message
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 16th Mar 2010 02:36 Edited at: 16th Mar 2010 02:37
Could we get a listbox?



It could have a "Get Selected" function that returns the id of the current value selected, "Add Item" function to add a new item to the listbox starting at id 0, and possibly if the items in the listbox surpass the heighth of the listbox a slider could pop up but thats optional, you could just limit the amount of items according to the element's height if you don't have the skills to do the slider hehe

EDIT: That would really beat having a column of 20 buttons xD

Add me to your MSN!
TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 16th Mar 2010 07:34
Quote: "My first GUI started with very small Lib similar to yours. I found myself always wanting more features. It was sorta addictive. Today that Lib is over 140k in source code - lol."
Looks like DarkForm is following suit.

kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 16th Mar 2010 08:20
I have made a small addition to the Textbox as follows:

New Variable: bool: isChat
Changed Overloaded Constructor: 1 change: Added bool isChat
New Function: public: void ToggleSelected ( )
New Function: public: bool ReturnSelected ( )
1 Change to Update function.

Here is the new code based on version 1.7.4, i've also attached the .h file



Lets you control your textboxes via enter button

Add me to your MSN!

Attachments

Login to view attachments
healer2000
14
Years of Service
User Offline
Joined: 18th Feb 2010
Location:
Posted: 16th Mar 2010 12:13 Edited at: 16th Mar 2010 12:14
kklouzal,

Could you please provide a simple code to demonstrate its use.
I am not able to figure out how to use the new functions.

BTW, the Listbox suggestion is a good idea.

Thanks!
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 16th Mar 2010 13:12
One thing this library might need is default constructors for each item along with a function to initialize it. I found that I could not add them as instance variables when making a class, also, you can't just declare them so they have global scope.

I would do this myself but I'm really busy at the moment, I may have another look when I have more time.

kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 16th Mar 2010 17:41 Edited at: 18th Mar 2010 21:15


You press enter, and it selects the textbox, then you can type, once you press enter again it clears the textbox, deselects it and then sends the value to the textarea.

EDIT: Number Only Textboxes?? (includes '.-')

Add me to your MSN!
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 19th Mar 2010 22:07
I've noticed that you can type into the checkboxes

Add me to your MSN!
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 3rd Apr 2010 15:42
Hey Healer take a look at my app:

its an animation Extractor for use with the Enhanced Animations plugin, it wouldnt be as it is if it wasnt for you. Thank you, will release on a future.

hi
healer2000
14
Years of Service
User Offline
Joined: 18th Feb 2010
Location:
Posted: 3rd Apr 2010 18:56
kklouzal,

yes feel free to improve and release.

Cetobasilius,

Nice work!


I'm currently working on another project:

Webcam Biofeedback:

http://forum.thegamecreators.com/?m=forum_view&t=167758&b=2
Triumph Daytona
14
Years of Service
User Offline
Joined: 18th Apr 2010
Location: UK
Posted: 18th Apr 2010 21:10
Hi Cetobasilius -- I'm new here; just joined, saw your post and had a thought -- try adding two new methods to the Textbox class



defined as:



Which now means you can trap, say, the TAB key to tab between fields:



Normally we would use TAB as field navigation and ENTER as button select. So, within your main loop you can do somethign like:



Hope this help!
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 1st May 2010 22:20
Thanks for creating this brilliant plugin! I haven't had chance to download it yet, but it will be invaluable in the application I am currently developing.

The optimist's right, The pessimist's right.
Poof Master
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location:
Posted: 3rd May 2010 06:28
Hey I was playing with the dark form a little and I am going to make a little 2d editor kind of like Little Big Planet except mine is actually 2d rather than 3d. Anyway would the best way to use your functionality with the buttons but still have a costume made UI just to have the images draw over your buttons. Basically just hiding your buttons? Or is there some ways to put lets say a sprite on top of the button like a picture of a crate so the player knows he is going to place a crate in the level?
Poof Master
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location:
Posted: 7th May 2010 04:06
I know this a little bit of an older thread but I am having some problems when clicking on an button in my project. Basically when I click it switches states and it looks like this:



Now the weird thing is it works sometimes meaning I will click it and nothing happens so I keep clicking it over and over and then all of the sudden it works. This function is inside a function called Game() witch has a switch case in it that runs this function if which looks like this:



and then I run this function in the while loop. Don't know if that was even necessary but I figure you need to get the whole picture to know whats going on.
healer2000
14
Years of Service
User Offline
Joined: 18th Feb 2010
Location:
Posted: 9th Jun 2010 09:32
Guys,

Feel free to modify DarkForm anyway you like it.

I have been quite busy with another project:

http://www.webcambiofeedback.com/

It is a biofeedback software which uses any ordinary webcam to detect breathing and heart rate variability to play games that teaches you how to relax.

Paul
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 9th Jun 2010 10:45
I was just thinking about DarkForm a couple of days ago, I used it in my game as a placeholder GUI as I really needed sprites for my buttons.

I noticed it slowed down my game quite alot, its a great plug-in only the DarkGDK draw functions are slow. What this needs is to create an image from the button/gadget once its created and the imaged used from then on.
I'm not sure how much work this would be but I may look at it one day, unless someone beats me to it.

Neco
16
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 25th Sep 2010 05:25
Sure would be sweet if someone could make this useable as a DBPro plugin, and maybe continue on with improvements, etc

I don't think I'll ever understand C++ enough to use GDK

KeiNagase
15
Years of Service
User Offline
Joined: 15th Jun 2009
Location:
Posted: 26th Sep 2010 03:03
Hi. I am having a hell of a time figuring out how to get DarkForm to work with my 2d game. I setup a small test game to figure out how to get it to work. It's using the default backdrop image with the DarkGDK 2d Template as a background sprite. I have two testboxes in a form and I want them to display over the sprite but they are not. Can someboy please tell me what I am doing wrong. Thank you.

KeiNagase
15
Years of Service
User Offline
Joined: 15th Jun 2009
Location:
Posted: 26th Sep 2010 03:05
Hi. I am having a hell of a time figuring out how to get DarkForm to work with my 2d game. I setup a small test game to figure out how to get it to work. It's using the default backdrop image with the DarkGDK 2d Template as a background sprite. I have two testboxes in a form and I want them to display over the sprite but they are not. Can someboy please tell me what I am doing wrong. Thank you.

Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 26th Sep 2010 20:03
My first idea was to suggest including this in the beginning of the program: dbDrawSpritesFirst(); But I'm not quite sure it would work. Besides, I see in the DarkForms source code that, in addition to dbBox and dbLine commands to draw the text boxes, it is also using dbText, and as far as I know (from reading forum posts), there is no way to display text above a sprite, unless you want to use native DirectX text commands.

Fortunately there is another way. Right after creating the sprite, hide it with dbHideSprite, and then in the main loop, draw it to the screen with dbPasteSprite, before you call form.update(). If you draw the sprite by pasting it, then you have complete control over the drawing order. The program will look like this:



Does that work?
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 26th Sep 2010 20:23
On second thoughts, you don't even need to create a sprite for the background. This should work:

KeiNagase
15
Years of Service
User Offline
Joined: 15th Jun 2009
Location:
Posted: 26th Sep 2010 22:28
Fantastic, Thanks Mireben. Both dbDrawSpritesFirst() worked as well as the hideSprite and pasteSprite.

dbDrawSpritesFirst actually worked on labels too. I think my current project so far just needs the textboxes since I will probably be making my own custom test like in the dark invaders tutorial.

(On a side note, if it could be done could a Mod please authorize me to post without moderation. My account should be a year old by now (Though I haven't posted here too much.)
MadMonkey
14
Years of Service
User Offline
Joined: 16th Oct 2010
Location: Home
Posted: 16th Oct 2010 15:16 Edited at: 17th Oct 2010 17:32
Why does:
strcat(file, ".extension");
add ".extension" to textboxes. Is there some way to fix it, I've already tried using dbClearEntryBuffer() after strcat().

Thanks in advance.
Sincerely, The Mad Monkey

No cig
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 17th Oct 2010 20:22
You should post the code which gives you the problem, otherwise the question is not understandable.
MadMonkey
14
Years of Service
User Offline
Joined: 16th Oct 2010
Location: Home
Posted: 18th Oct 2010 21:59
I'm making a map editor and I'm having trouble getting the save function working without bugs like ".map" adding to the textbox everytime I save. I know the open function won't work with this save function but at the time I made it there was no file extension.



Sincerely, The Mad Monkey

No cig
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 20th Oct 2010 21:37 Edited at: 20th Oct 2010 21:55
I have looked through your code. You use the char pointers badly. It seems that you mix the usage of char pointers and char arrays. The Name and and Filename attributes of the Map class are pointers but you never allocate storage space for them, which can even result in a crash. (If you want char pointers to point to strings, then the storage space should be allocated with "new" in the constructor and freed with "delete[]" in the destructor.) You use addition and strcat for pointers without a buffer array behind - which may work but with rather unpredictable result.

The actual problem of appending the extension to the textbox is caused by this:



The Mapname.getText function returs the pointer (memory address) of the internal char array of the textbox. You assign this to the Name pointer, with the result that Name now points to the same memory area as the textbox text, so any modification that you make on Name will modify the textbox as well. In the save function, you define another pointer and make it equal to Name, so this one also points to the memory area of the internal buffer of the textbox. Then you append ".map" to it, so it will append ".map" to the textbox.

You need to study more how char pointers and char arrays work and redesign the program a bit. Take, for example, the construction of the Map class:



This should be changed to something like this:



Note how I changed char pointers to char arrays and the array parameter to pointer. By defining Name and Filename as char arrays, you allocate storage space for the strings within the map object, then copy the string received in parameter to that internal storage space. Of course there should also be some safeguards in the program to ensure that Name and FileName can really hold the length of string received, or refuse a too long string, to avoid array overrun during the copy.

EDIT: If you don't want to worry about length and want to assign and add strings conveniently with the = and + operators, you can also try to use std::string instead of char arrays.

Login to post a reply

Server time is: 2024-11-19 16:32:12
Your offset time is: 2024-11-19 16:32:12