summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2006-09-26 23:52:50 +0000
committerSimon Howard2006-09-26 23:52:50 +0000
commitd39f279c74067717be18d60061fc8c10f12ef80b (patch)
tree0d49ae39398911655fd7130872b4402ad8db24a5
parent1b3dff9b4a1236afdec52056a08df51505c19df7 (diff)
downloadchocolate-doom-d39f279c74067717be18d60061fc8c10f12ef80b.tar.gz
chocolate-doom-d39f279c74067717be18d60061fc8c10f12ef80b.tar.bz2
chocolate-doom-d39f279c74067717be18d60061fc8c10f12ef80b.zip
Switch over a bunch of code to TXT_NewButton2 - improves readability.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 677
-rw-r--r--setup/mainmenu.c57
-rw-r--r--setup/multiplayer.c11
2 files changed, 27 insertions, 41 deletions
diff --git a/setup/mainmenu.c b/setup/mainmenu.c
index f5351214..0343fcff 100644
--- a/setup/mainmenu.c
+++ b/setup/mainmenu.c
@@ -47,22 +47,19 @@ void QuitConfirm(void *unused1, void *unused2)
TXT_AddWidget(window, TXT_NewStrut(24, 0));
TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);
- button = TXT_NewButton(" Yes ");
+ button = TXT_NewButton2(" Yes ", DoQuit, DoQuit);
TXT_SetWidgetAlign(button, TXT_HORIZ_CENTER);
TXT_AddWidget(window, button);
- TXT_SignalConnect(button, "pressed", DoQuit, DoQuit);
- button = TXT_NewButton(" No ");
+ button = TXT_NewButton2(" No ", DoQuit, NULL);
+ TXT_SetWidgetAlign(button, TXT_HORIZ_CENTER);
+ TXT_AddWidget(window, button);
// 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);
-
- TXT_SetWidgetAlign(button, TXT_HORIZ_CENTER);
- TXT_AddWidget(window, button);
- TXT_SignalConnect(button, "pressed", DoQuit, NULL);
}
extern void ConfigDisplay();
@@ -78,44 +75,38 @@ void MainMenu(void)
{
txt_window_t *window;
txt_window_action_t *quit_action;
- txt_button_t *button;
window = TXT_NewWindow("Main Menu");
- button = TXT_NewButton("Configure display");
- TXT_AddWidget(window, button);
- TXT_SignalConnect(button, "pressed", ConfigDisplay, NULL);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Configure display", ConfigDisplay, NULL));
- button = TXT_NewButton("Configure keyboard");
- TXT_AddWidget(window, button);
- TXT_SignalConnect(button, "pressed", ConfigKeyboard, NULL);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Configure keyboard", ConfigKeyboard, NULL));
- button = TXT_NewButton("Configure mouse");
- TXT_AddWidget(window, button);
- TXT_SignalConnect(button, "pressed", ConfigMouse, NULL);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Configure mouse", ConfigMouse, NULL));
- button = TXT_NewButton("Configure sound");
- TXT_AddWidget(window, button);
- TXT_SignalConnect(button, "pressed", ConfigSound, NULL);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Configure sound", ConfigSound, NULL));
- button = TXT_NewButton("Compatibility");
- TXT_AddWidget(window, button);
- TXT_SignalConnect(button, "pressed", CompatibilitySettings, NULL);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Compatibility", CompatibilitySettings, NULL));
+
+ TXT_AddWidget(window,
+ TXT_NewButton("Save parameters and launch DOOM"));
- TXT_AddWidget(window, TXT_NewButton("Save parameters and launch DOOM"));
TXT_AddWidget(window, TXT_NewStrut(0, 1));
- button = TXT_NewButton("Start a Network game");
- TXT_SignalConnect(button, "pressed", StartMultiGame, NULL);
- TXT_AddWidget(window, button);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Start a Network game", StartMultiGame, NULL));
- button = TXT_NewButton("Join a Network game");
- TXT_SignalConnect(button, "pressed", JoinMultiGame, NULL);
- TXT_AddWidget(window, button);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Join a Network game", JoinMultiGame, NULL));
- button = TXT_NewButton("Multiplayer configuration");
- TXT_SignalConnect(button, "pressed", MultiplayerConfig, NULL);
- TXT_AddWidget(window, button);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Multiplayer configuration",
+ MultiplayerConfig, NULL));
quit_action = TXT_NewWindowAction(KEY_ESCAPE, "Quit");
TXT_SignalConnect(quit_action, "pressed", QuitConfirm, NULL);
diff --git a/setup/multiplayer.c b/setup/multiplayer.c
index 60f2bb3d..400c047a 100644
--- a/setup/multiplayer.c
+++ b/setup/multiplayer.c
@@ -300,7 +300,6 @@ void StartMultiGame(void)
void JoinMultiGame(void)
{
txt_window_t *window;
- txt_button_t *button;
window = TXT_NewWindow("Join multiplayer game");
@@ -308,13 +307,9 @@ void JoinMultiGame(void)
TXT_AddWidget(window, TXT_NewInputBox(&connect_address, 40));
TXT_AddWidget(window, TXT_NewStrut(0, 1));
- button = TXT_NewButton("Add extra parameters...");
- TXT_SignalConnect(button, "pressed", OpenExtraParamsWindow, NULL);
- TXT_AddWidget(window, button);
-
- button = TXT_NewButton("Add WADs...");
- TXT_SignalConnect(button, "pressed", OpenWadsWindow, NULL);
- TXT_AddWidget(window, button);
+ TXT_AddWidget(window, TXT_NewButton2("Add extra parameters...",
+ OpenExtraParamsWindow, NULL));
+ TXT_AddWidget(window, TXT_NewButton2("Add WADs", OpenWadsWindow, NULL));
TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction());
}