timeline: fix TM_DrawDebug scaling

This commit is contained in:
Sebastian Krzyszkowiak 2017-08-07 02:01:15 +02:00
parent 4652efd6a9
commit b6eb181f1d

View file

@ -356,19 +356,19 @@ SYMBOL_INTERNAL void DrawQueue(struct Game *game, struct TM_Action* queue, int c
while (pom!=NULL) { while (pom!=NULL) {
int width = al_get_text_width(game->_priv.font_console, pom->name); int width = al_get_text_width(game->_priv.font_console, pom->name);
al_draw_filled_rectangle(pos-10, clipY, pos+width+10, clipY+ 60, pom->active ? al_map_rgba(255,255,255,192) : al_map_rgba(0, 0, 0, 0) ); al_draw_filled_rectangle(pos-(10/3200.0)*game->viewport.width, clipY, pos+width+(10/3200.0)*game->viewport.width, clipY+ (60/1800.0)*game->viewport.height, pom->active ? al_map_rgba(255,255,255,192) : al_map_rgba(0, 0, 0, 0) );
al_draw_rectangle(pos-10, clipY, pos+width+10, clipY+ 60, al_map_rgb(255,255,255), 2); al_draw_rectangle(pos-(10/3200.0)*game->viewport.width, clipY, pos+width+(10/3200.0)*game->viewport.width, clipY+ (60/1800.0)*game->viewport.height, al_map_rgb(255,255,255), 2);
al_draw_text(game->_priv.font_console, pom->active ? al_map_rgb(0,0,0) : al_map_rgb(255,255,255), pos, clipY, ALLEGRO_ALIGN_LEFT, pom->name); al_draw_text(game->_priv.font_console, pom->active ? al_map_rgb(0,0,0) : al_map_rgb(255,255,255), pos, clipY, ALLEGRO_ALIGN_LEFT, pom->name);
if (pom->delay) { if (pom->delay) {
al_draw_textf(game->_priv.font_console, al_map_rgb(255,255,255), pos, clipY - 50, ALLEGRO_ALIGN_LEFT, "%d", pom->delay); al_draw_textf(game->_priv.font_console, al_map_rgb(255,255,255), pos, clipY - (50/1800.0)*game->viewport.height, ALLEGRO_ALIGN_LEFT, "%d", pom->delay);
} }
if (pom->function == *runinbackground) { if (pom->function == *runinbackground) {
al_draw_textf(game->_priv.font_console, al_map_rgb(255,255,255), pos, clipY - 50, ALLEGRO_ALIGN_LEFT, "%s", (char*)pom->arguments->next->next->value); al_draw_textf(game->_priv.font_console, al_map_rgb(255,255,255), pos, clipY - (50/1800.0)*game->viewport.height, ALLEGRO_ALIGN_LEFT, "%s", (char*)pom->arguments->next->next->value);
} }
pos += width + 20; pos += width + (20/3200.0)*game->viewport.width;
pom = pom->next; pom = pom->next;
} }
} }
@ -386,12 +386,12 @@ SYMBOL_EXPORT void TM_DrawDebug(struct Game *game, struct Timeline* timeline, in
al_get_clipping_rectangle(&clipX, &clipY, &clipWidth, &clipHeight); al_get_clipping_rectangle(&clipX, &clipY, &clipWidth, &clipHeight);
al_use_transform(&trans); al_use_transform(&trans);
al_draw_filled_rectangle(clipX, clipY+clipHeight-340*(pos+1), clipX + clipWidth, clipY+clipHeight-340*pos, al_map_rgba(0,0,0,92)); al_draw_filled_rectangle(clipX, clipY+clipHeight-(340/1800.0)*game->viewport.height*(pos+1), clipX + clipWidth, clipY+clipHeight-(340/1800.0)*game->viewport.height*pos, al_map_rgba(0,0,0,92));
al_draw_textf(game->_priv.font_console, al_map_rgb(255,255,255), clipX + clipWidth / 2, clipY+clipHeight-340*(pos+1) + 10, ALLEGRO_ALIGN_CENTER, "Timeline: %s", timeline->name); al_draw_textf(game->_priv.font_console, al_map_rgb(255,255,255), clipX + clipWidth / 2, clipY+clipHeight-(340/1800.0)*game->viewport.height*(pos+1) + (10/1800.0)*game->viewport.height, ALLEGRO_ALIGN_CENTER, "Timeline: %s", timeline->name);
DrawQueue(game, timeline->queue, clipX + 25, clipY + clipHeight - 220 - 340*pos); DrawQueue(game, timeline->queue, clipX + (25/3200.0)*game->viewport.width, clipY + clipHeight - (220/1800.0)*game->viewport.height - (340/1800.0)*game->viewport.height*pos);
DrawQueue(game, timeline->background, clipX + 25, clipY + clipHeight - 100 - 340*pos); DrawQueue(game, timeline->background, clipX + (25/3200.0)*game->viewport.width, clipY + clipHeight - (100/1800.0)*game->viewport.height - (340/1800.0)*game->viewport.height*pos);
al_use_transform(&game->projection); al_use_transform(&game->projection);
} }