Skip to content

Commit 8f3d9fb

Browse files
author
Semphris
committed
HUD GameObjects are no longer affected by zooming
1 parent cfcae9b commit 8f3d9fb

File tree

7 files changed

+10
-2
lines changed

7 files changed

+10
-2
lines changed

src/badguy/yeti.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Yeti::draw_hit_points(DrawingContext& context)
131131
{
132132
context.push_transform();
133133
context.set_translation(Vector(0, 0));
134+
context.transform().scale = 1.f;
134135

135136
for (int i = 0; i < hit_points; ++i)
136137
{

src/object/level_time.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ LevelTime::draw(DrawingContext& context)
100100
return;
101101
context.push_transform();
102102
context.set_translation(Vector(0, 0));
103+
context.transform().scale = 1.f;
103104

104105
if ((time_left > TIME_WARNING) || (int(g_game_time * 2.5f) % 2)) {
105106
std::stringstream ss;

src/object/text_object.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ TextObject::draw(DrawingContext& context)
186186
{
187187
context.push_transform();
188188
context.set_translation(Vector(0, 0));
189+
context.transform().scale = 1.f;
189190
if (m_fader)
190191
context.set_alpha(m_fade_progress);
191192

src/object/textscroller.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ TextScroller::draw(DrawingContext& context)
243243
{
244244
context.push_transform();
245245
context.set_translation(Vector(0, 0));
246+
context.transform().scale = 1.f;
246247

247248
const float ctx_w = static_cast<float>(context.get_width());
248249
const float ctx_h = static_cast<float>(context.get_height());

src/supertux/player_status_hud.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ PlayerStatusHUD::draw(DrawingContext& context)
7272

7373
context.push_transform();
7474
context.set_translation(Vector(0, 0));
75+
context.transform().scale = 1.f;
7576
if (!Editor::is_active())
7677
{
7778
if (coin_surface)

src/trigger/climbable.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Climbable::draw(DrawingContext& context)
104104
if (!climbed_by.empty() && !message.empty()) {
105105
context.push_transform();
106106
context.set_translation(Vector(0, 0));
107+
context.transform().scale = 1.f;
107108
Vector pos = Vector(0, static_cast<float>(SCREEN_HEIGHT) / 2.0f - Resources::normal_font->get_height() / 2.0f);
108109
context.color().draw_center_text(Resources::normal_font, _(message), pos, LAYER_HUD, Climbable::text_color);
109110
context.pop_transform();

src/trigger/secretarea_trigger.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "supertux/sector.hpp"
2626
#include "util/reader_mapping.hpp"
2727
#include "video/drawing_context.hpp"
28+
#include "video/font.hpp"
2829
#include "video/video_system.hpp"
2930
#include "video/viewport.hpp"
3031

@@ -102,8 +103,9 @@ SecretAreaTrigger::draw(DrawingContext& context)
102103
if (message_timer.started()) {
103104
context.push_transform();
104105
context.set_translation(Vector(0, 0));
105-
Vector pos = Vector(0, static_cast<float>(SCREEN_HEIGHT) / 2.0f - Resources::normal_font->get_height() / 2.0f);
106-
context.color().draw_center_text(Resources::normal_font, message, pos, LAYER_HUD, SecretAreaTrigger::text_color);
106+
context.transform().scale = 1.f;
107+
Vector pos = Vector(static_cast<float>(context.get_width()) / 2.0f, static_cast<float>(context.get_height()) / 2.0f - Resources::normal_font->get_height() / 2.0f);
108+
context.color().draw_text(Resources::normal_font, message, pos, FontAlignment::ALIGN_CENTER, LAYER_HUD, SecretAreaTrigger::text_color);
107109
context.pop_transform();
108110
}
109111
if (Editor::is_active() || g_debug.show_collision_rects) {

0 commit comments

Comments
 (0)