summaryrefslogtreecommitdiff
path: root/src/screen
diff options
context:
space:
mode:
authorDusan Durech <dusan.d@Centrum.sk>2009-06-15 14:49:04 +0200
committerDusan Durech <dusan.d@Centrum.sk>2009-06-15 14:49:04 +0200
commit9b7a6f66182020913cd9b5b1205634dabbcf081e (patch)
tree1d21745d28f559a1c1f13be4bdaaf8ef0cc7ba56 /src/screen
parent20def950be569ed6c6e9887f80dc3beca27765d8 (diff)
add widget container, hi is use in mainMenu and small diff
Diffstat (limited to 'src/screen')
-rw-r--r--src/screen/mainMenu.c28
-rw-r--r--src/screen/world.c9
-rw-r--r--src/screen/world.h1
3 files changed, 33 insertions, 5 deletions
diff --git a/src/screen/mainMenu.c b/src/screen/mainMenu.c
index 7cc2228..147ef59 100644
--- a/src/screen/mainMenu.c
+++ b/src/screen/mainMenu.c
@@ -22,9 +22,11 @@
#include "widget_textfield.h"
#include "widget_check.h"
#include "widget_image.h"
+#include "widget_container.h"
static widget_t *image_backgorund;
+static widget_t *widget_container;
static widget_t *button_play;
static widget_t *button_setting;
static widget_t *button_table;
@@ -49,20 +51,26 @@ void main_menu_draw()
{
wid_image_draw(image_backgorund);
+ widget_container_draw(widget_container);
+/*
button_draw(button_play);
button_draw(button_setting);
button_draw(button_table);
button_draw(button_credits);
button_draw(button_end);
+*/
}
void main_menu_event()
{
+ widget_container_event(widget_container);
+/*
button_event(button_play);
button_event(button_setting);
button_event(button_table);
button_event(button_credits);
button_event(button_end);
+*/
}
void main_menu_stop()
@@ -105,11 +113,21 @@ void main_menu_init()
"screen_main", IMAGE_GROUP_BASE);
image_backgorund = wid_image_new(0, 0, image);
- button_play = button_new(_("Start game"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 200, eventWidget);
- button_setting = button_new(_("Settings"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 250, eventWidget);
- button_table = button_new(_("Highscore"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 300, eventWidget);
- button_credits = button_new(_("Credits"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 350, eventWidget);
- button_end = button_new(_("Quit game"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 400, eventWidget);
+ widget_container = widget_container_new(WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 200, WIDGET_BUTTON_WIDTH, 300);
+
+ button_play = button_new(_("Start game"), WIDGET_NONE_VALUE, WIDGET_NONE_VALUE, eventWidget);
+ button_setting = button_new(_("Settings"), WIDGET_NONE_VALUE, WIDGET_NONE_VALUE, eventWidget);
+ button_table = button_new(_("Highscore"), WIDGET_NONE_VALUE, WIDGET_NONE_VALUE, eventWidget);
+ button_credits = button_new(_("Credits"), WIDGET_NONE_VALUE, WIDGET_NONE_VALUE, eventWidget);
+ button_end = button_new(_("Quit game"), WIDGET_NONE_VALUE, WIDGET_NONE_VALUE, eventWidget);
+
+ widget_container_add(widget_container, button_play);
+ widget_container_add(widget_container, button_setting);
+ widget_container_add(widget_container, button_table);
+ widget_container_add(widget_container, button_credits);
+ widget_container_add(widget_container, button_end);
+
+ widget_set_layout_table(widget_container, 1, 5, 0, 50);
#ifndef NO_SOUND
music_add("menu.ogg", "menu", MUSIC_GROUP_BASE);
diff --git a/src/screen/world.c b/src/screen/world.c
index d573448..c3ccd8c 100644
--- a/src/screen/world.c
+++ b/src/screen/world.c
@@ -111,6 +111,15 @@ void world_inc_round()
}
}
+bool_t world_is_match_end()
+{
+ if (arena->max_countRound == WORLD_COUNT_ROUND_UNLIMITED) {
+ return FALSE;
+ }
+
+ return (arena->countRound >= arena->max_countRound);
+}
+
void prepareArena()
{
tux_t *tux;
diff --git a/src/screen/world.h b/src/screen/world.h
index 35eb74d..f64ac93 100644
--- a/src/screen/world.h
+++ b/src/screen/world.h
@@ -16,6 +16,7 @@ extern void world_init();
extern void world_set_arena(arenaFile_t *arenaFile);
extern void world_do_end();
extern void world_inc_round();
+extern bool_t world_is_match_end();
extern tux_t *world_get_control_tux(int control_type);
extern void world_set_control_tux(tux_t *tux, int control_type);
extern void world_tux_control(tux_t *p);