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 / Buttons and GUI?

Author
Message
Sphelx
21
Years of Service
User Offline
Joined: 29th Mar 2003
Location:
Posted: 29th Mar 2003 19:15
I've looked in numerous places but can't find tutorials or coding relevent to the creation of buttons or menu systems.

I'm just trying to create a game menu at the minute, leaving the game aside till i can get an interface. I've created text in the places i want buttons but i can't find any commands relevent to buttons or interface commands.


Sphelx,
Xoid
21
Years of Service
User Offline
Joined: 8th Mar 2003
Location:
Posted: 29th Mar 2003 19:26
well... it depends how you want to code your interface, alot of people use the sprite based method.

you could use a function like this code get a certain region of the screen.

so when you move your mouse over a certain area your sprite appears etc...

function BoundingBox(sprite_num,left#,top#,right#,bottom#)
rem determines whether mousepointer is in a region
if ((mouseX()>=left# AND mouseX()<=right#) AND (mouseY()>=top# AND mouseY()<=bottom#))
show sprite sprite_num
else
hide sprite sprite_num
endif
endfunction

coding a menu system isn't difficult if you think about it

Do not anticipate the outcome of the engagement, let nature take it's course, and your tools will strike at the right moment - from "Tao of Jeet Kune Do" by Bruce Lee
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Mar 2003 04:01
I just load a bitmap to screen and when you click the mouse it checks if you clicked where the button is, if you did, it does its thing.

"Computers are useless they can only give you answers."
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 30th Mar 2003 04:59
Yep but you need code similiar to Xoids.

RPGamer

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy! Oh ya, and Tat has a plugin for that!
Brent_Seraphim
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: United States
Posted: 30th Mar 2003 05:31
hehe,

If you read Xoid and Exeat's message you will find they are virutaly the same thing, one just gave examples of code, Exeat just explained it in english

Thats about how my code works. And yes it works! (Barely )

Quote :

"coding a menu system isn't difficult if you think about it"

Blessed words of wisdom!

"Laugh to scorn the power of man..."
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Mar 2003 06:02
Yeah, I was too lazy to read his code =P

"Computers are useless they can only give you answers."
Xoid
21
Years of Service
User Offline
Joined: 8th Mar 2003
Location:
Posted: 30th Mar 2003 15:13
Brent_Seraphim, If Sphelx wants a tutorial i'll be happy to supply him with one, but you know he shouldn't have too much of a problem after my and Exeat's explaination, LOL, hehe.

ok, ok, so I could have explained it abit BETTER

Do not anticipate the outcome of the engagement, let nature take it's course, and your tools will strike at the right moment - from "Tao of Jeet Kune Do" by Bruce Lee
Xoid
21
Years of Service
User Offline
Joined: 8th Mar 2003
Location:
Posted: 30th Mar 2003 15:57
ok, Sphelx, try this out, the code below will create a simple MenuBar for you,
all you and then save as a bitmap "MenuSystem.bmp", so you can just call it from within your code (Load Bitmap "MenuSystem.bmp",1) or whatever.

If you use/modify my BoundingBox code to suit your needs you should be able to write a GUI in no time.



Do not anticipate the outcome of the engagement, let nature take it's course, and your tools will strike at the right moment - from "Tao of Jeet Kune Do" by Bruce Lee
Megaman Zero
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 30th Mar 2003 23:39 Edited at: 30th Mar 2003 23:40
Someone gave me a menu system that they made for people to learn it. Only the Exit button works, but the menu shows how to place the buttons & other stuff, & shows how to get the button to work if its clicked. Dont remember who gave it to me, but it really helped out. I thank whoever it was greatly.

If you want it, I can send it to you, email me at shadow_guyver_iii_2000@yahoo.comif you want it, its got multiple reminders to help you out.

Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 31st Mar 2003 04:40
Heh, funnily enough earlier today I had to make a menu system anyway, so using Xoid's function I came up with something like this:



First thing that happens is a splash comes up (image 1), then when you click the menu shows (image 2) and you can hover your mouse over the buttons on the right and a respective image will appear on the left describing the 'link'. Works perfectly except for one thing. It runs slow as hell. The mouse's position updates once every 2 seconds. Any idea why?

"Computers are useless they can only give you answers."
Xoid
21
Years of Service
User Offline
Joined: 8th Mar 2003
Location:
Posted: 31st Mar 2003 05:17
it's probably because of the sprites hidden in memory, if the sprites are not needed you could always delete them, then when they are needed load into memory then display them. Hiding the sprites will use up more resources hence the slow-down.

also, if your GUI just uses lines, boxes etc... and doesn't use stylish graphics then you could just create a GUI using the line, box commands etc...

I would put the mouseclick() event before the ButtonCheck function which the system only has to check 1 line instead of 2;

i.e

do
--> [1] ButtonCheck()
--> [2] Check Co-ordinates
--> if mouseclick()=1 then do whatever
loop

instead try this,

do
--> [1] if mouseclick()=1 then
ButtonCheck()
loop

I've finished off the GUI which I'll upload to my website later on, so if you wanna download feel free.

sorry if I haven't explained it all that well I'm notoriously bad at explainations, lol especially in the earlier hours

Do not anticipate the outcome of the engagement, let nature take it's course, and your tools will strike at the right moment - from "Tao of Jeet Kune Do" by Bruce Lee
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 31st Mar 2003 06:10 Edited at: 31st Mar 2003 06:19
Thanks, I am using a fancy interface which is why I load so many images, I'll check if hiding them is slowing it down because you may be right there. Not sure I understand why you would put the MouseClick first though, it doesn't seem like it matters where it goes at all to me.

Edit: Yep, you were right, the new code:



Works as smooth as I could ever have hoped.

"Computers are useless they can only give you answers."

Login to post a reply

Server time is: 2024-11-24 08:28:37
Your offset time is: 2024-11-24 08:28:37