예제 #1
0
static void BuildWindow(void)
{
    char buf[50];
    txt_table_t *table;
    int i;

    TXT_ClearTable(window);
    table = TXT_NewTable(3);
    TXT_AddWidget(window, table);

    // Add spacers

    TXT_AddWidget(table, NULL);
    TXT_AddWidget(table, TXT_NewStrut(25, 1));
    TXT_AddWidget(table, TXT_NewStrut(17, 1));

    // Player labels

    for (i = 0; i < net_client_wait_data.max_players; ++i)
    {
        sprintf(buf, " %i. ", i + 1);
        TXT_AddWidget(table, TXT_NewLabel(buf));
        player_labels[i] = TXT_NewLabel("");
        ip_labels[i] = TXT_NewLabel("");
        TXT_AddWidget(table, player_labels[i]);
        TXT_AddWidget(table, ip_labels[i]);
    }

    drone_label = TXT_NewLabel("");

    TXT_AddWidget(window, drone_label);
}
예제 #2
0
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_SetWindowHelpURL(window, MULTI_JOIN_HELP_URL);

    TXT_AddWidgets(window, 
        gameopt_table = TXT_NewTable(2),
        TXT_NewSeparator("Server"),
        serveropt_table = TXT_NewTable(1),
        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);

    if (gamemission == hexen)
    {
        TXT_AddWidgets(gameopt_table,
                       TXT_NewLabel("Character class "),
                       TXT_NewDropdownList(&character_class,
                                           character_classes, 3),
                       NULL);
    }

    TXT_AddWidgets(serveropt_table,
                   TXT_NewHorizBox(
                           TXT_NewLabel("Connect to address: "),
                           address_box = TXT_NewInputBox(&connect_address, 30),
                           NULL),
                   TXT_NewButton2("Find server on Internet...",
                                  FindInternetServer, NULL),
                   TXT_NewButton2("Find server on local network...",
                                  FindLANServer, NULL),
                   NULL);

    TXT_SelectWidget(window, address_box);

    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction());
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, JoinGameAction());
}
예제 #3
0
static void CalibrateJoystick(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
{
    // Try to open all available joysticks.  If none are opened successfully,
    // bomb out with an error.

    if (!OpenAllJoysticks())
    {
        NoJoystick();
        return;
    }

    calibration_window = TXT_NewWindow("Gamepad/Joystick calibration");

    TXT_AddWidgets(calibration_window,
                   TXT_NewStrut(0, 1),
                   TXT_NewLabel("Center the D-pad or joystick,\n"
                                "and press a button."),
                   TXT_NewStrut(0, 1),
                   NULL);

    TXT_SetWindowAction(calibration_window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(calibration_window, TXT_HORIZ_CENTER, 
                        TXT_NewWindowAbortAction(calibration_window));
    TXT_SetWindowAction(calibration_window, TXT_HORIZ_RIGHT, NULL);

    TXT_SDL_SetEventCallback(CalibrationEventCallback, NULL);

    TXT_SignalConnect(calibration_window, "closed", CalibrateWindowClosed, NULL);

    // Start calibration

    joystick_index = -1;
}
예제 #4
0
static void OpenPromptWindow(txt_key_input_t *key_input)
{
    txt_window_t *window;
    txt_label_t *label;

    // Silently update when the shift button is held down.

    key_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);

    window = TXT_NewWindow(NULL);
    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, 
                        TXT_NewWindowAbortAction(window));
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
    
    label = TXT_NewLabel("Press the new key...");

    TXT_AddWidget(window, label);
    TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);

    TXT_SetKeyListener(window, KeyPressCallback, key_input);

    // Disable key mappings while we prompt for the key press

    TXT_EnableKeyMapping(0);

    // Grab input while reading the key.  On Windows Mobile
    // handheld devices, the hardware keypresses are only
    // detected when input is grabbed.

    SDL_WM_GrabInput(SDL_GRAB_ON);
    TXT_SignalConnect(window, "closed", ReleaseGrab, NULL);
}
예제 #5
0
static void QuitConfirm(void *unused1, void *unused2)
{
    txt_window_t *window;
    txt_label_t *label;
    txt_button_t *yes_button;
    txt_button_t *no_button;

    window = TXT_NewWindow(NULL);

    TXT_AddWidgets(window, 
                   label = TXT_NewLabel("Exiting setup.\nSave settings?"),
                   TXT_NewStrut(24, 0),
                   yes_button = TXT_NewButton2("  Yes  ", DoQuit, DoQuit),
                   no_button = TXT_NewButton2("  No   ", DoQuit, NULL),
                   NULL);

    TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);
    TXT_SetWidgetAlign(yes_button, TXT_HORIZ_CENTER);
    TXT_SetWidgetAlign(no_button, TXT_HORIZ_CENTER);

    // Only an "abort" button in the middle.
    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, 
                        TXT_NewWindowAbortAction(window));
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
}
예제 #6
0
static void QueryResponseCallback(net_addr_t *addr,
                                  net_querydata_t *querydata,
                                  unsigned int ping_time,
                                  TXT_UNCAST_ARG(results_table))
{
    TXT_CAST_ARG(txt_table_t, results_table);
    char ping_time_str[16];
    char description[47];

    // When we connect we'll have to negotiate a common protocol that we
    // can agree upon between the client and server. If we can't then we
    // won't be able to connect, so it's pointless to include it in the
    // results list. If protocol==NET_PROTOCOL_UNKNOWN then this may be
    // an old, pre-3.0 Chocolate Doom server that doesn't support the new
    // protocol negotiation mechanism, or it may be an incompatible fork.
    if (querydata->protocol == NET_PROTOCOL_UNKNOWN)
    {
        return;
    }

    M_snprintf(ping_time_str, sizeof(ping_time_str), "%ims", ping_time);

    // Build description from server name field. Because there is limited
    // space, we only include the player count if there are already players
    // connected to the server.
    if (querydata->num_players > 0)
    {
        M_snprintf(description, sizeof(description), "(%d/%d) ",
                   querydata->num_players, querydata->max_players);
    }
    else
    {
        M_StringCopy(description, "", sizeof(description));
    }

    M_StringConcat(description, querydata->description, sizeof(description));

    TXT_AddWidgets(results_table,
                   TXT_NewLabel(ping_time_str),
                   TXT_NewButton2(NET_AddrToString(addr),
                                  SelectQueryAddress, querydata),
                   TXT_NewLabel(description),
                   NULL);

    ++query_servers_found;
}
예제 #7
0
static void VKBCreateWindow(txt_inputbox_t *inputbox, int charset_index)
{
    int i;
    txt_table_t *keyboard;
    txt_table_t *softact;
    txt_table_t *softact_okcancel;
    txt_table_t *organizer;
    txt_window_action_t *cancel, *caps;

    //Create Widgets
    vkb_window = TXT_NewWindow(NULL);
    vkb_inputbox = inputbox;
    vkb_charset_index = charset_index;
    vkb_label = TXT_NewLabel("");
    keyboard = TXT_NewTable(19);
    organizer = TXT_NewTable(3);
    softact = TXT_NewTable(1);

    //Populate Window
    TXT_AddWidget(vkb_window, vkb_label);
    TXT_AddWidget(vkb_window, TXT_NewSeparator(NULL));
    TXT_AddWidget(vkb_window, organizer);
    TXT_AddWidget(organizer, keyboard);
    TXT_AddWidget(organizer, TXT_NewStrut(1, 0));
    TXT_AddWidget(organizer, softact);

    //Create Actions
    cancel = TXT_NewWindowAction(KEY_BBUTTON, "Revert");
    caps   = TXT_NewWindowAction(KEY_YBUTTON, "Caps");
    TXT_SignalConnect(cancel, "pressed", VKBCloseWindow,   0);
    TXT_SignalConnect(caps,   "pressed", VKBCycleCharsets, 0);
    TXT_AddWidget(softact, TXT_NewButton2("Backspace", VKBBackspace, NULL));
    TXT_AddWidget(softact, TXT_NewButton2("Caps-Lock", VKBCycleCharsets, NULL));
    TXT_AddWidget(softact, TXT_NewButton2("Revert", VKBCloseWindow, 0));
	TXT_AddWidget(softact, TXT_NewButton2("Accept", VKBCloseWindow, 1));

    //Create buttons and populate keyboard table
    for (i=0; vkb_charset[vkb_charset_index][i] != '\0'; i++)
    {
        char button[] = {vkb_charset[vkb_charset_index][i], '\0'};
        TXT_AddWidget(keyboard, TXT_NewButton2(button, VKBAddCharacter, button[0])); //, VKBAddCharacter));

        //Don't add padding on the last of row
        if ((i+1) % 10)
        {
            TXT_AddWidget(keyboard, TXT_NewStrut(1, 0));
        }
    }

    //Format & Update things
    TXT_SetWindowAction(vkb_window, TXT_HORIZ_LEFT,  cancel);
    TXT_SetWindowAction(vkb_window, TXT_HORIZ_RIGHT, caps);
    TXT_SetWidgetAlign(keyboard, TXT_HORIZ_CENTER);
    TXT_SetBGColor(vkb_label, TXT_COLOR_BLACK);
    TXT_LayoutWindow(vkb_window);
    VKBUpdateLabel();
	inputbox->editing = 1;
}
예제 #8
0
void TXT_ConfigureJoystickAxis(txt_joystick_axis_t *joystick_axis,
                               int using_button,
                               txt_joystick_axis_callback_t callback)
{
    // Open the joystick first.
    if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
    {
        return;
    }

    joystick_axis->joystick = SDL_JoystickOpen(joystick_index);
    if (joystick_axis->joystick == NULL)
    {
        TXT_MessageBox(NULL, "Please configure a controller first!");
        return;
    }

    SDL_JoystickEventState(SDL_ENABLE);

    // Build the prompt window.

    joystick_axis->config_window
        = TXT_NewWindow("Gamepad/Joystick calibration");
    TXT_AddWidgets(joystick_axis->config_window,
                   TXT_NewStrut(0, 1),
                   joystick_axis->config_label = TXT_NewLabel(""),
                   TXT_NewStrut(0, 1),
                   NULL);

    TXT_SetWindowAction(joystick_axis->config_window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(joystick_axis->config_window, TXT_HORIZ_CENTER,
                        TXT_NewWindowAbortAction(joystick_axis->config_window));
    TXT_SetWindowAction(joystick_axis->config_window, TXT_HORIZ_RIGHT, NULL);
    TXT_SetWidgetAlign(joystick_axis->config_window, TXT_HORIZ_CENTER);

    if (using_button >= 0)
    {
        joystick_axis->config_stage = CONFIG_STAGE1;
        joystick_axis->config_button = using_button;
        IdentifyBadAxes(joystick_axis);
    }
    else
    {
        joystick_axis->config_stage = CONFIG_CENTER;
    }

    SetCalibrationLabel(joystick_axis);

    // Close the joystick and shut down joystick subsystem when the window
    // is closed.
    TXT_SignalConnect(joystick_axis->config_window, "closed",
                      CalibrateWindowClosed, joystick_axis);

    TXT_SDL_SetEventCallback(EventCallback, joystick_axis);

    // When successfully calibrated, invoke this callback:
    joystick_axis->callback = callback;
}
예제 #9
0
static void OpenGameSelectDialog(GameSelectCallback callback)
{
    mission_config_t *mission = NULL;
    txt_window_t *window;
    const iwad_t **iwads;
    int num_games;
    int i;

    window = TXT_NewWindow("Select game");

    TXT_AddWidget(window, TXT_NewLabel("Select a game to configure:\n"));
    num_games = 0;

    // Add a button for each game.

    for (i=0; i<arrlen(mission_configs); ++i)
    {
        // Do we have any IWADs for this game installed?
        // If so, add a button.

        iwads = D_FindAllIWADs(mission_configs[i].mask);

        if (iwads[0] != NULL)
        {
            mission = &mission_configs[i];
            TXT_AddWidget(window, TXT_NewButton2(mission_configs[i].label,
                                                 GameSelected,
                                                 &mission_configs[i]));
            ++num_games;
        }

        free(iwads);
    }

    TXT_AddWidget(window, TXT_NewStrut(0, 1));

    // No IWADs found at all?  Fall back to doom, then.

    if (num_games == 0)
    {
        TXT_CloseWindow(window);
        SetMission(DEFAULT_MISSION);
        callback();
        return;
    }

    // Only one game? Use that game, and don't bother with a dialog.

    if (num_games == 1)
    {
        TXT_CloseWindow(window);
        SetMission(mission);
        callback();
        return;
    }

    game_selected_callback = callback;
}
예제 #10
0
static void AddJoystickControl(txt_table_t *table, char *label, int *var)
{
    txt_joystick_input_t *joy_input;

    joy_input = TXT_NewJoystickInput(var);

    TXT_AddWidget(table, TXT_NewLabel(label));
    TXT_AddWidget(table, joy_input);
}
예제 #11
0
static void AddKeyControl(txt_table_t *table, char *name, int *var)
{
    txt_key_input_t *key_input;

    TXT_AddWidget(table, TXT_NewLabel(name));
    key_input = TXT_NewKeyInput(var);
    TXT_AddWidget(table, key_input);

    TXT_SignalConnect(key_input, "set", KeySetCallback, var);
}
예제 #12
0
void ConfigMouse(void)
{
    txt_window_t *window;

    window = TXT_NewWindow("Mouse configuration");

    TXT_SetTableColumns(window, 2);

    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction());
    TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);

    TXT_AddWidgets(window,
                   TXT_NewCheckBox("Enable mouse", &usemouse),
                   TXT_TABLE_OVERFLOW_RIGHT,
                   TXT_NewInvertedCheckBox("Allow vertical mouse movement", 
                                           &novert),
                   TXT_TABLE_OVERFLOW_RIGHT,
                   TXT_NewCheckBox("Grab mouse in windowed mode", 
                                   &grabmouse),
                   TXT_TABLE_OVERFLOW_RIGHT,
                   TXT_NewCheckBox("Double click acts as \"use\"",
                                   &dclick_use),
                   TXT_TABLE_OVERFLOW_RIGHT,

                   TXT_NewSeparator("Mouse motion"),
                   TXT_NewLabel("Speed"),
                   TXT_NewSpinControl(&mouseSensitivity, 1, 256),
                   TXT_NewLabel("Acceleration"),
                   TXT_NewFloatSpinControl(&mouse_acceleration, 1.0, 5.0),
                   TXT_NewLabel("Acceleration threshold"),
                   TXT_NewSpinControl(&mouse_threshold, 0, 32),

                   TXT_NewSeparator("Buttons"),
                   NULL);

    AddMouseControl(window, "Fire/Attack", &mousebfire);
    AddMouseControl(window, "Move forward", &mousebforward);
    AddMouseControl(window, "Strafe on", &mousebstrafe);

    TXT_AddWidget(window,
                  TXT_NewButton2("More controls...", ConfigExtraButtons, NULL));
}
예제 #13
0
static void UpdateExtraTable(TXT_UNCAST_ARG(widget),
                             TXT_UNCAST_ARG(extra_table))
{
    TXT_CAST_ARG(txt_table_t, extra_table);

    TXT_ClearTable(extra_table);

    switch (snd_musicmode)
    {
        case MUSICMODE_OPL:
            TXT_AddWidgets(extra_table,
                           TXT_NewLabel("OPL type"),
                           OPLTypeSelector(),
                           NULL);
            break;

        case MUSICMODE_GUS:
            TXT_AddWidgets(extra_table,
                           TXT_NewLabel("GUS patch path:"),
                           TXT_TABLE_OVERFLOW_RIGHT,
                           TXT_NewFileSelector(&gus_patch_path, 34,
                                               "Select path to GUS patches",
                                               TXT_DIRECTORY),
                           TXT_TABLE_OVERFLOW_RIGHT,
                           NULL);
            break;

        case MUSICMODE_NATIVE:
            TXT_AddWidgets(extra_table,
                           TXT_NewLabel("Timidity configuration file:"),
                           TXT_TABLE_OVERFLOW_RIGHT,
                           TXT_NewFileSelector(&timidity_cfg_path, 34,
                                               "Select Timidity config file",
                                               cfg_extension),
                           TXT_TABLE_OVERFLOW_RIGHT,
                           NULL);
            break;

        default:
            break;
    }
}
예제 #14
0
static void AddMouseControl(TXT_UNCAST_ARG(table), char *label, int *var)
{
    TXT_CAST_ARG(txt_table_t, table);
    txt_mouse_input_t *mouse_input;

    TXT_AddWidget(table, TXT_NewLabel(label));

    mouse_input = TXT_NewMouseInput(var);
    TXT_AddWidget(table, mouse_input);

    TXT_SignalConnect(mouse_input, "set", MouseSetCallback, var);
}
예제 #15
0
static void CalibrateJoystick(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
{
    calibrate_stage = CALIBRATE_CENTER;

    // Try to open all available joysticks.  If none are opened successfully,
    // bomb out with an error.

    if (!OpenAllJoysticks())
    {
        NoJoystick();
        return;
    }

    calibration_window = TXT_NewWindow("Gamepad/Joystick calibration");

    TXT_AddWidgets(calibration_window,
                   TXT_NewLabel("Please follow the following instructions\n"
                                "in order to calibrate your controller."),
                   TXT_NewStrut(0, 1),
                   calibration_label = TXT_NewLabel("zzz"),
                   TXT_NewStrut(0, 1),
                   NULL);

    TXT_SetWindowAction(calibration_window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(calibration_window, TXT_HORIZ_CENTER, 
                        TXT_NewWindowAbortAction(calibration_window));
    TXT_SetWindowAction(calibration_window, TXT_HORIZ_RIGHT, NULL);

    TXT_SetWidgetAlign(calibration_label, TXT_HORIZ_CENTER);
    TXT_SDL_SetEventCallback(CalibrationEventCallback, NULL);

    TXT_SignalConnect(calibration_window, "closed", CalibrateWindowClosed, NULL);

    // Start calibration

    joystick_index = -1;
    calibrate_stage = CALIBRATE_CENTER;

    SetCalibrationLabel();
}
static void OpenErrorWindow(void)
{
    txt_window_t *window;

    window = TXT_NewWindow(NULL);

    TXT_AddWidget(window, TXT_NewLabel("Please configure a joystick first!"));

    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, 
                        TXT_NewWindowEscapeAction(window));
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
}
예제 #17
0
static void QueryResponseCallback(net_addr_t *addr,
                                  net_querydata_t *querydata,
                                  unsigned int ping_time,
                                  TXT_UNCAST_ARG(results_table))
{
    TXT_CAST_ARG(txt_table_t, results_table);
    char ping_time_str[16];
    char description[47];

    M_snprintf(ping_time_str, sizeof(ping_time_str), "%ims", ping_time);
    M_StringCopy(description, querydata->description,
                 sizeof(description));

    TXT_AddWidgets(results_table,
                   TXT_NewLabel(ping_time_str),
                   TXT_NewButton2(NET_AddrToString(addr),
                                  SelectQueryAddress, querydata),
                   TXT_NewLabel(description),
                   NULL);

    ++query_servers_found;
}
void StartMultiGame(void)
{
    txt_window_t *window;
    txt_table_t *gameopt_table;
    txt_table_t *advanced_table;
    txt_widget_t *iwad_selector;

    window = TXT_NewWindow("Start multiplayer game");

    TXT_AddWidgets(window, 
                   gameopt_table = TXT_NewTable(2),
                   TXT_NewSeparator("Monster options"),
                   TXT_NewInvertedCheckBox("Monsters enabled", &nomonsters),
                   TXT_NewCheckBox("Fast monsters", &fast),
                   TXT_NewCheckBox("Respawning monsters", &respawn),
                   TXT_NewSeparator("Advanced"),
                   advanced_table = TXT_NewTable(2),
                   TXT_NewButton2("Add extra parameters...", 
                                  OpenExtraParamsWindow, NULL),
                   NULL);

    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction());
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction());
    
    TXT_SetColumnWidths(gameopt_table, 12, 12);

    TXT_AddWidgets(gameopt_table,
           TXT_NewLabel("Game"),
           iwad_selector = IWADSelector(),
           TXT_NewLabel("Skill"),
           skillbutton = TXT_NewDropdownList(&skill, skills, 5),
           TXT_NewLabel("Game type"),
           TXT_NewDropdownList(&deathmatch, gamemodes, 3),
           TXT_NewLabel("Level warp"),
           warpbutton = TXT_NewButton2("????", LevelSelectDialog, NULL),
           TXT_NewLabel("Time limit"),
           TXT_NewHorizBox(TXT_NewIntInputBox(&timer, 2),
                           TXT_NewLabel("minutes"),
                           NULL),
           NULL);

    TXT_SetColumnWidths(advanced_table, 12, 12);

    TXT_SignalConnect(iwad_selector, "changed", UpdateWarpType, NULL);

    TXT_AddWidgets(advanced_table, 
                   TXT_NewLabel("UDP port"),
                   TXT_NewIntInputBox(&udpport, 5),
                   NULL);

    UpdateWarpType(NULL, NULL);
    UpdateWarpButton();
}
예제 #19
0
void PwnBox(TXT_UNCAST_ARG(widget), void *user_data)
{
    txt_window_t *window;
    txt_window_action_t *close_button;
    
    window = TXT_NewWindow("Pwned!");
    TXT_AddWidget(window, TXT_NewLabel(" BOOM! HEADSHOT! "));

    close_button = TXT_NewWindowAction(KEY_ENTER, "Close");
    TXT_SignalConnect(close_button, "pressed", ClosePwnBox, window);

    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, close_button);
}
예제 #20
0
void MultiplayerConfig(TXT_UNCAST_ARG(widget), void *user_data)
{
    txt_window_t *window;
    txt_label_t *label;
    txt_table_t *table;
    char buf[10];
    int i;

    window = TXT_NewWindow("Multiplayer Configuration");
    TXT_SetWindowHelpURL(window, MULTI_CONFIG_HELP_URL);

    TXT_AddWidgets(window,
                   TXT_NewStrut(0, 1),
                   TXT_NewHorizBox(TXT_NewLabel("Player name:  "),
                                   TXT_NewInputBox(&net_player_name, 25),
                                   NULL),
                   TXT_NewStrut(0, 1),
                   TXT_NewSeparator("Chat macros"),
                   NULL);

    table = TXT_NewTable(2);

    for (i=0; i<10; ++i)
    {
        M_snprintf(buf, sizeof(buf), "#%i ", i + 1);

        label = TXT_NewLabel(buf);
        TXT_SetFGColor(label, TXT_COLOR_BRIGHT_CYAN);

        TXT_AddWidgets(table,
                       label,
                       TXT_NewInputBox(&chat_macros[(i + 1) % 10], 40),
                       NULL);
    }

    TXT_AddWidget(window, table);
}
예제 #21
0
static void AddSectionLabel(txt_table_t *table, char *title, boolean add_space)
{
    char buf[64];

    if (add_space)
    {
        TXT_AddWidgets(table, TXT_NewStrut(0, 1), TXT_NewStrut(0, 1),
                              NULL);
    }

    M_snprintf(buf, sizeof(buf), " - %s - ", title);

    TXT_AddWidgets(table, TXT_NewLabel(buf),  TXT_NewStrut(0, 0),
                          NULL);
}
void MultiplayerConfig(void)
{
    txt_window_t *window;
    txt_label_t *label;
    txt_table_t *table;
    char buf[10];
    int i;

    window = TXT_NewWindow("Multiplayer Configuration");

    TXT_AddWidgets(window, 
                   TXT_NewStrut(0, 1),
                   TXT_NewHorizBox(TXT_NewLabel("Player name:  "),
                                   TXT_NewInputBox(&net_player_name, 25),
                                   NULL),
                   TXT_NewStrut(0, 1),
                   TXT_NewSeparator("Chat macros"),
                   NULL);

    table = TXT_NewTable(2);

    for (i=0; i<10; ++i)
    {
        sprintf(buf, "#%i ", i + 1);

        label = TXT_NewLabel(buf);
        TXT_SetFGColor(label, TXT_COLOR_BRIGHT_CYAN);

        TXT_AddWidgets(table,
                       label,
                       TXT_NewInputBox(&chat_macros[(i + 1) % 10], 40),
                       NULL);
    }
    
    TXT_AddWidget(window, table);
}
예제 #23
0
static void QueryPeriodicCallback(TXT_UNCAST_ARG(results_table))
{
    TXT_CAST_ARG(txt_table_t, results_table);

    if (!NET_Query_Poll(QueryResponseCallback, results_table))
    {
        TXT_SetPeriodicCallback(NULL, NULL, 0);

        if (query_servers_found == 0)
        {
            TXT_AddWidget(results_table, NULL);
            TXT_AddWidget(results_table, TXT_NewLabel("No servers found."));
        }
    }
}
예제 #24
0
static void BuildMasterStatusWindow(void)
{
    txt_window_t *master_window;

    master_window = TXT_NewWindow(NULL);
    master_msg_label = TXT_NewLabel("");
    TXT_AddWidget(master_window, master_msg_label);

    // This window is here purely for information, so it should be
    // in the background.

    TXT_LowerWindow(master_window);
    TXT_SetWindowPosition(master_window, TXT_HORIZ_CENTER, TXT_VERT_CENTER,
                                         TXT_SCREEN_W / 2, TXT_SCREEN_H - 4);
    TXT_SetWindowAction(master_window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(master_window, TXT_HORIZ_CENTER, NULL);
    TXT_SetWindowAction(master_window, TXT_HORIZ_RIGHT, NULL);
}
예제 #25
0
static void OpenWaitDialog(void)
{
    txt_window_action_t *cancel;

    TXT_SetDesktopTitle(PACKAGE_STRING);

    window = TXT_NewWindow("Waiting for game start...");

    TXT_AddWidget(window, TXT_NewLabel("\nPlease wait...\n\n"));

    cancel = TXT_NewWindowAction(KEY_ESCAPE, "Cancel");
    TXT_SignalConnect(cancel, "pressed", EscapePressed, NULL);

    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, cancel);
    TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_BOTTOM,
                                  TXT_SCREEN_W / 2, TXT_SCREEN_H - 9);

    old_max_players = 0;
}
예제 #26
0
txt_window_t *TXT_MessageBox(char *title, char *message, ...)
{
    txt_window_t *window;
    char buf[256];
    va_list args;

    va_start(args, message);
    TXT_vsnprintf(buf, sizeof(buf), message, args);
    va_end(args);

    window = TXT_NewWindow(title);
    TXT_AddWidget(window, TXT_NewLabel(buf));

    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, 
                        TXT_NewWindowEscapeAction(window));
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);

    return window;
}
예제 #27
0
파일: execute.c 프로젝트: Nekrofage/DoomRPi
static void TestCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data))
{
    execute_context_t *exec;
    char *main_cfg;
    char *extra_cfg;
    txt_window_t *testwindow;
    txt_label_t *label;
    
    testwindow = TXT_NewWindow("Starting Doom");

    label = TXT_NewLabel("Starting Doom to test the\n"
                         "settings.  Please wait.");
    TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);
    TXT_AddWidget(testwindow, label);
    TXT_DrawDesktop();

    // Save temporary configuration files with the current configuration

    main_cfg = TempFile("tmp.cfg");
    extra_cfg = TempFile("extratmp.cfg");

    M_SaveMainDefaults(main_cfg);
    M_SaveExtraDefaults(extra_cfg);

    // Run with the -testcontrols parameter

    exec = NewExecuteContext();
    AddCmdLineParameter(exec, "-testcontrols");
    AddCmdLineParameter(exec, "-config \"%s\"", main_cfg);
    AddCmdLineParameter(exec, "-extraconfig \"%s\"", extra_cfg);
    ExecuteDoom(exec);

    TXT_CloseWindow(testwindow);

    // Delete the temporary config files

    remove(main_cfg);
    remove(extra_cfg);
    free(main_cfg);
    free(extra_cfg);
}
예제 #28
0
void Window2(void)
{
    txt_window_t *window;
    txt_table_t *table;
    txt_table_t *unselectable_table;
    txt_scrollpane_t *scrollpane;

    window = TXT_NewWindow("Another test");
    TXT_SetWindowPosition(window, 
                          TXT_HORIZ_RIGHT, 
                          TXT_VERT_TOP, 
                          TXT_SCREEN_W - 1, 1);

    TXT_AddWidgets(window,
                   TXT_NewScrollPane(40, 1,
                        TXT_NewLabel("* Unselectable scroll pane *")),
                   unselectable_table = TXT_NewTable(1),
                   NULL);

    TXT_AddWidget(unselectable_table, TXT_NewLabel("* Unselectable table *"));

    TXT_AddWidget(window, TXT_NewSeparator("Input boxes"));
    table = TXT_NewTable(2);
    TXT_AddWidget(window, table);
    TXT_AddWidget(table, TXT_NewLabel("String: "));
    TXT_AddWidget(table, TXT_NewInputBox(&textbox_value, 20));
    TXT_AddWidget(table, TXT_NewLabel("Int: "));
    TXT_AddWidget(table, TXT_NewIntInputBox(&numbox_value, 10));
    TXT_AddWidget(table, TXT_NewLabel("Spin control:"));
    TXT_AddWidget(table, TXT_NewSpinControl(&numbox_value, 0, 15));

    TXT_AddWidget(window, TXT_NewSeparator("Scroll pane test"));
    scrollpane = TXT_NewScrollPane(40, 5, TXT_NewLabel(
        "This is a scrollable pane. The contents\n"
        "of this box are larger than the box\n"
        "itself, but it can be scrolled around\n"
        "to explore the full contents.\n"
        "\n"
        "Scrollable panes can be scrolled both\n"
        "vertically and horizontally. They\n"
        "can contain any widget. The scroll bars\n"
        "appear automatically as needed.\n"
        "\n"
        "This is a very long line of text that forces a horizontal scrollbar"
    ));
    TXT_AddWidget(window, scrollpane);
}
static void OpenPromptWindow(txt_joystick_input_t *joystick_input)
{
    txt_window_t *window;
    txt_label_t *label;
    SDL_Joystick *joystick;

    if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
    {
        return;
    }

    // Check the current joystick is valid

    joystick = SDL_JoystickOpen(joystick_index);

    if (joystick == NULL)
    {
        OpenErrorWindow();
        return;
    }

    // Open the prompt window

    window = TXT_NewWindow(NULL);
    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, 
                        TXT_NewWindowAbortAction(window));
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
    
    label = TXT_NewLabel("Press the new joystick button...");

    TXT_AddWidget(window, label);
    TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);
    TXT_SDL_SetEventCallback(EventCallback, joystick_input);
    TXT_SignalConnect(window, "closed", PromptWindowClosed, joystick);
    joystick_input->prompt_window = window;

    SDL_JoystickEventState(SDL_ENABLE);
}
예제 #30
0
void BuildGUI()
{
    txt_window_t *window;
    txt_table_t *table;
    
    window = TXT_NewWindow("Calculator");

    input_box = TXT_NewLabel("asdf");
    TXT_SetBGColor(input_box, TXT_COLOR_BLACK);
    TXT_AddWidget(window, input_box);
    TXT_AddWidget(window, TXT_NewSeparator(NULL));
    TXT_AddWidget(window, TXT_NewStrut(0, 1));

    table = TXT_NewTable(4);
    TXT_AddWidget(window, table);
    TXT_SetWidgetAlign(table, TXT_HORIZ_CENTER);

    AddNumberButton(table, 7);
    AddNumberButton(table, 8);
    AddNumberButton(table, 9);
    AddOperatorButton(table, "*", OP_MULT);
    AddNumberButton(table, 4);
    AddNumberButton(table, 5);
    AddNumberButton(table, 6);
    AddOperatorButton(table, "-", OP_MINUS);
    AddNumberButton(table, 1);
    AddNumberButton(table, 2);
    AddNumberButton(table, 3);
    AddOperatorButton(table, "+", OP_PLUS);
    AddNumberButton(table, 0);
    TXT_AddWidget(table, NULL);

    TXT_AddWidget(table, TXT_NewButton2("  =  ", Calculate, NULL));
    AddOperatorButton(table, "/", OP_DIV);
    
    TXT_AddWidget(window, TXT_NewStrut(0, 1));
    UpdateInputBox();
}