mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-03-04 09:11:27 +01:00
add dosowisko.net intro logo
This commit is contained in:
parent
b983eac305
commit
e4553576ce
9 changed files with 299 additions and 22 deletions
|
@ -73,6 +73,7 @@ void LoadGamestate(struct Game *game, const char* name) {
|
|||
gs->fade = true;
|
||||
gs->fade_counter = 0;
|
||||
gs->pending_load = true;
|
||||
gs->showLoading = true;
|
||||
}
|
||||
PrintConsole(game, "Gamestate \"%s\" marked to be LOADED.", name);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ struct Gamestate {
|
|||
void* handle;
|
||||
bool loaded, pending_load;
|
||||
bool started, pending_start;
|
||||
bool showLoading;
|
||||
bool paused;
|
||||
bool fade; // TODO: or maybe should it be in API?
|
||||
unsigned char fade_counter;
|
||||
|
|
|
@ -10,6 +10,7 @@ MACRO(GAMESTATE name)
|
|||
|
||||
ENDMACRO()
|
||||
|
||||
GAMESTATE("dosowisko")
|
||||
GAMESTATE("menu")
|
||||
GAMESTATE("disclaimer")
|
||||
GAMESTATE("intro")
|
||||
|
|
211
src/gamestates/dosowisko.c
Normal file
211
src/gamestates/dosowisko.c
Normal file
|
@ -0,0 +1,211 @@
|
|||
/*! \file disclaimer.c
|
||||
* \brief Init animation.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) Sebastian Krzyszkowiak <dos@dosowisko.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <allegro5/allegro_ttf.h>
|
||||
#include <allegro5/allegro_primitives.h>
|
||||
#include <math.h>
|
||||
#include "../utils.h"
|
||||
#include "../timeline.h"
|
||||
#include "dosowisko.h"
|
||||
|
||||
int Gamestate_ProgressCount = 3;
|
||||
|
||||
static char* text = "# dosowisko.net";
|
||||
|
||||
bool FadeIn(struct Game *game, struct TM_Action *action, enum TM_ActionState state) {
|
||||
struct dosowiskoResources *data = action->arguments->value;
|
||||
if (state == TM_ACTIONSTATE_START) {
|
||||
data->fade=0;
|
||||
}
|
||||
else if (state == TM_ACTIONSTATE_DESTROY) {
|
||||
data->fade=255;
|
||||
}
|
||||
else if (state == TM_ACTIONSTATE_RUNNING) {
|
||||
data->fade+=2;
|
||||
data->tan++;
|
||||
return data->fade >= 255;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FadeOut(struct Game *game, struct TM_Action *action, enum TM_ActionState state) {
|
||||
struct dosowiskoResources *data = action->arguments->value;
|
||||
if (state == TM_ACTIONSTATE_START) {
|
||||
data->fade=255;
|
||||
data->fadeout = true;
|
||||
}
|
||||
else if (state == TM_ACTIONSTATE_DESTROY) {
|
||||
data->fade=0;
|
||||
}
|
||||
else if (state == TM_ACTIONSTATE_RUNNING) {
|
||||
data->fade-=2;
|
||||
return data->fade <= 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool End(struct Game *game, struct TM_Action *action, enum TM_ActionState state) {
|
||||
if (state == TM_ACTIONSTATE_RUNNING) SwitchGamestate(game, "dosowisko", "menu");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlayKbd(struct Game *game, struct TM_Action *action, enum TM_ActionState state) {
|
||||
struct dosowiskoResources *data = action->arguments->value;
|
||||
if (state == TM_ACTIONSTATE_RUNNING) al_play_sample_instance(data->kbd);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Tick(struct Game *game, struct TM_Action *action, enum TM_ActionState state) {
|
||||
struct dosowiskoResources *data = action->arguments->value;
|
||||
if (state == TM_ACTIONSTATE_RUNNING) {
|
||||
data->underscore = !data->underscore;
|
||||
TM_AddBackgroundAction(Tick, TM_AddToArgs(NULL, 1, data), 500, "tick");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Type(struct Game *game, struct TM_Action *action, enum TM_ActionState state) {
|
||||
struct dosowiskoResources *data = action->arguments->value;
|
||||
if (state == TM_ACTIONSTATE_RUNNING) {
|
||||
strncpy(data->text, text, data->pos++);
|
||||
data->text[data->pos] = 0;
|
||||
if (strcmp(data->text, text) != 0) {
|
||||
TM_AddBackgroundAction(Type, TM_AddToArgs(NULL, 1, data), 60 + rand() % 60, "type");
|
||||
} else{
|
||||
al_stop_sample_instance(data->kbd);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Gamestate_Logic(struct Game *game, struct dosowiskoResources* data) {
|
||||
TM_Process();
|
||||
}
|
||||
|
||||
void Gamestate_Draw(struct Game *game, struct dosowiskoResources* data) {
|
||||
char t[255] = "";
|
||||
strcpy(t, data->text);
|
||||
if (data->underscore) {
|
||||
strncat(t, "_", 1);
|
||||
} else {
|
||||
strncat(t, " ", 1);
|
||||
}
|
||||
|
||||
al_set_target_bitmap(data->bitmap);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,0));
|
||||
al_draw_text(data->font, al_map_rgba(255,255,255,10), game->viewport.width/2, game->viewport.height*0.4167, ALLEGRO_ALIGN_CENTRE, t);
|
||||
al_set_target_backbuffer(game->display);
|
||||
|
||||
al_clear_to_color(al_map_rgb(35, 31, 32));
|
||||
|
||||
double tg = tan(-data->tan/384.0 * ALLEGRO_PI - ALLEGRO_PI/2);
|
||||
|
||||
int fade = data->fadeout ? 255 : data->fade;
|
||||
|
||||
al_draw_tinted_scaled_bitmap(data->bitmap, al_map_rgba(fade, fade, fade, fade), 0, 0, al_get_bitmap_width(data->bitmap), al_get_bitmap_height(data->bitmap), -tg*al_get_bitmap_width(data->bitmap)*0.05, -tg*al_get_bitmap_height(data->bitmap)*0.05, al_get_bitmap_width(data->bitmap)+tg*0.1*al_get_bitmap_width(data->bitmap), al_get_bitmap_height(data->bitmap)+tg*0.1*al_get_bitmap_height(data->bitmap), 0);
|
||||
|
||||
al_draw_bitmap(data->checkerboard, 0, 0, 0);
|
||||
|
||||
if (data->fadeout) {
|
||||
al_draw_filled_rectangle(0, 0, game->viewport.width, game->viewport.height, al_map_rgba_f(0,0,0,1-sin(data->fade*2/255.0 * ALLEGRO_PI/4)));
|
||||
}
|
||||
}
|
||||
|
||||
void Gamestate_Start(struct Game *game, struct dosowiskoResources* data) {
|
||||
data->pos = 1;
|
||||
data->fade = 0;
|
||||
data->tan = 64;
|
||||
data->fadeout = false;
|
||||
data->underscore=true;
|
||||
strcpy(data->text, "#");
|
||||
TM_AddBackgroundAction(Tick, TM_AddToArgs(NULL, 1, data), 500, "tick");
|
||||
TM_AddDelay(300);
|
||||
TM_AddQueuedBackgroundAction(FadeIn, TM_AddToArgs(NULL, 1, data), 0, "fadein");
|
||||
TM_AddDelay(1500);
|
||||
TM_AddQueuedBackgroundAction(PlayKbd, TM_AddToArgs(NULL, 1, data), 0, "playkbd");
|
||||
TM_AddQueuedBackgroundAction(Type, TM_AddToArgs(NULL, 1, data), 0, "type");
|
||||
TM_AddDelay(3000);
|
||||
TM_AddAction(FadeOut, TM_AddToArgs(NULL, 1, data), "fadeout");
|
||||
TM_AddDelay(300);
|
||||
TM_AddAction(End, NULL, "end");
|
||||
FadeGamestate(game, true);
|
||||
al_play_sample_instance(data->sound);
|
||||
}
|
||||
|
||||
void Gamestate_ProcessEvent(struct Game *game, struct dosowiskoResources* data, ALLEGRO_EVENT *ev) {
|
||||
TM_HandleEvent(ev);
|
||||
if ((ev->type==ALLEGRO_EVENT_KEY_DOWN) && (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE)) {
|
||||
SwitchGamestate(game, "dosowisko", "menu");
|
||||
}
|
||||
}
|
||||
|
||||
void* Gamestate_Load(struct Game *game, void (*progress)(struct Game*)) {
|
||||
struct dosowiskoResources *data = malloc(sizeof(struct dosowiskoResources));
|
||||
TM_Init(game);
|
||||
data->bitmap = al_create_bitmap(game->viewport.width, game->viewport.height);
|
||||
data->checkerboard = al_create_bitmap(game->viewport.width, game->viewport.height);
|
||||
|
||||
al_set_target_bitmap(data->checkerboard);
|
||||
int x, y;
|
||||
for (x = 0; x < al_get_bitmap_width(data->checkerboard); x=x+2) {
|
||||
for (y = 0; y < al_get_bitmap_height(data->checkerboard); y=y+2) {
|
||||
al_put_pixel(x, y, al_map_rgb(0,0,0));
|
||||
}
|
||||
}
|
||||
al_set_target_backbuffer(game->display);
|
||||
(*progress)(game);
|
||||
|
||||
data->font = al_load_ttf_font(GetDataFilePath(game, "fonts/DejaVuSansMono.ttf"),game->viewport.height*0.1666,0 );
|
||||
(*progress)(game);
|
||||
data->sample = al_load_sample( GetDataFilePath(game, "dosowisko.flac") );
|
||||
data->sound = al_create_sample_instance(data->sample);
|
||||
al_attach_sample_instance_to_mixer(data->sound, game->audio.music);
|
||||
al_set_sample_instance_playmode(data->sound, ALLEGRO_PLAYMODE_ONCE);
|
||||
(*progress)(game);
|
||||
|
||||
data->kbd_sample = al_load_sample( GetDataFilePath(game, "keyboard.flac") );
|
||||
data->kbd = al_create_sample_instance(data->kbd_sample);
|
||||
al_attach_sample_instance_to_mixer(data->kbd, game->audio.fx);
|
||||
al_set_sample_instance_playmode(data->kbd, ALLEGRO_PLAYMODE_ONCE);
|
||||
(*progress)(game);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void Gamestate_Stop(struct Game *game, struct dosowiskoResources* data) {
|
||||
FadeGamestate(game, false);
|
||||
al_stop_sample_instance(data->sound);
|
||||
}
|
||||
|
||||
void Gamestate_Unload(struct Game *game, struct dosowiskoResources* data) {
|
||||
al_destroy_font(data->font);
|
||||
al_destroy_sample_instance(data->sound);
|
||||
al_destroy_sample(data->sample);
|
||||
free(data);
|
||||
TM_Destroy();
|
||||
}
|
||||
|
||||
void Gamestate_Reload(struct Game *game, struct dosowiskoResources* data) {}
|
||||
|
||||
void Gamestate_Resume(struct Game *game, struct dosowiskoResources* data) {}
|
||||
void Gamestate_Pause(struct Game *game, struct dosowiskoResources* data) {}
|
32
src/gamestates/dosowisko.h
Normal file
32
src/gamestates/dosowisko.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*! \file disclaimer.h
|
||||
* \brief Init animation.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) Sebastian Krzyszkowiak <dos@dosowisko.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
struct dosowiskoResources {
|
||||
ALLEGRO_FONT *font;
|
||||
ALLEGRO_SAMPLE *sample, *kbd_sample;
|
||||
ALLEGRO_SAMPLE_INSTANCE *sound, *kbd;
|
||||
ALLEGRO_BITMAP *bitmap, *checkerboard;
|
||||
int pos;
|
||||
int fade;
|
||||
char text[255];
|
||||
bool underscore, fadeout;
|
||||
int tan;
|
||||
};
|
31
src/main.c
31
src/main.c
|
@ -53,6 +53,7 @@ void DrawConsole(struct Game *game) {
|
|||
}
|
||||
|
||||
void DrawGamestates(struct Game *game) {
|
||||
al_set_target_backbuffer(game->display);
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
struct Gamestate *tmp = game->_priv.gamestates;
|
||||
while (tmp) {
|
||||
|
@ -119,7 +120,11 @@ int Console_Load(struct Game *game) {
|
|||
game->_priv.font_console = NULL;
|
||||
game->_priv.console = NULL;
|
||||
game->_priv.font_console = al_load_ttf_font(GetDataFilePath(game, "fonts/DejaVuSansMono.ttf"),game->viewport.height*0.018,0 );
|
||||
//game->_priv.font_console = al_load_ttf_font(GetDataFilePath(game, "fonts/PerfectDOSVGA437.ttf"),game->viewport.height*0.022,0 );
|
||||
if (game->viewport.height*0.022 >= 16) {
|
||||
game->_priv.font_bsod = al_load_ttf_font(GetDataFilePath(game, "fonts/PerfectDOSVGA437.ttf"),16,0 );
|
||||
} else {
|
||||
game->_priv.font_bsod = al_load_ttf_font(GetDataFilePath(game, "fonts/DejaVuSansMono.ttf"),game->viewport.height*0.022,0 );
|
||||
}
|
||||
game->_priv.font = al_load_ttf_font(GetDataFilePath(game, "fonts/ShadowsIntoLight.ttf"),game->viewport.height*0.09,0 );
|
||||
game->_priv.console = al_create_bitmap(game->viewport.width, game->viewport.height*0.12);
|
||||
al_set_target_bitmap(game->_priv.console);
|
||||
|
@ -161,6 +166,9 @@ int main(int argc, char **argv){
|
|||
game._priv.fps_count.fps = 0;
|
||||
game._priv.fps_count.old_time = 0;
|
||||
|
||||
game._priv.font_bsod = NULL;
|
||||
game._priv.console = NULL;
|
||||
|
||||
game.config.fullscreen = atoi(GetConfigOptionDefault(&game, "SuperDerpy", "fullscreen", "1"));
|
||||
game.config.music = atoi(GetConfigOptionDefault(&game, "SuperDerpy", "music", "7"));
|
||||
game.config.voice = atoi(GetConfigOptionDefault(&game, "SuperDerpy", "voice", "10"));
|
||||
|
@ -278,7 +286,7 @@ int main(int argc, char **argv){
|
|||
game.shuttingdown = false;
|
||||
game.restart = false;
|
||||
|
||||
char* gamestate = strdup("menu"); // FIXME: don't hardcore gamestate
|
||||
char* gamestate = strdup("dosowisko"); // FIXME: don't hardcore gamestate
|
||||
|
||||
int c;
|
||||
while ((c = getopt (argc, argv, "l:s:")) != -1)
|
||||
|
@ -295,6 +303,7 @@ int main(int argc, char **argv){
|
|||
}
|
||||
|
||||
LoadGamestate(&game, gamestate);
|
||||
game._priv.gamestates->showLoading = false; // we have only one gamestate right now
|
||||
StartGamestate(&game, gamestate);
|
||||
free(gamestate);
|
||||
|
||||
|
@ -351,13 +360,16 @@ int main(int argc, char **argv){
|
|||
while (tmp) {
|
||||
if ((tmp->pending_load) && (tmp->loaded)) {
|
||||
PrintConsole(&game, "Unloading gamestate \"%s\"...", tmp->name);
|
||||
al_stop_timer(game._priv.timer);
|
||||
tmp->loaded = false;
|
||||
tmp->pending_load = false;
|
||||
(*tmp->api.Gamestate_Unload)(&game, tmp->data);
|
||||
dlclose(tmp->handle);
|
||||
tmp->handle = NULL;
|
||||
al_start_timer(game._priv.timer);
|
||||
} else if ((tmp->pending_load) && (!tmp->loaded)) {
|
||||
PrintConsole(&game, "Loading gamestate \"%s\"...", tmp->name);
|
||||
al_stop_timer(game._priv.timer);
|
||||
// TODO: take proper game name
|
||||
char libname[1024];
|
||||
snprintf(libname, 1024, "libsuperderpy-%s-%s.so", "muffinattack", tmp->name);
|
||||
|
@ -395,25 +407,28 @@ int main(int argc, char **argv){
|
|||
int p = 0;
|
||||
void progress(struct Game *game) {
|
||||
p++;
|
||||
al_set_target_backbuffer(game->display);
|
||||
DrawGamestates(game);
|
||||
float progress = ((p / (*(tmp->api.Gamestate_ProgressCount) ? (float)*(tmp->api.Gamestate_ProgressCount) : 1))/(float)toLoad)+(loaded/(float)toLoad);
|
||||
if (game->config.debug) PrintConsole(game, "[%s] Progress: %d% (%d/%d)", tmp->name, (int)(progress*100), p, *(tmp->api.Gamestate_ProgressCount));
|
||||
(*game->_priv.loading.Draw)(game, game->_priv.loading.data, progress);
|
||||
if (tmp->showLoading) (*game->_priv.loading.Draw)(game, game->_priv.loading.data, progress);
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
}
|
||||
|
||||
// initially draw loading screen with empty bar
|
||||
(*game._priv.loading.Draw)(&game, game._priv.loading.data, 0);
|
||||
DrawGamestates(&game);
|
||||
if (tmp->showLoading) {
|
||||
(*game._priv.loading.Draw)(&game, game._priv.loading.data, 0);
|
||||
}
|
||||
DrawConsole(&game);
|
||||
al_flip_display();
|
||||
|
||||
tmp->data = (*tmp->api.Gamestate_Load)(&game, &progress);
|
||||
loaded++;
|
||||
|
||||
tmp->loaded = true;
|
||||
tmp->pending_load = false;
|
||||
}
|
||||
al_start_timer(game._priv.timer);
|
||||
}
|
||||
|
||||
tmp=tmp->next;
|
||||
|
@ -424,9 +439,11 @@ int main(int argc, char **argv){
|
|||
|
||||
while (tmp) {
|
||||
|
||||
if ((tmp->pending_start) && (!tmp->started) && (tmp->loaded)) {
|
||||
if ((tmp->pending_start) && (!tmp->started) && (tmp->loaded)) {
|
||||
PrintConsole(&game, "Starting gamestate \"%s\"...", tmp->name);
|
||||
al_stop_timer(game._priv.timer);
|
||||
(*tmp->api.Gamestate_Start)(&game, tmp->data);
|
||||
al_start_timer(game._priv.timer);
|
||||
tmp->started = true;
|
||||
tmp->pending_start = false;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ struct Game {
|
|||
struct Gamestate *gamestates; /*!< List of known gamestates. */
|
||||
ALLEGRO_FONT *font; /*!< Main font used in game. */
|
||||
ALLEGRO_FONT *font_console; /*!< Font used in game console. */
|
||||
ALLEGRO_FONT *font_bsod; /*!< Font used in Blue Screens of Derp. */
|
||||
ALLEGRO_BITMAP *console; /*!< Bitmap with game console. */
|
||||
ALLEGRO_EVENT_QUEUE *event_queue; /*!< Main event queue. */
|
||||
ALLEGRO_TIMER *timer; /*!< Main LPS timer. */
|
||||
|
|
|
@ -74,6 +74,7 @@ void TM_Process(void) {
|
|||
struct TM_Action *tmp, *tmp2, *pom = background;
|
||||
tmp = NULL;
|
||||
while (pom!=NULL) {
|
||||
bool destroy = false;
|
||||
if (pom->active) {
|
||||
if (*pom->function) {
|
||||
if ((*pom->function)(game, pom, TM_ACTIONSTATE_RUNNING)) {
|
||||
|
@ -85,6 +86,7 @@ void TM_Process(void) {
|
|||
} else {
|
||||
background = pom->next;
|
||||
}
|
||||
destroy = true;
|
||||
}
|
||||
} else {
|
||||
/* delay handling */
|
||||
|
@ -93,16 +95,24 @@ void TM_Process(void) {
|
|||
} else {
|
||||
background = pom->next;
|
||||
}
|
||||
destroy = true;
|
||||
}
|
||||
}
|
||||
if ((!tmp) || (tmp->next==pom)) {
|
||||
|
||||
if (!destroy) {
|
||||
tmp = pom;
|
||||
pom = pom->next;
|
||||
} else {
|
||||
free(pom->name);
|
||||
free(pom);
|
||||
tmp2 = tmp;
|
||||
if (!tmp) pom=background->next;
|
||||
if (!tmp) {
|
||||
if (background) {
|
||||
pom=background->next;
|
||||
} else {
|
||||
pom=NULL;
|
||||
}
|
||||
}
|
||||
else pom=tmp->next;
|
||||
tmp = tmp2;
|
||||
}
|
||||
|
|
29
src/utils.c
29
src/utils.c
|
@ -170,7 +170,6 @@ void FatalError(struct Game *game, bool fatal, char* format, ...) {
|
|||
vsnprintf(text, 1024, format, vl);
|
||||
va_end(vl);
|
||||
printf("%s\n", text);
|
||||
if (!game->_priv.font_console) exit(1);
|
||||
} else {
|
||||
PrintConsole(game, "Fatal Error, displaying Blue Screen of Derp...");
|
||||
va_list vl;
|
||||
|
@ -180,6 +179,10 @@ void FatalError(struct Game *game, bool fatal, char* format, ...) {
|
|||
PrintConsole(game, text);
|
||||
}
|
||||
|
||||
if (!game->_priv.font_bsod) {
|
||||
game->_priv.font_bsod = al_create_builtin_font();
|
||||
}
|
||||
|
||||
al_set_target_backbuffer(game->display);
|
||||
al_clear_to_color(al_map_rgb(0,0,170));
|
||||
al_flip_display();
|
||||
|
@ -193,30 +196,30 @@ void FatalError(struct Game *game, bool fatal, char* format, ...) {
|
|||
|
||||
char *header = "SUPER DERPY";
|
||||
|
||||
al_draw_filled_rectangle(game->viewport.width/2 - al_get_text_width(game->_priv.font_console, header)/2 - 4, (int)(game->viewport.height * 0.32), 4 + game->viewport.width/2 + al_get_text_width(game->_priv.font_console, header)/2, (int)(game->viewport.height * 0.32) + al_get_font_line_height(game->_priv.font_console), al_map_rgb(170,170,170));
|
||||
al_draw_filled_rectangle(game->viewport.width/2 - al_get_text_width(game->_priv.font_bsod, header)/2 - 4, (int)(game->viewport.height * 0.32), 4 + game->viewport.width/2 + al_get_text_width(game->_priv.font_bsod, header)/2, (int)(game->viewport.height * 0.32) + al_get_font_line_height(game->_priv.font_bsod), al_map_rgb(170,170,170));
|
||||
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(0, 0, 170), game->viewport.width/2, (int)(game->viewport.height * 0.32), ALLEGRO_ALIGN_CENTRE, header);
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(0, 0, 170), game->viewport.width/2, (int)(game->viewport.height * 0.32), ALLEGRO_ALIGN_CENTRE, header);
|
||||
|
||||
char *header2 = "A fatal exception 0xD3RP has occured at 0028:M00F11NZ in GST SD(01) +";
|
||||
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2, (int)(game->viewport.height * 0.32+2*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_CENTRE, header2);
|
||||
al_draw_textf(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_console, header2)/2, (int)(game->viewport.height * 0.32+3*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_LEFT, "%p and system just doesn't know what went wrong.", game);
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2, (int)(game->viewport.height * 0.32+2*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, header2);
|
||||
al_draw_textf(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(game->viewport.height * 0.32+3*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "%p and system just doesn't know what went wrong.", game);
|
||||
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2, (int)(game->viewport.height * 0.32+5*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_CENTRE, text);
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2, (int)(game->viewport.height * 0.32+5*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, text);
|
||||
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_console, header2)/2, (int)(game->viewport.height * 0.32+7*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_LEFT, "* Press any key to terminate this error.");
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_console, header2)/2, (int)(game->viewport.height * 0.32+8*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_LEFT, "* Press any key to destroy all muffins in the world.");
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_console, header2)/2, (int)(game->viewport.height * 0.32+9*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_LEFT, "* Just kidding, please press any key anyway.");
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(game->viewport.height * 0.32+7*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "* Press any key to terminate this error.");
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(game->viewport.height * 0.32+8*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "* Press any key to destroy all muffins in the world.");
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(game->viewport.height * 0.32+9*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "* Just kidding, please press any key anyway.");
|
||||
|
||||
|
||||
if (fatal) {
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_console, header2)/2, (int)(game->viewport.height * 0.32+11*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_LEFT, "This is fatal error. My bad.");
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(game->viewport.height * 0.32+11*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "This is fatal error. My bad.");
|
||||
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2, (int)(game->viewport.height * 0.32+13*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_CENTRE, "Press any key to quit _");
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2, (int)(game->viewport.height * 0.32+13*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, "Press any key to quit _");
|
||||
} else {
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_console, header2)/2, (int)(game->viewport.height * 0.32+11*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_LEFT, "Anything I can do to help?");
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(game->viewport.height * 0.32+11*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "Anything I can do to help?");
|
||||
|
||||
al_draw_text(game->_priv.font_console, al_map_rgb(255,255,255), game->viewport.width/2, (int)(game->viewport.height * 0.32+13*al_get_font_line_height(game->_priv.font_console)*1.25), ALLEGRO_ALIGN_CENTRE, "Press any key to continue _");
|
||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), game->viewport.width/2, (int)(game->viewport.height * 0.32+13*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, "Press any key to continue _");
|
||||
}
|
||||
|
||||
al_flip_display();
|
||||
|
|
Loading…
Add table
Reference in a new issue