static void GenerateModesTable(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(modes_table)) { TXT_CAST_ARG(txt_table_t, modes_table); char buf[15]; screen_mode_t *modes; txt_radiobutton_t *rbutton; int i; // Pick which modes list to use if (fullscreen) { if (screen_modes_fullscreen == NULL) { BuildFullscreenModesList(); } modes = screen_modes_fullscreen; } else if (aspect_ratio_correct) { modes = screen_modes_scaled; } else { modes = screen_modes_unscaled; } // Build the table TXT_ClearTable(modes_table); TXT_SetColumnWidths(modes_table, 14, 14, 14, 14, 14); for (i=0; modes[i].w != 0; ++i) { // Skip bad fullscreen modes if (fullscreen && !GoodFullscreenMode(&modes[i])) { continue; } sprintf(buf, "%ix%i", modes[i].w, modes[i].h); rbutton = TXT_NewRadioButton(buf, &vidmode, i); TXT_AddWidget(modes_table, rbutton); TXT_SignalConnect(rbutton, "selected", ModeSelected, &modes[i]); } // Find the nearest mode in the list that matches the current // settings vidmode = FindBestMode(modes); if (vidmode > 0) { screen_width = modes[vidmode].w; screen_height = modes[vidmode].h; } }
static void AdvancedDisplayConfig(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(modes_table)) { TXT_CAST_ARG(txt_table_t, modes_table); txt_window_t *window; txt_checkbox_t *ar_checkbox; window = TXT_NewWindow("Advanced display options"); TXT_SetColumnWidths(window, 35); TXT_AddWidgets(window, ar_checkbox = TXT_NewCheckBox("Fix aspect ratio", &aspect_ratio_correct), TXT_NewCheckBox("Show ENDOOM screen on exit", &show_endoom), NULL); TXT_SignalConnect(ar_checkbox, "changed", GenerateModesTable, modes_table); // On Windows, there is an extra control to change between // the Windows GDI and DirectX video drivers. #if defined(_WIN32) && !defined(_WIN32_WCE) { txt_radiobutton_t *dx_button, *gdi_button; TXT_AddWidgets(window, TXT_NewSeparator("Windows video driver"), dx_button = TXT_NewRadioButton("DirectX", &use_directx, 1), gdi_button = TXT_NewRadioButton("Windows GDI", &use_directx, 0), NULL); TXT_SignalConnect(dx_button, "selected", UpdateVideoDriver, modes_table); TXT_SignalConnect(gdi_button, "selected", UpdateVideoDriver, modes_table); SetWin32VideoDriver(); } #endif }
static txt_radiobutton_t *SizeSelectButton(window_size_t *size) { char buf[15]; txt_radiobutton_t *result; M_snprintf(buf, sizeof(buf), "%ix%i", size->w, size->h); result = TXT_NewRadioButton(buf, &window_width, size->w); TXT_SignalConnect(result, "selected", WindowSizeSelected, size); return result; }
void JoinMultiGame(void) { txt_window_t *window; txt_table_t *gameopt_table; txt_table_t *serveropt_table; txt_inputbox_t *address_box; window = TXT_NewWindow("Join multiplayer game"); TXT_AddWidgets(window, gameopt_table = TXT_NewTable(2), TXT_NewSeparator("Server"), serveropt_table = TXT_NewTable(2), TXT_NewStrut(0, 1), TXT_NewButton2("Add extra parameters...", OpenExtraParamsWindow, NULL), NULL); TXT_SetColumnWidths(gameopt_table, 12, 12); TXT_AddWidgets(gameopt_table, TXT_NewLabel("Game"), IWADSelector(), NULL); TXT_AddWidgets(serveropt_table, TXT_NewRadioButton("Connect to address:", &jointype, JOIN_ADDRESS), address_box = TXT_NewInputBox(&connect_address, 30), TXT_NewRadioButton("Auto-join LAN game", &jointype, JOIN_AUTO_LAN), NULL); TXT_SignalConnect(address_box, "changed", SelectAddressJoin, NULL); TXT_SelectWidget(window, address_box); TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction()); TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, JoinGameAction()); }
void ConfigDisplay(void) { txt_window_t *window; txt_table_t *modes_table; txt_separator_t *modes_separator; txt_table_t *bpp_table; txt_window_action_t *advanced_button; txt_checkbox_t *fs_checkbox; int i; int num_columns; int num_rows; int window_y; // What color depths are supported? Generate supported_bpps array // and set selected_bpp to match the current value of screen_bpp. IdentifyPixelDepths(); SetSelectedBPP(); // First time in? Initialise selected_screen_{width,height} if (selected_screen_width == 0) { selected_screen_width = screen_width; selected_screen_height = screen_height; } // Open the window window = TXT_NewWindow("Display Configuration"); // Some machines can have lots of video modes. This tries to // keep a limit of six lines by increasing the number of // columns. In extreme cases, the window is moved up slightly. BuildFullscreenModesList(); if (num_screen_modes_fullscreen <= 24) { num_columns = 3; } else if (num_screen_modes_fullscreen <= 40) { num_columns = 4; } else { num_columns = 5; } modes_table = TXT_NewTable(num_columns); // Build window: TXT_AddWidget(window, fs_checkbox = TXT_NewCheckBox("Full screen", &fullscreen)); if (num_supported_bpps > 1) { TXT_AddWidgets(window, TXT_NewSeparator("Color depth"), bpp_table = TXT_NewTable(4), NULL); for (i = 0; i < num_supported_bpps; ++i) { txt_radiobutton_t *button; button = TXT_NewRadioButton(supported_bpps[i], &selected_bpp, i); TXT_AddWidget(bpp_table, button); TXT_SignalConnect(button, "selected", UpdateBPP, modes_table); } } TXT_AddWidgets(window, modes_separator = TXT_NewSeparator(""), modes_table, NULL); TXT_SignalConnect(fs_checkbox, "changed", GenerateModesTable, modes_table); TXT_SignalConnect(fs_checkbox, "changed", UpdateModeSeparator, modes_separator); // How many rows high will the configuration window be? // Need to take into account number of fullscreen modes, and also // number of supported pixel depths. // The windowed modes list is four rows, so take the maximum of // windowed and fullscreen. num_rows = (num_screen_modes_fullscreen + num_columns - 1) / num_columns; if (num_rows < 4) { num_rows = 4; } if (num_supported_bpps > 1) { num_rows += 2; } if (num_rows < 14) { window_y = 8 - ((num_rows + 1) / 2); } else { window_y = 1; } // The window is set at a fixed vertical position. This keeps // the top of the window stationary when switching between // fullscreen and windowed mode (which causes the window's // height to change). TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP, TXT_SCREEN_W / 2, window_y); GenerateModesTable(NULL, modes_table); UpdateModeSeparator(NULL, modes_separator); // Button to open "advanced" window. // Need to pass a pointer to the modes table, as some of the options // in there trigger a rebuild of it. advanced_button = TXT_NewWindowAction('a', "Advanced"); TXT_SetWindowAction(window, TXT_HORIZ_CENTER, advanced_button); TXT_SignalConnect(advanced_button, "pressed", AdvancedDisplayConfig, modes_table); }
void ConfigSound(TXT_UNCAST_ARG(widget), void *user_data) { txt_window_t *window; txt_window_action_t *music_action; // Build the window window = TXT_NewWindow("Sound configuration"); TXT_SetWindowHelpURL(window, WINDOW_HELP_URL); TXT_SetColumnWidths(window, 40); TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP, TXT_SCREEN_W / 2, 3); music_action = TXT_NewWindowAction('m', "Music Packs"); TXT_SetWindowAction(window, TXT_HORIZ_CENTER, music_action); TXT_SignalConnect(music_action, "pressed", OpenMusicPackDir, NULL); TXT_AddWidgets(window, TXT_NewSeparator("Sound effects"), TXT_NewRadioButton("Disabled", &snd_sfxdevice, SNDDEVICE_NONE), TXT_If(gamemission == doom, TXT_NewRadioButton("PC speaker effects", &snd_sfxdevice, SNDDEVICE_PCSPEAKER)), TXT_NewRadioButton("Digital sound effects", &snd_sfxdevice, SNDDEVICE_SB), TXT_If(gamemission == doom || gamemission == heretic || gamemission == hexen, TXT_NewConditional(&snd_sfxdevice, SNDDEVICE_SB, TXT_NewHorizBox( TXT_NewStrut(4, 0), TXT_NewCheckBox("Pitch-shifted sounds", &snd_pitchshift), NULL))), TXT_If(gamemission == strife, TXT_NewConditional(&snd_sfxdevice, SNDDEVICE_SB, TXT_NewHorizBox( TXT_NewStrut(4, 0), TXT_NewCheckBox("Show text with voices", &show_talk), NULL))), TXT_NewSeparator("Music"), TXT_NewRadioButton("Disabled", &snd_musicdevice, SNDDEVICE_NONE), TXT_NewRadioButton("OPL (Adlib/Soundblaster)", &snd_musicdevice, SNDDEVICE_SB), TXT_NewConditional(&snd_musicdevice, SNDDEVICE_SB, TXT_NewHorizBox( TXT_NewStrut(4, 0), TXT_NewLabel("Chip type: "), OPLTypeSelector(), NULL)), TXT_NewRadioButton("GUS (emulated)", &snd_musicdevice, SNDDEVICE_GUS), TXT_NewConditional(&snd_musicdevice, SNDDEVICE_GUS, TXT_MakeTable(2, TXT_NewStrut(4, 0), TXT_NewLabel("Path to patch files: "), TXT_NewStrut(4, 0), TXT_NewFileSelector(&gus_patch_path, 34, "Select directory containing GUS patches", TXT_DIRECTORY), NULL)), TXT_NewRadioButton("Native MIDI", &snd_musicdevice, SNDDEVICE_GENMIDI), TXT_NewConditional(&snd_musicdevice, SNDDEVICE_GENMIDI, TXT_MakeTable(2, TXT_NewStrut(4, 0), TXT_NewLabel("Timidity configuration file: "), TXT_NewStrut(4, 0), TXT_NewFileSelector(&timidity_cfg_path, 34, "Select Timidity config file", cfg_extension), NULL)), NULL); }
void SetupWindow(void) { txt_window_t *window; txt_table_t *table; txt_table_t *rightpane; txt_checkbox_t *cheesy_checkbox; txt_window_action_t *pwn; txt_label_t *toplabel; char buf[100]; int i; window = TXT_NewWindow("Window test"); TXT_AddWidget(window, TXT_NewSeparator("Main section")); table = TXT_NewTable(3); toplabel = TXT_NewLabel("This is a multiline label.\n" "A single label object contains \n" "all three of these lines.\n"); TXT_AddWidget(window, toplabel); TXT_SetWidgetAlign(toplabel, TXT_HORIZ_CENTER); //TXT_AddWidget(window, TXT_NewScrollPane(15, 4, table)); TXT_AddWidget(window, table); for (i=0; i<5; ++i) { sprintf(buf, "Option %i in a table:", i + 1); TXT_AddWidget(table, TXT_NewLabel(buf)); sprintf(buf, " Button %i-1 ", i + 1); TXT_AddWidget(table, TXT_NewButton(buf)); sprintf(buf, " Button %i-2 ", i + 1); TXT_AddWidget(table, TXT_NewButton(buf)); } TXT_AddWidget(window, TXT_NewStrut(0, 1)); value_label = TXT_NewLabel(""); TXT_AddWidget(window, value_label); table = TXT_NewTable(2); TXT_AddWidget(window, table); TXT_SetWidgetAlign(table, TXT_HORIZ_CENTER); cheesy_checkbox = TXT_NewCheckBox("Cheesy", &cheesy); TXT_AddWidget(table, cheesy_checkbox); TXT_SignalConnect(cheesy_checkbox, "changed", UpdateLabel, NULL); rightpane = TXT_NewTable(1); TXT_AddWidget(table, rightpane); for (i=0; i<3; ++i) { txt_radiobutton_t *rbut; rbut = TXT_NewRadioButton(radio_values[i], &radiobutton_value, i); TXT_AddWidget(rightpane, rbut); TXT_SignalConnect(rbut, "selected", UpdateLabel, NULL); } UpdateLabel(NULL, NULL); TXT_AddWidget(window, TXT_NewButton2("Close Window", CloseWindow, NULL)); pwn = TXT_NewWindowAction(KEY_F1, "PWN!"); TXT_SetWindowAction(window, TXT_HORIZ_CENTER, pwn); TXT_SignalConnect(pwn, "pressed", PwnBox, NULL); firstwin = window; }