本文整理汇总了C++中TXT_SignalConnect函数的典型用法代码示例。如果您正苦于以下问题:C++ TXT_SignalConnect函数的具体用法?C++ TXT_SignalConnect怎么用?C++ TXT_SignalConnect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TXT_SignalConnect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenSelectorWindow
static void OpenSelectorWindow(txt_dropdown_list_t *list)
{
txt_window_t *window;
int i;
// Open a simple window with no title bar or action buttons.
window = TXT_NewWindow(NULL);
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
// Position the window so that the currently selected item appears
// over the top of the list widget.
TXT_SetWindowPosition(window, TXT_HORIZ_LEFT, TXT_VERT_TOP,
list->widget.x - 2, SelectorWindowY(list));
// Add a button to the window for each option in the list.
for (i=0; i<list->num_values; ++i)
{
txt_button_t *button;
callback_data_t *data;
button = TXT_NewButton(list->values[i]);
TXT_AddWidget(window, button);
// Callback struct
data = malloc(sizeof(callback_data_t));
data->list = list;
data->window = window;
data->item = i;
// When the button is pressed, invoke the button press callback
TXT_SignalConnect(button, "pressed", ItemSelected, data);
// When the window is closed, free back the callback struct
TXT_SignalConnect(window, "closed", FreeCallbackData, data);
// Is this the currently-selected value? If so, select the button
// in the window as the default.
if (i == *list->variable)
{
TXT_SelectWidget(window, button);
}
}
// Catch presses of escape in this window and close it.
TXT_SetKeyListener(window, SelectorWindowListener, NULL);
}
示例2: VKBCreateWindow
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;
}
示例3: MainMenu
void MainMenu(void)
{
txt_window_t *window;
txt_window_action_t *quit_action;
txt_window_action_t *warp_action;
window = TXT_NewWindow("Main Menu");
TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);
TXT_AddWidgets(window,
TXT_NewButton2("Configure Display",
(TxtWidgetSignalFunc) ConfigDisplay, NULL),
TXT_NewButton2("Configure Sound",
(TxtWidgetSignalFunc) ConfigSound, NULL),
TXT_NewButton2("Configure Keyboard",
(TxtWidgetSignalFunc) ConfigKeyboard, NULL),
TXT_NewButton2("Configure Mouse",
(TxtWidgetSignalFunc) ConfigMouse, NULL),
TXT_NewButton2("Configure Gamepad/Joystick",
(TxtWidgetSignalFunc) ConfigJoystick, NULL),
NULL);
// The compatibility window is only appropriate for Doom/Strife.
if (gamemission == doom || gamemission == strife)
{
txt_button_t *button;
button = TXT_NewButton2("Compatibility",
(TxtWidgetSignalFunc) CompatibilitySettings,
NULL);
TXT_AddWidget(window, button);
}
TXT_AddWidgets(window,
GetLaunchButton(),
TXT_NewStrut(0, 1),
TXT_NewButton2("Start a Network Game",
(TxtWidgetSignalFunc) StartMultiGame, NULL),
TXT_NewButton2("Join a Network Game",
(TxtWidgetSignalFunc) JoinMultiGame, NULL),
TXT_NewButton2("Multiplayer Configuration",
(TxtWidgetSignalFunc) MultiplayerConfig, NULL),
NULL);
quit_action = TXT_NewWindowAction(KEY_ESCAPE, "Quit");
warp_action = TXT_NewWindowAction(KEY_F2, "Warp");
TXT_SignalConnect(quit_action, "pressed", QuitConfirm, NULL);
TXT_SignalConnect(warp_action, "pressed",
(TxtWidgetSignalFunc) WarpMenu, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, quit_action);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER, warp_action);
TXT_SetKeyListener(window, MainMenuKeyPress, NULL);
}
示例4: GenerateModesTable
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;
}
}
示例5: CalibrateJoystick
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;
}
示例6: OpenPromptWindow
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);
}
示例7: AdvancedDisplayConfig
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),
NULL);
if (gamemission == heretic || gamemission == hexen || gamemission == strife)
{
TXT_AddWidget(window,
TXT_NewCheckBox("Graphical startup", &graphical_startup));
}
if (gamemission == doom || gamemission == heretic || gamemission == strife)
{
TXT_AddWidget(window,
TXT_NewCheckBox("Show ENDOOM screen on exit",
&show_endoom));
}
TXT_SignalConnect(ar_checkbox, "changed", GenerateModesTable, modes_table);
}
示例8: AdvancedDisplayConfig
static void AdvancedDisplayConfig(TXT_UNCAST_ARG(widget),
TXT_UNCAST_ARG(sizes_table))
{
TXT_CAST_ARG(txt_table_t, sizes_table);
txt_window_t *window;
txt_checkbox_t *ar_checkbox;
window = TXT_NewWindow("Advanced display options");
TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);
TXT_SetColumnWidths(window, 40);
TXT_AddWidgets(window,
ar_checkbox = TXT_NewCheckBox("Force correct aspect ratio",
&aspect_ratio_correct),
TXT_If(gamemission == heretic || gamemission == hexen
|| gamemission == strife,
TXT_NewCheckBox("Graphical startup", &graphical_startup)),
TXT_If(gamemission == doom || gamemission == heretic
|| gamemission == strife,
TXT_NewCheckBox("Show ENDOOM screen on exit",
&show_endoom)),
#ifdef HAVE_LIBPNG
TXT_NewCheckBox("Save screenshots in PNG format",
&png_screenshots),
#endif
NULL);
TXT_SignalConnect(ar_checkbox, "changed", GenerateSizesTable, sizes_table);
}
示例9: ScrollingMenu
void ScrollingMenu(void)
{
txt_window_t *window;
txt_button_t *button;
txt_table_t *table;
window = TXT_NewWindow("Scrollable menu");
table = TXT_NewTable(1);
TXT_AddWidgets(table,
TXT_NewButton("Configure display"),
TXT_NewButton("Configure joystick"),
TXT_NewButton("Configure keyboard"),
TXT_NewButton("Configure mouse"),
TXT_NewButton("Configure sound"),
TXT_NewStrut(0, 1),
button = TXT_NewButton("Save Parameters and launch DOOM"),
TXT_NewStrut(0, 1),
TXT_NewButton("Start a network game"),
TXT_NewButton("Join a network game"),
TXT_NewButton("Multiplayer configuration"),
NULL);
TXT_SignalConnect(button, "pressed", PwnBox, NULL);
TXT_AddWidget(window, TXT_NewScrollPane(0, 6, table));
}
示例10: OpenPromptWindow
static void OpenPromptWindow(txt_joystick_input_t *joystick_input)
{
txt_window_t *window;
SDL_Joystick *joystick;
// Silently update when the shift button is held down.
joystick_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);
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_MessageBox(NULL, "Press the new button on the controller...");
TXT_SDL_SetEventCallback(EventCallback, joystick_input);
TXT_SignalConnect(window, "closed", PromptWindowClosed, joystick);
joystick_input->prompt_window = window;
SDL_JoystickEventState(SDL_ENABLE);
}
示例11: TXT_ConfigureJoystickAxis
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;
}
示例12: TXT_NewWindowAction
txt_window_action_t *TXT_NewWindowSelectAction(txt_window_t *window)
{
txt_window_action_t *action;
action = TXT_NewWindowAction(KEY_RCTRL, "Select");
TXT_SignalConnect(action, "pressed", WindowSelectCallback, window);
return action;
}
示例13: TXT_NewWindowAction
static txt_window_action_t *WadWindowAction(void)
{
txt_window_action_t *action;
action = TXT_NewWindowAction('w', "Add WADs");
TXT_SignalConnect(action, "pressed", OpenWadsWindow, NULL);
return action;
}
示例14: TXT_NewWindowAction
txt_window_action_t *TestConfigAction(void)
{
txt_window_action_t *test_action;
test_action = TXT_NewWindowAction('t', "Test");
TXT_SignalConnect(test_action, "pressed", TestCallback, NULL);
return test_action;
}
示例15: TXT_NewWindowAction
txt_window_action_t *TXT_NewWindowEscapeAction(txt_window_t *window)
{
txt_window_action_t *action;
action = TXT_NewWindowAction(KEY_ESCAPE, "Close");
TXT_SignalConnect(action, "pressed", WindowCloseCallback, window);
return action;
}