mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
code wrap-up, code wrap-uuuuup!
This commit is contained in:
parent
c215af797d
commit
cb2d44d3e5
6 changed files with 171 additions and 162 deletions
|
@ -29,6 +29,7 @@ void About_Load(struct Game *game) {
|
|||
al_destroy_bitmap(game->about.fade_bitmap);
|
||||
About_Draw(game);
|
||||
}
|
||||
|
||||
int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
||||
if (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
|
||||
UnloadGameState(game);
|
||||
|
@ -37,6 +38,7 @@ int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void About_Preload(struct Game *game) {
|
||||
game->about.image = al_load_bitmap( "data/table.png" );
|
||||
game->about.letter = al_load_bitmap( "data/letter.png" );
|
||||
|
@ -111,6 +113,7 @@ void About_Preload(struct Game *game) {
|
|||
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
}
|
||||
|
||||
void About_Unload(struct Game *game) {
|
||||
if (game->about.x<0) game->about.x=0;
|
||||
ALLEGRO_EVENT ev;
|
||||
|
|
|
@ -43,6 +43,7 @@ void Intro_Load(struct Game *game) {
|
|||
}
|
||||
Intro_Draw(game);
|
||||
}
|
||||
|
||||
int Intro_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
||||
if (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
|
||||
UnloadGameState(game);
|
||||
|
@ -57,6 +58,7 @@ int Intro_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Intro_Preload(struct Game *game) {
|
||||
game->intro.position = 0;
|
||||
game->intro.page = 0;
|
||||
|
@ -125,6 +127,7 @@ void Intro_Preload(struct Game *game) {
|
|||
PrintConsole(game, "Chainpreloading GAMESTATE_MAP...");
|
||||
Map_Preload(game);
|
||||
}
|
||||
|
||||
void Intro_Unload(struct Game *game) {
|
||||
ALLEGRO_EVENT ev;
|
||||
for(int fadeloop=255; fadeloop>=0; fadeloop-=10){
|
||||
|
|
|
@ -36,6 +36,7 @@ void Level_Load(struct Game *game) {
|
|||
al_destroy_bitmap(game->level.fade_bitmap);
|
||||
Level_Draw(game);
|
||||
}
|
||||
|
||||
int Level_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
||||
if (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
|
||||
UnloadGameState(game);
|
||||
|
@ -44,6 +45,7 @@ int Level_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Level_Preload(struct Game *game) {
|
||||
game->level.derpy_frame = 0;
|
||||
game->level.derpy_frame_tmp = 0;
|
||||
|
@ -66,6 +68,7 @@ void Level_Preload(struct Game *game) {
|
|||
al_draw_textf(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/2, ALLEGRO_ALIGN_CENTRE, "Level %d: Not implemented yet!", game->level.current_level);
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
}
|
||||
|
||||
void Level_Unload(struct Game *game) {
|
||||
ALLEGRO_EVENT ev;
|
||||
game->level.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
|
|
|
@ -104,7 +104,6 @@ int main(int argc, char **argv){
|
|||
|
||||
InitConfig();
|
||||
|
||||
//ALLEGRO_DISPLAY_MODE disp_data;
|
||||
bool redraw = true;
|
||||
|
||||
struct Game game;
|
||||
|
@ -194,8 +193,7 @@ int main(int argc, char **argv){
|
|||
PreloadGameState(&game);
|
||||
LoadGameState(&game);
|
||||
game.loadstate = GAMESTATE_MENU;
|
||||
while(1)
|
||||
{
|
||||
while(1) {
|
||||
ALLEGRO_EVENT ev;
|
||||
al_wait_for_event(game.event_queue, &ev);
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ void Map_Load(struct Game *game) {
|
|||
}
|
||||
Map_Draw(game);
|
||||
}
|
||||
|
||||
int Map_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
||||
if ((((game->map.selected<4) || (game->map.selected==6)) && (ev->keyboard.keycode==ALLEGRO_KEY_LEFT)) || ((game->map.selected>4) && (game->map.selected!=6) && (ev->keyboard.keycode==ALLEGRO_KEY_RIGHT)) || ((game->map.selected==4) && (ev->keyboard.keycode==ALLEGRO_KEY_UP)) || ((game->map.selected==6) && (ev->keyboard.keycode==ALLEGRO_KEY_DOWN))) {
|
||||
game->map.selected--;
|
||||
|
@ -104,6 +105,7 @@ void Map_Preload(struct Game *game) {
|
|||
al_draw_scaled_bitmap(game->map.highlight,0,0,al_get_bitmap_width(game->map.highlight),al_get_bitmap_height(game->map.highlight),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
}
|
||||
|
||||
void Map_Unload(struct Game *game) {
|
||||
game->level.current_level = game->map.selected;
|
||||
ALLEGRO_EVENT ev;
|
||||
|
|
Loading…
Reference in a new issue