#include "object/text_object.hpp"
#include "scripting/squirrel_util.hpp"
-#include "supertux/main.hpp"
+#include "supertux/globals.hpp"
#include "supertux/resources.hpp"
#include "video/drawing_context.hpp"
-TextObject::TextObject(std::string name) :
+TextObject::TextObject(std::string name_) :
font(),
text(),
- fading(0),
- fadetime(0),
- visible(false),
+ fading(0),
+ fadetime(0),
+ visible(false),
centered(),
anchor(ANCHOR_MIDDLE),
pos(0, 0)
{
- this->name = name;
- font = normal_font;
+ this->name = name_;
+ font = Resources::normal_font;
centered = false;
}
if (name.empty())
return;
- Scripting::expose_object(vm, table_idx, dynamic_cast<Scripting::Text *>(this), name, false);
+ scripting::expose_object(vm, table_idx, dynamic_cast<scripting::Text *>(this), name, false);
}
void
if (name.empty())
return;
- Scripting::unexpose_object(vm, table_idx, name);
+ scripting::unexpose_object(vm, table_idx, name);
}
void
-TextObject::set_font(const std::string& name)
+TextObject::set_font(const std::string& name_)
{
- if(name == "normal") {
- font = normal_font;
- } else if(name == "big") {
- font = big_font;
- } else if(name == "small") {
- font = small_font;
+ if(name_ == "normal") {
+ font = Resources::normal_font;
+ } else if(name_ == "big") {
+ font = Resources::big_font;
+ } else if(name_ == "small") {
+ font = Resources::small_font;
} else {
- log_warning << "Unknown font '" << name << "'." << std::endl;
- font = normal_font;
+ log_warning << "Unknown font '" << name_ << "'." << std::endl;
+ font = Resources::normal_font;
}
}
void
-TextObject::set_text(const std::string& text)
+TextObject::set_text(const std::string& text_)
{
- this->text = text;
+ this->text = text_;
}
void
-TextObject::fade_in(float fadetime)
+TextObject::fade_in(float fadetime_)
{
- this->fadetime = fadetime;
- fading = fadetime;
+ this->fadetime = fadetime_;
+ fading = fadetime_;
}
void
-TextObject::fade_out(float fadetime)
+TextObject::fade_out(float fadetime_)
{
- this->fadetime = fadetime;
- fading = -fadetime;
+ this->fadetime = fadetime_;
+ fading = -fadetime_;
}
void
-TextObject::set_visible(bool visible)
+TextObject::set_visible(bool visible_)
{
- this->visible = visible;
+ this->visible = visible_;
fading = 0;
}
void
-TextObject::set_centered(bool centered)
+TextObject::set_centered(bool centered_)
{
- this->centered = centered;
+ this->centered = centered_;
}
void
float width = 500;
float height = 70;
- Vector spos = pos + get_anchor_pos(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
+ Vector spos = pos + get_anchor_pos(Rectf(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
width, height, anchor);
context.draw_filled_rect(spos, Vector(width, height),