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 _COMMONS_
00034 #define _COMMONS_
00035 #include "../include/commons.h"
00036 #endif // _COMMONS_
00037
00038 #ifndef _BUTTONS_
00039 #define _BUTTONS_
00040 #include "../include/buttons.h"
00041 #endif // _BUTTONS_
00042
00043 #ifndef _OPTIONS_
00044 #define _OPTIONS_
00045 #include "../include/options.h"
00046 #endif // _OPTIONS_
00047
00048
00049
00050 static BUTTONPTR fullscreen = NULL, fpscount = NULL, back = NULL;
00051
00052
00053
00054 static _Bool fps = true;
00055
00056
00057
00058 _Bool get_fps_status(void)
00059 {
00060 return fps;
00061 }
00062
00063
00064
00065 _Bool set_fps_status(_Bool _fps)
00066 {
00067 fps = _fps;
00068 return fps;
00069 }
00070
00071
00072
00073 void options(void)
00074 {
00075 GDATAPTR game = get_game_data();
00076 char *text, *onoff;
00077 int flags = al_get_display_flags();
00078 if(flags & ALLEGRO_FULLSCREEN_WINDOW)
00079 text = "WINDOWED";
00080 else
00081 text = "FULLSCREEN";
00082
00083 if(fps)
00084 onoff = "FPS COUNTER: ON";
00085 else
00086 onoff = "FPS COUNTER: OFF";
00087
00088 if(fullscreen == NULL)
00089 {
00090 fullscreen = create_new_button("FULLSCREEN",
00091 "DEFAULT",
00092 text,
00093 game->b_font,
00094 BCOLOR(255, 255, 255, 255),
00095 BCOLOR(65, 105, 255, 191),
00096 -280,
00097 150,
00098 263,
00099 BRIGHT,
00100 BVISIBLE,
00101 true
00102 );
00103 }
00104 if(fpscount == NULL)
00105 {
00106 fpscount = create_new_button("FPS",
00107 "DEFAULT",
00108 onoff,
00109 game->b_font,
00110 BCOLOR(255, 255, 255, 255),
00111 BCOLOR(65, 105, 255, 191),
00112 -280,
00113 250,
00114 263,
00115 BRIGHT,
00116 BVISIBLE,
00117 true
00118 );
00119 }
00120 if(back == NULL)
00121 {
00122 back = create_new_button("BACK",
00123 "DEFAULT",
00124 "BACK",
00125 game->b_font,
00126 BCOLOR(255, 255, 255, 255),
00127 BCOLOR(65, 105, 255, 191),
00128 -280,
00129 500,
00130 50,
00131 BRIGHT,
00132 BVISIBLE,
00133 true
00134 );
00135 }
00136 }
00137
00138
00139
00140 void options_cleanup(void)
00141 {
00142 remove_element_from_button_list(&fullscreen);
00143 remove_element_from_button_list(&fpscount);
00144 remove_element_from_button_list(&back);
00145 fullscreen = NULL;
00146 fpscount = NULL;
00147 back = NULL;
00148 }
00149
00150
00151
00152 void exit_options(GDATAPTR game)
00153 {
00154 BUTTONPTR currentptr, firstptr = get_first_element_from_button_list();
00155 currentptr = search_button_list_for_element(&firstptr, "FULLSCREEN");
00156 currentptr->bdata.limit = 805;
00157 currentptr->bdata.aflags = BRIGHT;
00158 currentptr = search_button_list_for_element(&firstptr, "FPS");
00159 currentptr->bdata.limit = 805;
00160 currentptr->bdata.aflags = BRIGHT;
00161 currentptr = search_button_list_for_element(&firstptr, "BACK");
00162 currentptr->bdata.limit = -600;
00163 currentptr->bdata.aflags = BLEFT;
00164 }
00165
00166
00167
00168
00169
00170