mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-08 06:06:43 +01:00
make fonts sharper (integer positioning)
This commit is contained in:
parent
dd29fc6f5b
commit
c39fea9c98
3 changed files with 23 additions and 15 deletions
|
@ -98,13 +98,14 @@ void* Gamestate_Load(struct Game *game, void (*progress)(struct Game *game)) {
|
|||
data->text_bitmap = al_create_bitmap(game->viewport.height*1.6*0.4, game->viewport.height*3.225);
|
||||
al_set_target_bitmap(data->text_bitmap);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,0));
|
||||
al_draw_text(data->font, al_map_rgb(0,0,0), 0.5*al_get_bitmap_width(data->text_bitmap), 0.015*al_get_bitmap_height(data->text_bitmap), ALLEGRO_ALIGN_CENTRE, "Super Derpy: Muffin Attack");
|
||||
al_draw_text(data->font, al_map_rgb(0,0,0), 0.5*al_get_bitmap_width(data->text_bitmap), 0.035*al_get_bitmap_height(data->text_bitmap), ALLEGRO_ALIGN_CENTRE, "Version 0.1a (Development Preview)");
|
||||
al_draw_text(data->font, al_map_rgb(0,0,0), (int)(0.5*al_get_bitmap_width(data->text_bitmap)), (int)(0.015*al_get_bitmap_height(data->text_bitmap)), ALLEGRO_ALIGN_CENTRE, "Super Derpy: Muffin Attack");
|
||||
al_draw_text(data->font, al_map_rgb(0,0,0), (int)(0.5*al_get_bitmap_width(data->text_bitmap)), (int)(0.035*al_get_bitmap_height(data->text_bitmap)), ALLEGRO_ALIGN_CENTRE, "Version 0.1a (Development Preview)");
|
||||
(*progress)(game);
|
||||
|
||||
al_set_target_bitmap(data->text_bitmap);
|
||||
float y=0.07;
|
||||
void draw_text(char* text) {
|
||||
al_draw_text(data->font, al_map_rgb(0,0,0), 0, y*al_get_bitmap_height(data->text_bitmap), ALLEGRO_ALIGN_LEFT, text);
|
||||
al_draw_text(data->font, al_map_rgb(0,0,0), 0, (int)(y*al_get_bitmap_height(data->text_bitmap)), ALLEGRO_ALIGN_LEFT, text);
|
||||
y+=0.0131;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,6 +119,7 @@ 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 );
|
||||
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);
|
||||
|
|
30
src/utils.c
30
src/utils.c
|
@ -44,8 +44,8 @@ void DrawHorizontalGradientRect(float x, float y, float w, float h, ALLEGRO_COLO
|
|||
}
|
||||
|
||||
void DrawTextWithShadow(ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, char const *text) {
|
||||
al_draw_text(font, al_map_rgba(0,0,0,128), x+1, y+1, flags, text);
|
||||
al_draw_text(font, color, x, y, flags, text);
|
||||
al_draw_text(font, al_map_rgba(0,0,0,128), (int)x+1, (int)y+1, flags, text);
|
||||
al_draw_text(font, color, (int)x, (int)y, flags, text);
|
||||
}
|
||||
|
||||
void FadeGamestate(struct Game *game, bool in) {
|
||||
|
@ -180,18 +180,13 @@ void FatalError(struct Game *game, bool fatal, char* format, ...) {
|
|||
PrintConsole(game, text);
|
||||
}
|
||||
|
||||
al_set_target_backbuffer(game->display);
|
||||
al_clear_to_color(al_map_rgb(0,0,170));
|
||||
al_flip_display();
|
||||
al_rest(1.1);
|
||||
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
ALLEGRO_KEYBOARD_STATE kb;
|
||||
al_get_keyboard_state(&kb);
|
||||
|
||||
int i;
|
||||
for (i=0; i<ALLEGRO_KEY_MAX; i++) {
|
||||
if (al_key_down(&kb, i)) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
al_set_target_backbuffer(game->display);
|
||||
al_clear_to_color(al_map_rgb(0,0,170));
|
||||
|
@ -225,6 +220,17 @@ void FatalError(struct Game *game, bool fatal, char* format, ...) {
|
|||
}
|
||||
|
||||
al_flip_display();
|
||||
|
||||
ALLEGRO_KEYBOARD_STATE kb;
|
||||
al_get_keyboard_state(&kb);
|
||||
|
||||
int i;
|
||||
for (i=0; i<ALLEGRO_KEY_MAX; i++) {
|
||||
if (al_key_down(&kb, i)) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue