MenuDeathmatchBonuses::MenuDeathmatchBonuses(){ AG_Box * item; // nadpis createHeading("Deathmatch bonuses setings"); // ok item = createItem("OK"); AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0); // bonus item = createItemHoriz("bonus"); AG_AddEvent(items_.back(), "window-keydown", handlerIntItem, "%p,%i,%i", &bonus, MENU_DEATHMATCH_BONUSES_MIN, MENU_DEATHMATCH_BONUSES_MAX); AG_NumericalNewIntR(item, 0, 0, 0, &bonus, MENU_DEATHMATCH_BONUSES_MIN, MENU_DEATHMATCH_BONUSES_MAX); // ok item = createItem("OK"); AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0); AG_SpacerNewHoriz(win); }
MenuOptions::MenuOptions(): speed_(CONFIG->speed()), visible_presumption_(CONFIG->visible_presumption()), fullscreen_(CONFIG->fullscreen()), sound_(CONFIG->sound()){ AG_Box * item; // nadpis createHeading("Options"); // jazyk item = createItem("Language"); // TODO u combo // klavesy item = createItem("Controls"); AG_SetEvent(item, "window-mousebuttondown", MenuOptionsControls::create, 0); // rychlost hry item = createItemHoriz("Game speed"); AG_AddEvent(items_.back(), "window-keydown", handlerIntItem, "%p,%i,%i", &speed_, CONFIG_SPEED_MIN, CONFIG_SPEED_MAX); AG_NumericalNewIntR(item, 0, 0, 0, &speed_, CONFIG_SPEED_MIN, CONFIG_SPEED_MAX); // viditelna presumpce item = createItemHoriz("Explosion presumptions"); AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem, "%p", &visible_presumption_); item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL); AG_BoxSetPadding(item, 0); AG_SpacerNewVert(item); AG_CheckboxNewInt(item, 0, " ", &visible_presumption_); // fullscreen item = createItemHoriz("Play in fullscreen"); AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem, "%p", &fullscreen_); item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL); AG_BoxSetPadding(item, 0); AG_SpacerNewVert(item); AG_CheckboxNewInt(item, 0, " ", &fullscreen_); // zvuk item = createItemHoriz("Sound enabled"); AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem, "%p", &sound_); item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL); AG_BoxSetPadding(item, 0); AG_SpacerNewVert(item); AG_CheckboxNewInt(item, 0, " ", &sound_); // back item = createItem("Save"); AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0); AG_SpacerNewHoriz(win); }
MenuOptions::MenuOptions(): speed_(CONFIG->speed()), visible_presumption_(CONFIG->visible_presumption()), split_screen_(CONFIG->split_screen()), fullscreen_(CONFIG->fullscreen()), sound_(CONFIG->sound()){ AG_Box * item; AG_UCombo *combo; AG_TlistItem * combo_item; AG_Checkbox * checkbox; // nadpis createHeading(LANG_MENU(LANG_OPTIONS, LANG_HEADING)); // jazyk item = createItem(LANG_MENU(LANG_OPTIONS, LANG_LANGUAGE)); combo = AG_UComboNew(item, AG_UCOMBO_HFILL); AG_SetEvent(combo, "ucombo-selected", handlerLanguage, "%p", combo->button); for(Uint16 i=0 ; i<CONFIG->languages_.size() ; ++i){ combo_item = AG_TlistAddPtr(combo->list, 0, CONFIG->languages_[i].show.c_str(), &CONFIG->languages_[i]); if(CONFIG->language_==CONFIG->languages_[i].name) AG_ButtonText(combo->button, "%s", combo_item->text); } // klavesy item = createItem(LANG_MENU(LANG_OPTIONS, LANG_CONTROLS)); AG_SetEvent(item, "window-mousebuttondown", MenuOptionsControls::create, 0); // rychlost hry item = createItemHoriz(LANG_MENU(LANG_OPTIONS, LANG_SPEED)); AG_AddEvent(items_.back(), "window-keyup", handlerIntItem, "%p,%i,%i", &speed_, CONFIG_SPEED_MIN, CONFIG_SPEED_MAX); AG_NumericalNewIntR(item, 0, 0, 0, &speed_, CONFIG_SPEED_MIN, CONFIG_SPEED_MAX); // viditelna presumpce createCheckboxItem(LANG_MENU(LANG_OPTIONS, LANG_PRESUMPTIONS), &visible_presumption_); // rozedelni obrazovek createCheckboxItem(LANG_MENU(LANG_OPTIONS, LANG_SPLIT_SCREEN), &split_screen_); // fullscreen checkbox = createCheckboxItem(LANG_MENU(LANG_OPTIONS, LANG_FULLSCREEN), &fullscreen_); AG_AddEvent(items_.back(), "window-mousebuttondown", handlerToggleFullscreen, 0); AG_AddEvent(checkbox, "window-mousebuttondown", handlerToggleFullscreen, 0); // zvuk - neni implementovano // createCheckboxItem(LANG_MENU(LANG_OPTIONS, LANG_SOUND), // &sound_); // back item = createItem(LANG_MENU(LANG_OPTIONS, LANG_SAVE)); AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0); AG_SpacerNewHoriz(win); }
static AG_Window * DEV_ConfigWindow(AG_Config *cfg) { char path[AG_PATHNAME_MAX]; AG_Window *win; AG_Box *hb; AG_Textbox *tbox; /* AG_Checkbox *cb; */ AG_Notebook *nb; AG_NotebookTab *tab; if ((win = AG_WindowNewNamedS(0, "DEV_Config")) == NULL) { return (NULL); } AG_WindowSetCaptionS(win, _("Agar settings")); AG_WindowSetCloseAction(win, AG_WINDOW_DETACH); nb = AG_NotebookNew(win, AG_NOTEBOOK_HFILL|AG_NOTEBOOK_VFILL); tab = AG_NotebookAdd(nb, _("Video"), AG_BOX_VERT); { AG_NumericalNewIntR(tab, 0, "%", _("Screenshot quality: "), &agScreenshotQuality, 1, 100); } tab = AG_NotebookAdd(nb, _("GUI"), AG_BOX_VERT); { AG_CheckboxNewInt(tab, 0, _("Built-in key composition"), &agTextComposition); AG_CheckboxNewInt(tab, 0, _("Bidirectional"), &agTextBidi); AG_SeparatorNewHoriz(tab); AG_LabelNewS(tab, 0, _("Timer settings (milliseconds):")); AG_NumericalNewIntR(tab, 0, NULL, _("Double click delay: "), &agMouseDblclickDelay, 1, 10000); AG_NumericalNewIntR(tab, 0, NULL, _("Cursor spin delay: "), &agMouseSpinDelay, 1, 10000); AG_NumericalNewIntR(tab, 0, NULL, _("Cursor spin interval: "), &agMouseSpinIval, 1, 10000); AG_NumericalNewIntR(tab, 0, NULL, _("Key repeat delay: "), &agKbdDelay, 1, 1000); AG_NumericalNewIntR(tab, 0, NULL, _("Key repeat interval: "), &agKbdRepeat, 1, 500); } tab = AG_NotebookAdd(nb, _("Directories"), AG_BOX_VERT); { hb = AG_BoxNewHoriz(tab, AG_BOX_HFILL); tbox = AG_TextboxNewS(hb, AG_TEXTBOX_HFILL, _("Temporary file directory: ")); AG_GetString(agConfig, "tmp-path", path, sizeof(path)); AG_TextboxSetString(tbox, path); AG_SetEvent(tbox, "textbox-return", SetPath, "%s", "tmp-path"); AG_TextboxSizeHint(tbox, "XXXXXXXXXXXXXXXXXXXX"); AG_ButtonNewFn(hb, 0, "...", SelectPath, "%s,%p", "tmp-path", tbox); hb = AG_BoxNewHoriz(tab, AG_BOX_HFILL); tbox = AG_TextboxNewS(hb, AG_TEXTBOX_HFILL, _("Dataset save directory: ")); AG_GetString(agConfig, "save-path", path, sizeof(path)); AG_TextboxSetString(tbox, path); AG_SetEvent(tbox, "textbox-return", SetPath, "%s", "save-path"); AG_ButtonNewFn(hb, 0, "...", SelectPath, "%s,%p", "save-path", tbox); hb = AG_BoxNewHoriz(tab, AG_BOX_HFILL); tbox = AG_TextboxNewS(hb, AG_TEXTBOX_HFILL, _("Dataset search path: ")); AG_GetString(agConfig, "load-path", path, sizeof(path)); AG_TextboxSetString(tbox, path); AG_SetEvent(tbox, "textbox-return", SetPath, "%s", "load-path"); hb = AG_BoxNewHoriz(tab, AG_BOX_HFILL); tbox = AG_TextboxNewS(hb, AG_TEXTBOX_HFILL, _("Font search path: ")); AG_GetString(agConfig, "font-path", path, sizeof(path)); AG_TextboxSetString(tbox, path); AG_SetEvent(tbox, "textbox-return", SetPath, "%s", "font-path"); } #if 0 tab = AG_NotebookAdd(nb, _("Colors"), AG_BOX_VERT); { AG_Pane *hPane; AG_HSVPal *hsv; AG_Tlist *tl; AG_TlistItem *it; AG_Label *lbl; int i; hPane = AG_PaneNew(tab, AG_PANE_HORIZ, AG_PANE_EXPAND); { tl = AG_TlistNew(hPane->div[0], AG_TLIST_EXPAND); AG_TlistSizeHint(tl, "Tileview text background", 10); for (i = 0; i < LAST_COLOR; i++) { it = AG_TlistAdd(tl, NULL, _(agColorNames[i])); it->p1 = &agColors[i]; } hsv = AG_HSVPalNew(hPane->div[1], AG_HSVPAL_EXPAND); AG_SetEvent(hsv, "h-changed", SetColor, "%p", tl); AG_SetEvent(hsv, "sv-changed", SetColor, "%p", tl); AG_SetEvent(tl, "tlist-selected", BindSelectedColor, "%p", hsv); } lbl = AG_LabelNew(tab, 0, _("Warning: Some color changes will not " "take effect until %s is restarted."), agProgName); AG_LabelSetPaddingLeft(lbl, 10); AG_LabelSetPaddingRight(lbl, 10); hb = AG_BoxNewHoriz(tab, AG_BOX_HOMOGENOUS|AG_BOX_HFILL); { AG_ButtonNewFn(hb, 0, _("Load scheme"), LoadColorSchemeDlg, NULL); AG_ButtonNewFn(hb, 0, _("Save scheme"), SaveColorSchemeDlg, NULL); } } #endif #ifdef AG_DEBUG tab = AG_NotebookAdd(nb, _("Debug"), AG_BOX_VERT); { AG_NumericalNewIntR(tab, 0, NULL, _("Debug level: "), &agDebugLvl, 0, 255); } #endif hb = AG_BoxNewHoriz(win, AG_BOX_HOMOGENOUS|AG_BOX_HFILL); { AG_ButtonNewFn(hb, 0, _("Close"), AGWINDETACH(win)); AG_ButtonNewFn(hb, 0, _("Save"), SaveConfig, NULL); } return (win); }