[Xbubble-commits] xbubble/src screens.c,1.1,1.2 screens.h,1.1,1.2
Martin Quinson
xbubble-devel@lists.alioth.debian.org
Wed, 27 Apr 2005 14:52:08 +0000
Update of /cvsroot/xbubble/xbubble/src
In directory haydn:/tmp/cvs-serv14914
Modified Files:
screens.c screens.h
Log Message:
add a setting menu (yet unimplemented), and some cleanups
Index: screens.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble/src/screens.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- screens.c 5 Dec 2004 20:41:01 -0000 1.1
+++ screens.c 27 Apr 2005 14:52:06 -0000 1.2
@@ -45,24 +45,25 @@
extern int menufont_color[3];
extern int notitle;
-enum ScreenMain_Choice screen_main() {
+enum ScreenMain_Choice screen_main(enum ScreenMain_Choice preset) {
int title_height;
int menu_height;
int menu_x;
int menu_y;
Window title=(Window)NULL;
- char* menu[] = {
+ const char* menu[] = {
_("Single Player"),
_("Two Players"),
_("Player vs Computer"),
_("Challenge"),
_("Demo"),
+ _("Settings"),
_("Quit")
};
- int choice = S1_SINGLE_PLAYER;
+ int choice = preset;
title_height = title_font->ascent + title_font->descent;
- get_menu_size( 6, menu, &menu_x, &menu_height, 0 );
+ get_menu_size( 7, menu, &menu_x, &menu_height, 0 );
if(!notitle)
title = create_dialog( win_width/2, ( win_height - menu_height )/2,
"XBubble", title_font,
@@ -70,7 +71,7 @@
titlefont_color[2] ),0, 1.0 );
menu_x = win_width/2;
menu_y = ( win_height + title_height )/2;
- get_menu_choices( 6, menu, &menu_x, &menu_y, &choice, 1, False, True );
+ get_menu_choices( 7, menu, &menu_x, &menu_y, &choice, 1, False, True );
if(!notitle)
XDestroyWindow( display, title );
return choice;
@@ -83,7 +84,7 @@
int menu_y;
Window title;
int choice = S2_NORMAL;
- char* menu[] = {
+ const char* menu[] = {
_("Very easy"),
_("Easy"),
_("Normal"),
@@ -121,7 +122,7 @@
unsigned long pixel[4];
Window title;
Window stats_box[3];
- char* menu[] = { _("Continue"),_("End") };
+ const char* menu[] = { _("Continue"),_("End") };
char* pstats[3][4];
char stats[3][4][32] = { { "","","","" }, { "","","","" },
{ " ", N_("Game Wins"), N_("Round Wins"), N_("Percentage") }};
@@ -149,7 +150,7 @@
sprintf( pstats[i][3], "%d", percentage[j] );
}
for ( i = 0; i < 3; i++ ) {
- get_column_size( 4, pstats[i], menu_font, &width[i], &height[i] );
+ get_column_size( 4, (const char**)pstats[i], menu_font, &width[i], &height[i] );
width[i] *= 1.5;
height[i] *= 1.5;
}
@@ -168,7 +169,7 @@
menufont_color[2] ), 0, 1.0 );
/* statistics windows */
for ( i = 0; i < 3; i++ )
- stats_box[i] = create_column( stats_x[i], stats_y, 4, pstats[i], menu_font,
+ stats_box[i] = create_column( stats_x[i], stats_y, 4, (const char**)pstats[i], menu_font,
pixel, 1.0 );
/* continue/end menu */
get_menu_choices( 2, menu, &menu_x, &menu_y, &choice, 1, False, True );
@@ -189,7 +190,7 @@
int menu_width;
int menu_height;
int title_y;
- char* menu[5] = { "1", "2", "3", "4", "5" };
+ const char* menu[5] = { "1", "2", "3", "4", "5" };
Window title;
Window subtitle1;
Window subtitle2;
@@ -240,7 +241,7 @@
Window title;
Window subtitle;
Window footnote;
- char* menu[5] = { "1", "2", "3", "4", "5" };
+ const char* menu[5] = { "1", "2", "3", "4", "5" };
title_height = 3*( dialog_font->ascent + dialog_font->descent )/2;
get_menu_size( 5, menu, &menu_width, &menu_height, 1);
@@ -265,4 +266,51 @@
XDestroyWindow( display, subtitle );
XDestroyWindow( display, footnote );
return choice;
+}
+
+enum ScreenSettings_Choice screen_settings(enum ScreenSettings_Choice preset) {
+ int title_height;
+ int menu_height;
+ int menu_x;
+ int menu_y;
+ Window title=(Window)NULL;
+ const char* menu[] = {
+ _("Key controls"),
+ _("Canon sensibility"),
+ _("Theme"),
+ _("Back")
+ };
+ int choice = preset;
+
+ title_height = title_font->ascent + title_font->descent;
+ get_menu_size( 4, menu, &menu_x, &menu_height, 0 );
+ if(!notitle)
+ title = create_dialog( win_width/2, ( win_height - menu_height )/2,
+ _("Settings"), title_font,
+ get_pixel( titlefont_color[0], titlefont_color[1],
+ titlefont_color[2] ),0, 1.0 );
+ menu_x = win_width/2;
+ menu_y = ( win_height + title_height )/2;
+ get_menu_choices( 4, menu, &menu_x, &menu_y, &choice, 1, False, True );
+ if(!notitle)
+ XDestroyWindow( display, title );
+ return choice;
+}
+
+#include <unistd.h>
+extern Window root;
+extern GC dialog_gc;
+
+void screen_unimplemented() {
+ int menu_height;
+ int menu_x;
+ int menu_y;
+ Window title=(Window)NULL;
+ const char* menu[] = { _("Not implemented") };
+ int choice = 0;
+
+ get_menu_size( 1, menu, &menu_x, &menu_height, 0 );
+ menu_x = win_width/2;
+ menu_y = win_height/2;
+ get_menu_choices( 1, menu, &menu_x, &menu_y, &choice, 1, False, True );
}
Index: screens.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble/src/screens.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- screens.h 5 Dec 2004 20:41:01 -0000 1.1
+++ screens.h 27 Apr 2005 14:52:06 -0000 1.2
@@ -10,6 +10,7 @@
S1_PLAYER_VS_COMPUTER,
S1_CHALLENGE,
S1_DEMO,
+ S1_SETTINGS,
S1_QUIT
};
@@ -41,10 +42,22 @@
S5_4
};
-enum ScreenMain_Choice screen_main();
-enum ScreenComputerSkill_Choice screen_computer_skill();
+enum ScreenSettings_Choice {
+ S6_ESCAPE = -1,
+ S6_KEY,
+ S6_CANON,
+ S6_THEME,
+ S6_BACK
+};
+
+enum ScreenMain_Choice screen_main(enum ScreenMain_Choice preset);
+enum ScreenComputerSkill_Choice screen_computer_skill(void);
enum Screen2p_Choice screen_2p( enum GameMode mode, int *rounds, int *games );
enum handicap_2p_Choice screen_2p_handicap( int *choice );
-enum handicap_1p_Choice screen_1p_handicap();
+enum handicap_1p_Choice screen_1p_handicap(void);
+
+enum ScreenSettings_Choice screen_settings(enum ScreenSettings_Choice preset);
+
+void screen_unimplemented(void);
#endif /* _SCREENS_H */