AG_Window * RG_FillEdit(void *p, RG_Tileview *tv) { struct rg_fill_feature *f = p; AG_Window *win; AG_Box *box; win = AG_WindowNew(0); AG_WindowSetCaptionS(win, _("Fill/gradient")); { static const char *modes[] = { N_("Solid"), N_("Horizontal gradient"), N_("Vertical gradient"), N_("Circular gradient"), N_("Pixmap pattern"), NULL }; AG_RadioNewUint(win, AG_RADIO_HFILL, modes, &f->type); } box = AG_BoxNew(win, AG_BOX_VERT, AG_BOX_HFILL|AG_BOX_VFILL); { AG_HSVPal *hsv1, *hsv2; AG_Numerical *num; AG_Notebook *nb; AG_NotebookTab *ntab; nb = AG_NotebookNew(box, AG_NOTEBOOK_HFILL|AG_NOTEBOOK_VFILL); ntab = AG_NotebookAddTab(nb, _("Color A"), AG_BOX_VERT); { hsv1 = AG_HSVPalNew(ntab, AG_HSVPAL_EXPAND); AG_BindUint8(hsv1, "RGBAv", (Uint8 *)&f->f_gradient.c1); } ntab = AG_NotebookAddTab(nb, _("Color B"), AG_BOX_VERT); { hsv2 = AG_HSVPalNew(ntab, AG_HSVPAL_EXPAND); AG_BindUint8(hsv2, "RGBAv", (Uint8 *)&f->f_gradient.c2); } num = AG_NumericalNewUint8R(box, 0, NULL, _("Overall alpha: "), &f->alpha, 0, 255); AG_NumericalSetIncrement(num, 5); } return (win); }
static void MainWindow(void) { AG_Window *win; AG_Table *t; AG_Button *btn; AG_Notebook *nb; AG_NotebookTab *ntab; AG_HBox *hbox; int i, j; win = AG_WindowNewNamedS(0, "agar-benchmarks"); AG_WindowSetCaption(win, "Agar Benchmarks"); nb = AG_NotebookNew(win, AG_NOTEBOOK_HFILL|AG_NOTEBOOK_VFILL); for (i = 0; i < ntests; i++) { struct test_ops *test = tests[i]; ntab = AG_NotebookAddTab(nb, test->name, AG_BOX_VERT); t = AG_TableNewPolled(ntab, AG_TABLE_MULTI|AG_TABLE_EXPAND, poll_test, "%i", i); AG_TableAddCol(t, "Test", "70%", NULL); AG_TableAddCol(t, "Min", "10%", NULL); AG_TableAddCol(t, "Avg", "10%", NULL); AG_TableAddCol(t, "Max", "10%", NULL); AG_TableAddCol(t, NULL, NULL, NULL); hbox = AG_HBoxNew(ntab, AG_HBOX_HOMOGENOUS|AG_HBOX_HFILL); { btn = AG_ButtonNewS(hbox, 0, "Run tests"); AG_SetEvent(btn, "button-pushed", RunTests, "%p,%p", test, t); btn = AG_ButtonNewS(hbox, 0, "Save results"); AG_SetEvent(btn, "button-pushed", SaveToFileDlg, "%p,%p", test, t); btn = AG_ButtonNewS(hbox, 0, "Quit"); AG_SetEvent(btn, "button-pushed", QuitApp, NULL); } for (j = 0; j < test->nfuncs; j++) { struct testfn_ops *fn = &test->funcs[j]; fn->clksMin = 0; fn->clksAvg = 0; fn->clksMax = 0; } } AG_WindowSetGeometryAligned(win, AG_WINDOW_MC, agView->w-20, agView->h-20); AG_WindowShow(win); }
void TestState::enter() { int screenWidth = graphicsEngine->getScreenWidth(); int screenHeight = graphicsEngine->getScreenHeight(); AG_Window *chatWindow = AG_WindowNewNamed(AG_WINDOW_NOBUTTONS, "ChatWindow"); AG_WindowSetCaption(chatWindow, "Chat"); AG_WindowSetSpacing(chatWindow, 5); AG_WindowSetGeometry(chatWindow, 10, screenHeight - 185, 400, 175); AG_WindowShow(chatWindow); AG_Notebook *book = AG_NotebookNew(chatWindow, AG_NOTEBOOK_EXPAND); AG_ObjectSetName(book, "ChannelsFolder"); AG_NotebookTab *nbTab = AG_NotebookAddTab(book, "Global Chat", AG_BOX_VERT); AG_ObjectSetName(nbTab, "GlobalChat"); AG_Console *console = AG_ConsoleNew(nbTab, AG_CONSOLE_EXPAND|AG_CONSOLE_AUTOSCROLL); AG_ObjectSetName(console, "Chat"); AG_Textbox *chatInput = AG_TextboxNewS(chatWindow, AG_TEXTBOX_CATCH_TAB, ""); AG_TextboxSizeHint(chatInput, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); AG_SetEvent(chatInput, "textbox-return", submit_chat, "%p%p%p", chatServer, chatInput, console); // add elements to interface manager interfaceManager->addWindow(chatWindow); popUp = AG_WindowNew(AG_WINDOW_NOBUTTONS); AG_WindowSetCaption(popUp, "Exit Game"); AG_WindowSetGeometry(popUp, screenWidth / 2 - 75, screenHeight / 2 - 40, 150, 80); AG_WindowHide(popUp); AG_Button *logOut = AG_ButtonNewFn(popUp, 0, "Log Out", handle_logout, 0); AG_ButtonJustify(logOut, AG_TEXT_CENTER); AG_Button *exitGame = AG_ButtonNewFn(popUp, 0, "Exit to Desktop", handle_exit, 0); AG_ButtonJustify(exitGame, AG_TEXT_CENTER); interfaceManager->addWindow(popUp); std::string nick = player->getSelectedCharacter()->getName(); std::string host = "neo.us.whatnet.org"; chatServer->setNick(nick); #ifndef WITHOUT_CHAT chatServer->connect(host); #endif // add listener interfaceManager->addMouseListener(&handle_mouse); }
void OnConfigDisplayMenu(AG_Event *event) { AG_MenuItem *self = (AG_MenuItem *)AG_SELF(); AG_Window *win; AG_Notebook *note; AG_Notebook *note2; AG_NotebookTab *tab; AG_NotebookTab *tab2; AG_Box *box; AG_Button *btn; struct gui_disp *cfg; int i, num; cfg = (struct gui_disp *)malloc(sizeof(struct gui_disp)); if(cfg == NULL) return; { LockVM(); cfg->nDrawFPS = configdat.nDrawFPS; cfg->nEmuFPS = configdat.nEmuFPS; cfg->nBrightness = configdat.nBrightness; cfg->nRenderMethod = configdat.nRenderMethod; cfg->uWidth = configdat.uWidth; cfg->uHeight = configdat.uHeight; cfg->bFullScan = configdat.bFullScan; cfg->bFullScanFS = configdat.bFullScanFS; cfg->bSmoosing = configdat.bSmoosing; cfg->bUseSIMD = configdat.bUseSIMD; #ifdef _USE_OPENCL cfg->bUseOpenCL = configdat.bUseOpenCL; cfg->nCLGlobalWorkThreads = configdat.nCLGlobalWorkThreads; cfg->bCLSparse = configdat.bCLSparse; cfg->nCLDeviceNum = configdat.nCLDeviceNum; cfg->nCLPlatformNum = configdat.nCLPlatformNum; cfg->bCLInteropGL = configdat.bCLInteropGL; for(i = 0; i <= 8; i++) cfg->sDeviceName[i] = NULL; if(cldraw == NULL) { num = 8; } else { num = cldraw->GetDevices(); } if(num >= 8) num = 8; if(num <= 0) num = 0; for(i = 0; i < num; i++) { cfg->sDeviceName[i] = malloc(96 * sizeof(char)); cfg->sDeviceName[i][0] = '\0'; if(cldraw == NULL) { snprintf(cfg->sDeviceName[i], 94, "Processor #%d", i); } else { char sName[64]; char sType[16]; cldraw->GetDeviceName(sName, 64, i); cldraw->GetDeviceType(sType, 16, i); snprintf(cfg->sDeviceName[i], 94, "%s(%s)", sType, sName); } } cfg->sDeviceName[8] = NULL; #endif UnlockVM(); } win= AG_WindowNew(DIALOG_WINDOW_DEFAULT); note = AG_NotebookNew(AGWIDGET(win), AG_NOTEBOOK_HFILL); { tab = AG_NotebookAddTab(note, gettext("Screen"), AG_BOX_HORIZ); OnConfigMenuScreen(cfg, tab); #ifdef USE_OPENGL tab = AG_NotebookAddTab(note, gettext("Display"), AG_BOX_HORIZ); ConfigMenuBright(cfg, tab); #endif /* USE_OPENGL */ #ifdef _USE_OPENCL tab = AG_NotebookAddTab(note, gettext("OpenCL"), AG_BOX_HORIZ); ConfigMenuOpenCL(cfg, tab); #endif /* USE_OPENGL */ } box = AG_BoxNewHoriz(AGWIDGET(win), AG_BOX_HFILL); AG_WidgetSetSize(AGWIDGET(box), 320, 24); { AG_Box *vbox; vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("OK"), OnConfigApplyDisp, "%p", cfg); vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); AG_WidgetSetSize(AGWIDGET(vbox), 80, 24); vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("Cancel"), OnPushCancel2, "%p", cfg); } AG_SetEvent(win, "window-close", OnPushCancel2, "%p", cfg); AG_WindowSetCaption(win, gettext("Display")); AG_WindowShow(win); }
void OnConfigSoundMenu(AG_Event *event) { AG_MenuItem *self = (AG_MenuItem *)AG_SELF(); AG_Window *win; AG_Notebook *note; AG_Notebook *note2; AG_NotebookTab *tab; AG_NotebookTab *tab2; AG_Box *box; AG_Button *btn; struct gui_sound *cfg; cfg = malloc(sizeof(struct gui_sound)); if(cfg == NULL) return; { cfg->iTotalVolume = configdat.iTotalVolume; cfg->nFMVolume = configdat.nFMVolume; cfg->nPSGVolume = configdat.nPSGVolume; cfg->nBeepVolume = configdat.nBeepVolume; cfg->nCMTVolume = configdat.nCMTVolume; cfg->nWaveVolume = configdat.nWaveVolume; cfg->uChSeparation = configdat.uChSeparation; cfg->nSampleRate = configdat.nSampleRate; cfg->nSoundBuffer = configdat.nSoundBuffer; cfg->nBeepFreq = configdat.nBeepFreq; cfg->bFMHQmode = configdat.bFMHQmode; cfg->nStereoOut = configdat.nStereoOut; cfg->bTapeMon = configdat.bTapeMon; cfg->bOPNEnable = configdat.bOPNEnable; cfg->bWHGEnable = configdat.bWHGEnable; cfg->bTHGEnable = configdat.bTHGEnable; #ifdef FDDSND cfg->bFddSound = configdat.bFddSound; #endif } win= AG_WindowNew(DIALOG_WINDOW_DEFAULT); note = AG_NotebookNew(AGWIDGET(win), AG_NOTEBOOK_HFILL); { tab = AG_NotebookAddTab(note, gettext("Volume"), AG_BOX_VERT); VolumeMenu(tab, cfg); tab = AG_NotebookAddTab(note, gettext("Rendering"), AG_BOX_HORIZ); SoundMenu(tab, cfg); tab = AG_NotebookAddTab(note, gettext("Misc"), AG_BOX_HORIZ); SoundMenu2(tab, cfg); } box = AG_BoxNewHoriz(AGWIDGET(win), AG_BOX_HFILL); AG_WidgetSetSize(AGWIDGET(box), 320, 24); { AG_Box *vbox; vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("OK"), OnConfigApplySound, "%p", cfg); vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); AG_WidgetSetSize(AGWIDGET(vbox), 80, 24); vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("Cancel"), OnPushCancel2, "%p", cfg); } AG_SetEvent(win, "window-close", OnPushCancel2, "%p", cfg); AG_WindowSetCaption(win, gettext("Sound Preferences")); AG_WindowShow(win); }