00001
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _ALLEGRO5_
00014 #define _ALLEGRO5_
00015 #include <allegro5/allegro5.h>
00016 #endif // _ALLEGRO5_
00017
00018 #ifndef _ALLEGRO5FONT_
00019 #define _ALLEGRO5FONT_
00020 #include <allegro5/allegro_font.h>
00021 #endif // _ALLEGRO5FONT_
00022
00023 #ifndef _ALLEGRO5TTF_
00024 #define _ALLEGRO5TTF_
00025 #include <allegro5/allegro_ttf.h>
00026 #endif // _ALLEGRO5TTF_
00027
00028 #ifndef _ALLEGRO5IMAGE_
00029 #define _ALLEGRO5IMAGE_
00030 #include <allegro5/allegro_image.h>
00031 #endif // _ALLEGRO5IMAGE_
00032
00033 #ifndef _CHIPMUNK_
00034 #define _CHIPMUNK_
00035 #include "chipmunk.h"
00036 #endif // _CHIPMUNK_
00037
00038 #ifndef _COMMONS_
00039 #define _COMMONS_
00040 #include "../include/commons.h"
00041 #endif // _COMMONS_
00042
00043 #ifndef _BUTTONS_
00044 #define _BUTTONS_
00045 #include "../include/buttons.h"
00046 #endif // _BUTTONS_
00047
00048 #ifndef _SPRITES_
00049 #define _SPRITES_
00050 #include "../include/sprites.h"
00051 #endif // _SPRITES_
00052
00053 #ifndef _RENDER_
00054 #define _RENDER_
00055 #include "../include/render.h"
00056 #endif // _RENDER_
00057
00058 #ifndef _MAINGAME_
00059 #define _MAINGAME_
00060 #include "../include/maingame.h"
00061 #endif // _MAINGAME_
00062
00063 #ifndef _PAUSE_
00064 #define _PAUSE_
00065 #include "../include/pause.h"
00066 #endif // _PAUSE_
00067
00068
00069
00070 static BUTTONPTR resume = NULL, quit = NULL, exitgame = NULL;
00071
00072
00073
00074 void paused(int score, char *survival_time, int lives)
00075 {
00076 GDATAPTR game = get_game_data();
00077
00078 if(quit == NULL)
00079 {
00080 quit = create_new_button("QUITTOMENU",
00081 "DEFAULT",
00082 "QUIT TO MENU",
00083 game->b_font,
00084 BCOLOR(255, 255, 255, 255),
00085 BCOLOR(65, 105, 255, 191),
00086 -280,
00087 150,
00088 263,
00089 BRIGHT,
00090 BVISIBLE,
00091 true
00092 );
00093 }
00094 if(exitgame == NULL)
00095 {
00096 exitgame = create_new_button("EXITGAME",
00097 "DEFAULT",
00098 "EXIT GAME",
00099 game->b_font,
00100 BCOLOR(255, 255, 255, 255),
00101 BCOLOR(65, 105, 255, 191),
00102 -280,
00103 250,
00104 263,
00105 BRIGHT,
00106 BVISIBLE,
00107 true
00108 );
00109 }
00110 if(resume == NULL)
00111 {
00112 resume = create_new_button("RESUME",
00113 "DEFAULT",
00114 "RESUME",
00115 game->b_font,
00116 BCOLOR(255, 255, 255, 255),
00117 BCOLOR(65, 105, 255, 191),
00118 -280,
00119 500,
00120 50,
00121 BRIGHT,
00122 BVISIBLE,
00123 true
00124 );
00125 }
00126
00127 al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, RCOLOR(0, 0, 0, 255));
00128 add_element_to_render_queue(NULL, 280, 325, 0, RCOLOR(0, 0, 0, 255), update_score);
00129 add_element_to_render_queue(NULL, 280, 375, 0, RCOLOR(0, 0, 0, 255), update_survivaltime);
00130 al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, RDEFAULT);
00131
00132 SPRITESPTR sprite = search_sprite_list_for_element("STICKMAN");
00133 SIMAGEPTR life = search_image_list_for_element(&(sprite->ifirstptr), "STICKFIGURE_LIVES");
00134
00135 int x = 280;
00136 int y = 425;
00137
00138 for(int i = 0; i < lives; i++)
00139 {
00140 add_element_to_render_queue(life->image, x, y, 0, RCOLOR(255, 255, 255, 255), NULL);
00141 x += life->width+10;
00142 }
00143
00144 }
00145
00146
00147
00148 void pause_cleanup(void)
00149 {
00150 remove_element_from_button_list(&quit);
00151 remove_element_from_button_list(&exitgame);
00152 remove_element_from_button_list(&resume);
00153 quit = NULL;
00154 exitgame = NULL;
00155 resume = NULL;
00156 }
00157
00158
00159
00160 void exit_pause(GDATAPTR game)
00161 {
00162 BUTTONPTR currentptr, firstptr = get_first_element_from_button_list();
00163 currentptr = search_button_list_for_element(&firstptr, "QUITTOMENU");
00164 currentptr->bdata.limit = 805;
00165 currentptr->bdata.aflags = BRIGHT;
00166 currentptr = search_button_list_for_element(&firstptr, "EXITGAME");
00167 currentptr->bdata.limit = 805;
00168 currentptr->bdata.aflags = BRIGHT;
00169 currentptr = search_button_list_for_element(&firstptr, "RESUME");
00170 currentptr->bdata.limit = -600;
00171 currentptr->bdata.aflags = BLEFT;
00172 }
00173
00174
00175
00176
00177
00178