1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright(C) 2006 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
#include <stdlib.h>
#include "config.h"
#include "textscreen.h"
void DoQuit(void *widget, void *dosave)
{
if (dosave != NULL)
{
printf("Saving config\n");
}
exit(0);
}
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("Save settings and\n"
"quit setup?"),
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);
}
extern void ConfigDisplay();
extern void ConfigKeyboard();
extern void ConfigMouse();
extern void ConfigSound();
extern void CompatibilitySettings();
extern void StartMultiGame();
extern void JoinMultiGame();
extern void MultiplayerConfig();
void MainMenu(void)
{
txt_window_t *window;
txt_window_action_t *quit_action;
window = TXT_NewWindow("Main Menu");
TXT_AddWidgets(window,
TXT_NewButton2("Configure display", ConfigDisplay, NULL),
TXT_NewButton2("Configure keyboard", ConfigKeyboard, NULL),
TXT_NewButton2("Configure mouse", ConfigMouse, NULL),
TXT_NewButton2("Configure sound", ConfigSound, NULL),
TXT_NewButton2("Compatibility", CompatibilitySettings, NULL),
TXT_NewButton("Save parameters and launch DOOM"),
TXT_NewStrut(0, 1),
TXT_NewButton2("Start a Network game", StartMultiGame, NULL),
TXT_NewButton2("Join a Network game", JoinMultiGame, NULL),
TXT_NewButton2("Multiplayer configuration", MultiplayerConfig, NULL),
NULL);
quit_action = TXT_NewWindowAction(KEY_ESCAPE, "Quit");
TXT_SignalConnect(quit_action, "pressed", QuitConfirm, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, quit_action);
}
int main(int argc, char *argv[])
{
TXT_Init();
TXT_SetDesktopTitle(PACKAGE_NAME " Setup ver " PACKAGE_VERSION);
MainMenu();
TXT_GUIMainLoop();
return 0;
}
|