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.

DarkBASIC Discussion / [LOCKED] Can somebody tell me how to make a menu.

Author
Message
Deathead
19
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 5th Apr 2007 17:05 Edited at: 24th Apr 2007 22:25
And i have searched!

JOIN NOW!Or be square!
SimSmall
21
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 5th Apr 2007 18:24 Edited at: 5th Apr 2007 18:25
with mouse:

check if the mouse lies with a set area (usually a box)



(probably best storing each co-ordinate in an array) ,then just check inside the if, whether the mouse is being clicked, and if so, do whatever...

without mouse:

inkey$()
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 5th Apr 2007 18:29
Not sure you were searching for then.

I searched for the word 'Menu' on this board alone and got 60 results.

Methinks maybe it involved too much reading to find exactly what you want and you preferred someone else did it for you?...

As I'm in a good mood, here's the easy method...

Load up any paint program and create a new image the same size as your DB program - 800x600 for example.

Create a coloured rectangle 200 pixels wide and 100 pixels high. If you need six buttons on your menu, then make six copies of this rectangle.

Put the text you want onto each of the buttons and using copy/paste, position them on the screen where you want them.

Save the screen as MenuScrn.jpg (or bmp if your paint prog won't do jpg files).

Use the mouse to locate the X and Y positions of the TOP LEFT and BOTTOM RIGHT corners of each button. Write them down!

In your DB program, simply load in the image you created and sit in a loop checking the mouse position. Use a blocks of code like this (one for EACH button):



IMPORTANT:

In the section for each button of your menu, you need to change the variables Tlx, Tly, Brx and Bry to the values you noted down in the paint program. They are:

Tlx - the button's Top Left X value
Tly - the button's Top Left Y value
Brx - the button's Bottom Right X value
Bry - the button's Bottom Right Y value

The code inside each block is only carried out if the mouse button is clicked inside the boundaries of the respective button.

This method is probably the easiest and there are other and better ways to do it.

You might prefer to load the button images in separately rather than the screen and place them manually - or make sprites out of them.

If you want a quick menu screen though, this is probably the easiest and quickest method. You can always go back later and tidy up the image with buttons on it.

TDK_Man

Deathead
19
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 5th Apr 2007 21:02 Edited at: 5th Apr 2007 21:06
I wrote how to make menus so it was a different search thanks TDK
and simsmall i try em out.

PLS JOIN I really do
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 20th Apr 2007 11:04
Chekk the Code Base for DBC and Look for CalofDuty on (INPUT)
There is a Short But Easy Read Abel Code for (Mouse)

Stig Magne Risnes Berger
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 20th Apr 2007 11:06
here is The Code



` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com

main_menu:
ink rgb(255,255,255),0
text 20,120,"New Game"
text 20,160,"Load"
text 20,200,"Options"
text 20,240,"Credits"
text 20,280,"Exit"
repeat
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 110) and (mousey() <=130))) then ink rgb(255,255,0),0 : text 20,120,"New Game"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 110) or (mousey() >130))) then ink rgb(255,255,255),0 : text 20,120,"New Game"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 110) and (mousey() <=130))) and (mouseclick()=1)) then end
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 150) and (mousey() <=170))) then ink rgb(255,255,0),0 : text 20,160,"Load"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 150) or (mousey() >170))) then ink rgb(255,255,255),0 : text 20,160,"Load"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 150) and (mousey() <=170))) and (mouseclick()=1)) then end
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 190) and (mousey() <=210))) then ink rgb(255,255,0),0 : text 20,200,"Options"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 190) or (mousey() >210))) then ink rgb(255,255,255),0 : text 20,200,"Options"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 190) and (mousey() <=210))) and (mouseclick()=1)) then end
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 230) and (mousey() <=250))) then ink rgb(255,255,0),0 : text 20,240,"Credits"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 230) or (mousey() >250))) then ink rgb(255,255,255),0 : text 20,240,"Credits"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 230) and (mousey() <=250))) and (mouseclick()=1)) then end
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 270) and (mousey() <=290))) then ink rgb(255,255,0),0 : text 20,280,"Exit"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 270) or (mousey() >290))) then ink rgb(255,255,255),0 : text 20,280,"Exit"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 270) and (mousey() <=290))) and (mouseclick()=1)) then end
until false

Stig Magne Risnes Berger
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 20th Apr 2007 11:08
Sorry i Try on More Time


[` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com

main_menu:
ink rgb(255,255,255),0
text 20,120,"New Game"
text 20,160,"Load"
text 20,200,"Options"
text 20,240,"Credits"
text 20,280,"Exit"
repeat
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 110) and (mousey() <=130))) then ink rgb(255,255,0),0 : text 20,120,"New Game"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 110) or (mousey() >130))) then ink rgb(255,255,255),0 : text 20,120,"New Game"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 110) and (mousey() <=130))) and (mouseclick()=1)) then end
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 150) and (mousey() <=170))) then ink rgb(255,255,0),0 : text 20,160,"Load"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 150) or (mousey() >170))) then ink rgb(255,255,255),0 : text 20,160,"Load"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 150) and (mousey() <=170))) and (mouseclick()=1)) then end
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 190) and (mousey() <=210))) then ink rgb(255,255,0),0 : text 20,200,"Options"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 190) or (mousey() >210))) then ink rgb(255,255,255),0 : text 20,200,"Options"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 190) and (mousey() <=210))) and (mouseclick()=1)) then end
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 230) and (mousey() <=250))) then ink rgb(255,255,0),0 : text 20,240,"Credits"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 230) or (mousey() >250))) then ink rgb(255,255,255),0 : text 20,240,"Credits"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 230) and (mousey() <=250))) and (mouseclick()=1)) then end
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 270) and (mousey() <=290))) then ink rgb(255,255,0),0 : text 20,280,"Exit"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 270) or (mousey() >290))) then ink rgb(255,255,255),0 : text 20,280,"Exit"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 270) and (mousey() <=290))) and (mouseclick()=1)) then end
until false]

Stig Magne Risnes Berger
Deathead
19
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 20th Apr 2007 11:52
Thanks mate...I try it out

Check in today!-PLS
Freddix
AGK Developer
23
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 20th Apr 2007 15:21 Edited at: 20th Apr 2007 19:25
take a look at my old website, there is a small free menu system using graphics :

http://cordierfr.free.fr/html/index_english.html
click on the left on "DarkBASIC v1", then on "Code Source 2D". There is in the list a Menu system that may work with DarkBASIC v1 and Professional ...

Gandalf said: "All we have to decide is what to do with the time that is given to us"
Odyssey-Creators - X-Quad Editor - 3DMapEditor
Deathead
19
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 20th Apr 2007 21:02
Thanks Freddix check it out later to.

Check in today!-PLS
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Apr 2007 00:50
Hello friends !! have a look to this little code...you can make windows where you decide...you can put buttons and lines...but the rest must be done for you haha... it`s a joke !! but with a little patience you can make the rest


oh my god
Deathead
19
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 23rd Apr 2007 21:37
You got me for a second and by the way i could try anything because either way i have to print because i have lost the internet on my laptop.

JOIN NOW!Or be square!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th May 2007 09:43
Quite a few new users have been asking for info on this subject recently, so I've done a tutorial on the subject.

If you need an in-game menu screen for your game then check out tutorial number 16 here:

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

TDK_Man

Deathead
19
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 11th May 2007 00:44
Thank TDK!

JOIN NOW!Or be square!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th May 2007 02:18
NP!

Please let me know if you found it helpful, easy or difficult to follow etc.

TDK_Man

Deathead
19
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 11th May 2007 23:39
I kinda using Blender now so this has no use to me now can you lock it...Kind Regards,

Deathead

P.S. The Tutorial was good.

JOIN NOW!Or be square!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 12th May 2007 01:32
I'm not quite sure what Blender has to do with making an in-game menu, but locked as per request.

TDK_Man

Login to post a reply

Server time is: 2026-07-06 03:59:04
Your offset time is: 2026-07-06 03:59:04