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 / I'm a newbie and i need help

Author
Message
EnergeeUK
21
Years of Service
User Offline
Joined: 15th Jan 2003
Location:
Posted: 15th Jan 2003 19:39
Hi everyone
I got darkbasic a while ago and played with it to create a menu. Since then i've lost the code and cannot remember how i did it can you help, this is the situation
I've got a starfiled running in a window ( do loop for the starfield) i have 3 static buttons over the top of starfield, i know the co-ordinates of the buttons (topleft x,y and bottom right x,y) i just cannot remember the code to make the buttons work (ie make them clickable and to load another program)
can anyone help me pleeaasseeeeeeeeee
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Jan 2003 19:41
Something like this?

Fluffy Paul
21
Years of Service
User Offline
Joined: 16th Dec 2002
Location: United Kingdom
Posted: 16th Jan 2003 16:23
I have a 2D array of all my GUI objects thus:

Dim GUIarray(n,6)
where n=number of GUI objects and the 4 things I store for each object are:
1 visibility flag [ 0=no | 1=yes]
2 top [ y-coord on screen ]
3 left [ x-coord on screen ]
4 bottom [ y-coord on screen ]
5 right [ x-coord on screen ]
6 action [ a number which I use in another array ]

the reason I keep track of what's visible and what's not is so that I don't bother checking to see if I've clicked on something that's not visble.

The action number corresponds to a list of actions that I've programmed already. How you store the actions is up to you - my actions are functions. I have a "doAction(actionNumber,dataString)" function which has a CASE statement like this:

CASE 1:
actionFunction(dataString)

CASE2:
anotherFunction(dataString)

and so on. The data doesn't have to be a string - it can be whatever you need it to be. It really pays off to be organised about GUI icons in this way because it means you can have lots of them and you won't get lost.
Shadow
22
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 19th Jan 2003 20:55
v. simple menu options:



then just:
if option(100,100,200,120,"start game") then ...

Login to post a reply

Server time is: 2024-11-23 21:27:10
Your offset time is: 2024-11-23 21:27:10