If what you want to achieve is, depending on the status of the r_aspectratio cvar, change the position (RECT for gui code) of certain windowDef's, then it's possible.
It does work for mainmenu GUI's, however I haven't tested it in 'in-game' GUIs, but it should work.
Write the following in the gui file:
Code:
choiceDef aspect_ratio {
rect 0, 0, 0, 0
choices "0;1;2"
cvar "r_aspectratio"
currentChoice 0
choiceType 0
}
// 0 = 4:3
// 1 = 16:9
// 2 = 16:10
But now you need to tell the engine what to do with that:
Code:
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Events
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
onEvent {
if ("gui::r_aspectratio" == 0) { // here the cvar is 0 = 4:3
set "DO ALL YOUR SETUP HERE"
}
if ("gui::r_aspectratio" == 1) { // here the cvar is 1 = 16:9
set "DO ALL YOUR SETUP HERE"
}
if ("gui::r_aspectratio" == 2) { // here the cvar is 2 = 16:10
set "DO ALL YOUR SETUP HERE"
}
}
This means that whenever the r_aspectratio cvar is changed, the engine does what you told it to do (hence the onEvent statement)
FOR EXAMPLE
Code:
if ("gui::r_aspectratio" == 0) {
set "OptionsBtnText::rect" "20 20 80 20" ;
}
if ("gui::r_aspectratio" == 1) {
set "OptionsBtnText::rect" "80 60 80 20" ;
}
if ("gui::r_aspectratio" == 2) {
set "OptionsBtnText::rect" "0 90 80 20" ;
}
// Notice the rect is the position on-screen X, Y, X SIZE, Y SIZE