mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-03-04 09:11:27 +01:00
work on about screen
This commit is contained in:
parent
add0c3d3ba
commit
5ce44c0e4e
3 changed files with 26 additions and 6 deletions
26
src/about.c
26
src/about.c
|
@ -5,7 +5,11 @@
|
||||||
|
|
||||||
void About_Draw(struct Game *game) {
|
void About_Draw(struct Game *game) {
|
||||||
al_draw_scaled_bitmap(game->about.image,0,0,al_get_bitmap_width(game->about.image),al_get_bitmap_height(game->about.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
al_draw_scaled_bitmap(game->about.image,0,0,al_get_bitmap_width(game->about.image),al_get_bitmap_height(game->about.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
||||||
al_draw_text(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, "Not implemented yet!");
|
float x = game->about.x;
|
||||||
|
if (x<0) x=0;
|
||||||
|
al_draw_bitmap_region(game->about.text_bitmap, 0, x*al_get_bitmap_height(game->about.text_bitmap), al_get_bitmap_width(game->about.text_bitmap), al_get_display_height(game->display)*0.8, al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, 0);
|
||||||
|
game->about.x+=0.0005;
|
||||||
|
if (game->about.x>1) game->about.x=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void About_Load(struct Game *game) {
|
void About_Load(struct Game *game) {
|
||||||
|
@ -31,15 +35,27 @@ int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
||||||
void About_Preload(struct Game *game) {
|
void About_Preload(struct Game *game) {
|
||||||
game->about.image = al_load_bitmap( "data/table.png" );
|
game->about.image = al_load_bitmap( "data/table.png" );
|
||||||
game->about.sample = al_load_sample( "data/about.flac" );
|
game->about.sample = al_load_sample( "data/about.flac" );
|
||||||
|
game->about.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.04,0 );
|
||||||
|
game->about.x = -0.05;
|
||||||
if (!game->about.sample){
|
if (!game->about.sample){
|
||||||
fprintf(stderr, "Audio clip sample not loaded!\n" );
|
fprintf(stderr, "Audio clip sample not loaded!\n" );
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
game->about.text_bitmap = al_create_bitmap(al_get_display_width(game->display)*0.4, al_get_display_height(game->display)*2);
|
||||||
|
al_set_target_bitmap(game->about.text_bitmap);
|
||||||
|
al_clear_to_color(al_map_rgba(255,0,0,0.5));
|
||||||
|
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0, ALLEGRO_ALIGN_LEFT, "Not implemented yet!");
|
||||||
|
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0.2*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, "Still not implemented!");
|
||||||
|
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0.4*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, "Please... leave me alone...");
|
||||||
|
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0.6*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, "I won't be implemented soon!");
|
||||||
|
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0.8*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, "Nope, still not implemented!");
|
||||||
|
|
||||||
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||||
|
|
||||||
al_set_target_bitmap(game->about.fade_bitmap);
|
al_set_target_bitmap(game->about.fade_bitmap);
|
||||||
al_draw_scaled_bitmap(game->about.image,0,0,al_get_bitmap_width(game->about.image),al_get_bitmap_height(game->about.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
al_draw_scaled_bitmap(game->about.image,0,0,al_get_bitmap_width(game->about.image),al_get_bitmap_height(game->about.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
||||||
al_draw_text(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, "Not implemented yet!");
|
al_draw_bitmap_region(game->about.text_bitmap, 0, 0, al_get_bitmap_width(game->about.text_bitmap), al_get_display_height(game->display)*0.8, al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, 0);
|
||||||
|
|
||||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||||
}
|
}
|
||||||
void About_Unload(struct Game *game) {
|
void About_Unload(struct Game *game) {
|
||||||
|
@ -47,7 +63,7 @@ void About_Unload(struct Game *game) {
|
||||||
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||||
al_set_target_bitmap(game->about.fade_bitmap);
|
al_set_target_bitmap(game->about.fade_bitmap);
|
||||||
al_draw_scaled_bitmap(game->about.image,0,0,al_get_bitmap_width(game->about.image),al_get_bitmap_height(game->about.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
al_draw_scaled_bitmap(game->about.image,0,0,al_get_bitmap_width(game->about.image),al_get_bitmap_height(game->about.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
||||||
al_draw_text(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, "Not implemented yet!");
|
al_draw_bitmap_region(game->about.text_bitmap, 0, game->about.x*al_get_bitmap_height(game->about.text_bitmap), al_get_bitmap_width(game->about.text_bitmap), al_get_display_height(game->display)*0.8, al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, 0);
|
||||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||||
for(int fadeloop=255; fadeloop>=0; fadeloop-=10){
|
for(int fadeloop=255; fadeloop>=0; fadeloop-=10){
|
||||||
al_wait_for_event(game->event_queue, &ev);
|
al_wait_for_event(game->event_queue, &ev);
|
||||||
|
@ -57,5 +73,7 @@ void About_Unload(struct Game *game) {
|
||||||
}
|
}
|
||||||
al_destroy_bitmap(game->about.image);
|
al_destroy_bitmap(game->about.image);
|
||||||
al_destroy_bitmap(game->about.fade_bitmap);
|
al_destroy_bitmap(game->about.fade_bitmap);
|
||||||
|
al_destroy_bitmap(game->about.text_bitmap);
|
||||||
al_destroy_sample(game->about.sample);
|
al_destroy_sample(game->about.sample);
|
||||||
|
al_destroy_font(game->about.font);
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ int main(int argc, char **argv){
|
||||||
game.loadstate = GAMESTATE_LOADING;
|
game.loadstate = GAMESTATE_LOADING;
|
||||||
PreloadGameState(&game);
|
PreloadGameState(&game);
|
||||||
LoadGameState(&game);
|
LoadGameState(&game);
|
||||||
game.loadstate = GAMESTATE_MENU;
|
game.loadstate = GAMESTATE_ABOUT;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
ALLEGRO_EVENT ev;
|
ALLEGRO_EVENT ev;
|
||||||
|
|
|
@ -41,8 +41,10 @@ struct Loading {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct About {
|
struct About {
|
||||||
ALLEGRO_BITMAP *fade_bitmap, *image;
|
ALLEGRO_BITMAP *fade_bitmap, *image, *text_bitmap;
|
||||||
ALLEGRO_SAMPLE *sample;
|
ALLEGRO_SAMPLE *sample;
|
||||||
|
ALLEGRO_FONT *font;
|
||||||
|
float x;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Map {
|
struct Map {
|
||||||
|
|
Loading…
Add table
Reference in a new issue