--Global vars:
menuOpened = 0;
listOpened = 0;
currentInList = -1;
keyList = {};
centrex = getconfig_i("GlobalConfig", "wwidth")/2;
centrey = getconfig_i("GlobalConfig", "wheight")/2;
ITEM_LISTBOX = gui_addListBox(10, 100, 630, 428, "", -1);
gui_hideElement(ITEM_LISTBOX);
consoleWindow = gui_addWindow(0,0, 2*centrex, 600 , "Console");
mainMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Menu");
gravityMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Gravity Settings");
localMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Location Settings");
weatherMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Weather Settings");
lightingMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Lighting Settings");
soundMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Sound Settings");
objectMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Object Settings");
MAIN_MENU_GRAVITI_SET = gui_addButton(20,20,180,40,"Gravity", mainMenuWindow);
MAIN_MENU_LOCATION_SET = gui_addButton(20,45,180,65, "Location", mainMenuWindow);
MAIN_MENU_WEATHER_SET = gui_addButton(20,70,180,90, "Weather", mainMenuWindow);
MAIN_MENU_LIGHTING_SET = gui_addButton(20,95,180,115, "Lighting", mainMenuWindow);
MAIN_MENU_SOUND_SET = gui_addButton(20,120,180,140, "Sound", mainMenuWindow);
MAIN_MENU_OBJECT_SET = gui_addButton(20,145,180,165, "Objects", mainMenuWindow);
MAIN_MENU_CLOSE = gui_addButton(20,170,180,190, "Close", mainMenuWindow);
GRAVITY_MENU_CLOSE = gui_addButton(20,200,180,220,"Close", gravityMenuWindow);
GRAVITY_ENABLE_CHECKBOX = gui_addCheckBox(20,50,180,60, "Gravity", gravityMenuWindow);
GRAVITY_SPIN = gui_addSpinBox(20,20,180,40, "Gravity level", gravityMenuWindow);
LOCATION_MENU_CLOSE = gui_addButton(20,200,180,220, "Close", localMenuWindow);
LOCATION_MENU_SAVE = gui_addButton(20,20,180,40, "Save", localMenuWindow);
LOCATION_MENU_LOAD = gui_addButton(20,45,180,65, "Load", localMenuWindow);
--
WEATHER_MENU_CLOSE = gui_addButton(20,200,180,220,"Close", weatherMenuWindow);
WEATHER_MENU_SET_DAY = gui_addButton(20,20,180,40,"Day",weatherMenuWindow);
WEATHER_MENU_SET_NIGHT = gui_addButton(20,45,180,65,"Night", weatherMenuWindow);
WEATHER_MENU_SET_ANGLES = gui_addButton(20,70,180,90,"Angles", weatherMenuWindow);
WEATHER_MENU_SPIN_THETA = gui_addSpinBox(105,95,180,115,"ThetaAngl",weatherMenuWindow);
WEATHER_MENU_SPIN_PHI = gui_addSpinBox(20,95,95,115,"PhiAngl",weatherMenuWindow);
LIGHTING_MENU_CLOSE = gui_addButton(20,200,180,220, "Close", lightingMenuWindow);
LIGHTING_MENU_SET_MAX = gui_addButton(20,20,180,40, "Max Light", lightingMenuWindow);
LIGHTING_MENU_SET_LIGHT = gui_addButton(105,45,180,65, "Lightning", lightingMenuWindow);
LIGHTING_MENU_SET_SUN_HEIGHT = gui_addButton(105,70,180,90, "Sun Hight", lightingMenuWindow);
LIGHTING_MENU_SPIN_LIGHT_LVL = gui_addSpinBox(20,45,95,65, "Lightning level", lightingMenuWindow);
LIGHTING_MENU_SPIN_SUN_HEIGHT= gui_addSpinBox(20,70,95,90, "Sun Hight", lightingMenuWindow);
SOUND_MENU_CLOSE = gui_addButton(20,200,180,220, "Close", soundMenuWindow);
SOUND_MENU_SPIN_VOL = gui_addSpinBox(20,20,180,40, "Sound level", soundMenuWindow);
SOUND_MENU_CHECK_MUTE = gui_addCheckBox(20,50,180,60,"Sound", soundMenuWindow);
OBJECT_MENU_CLOSE = gui_addButton(20,200,180,220, "Close", objectMenuWindow);
OBJECT_MENU_SAVE = gui_addButton(20,45,180,65, "Save Changes", objectMenuWindow);
OBJECT_MENU_LOAD = gui_addButton(20,70,180,95, "Load Changes", objectMenuWindow);
OBJECT_MENU_SPIN_MAX = gui_addSpinBox(125,20,180,40, "max", objectMenuWindow);
OBJECT_MENU_TEXT_1 =gui_addStaticText(20,20,115,40,"Max Object Number",objectMenuWindow);
gui_hideElement(consoleWindow);
gui_hideElement(mainMenuWindow);
gui_hideElement(gravityMenuWindow);
gui_hideElement(localMenuWindow);
gui_hideElement(weatherMenuWindow);
gui_hideElement(lightingMenuWindow);
gui_hideElement(soundMenuWindow);
gui_hideElement(objectMenuWindow);
modelList = getModelList();
countInList = 0;
for i,line in ipairs(modelList) do
gui_addItemToList(ITEM_LISTBOX, line);
keyList[countInList] = i-1;
countInList = countInList +1;
print(i, line);
end
if countInList > 0 then
currentInList = 0;
gui_setListActive(ITEM_LISTBOX, currentInList);
end;
function keyboardEvent ( id )
if id == 0x49 then
if menuOpened==1 then
gui_hideElement(mainMenuWindow);
gui_hideElement(gravityMenuWindow);
gui_hideElement(localMenuWindow);
gui_hideElement(weatherMenuWindow);
gui_hideElement(lightingMenuWindow);
gui_hideElement(soundMenuWindow);
gui_hideElement(objectMenuWindow);
menuOpened = 0;
gui_removeFocus(1);
receiverEnable(1);
print ("GUI CLOSED");
else
gui_showElement(mainMenuWindow);
gui_setFocus(mainMenuWindow);
menuOpened = 1;
receiverDisable();
print ("GUI OPENED");
end
elseif id == 174 then
vol = get_volume();
set_volume(vol-1);
elseif id == 81 then
currentInList = currentInList-1;
if currentInList<0 and countInList>0 then currentInList = 0; end;
gui_setListActive(ITEM_LISTBOX, currentInList);
elseif id == 87 then
currentInList = currentInList+1;
if currentInList>countInList-1 and countInList>0 then currentInList = 0; end;
gui_setListActive(ITEM_LISTBOX, currentInList);
elseif id == 175 then
vol = get_volume();
set_volume(vol-1);
elseif id == 9 then
if listOpened==1 then
gui_hideElement(ITEM_LISTBOX);
listOpened = 0;
else
gui_showElement(ITEM_LISTBOX);
listOpened = 1;
end
end
end
function mouseEvent ( id )
if id == 0 then
addObject(keyList[currentInList]);
end
end
function event ( id )
if id == MAIN_MENU_GRAVITI_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(gravityMenuWindow);
gui_setFocus(gravityMenuWindow);
elseif id == MAIN_MENU_LOCATION_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(localMenuWindow);
gui_setFocus(localMenuWindow);
elseif id == MAIN_MENU_WEATHER_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(weatherMenuWindow);
gui_setFocus(weatherMenuWindow);
elseif id == MAIN_MENU_LIGHTING_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(lightingMenuWindow);
gui_setFocus(lightingMenuWindow);
elseif id == MAIN_MENU_SOUND_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(soundMenuWindow);
gui_setFocus(soundMenuWindow);
elseif id == MAIN_MENU_OBJECT_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(objectMenuWindow);
gui_setFocus(objectMenuWindow);
elseif id == MAIN_MENU_CLOSE then
gui_hideElement(mainMenuWindow);
elseif id == GRAVITY_MENU_CLOSE or LOCATION_MENU_CLOSE or
WEATHER_MENU_CLOSE or LIGHTING_MENU_CLOSE or
SOUND_MENU_CLOSE or OBJECT_MENU_CLOSE
then
gui_hideElement(gravityMenuWindow);
gui_hideElement(localMenuWindow);
gui_hideElement(weatherMenuWindow);
gui_hideElement(lightingMenuWindow);
gui_hideElement(soundMenuWindow);
gui_hideElement(objectMenuWindow);
gui_showElement(mainMenuWindow);
gui_setFocus(mainMenuWindow);
else
print("other")
end
end
--gui_showElement(consoleWindow);
--gui_showElement(mainMenuWindow);