Wiki Revision Page "Menu Guide" Revision 28:
---+ Menu Guide
-By Cobo-


---++ Introduction
This is a guide for Digital Paint Paintball2 Menus, What are the Menus? Well, if you dont know, Launch  Digital Paintball Paintball2 and look at your screen, what do you see? everything from top to bottom is a menu, click on the Play option and again from top to bottom a Menu. But where are they? all of them, from the Main Menu to the Scores window that you get on the game are on a folder named Menus(Yes really) and you can find that on \pball\menus\.
So now you want to learn more about Menus? well read on.

---++ Headers
---+++ What are they?
A Header is just the word i use to define the words that define what kind of menu you are making. Get it? No? Yes? Well open up the main_ingame Menu(\pball\menus\main_ingame.txt). What you have here is the menu that you get when you are playing and hit the escape key. now, lets take a look at the text, shall we?
The first line: pb2menu 1. is a must have in your menu, without it when you tried to run your menu you would get an error. so always remember to put it on your menus.
keep reading, and you should find the background header, so what is the background header? its the background! when you dont specify the background (dont write it) then the background will appear like the Main menu, a solid full size backgrouns. when you set the background to none (background none) then the background will be transparent, you can also set it to any image you have in the pics folder, for example menu_bg_ingame is a picture in the pics folder, that background is the one that is a rectangle from left to right. So this pretty mcuh covers backgrounds, so lets move on...
Lets say we want to make our menu be on top of other menus then you would change the type to dialog (type dialog).
---++ Widgets
---+++ What are they?
Widets are the most important part of a Menu, they could be text, a picture, a textobox, or any other thing that is on a Menu.
To make a Widget simply write widget (lower case) and then the next things you write will specify what kind of widget it is.
---+++ Positioning Widgets
There are many ways to position a widget on a menu for example lets say we want to position our widget on 200, 400 coordinates (X, Y) then you would put...
[code]widget
     xabs 200
     yabs 400[/code]
xabs and yabs stand for x absolute and y absolute. they mean where ever you specify x or y, thats where the widget will be, at X, Y.

Another way to position your widget would be by relative positioning...
[code]widget
     xabs 200
     yabs 400
widget
     xrel 100
     yrel -100[/code]
Where xrel and yrel are x relative and y relative. That means that the second Widget would be positioned at 300, 300

One more way to possition widgets is by making them relative to the center...
[code]widget
     xcent -100
     ycent 100[/code]
Where xcent and ycent are x center and y center. So if you have a 800x600 resolution it would be at 300, 400 ((800/2)-100, (600/2)+100.

After you positioned your widget you can align it to a side, for example lets say you positioned your widget to 100, 100 and want your left corner aligned to that position, then you would have to do set halign left, it could also be halign right or halign center. But what if you want it aligned to the top of the widget? then you would use valign top, or valign bottom for bottom and valign center for aligning to the center. halign ans valign stand for horisontal align and vertical align.
---+++ Text Widget
This is the most common widget, its just text, but can also work as a button. you specify a text widget by setting the widget type as text. and the text with, well... text (test "This is the text"). You can make it act as a button by adding command ""
Example
[code]widget
     type text
     text "Hello World"
     xcent 0
     ycent -100
     command "menu pop"[/code]
When you click on the Hello World text the menu should dissapear and go to the previous menu (that's what "menu pop" does)
---+++ Pic Widget
Another kind of Widget is the pic widget, all it does is draws a selected picture into your menu and can work as a button as well. you ddeclare a widget a pic by writing: type pic. It is almost the same as a text widget, with a few differences. Instead of writing text for declaring the text, you would use pic to declare the picture, and the picture must be on your pics folder. Lets take a look at an example...
[code]widget
     type pic
     command "menu play"
     xcent 0
     ycent 0     
     halign center
     pic "m_play1"
     hoverpic "m_play1h"
     selectedpic "m_play1s"[/code]
So there you have it, a picture on the center that when you click it takes you to the Play menu. but what about those other things? Well, all they do is when you hover above the pic (hoverpic) then the hoverpic will kick in, and when you clikc it (selectedpic), you will the the selectedpic.
You can also change the pic's width and height by using picwidth and picheight.