Position



For the purpose of setting the position of elements on the screen these are the dimensions of your screen.
(640 horizontal, left to right
480 vertical, top to bottom)
This is independent from the resolution you use.


A) In the .menu file you can find lines like the following:

menuDef {
name "playerRect"
rect 10 30 40 28


In this case (menuDef),
the highlighted line indicates the position of the rectangular area (rect) where the info is displayed.

1st number: position x (left to right, 0-640)
2nd number: position y (top to bottom, 0-480)
3rd number: size x (horizontal)
4th number: size y (vertical)




B) you can also find lines like the following:

itemDef {
name "playerRect"
rect 10 -3 40 28



In this case (itemDef),
rect defines the position relative to the upper-left corner of the area defined in the menuDef section.

It defines the size of icons and background images.

Text is not affected by the size of the area.
Text is displayed left-aligned on top of the defined area.

1st number: position x (left to right)
2nd number: position y (top to bottom)
3rd number: size x (horizontal)
4th number: size y (vertical)

To move things around simply adjust the numbers until you are satisfied.



examples:



code:
menuDef {
visible 1
rect 0 0 100 100
style WINDOW_STYLE_FILLED
backcolor 0 1 0 .4
}

menuDef {
visible 1
rect 270 190 100 100
style WINDOW_STYLE_FILLED
backcolor 0 1 0 .4
}

menuDef {
visible 1
rect 535 375 100 100
style WINDOW_STYLE_FILLED
backcolor 0 1 0 .6
}




code:
menuDef {
visible 1
rect 270 190 100 100
style WINDOW_STYLE_FILLED
backcolor 0 1 0 .4

itemDef {
visible 1
rect 0 0 50 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .5
}

itemDef {
visible 1
rect -100 -100 50 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .5
}

itemDef {
visible 1
rect 100 100 50 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .5
}

}



code:
menuDef {
visible 1
rect 270 190 100 100

itemDef {
visible 1
rect 0 0 100 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .4
ownerdraw CG_PLAYER_HEALTH
}

itemDef {
visible 1
rect 150 0 100 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .4
ownerdraw CG_PLAYER_ARMOR_VALUE
}

itemDef {
visible 1
rect 0 150 100 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .4
ownerdraw CG_PLAYER_AMMO_VALUE
}

}

0 comments: