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.

Code Snippets / Some GUI Functions

Author
Message
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 20th Jul 2006 21:19 Edited at: 20th Jul 2006 22:07
Here are some GUI functions for you to play with. Media is attached. I'll post more info in a minute.

[edit]
Ok, more info:
This is slightly different to what I used to do because:
1) It's actually made out of 3D Plains positioned at the screen (thanks CuCuMBeR)
2) All the text you see on the buttons etc is actually textured onto the objects, which means different things can be ordered easily without the text always being at the front.
3)I've never been able to make a menu bar before , but I looked at Phaelax's code (didn't copy it though), and I just got an idea of adding menus by making a seperate function for each of them, rather than making some kind of tokenizer - thanks Phaelax.


Here are the functions:
initGUI() - Starts everything up
setBackground() - Makes the background
makeFrame() - Creates a frame
loadButton() - This will load the images for the buttons
makeButton() - Put a button somewhere
handleButtons() - Controls all the buttons
loadMenu() - Loads the images for the menus
num=addMenu() - Created a menu.. thing.. like "File" or "Edit"
num=addSubMenu() - Makes a emm.. sub menu
createMenus() - Actually makes the menus
handleMenus() - Controls the menus (not super perfect yet, but good)
getMenuSelection() - Finds what you have selected from the menu
menuSelection() - Returns 1 if selection is equal to the parameter
handleGUI() - just a quick shortcut so you can handle all things

Sprite3D() - Makes a 3d sprite (Hooray to CuCuMBeR)
showSprite3D() - Shows a sprite, only use if sprite is hidden
hideSprite3D() - vice versa
ghostSprite3D() - ghosts the sprite
unghostSprite3D() - unghosts it

freeimage() - everyone knows this one - finds a free image...
freeobject() - ...and this finds a free object.


I appologise for some objects/images and variables having to be used in this one, but I guess you could use the freeobject/image() functions to work around that.

Have fun (if you can't afford BlueGUI that is)


[edit]
Oh, and in the screenshot below, you can't see the mouse, bloody windows... ¬_¬', oh well, it's actually over File>Save As.
The menu works btw, just doesn't do anything right now, but that's cos it has nothing to do. But to prove it try clicking on file>exit and it will work fine.
Oh, and the menus don't have to be ghosted, you can choose that in the addMenu() function.







Attachments

Login to view attachments
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 20th Jul 2006 22:09
Very nice looking GUI! I could see those functions being useful

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 20th Jul 2006 22:40
I agree, looks good Zotoaster


Home of the Cartography Shop - DarkBASIC Professional map importer
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 20th Jul 2006 22:55
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 20th Jul 2006 22:57
"RUC go look at my code snippet"

Lol, looking good. Havent looked over the code, but is that a pre-generated fractal image?


Projects: Online CTF Game | Newcommer's Guide to FPS's
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 20th Jul 2006 23:00
Yeah but it's only a screenshot

UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 21st Jul 2006 01:44
Looks great. Once I upgrade to DBP, I will definitly use this. Good job

Chris Franklin
19
Years of Service
User Offline
Joined: 2nd Aug 2005
Location: UK
Posted: 24th Jul 2006 20:56
Awzomness

Platformer Compo!
WHITEKNUCKLE IS BACK! Check the wip boards for more info
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 24th Jul 2006 21:12
Here's a screenie of a different style. Also has a prototype window, still have to add those buttons, and text to the top, but other than that it works. I need to remake the buttons, because they seem to screw up recently, but they're only buttons, probably the least used these days (suprisingly).



sneaky smith12
18
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Like id tell you, oh wait i just did
Posted: 20th Sep 2006 01:42
nice looking gui

ill try it out when i can

If at first you dont succeed, LOWER YOUR STANDARDS.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 20th Sep 2006 02:25
Wow... serious bumpage... I've been working on some better ones, haven't posted them yet though... really should get round to it though...

Vampiric
18
Years of Service
User Offline
Joined: 30th Oct 2006
Location:
Posted: 7th Nov 2006 19:19
bump again i'm going to look at this gui and try and learn something from it should be helpful

All bow down to evil
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 9th Nov 2006 15:13 Edited at: 9th Nov 2006 21:36
Great GUI I will definetally make something kwel with this.. Anyways this is buttonpressed function it returns 1 if button is pressed..

I think i will make my own GUI too sometime..



example



Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 9th Nov 2006 19:44
Ah touché, never knew I didn't have that. Well I have a much newer GUI that I haven't released. It includes listboxes, tabs, labels, text boxes, lots of stuff (and a buttonPressed() function )

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 9th Nov 2006 21:37
Tehee Now you know it.. Cant wait for never version.. I also got demo for the zelda:WW Treasures mini-game where i used the your (was it yours water!?) water and my modelled link and ship... BUT! I got formated my computer and i lost evrything..

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 9th Nov 2006 21:57
Was it a plain blue matrix with waves?

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 10th Nov 2006 08:18
Yes i think so.. The Wind Waker style

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 10th Nov 2006 22:36
Yup, that was mine

Login to post a reply

Server time is: 2024-11-22 23:24:00
Your offset time is: 2024-11-22 23:24:00