float x_pos = pos_x;
float y_pos = pos_y + 24*index - menu_height/2 + 12;
int shadow_size = 2;
- int text_width = int(normal_font->get_text_width(pitem.text));
- int input_width = int(normal_font->get_text_width(pitem.input) + 10);
+ int text_width = int(Resources::normal_font->get_text_width(pitem.text));
+ int input_width = int(Resources::normal_font->get_text_width(pitem.input) + 10);
int list_width = 0;
float left = pos_x - menu_width/2 + 16;
float right = pos_x + menu_width/2 - 16;
if(pitem.list.size() > 0) {
- list_width = (int) normal_font->get_text_width(pitem.list[pitem.selected]);
+ list_width = (int) Resources::normal_font->get_text_width(pitem.list[pitem.selected]);
}
if (arrange_left)
{
case MN_INACTIVE:
{
- context.draw_text(normal_font, pitem.text,
- Vector(pos_x, y_pos - int(normal_font->get_height()/2)),
+ context.draw_text(Resources::normal_font, pitem.text,
+ Vector(pos_x, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_CENTER, LAYER_GUI, inactive_color);
break;
}
}
case MN_LABEL:
{
- context.draw_text(big_font, pitem.text,
- Vector(pos_x, y_pos - int(big_font->get_height()/2)),
+ context.draw_text(Resources::big_font, pitem.text,
+ Vector(pos_x, y_pos - int(Resources::big_font->get_height()/2)),
ALIGN_CENTER, LAYER_GUI, label_color);
break;
}
if(pitem.kind == MN_TEXTFIELD || pitem.kind == MN_NUMFIELD)
{
if(active_item == index)
- context.draw_text(normal_font,
+ context.draw_text(Resources::normal_font,
pitem.get_input_with_symbol(true),
- Vector(right, y_pos - int(normal_font->get_height()/2)),
+ Vector(right, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_RIGHT, LAYER_GUI, field_color);
else
- context.draw_text(normal_font,
+ context.draw_text(Resources::normal_font,
pitem.get_input_with_symbol(false),
- Vector(right, y_pos - int(normal_font->get_height()/2)),
+ Vector(right, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_RIGHT, LAYER_GUI, field_color);
}
else
- context.draw_text(normal_font, pitem.input,
- Vector(right, y_pos - int(normal_font->get_height()/2)),
+ context.draw_text(Resources::normal_font, pitem.input,
+ Vector(right, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_RIGHT, LAYER_GUI, field_color);
- context.draw_text(normal_font, pitem.text,
- Vector(left, y_pos - int(normal_font->get_height()/2)),
+ context.draw_text(Resources::normal_font, pitem.text,
+ Vector(left, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_LEFT, LAYER_GUI, text_color);
break;
}
{
float roff = arrow_left->get_width();
// Draw left side
- context.draw_text(normal_font, pitem.text,
- Vector(left, y_pos - int(normal_font->get_height()/2)),
+ context.draw_text(Resources::normal_font, pitem.text,
+ Vector(left, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_LEFT, LAYER_GUI, text_color);
// Draw right side
context.draw_surface(arrow_right.get(),
Vector(right - roff, y_pos - 8),
LAYER_GUI);
- context.draw_text(normal_font, pitem.list[pitem.selected],
- Vector(right - roff, y_pos - int(normal_font->get_height()/2)),
+ context.draw_text(Resources::normal_font, pitem.list[pitem.selected],
+ Vector(right - roff, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_RIGHT, LAYER_GUI, text_color);
break;
}
case MN_BACK:
{
- context.draw_text(normal_font, pitem.text,
- Vector(pos_x, y_pos - int(normal_font->get_height()/2)),
+ context.draw_text(Resources::Resources::normal_font, pitem.text,
+ Vector(pos_x, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_CENTER, LAYER_GUI, text_color);
context.draw_surface(back.get(),
Vector(x_pos + text_width/2 + 16, y_pos - 8),
case MN_TOGGLE:
{
- context.draw_text(normal_font, pitem.text,
- Vector(pos_x - menu_width/2 + 16, y_pos - (normal_font->get_height()/2)),
+ context.draw_text(Resources::normal_font, pitem.text,
+ Vector(pos_x - menu_width/2 + 16, y_pos - (Resources::normal_font->get_height()/2)),
ALIGN_LEFT, LAYER_GUI, text_color);
if(pitem.toggled)
break;
}
case MN_ACTION:
- context.draw_text(normal_font, pitem.text,
- Vector(pos_x, y_pos - int(normal_font->get_height()/2)),
+ context.draw_text(Resources::normal_font, pitem.text,
+ Vector(pos_x, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_CENTER, LAYER_GUI, text_color);
break;
case MN_GOTO:
- context.draw_text(normal_font, pitem.text,
- Vector(pos_x, y_pos - int(normal_font->get_height()/2)),
+ context.draw_text(Resources::normal_font, pitem.text,
+ Vector(pos_x, y_pos - int(Resources::normal_font->get_height()/2)),
ALIGN_CENTER, LAYER_GUI, text_color);
break;
}
float menu_width = 0;
for(unsigned int i = 0; i < items.size(); ++i)
{
- Font* font = normal_font;
+ Font* font = Resources::Resources::normal_font;
if(items[i]->kind == MN_LABEL)
- font = big_font;
+ font = Resources::big_font;
float w = font->get_text_width(items[i]->text) +
- big_font->get_text_width(items[i]->input) + 16;
+ Resources::big_font->get_text_width(items[i]->input) + 16;
if(items[i]->kind == MN_TOGGLE)
w += 32;
if (!items[active_item]->help.empty())
{
- int text_width = (int) normal_font->get_text_width(items[active_item]->help);
- int text_height = (int) normal_font->get_text_height(items[active_item]->help);
+ int text_width = (int) Resources::normal_font->get_text_width(items[active_item]->help);
+ int text_height = (int) Resources::normal_font->get_text_height(items[active_item]->help);
Rect text_rect(pos_x - text_width/2 - 8,
SCREEN_HEIGHT - 48 - text_height/2 - 4,
16.0f,
LAYER_GUI-10);
- context.draw_text(normal_font, items[active_item]->help,
+ context.draw_text(Resources::normal_font, items[active_item]->help,
Vector(pos_x, SCREEN_HEIGHT - 48 - text_height/2),
ALIGN_CENTER, LAYER_GUI);
}
MenuItem::set_help(const std::string& help_text)
{
std::string overflow;
- help = normal_font->wrap_to_width(help_text, 600, &overflow);
+ help = Resources::normal_font->wrap_to_width(help_text, 600, &overflow);
while (!overflow.empty())
{
help += "\n";
- help += normal_font->wrap_to_width(overflow, 600, &overflow);
+ help += Resources::normal_font->wrap_to_width(overflow, 600, &overflow);
}
}
class Menu;
-class MenuManager // FIXME: temporary name
+class MenuManager
{
public:
static std::vector<Menu*> last_menus;
context.push_transform();
context.set_alpha(alpha);
- context.draw_text(normal_font, text, position, ALIGN_LEFT, LAYER_OBJECTS+1, FloatingText::text_color);
+ context.draw_text(Resources::normal_font, text, position, ALIGN_LEFT, LAYER_OBJECTS+1, FloatingText::text_color);
context.pop_transform();
}
Surface* time_surf = time_surface.get();
if (time_surf) {
- float all_width = time_surf->get_width() + normal_font->get_text_width(time_text);
+ float all_width = time_surf->get_width() + Resources::normal_font->get_text_width(time_text);
context.draw_surface(time_surf, Vector((SCREEN_WIDTH - all_width)/2, BORDER_Y + 1), LAYER_FOREGROUND1);
- context.draw_text(normal_font, time_text, Vector((SCREEN_WIDTH - all_width)/2 + time_surf->get_width(), BORDER_Y), ALIGN_LEFT, LAYER_FOREGROUND1, LevelTime::text_color);
+ context.draw_text(Resources::normal_font, time_text, Vector((SCREEN_WIDTH - all_width)/2 + time_surf->get_width(), BORDER_Y), ALIGN_LEFT, LAYER_FOREGROUND1, LevelTime::text_color);
}
}
pos(0, 0)
{
this->name = name;
- font = normal_font;
+ font = Resources::normal_font;
centered = false;
}
TextObject::set_font(const std::string& name)
{
if(name == "normal") {
- font = normal_font;
+ font = Resources::normal_font;
} else if(name == "big") {
- font = big_font;
+ font = Resources::big_font;
} else if(name == "small") {
- font = small_font;
+ font = Resources::small_font;
} else {
log_warning << "Unknown font '" << name << "'." << std::endl;
- font = normal_font;
+ font = Resources::normal_font;
}
}
switch(format_char)
{
case ' ':
- return small_font;
+ return Resources::small_font;
break;
case '-':
- return big_font;
+ return Resources::big_font;
break;
case '\t':
case '*':
case '#':
case '!':
- return normal_font;
+ return Resources::normal_font;
break;
default:
- return normal_font;
+ return Resources::normal_font;
log_warning << "Unknown format_char: '" << format_char << "'" << std::endl;
break;
}
InfoBoxLine::InfoBoxLine(char format_char, const std::string& text) :
lineType(NORMAL),
- font(normal_font),
+ font(Resources::normal_font),
color(),
text(text),
image(0)
LevelIntro::draw(DrawingContext& context)
{
const Statistics& stats = level->stats;
- int py = static_cast<int>(SCREEN_HEIGHT / 2 - normal_font->get_height() / 2);
+ int py = static_cast<int>(SCREEN_HEIGHT / 2 - Resources::normal_font->get_height() / 2);
context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(0.0f, 0.0f, 0.0f, 1.0f), 0);
{
- context.draw_center_text(normal_font, level->get_name(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::header_color);
- py += static_cast<int>(normal_font->get_height());
+ context.draw_center_text(Resources::normal_font, level->get_name(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::header_color);
+ py += static_cast<int>(Resources::normal_font->get_height());
}
std::string author = level->get_author();
if ((author != "") && (author != "SuperTux Team")) {
std::string author_text = std::string(_("contributed by ")) + author;
- context.draw_center_text(small_font, author_text, Vector(0, py), LAYER_FOREGROUND1, LevelIntro::author_color);
- py += static_cast<int>(small_font->get_height());
+ context.draw_center_text(Resources::small_font, author_text, Vector(0, py), LAYER_FOREGROUND1, LevelIntro::author_color);
+ py += static_cast<int>(Resources::small_font->get_height());
}
py += 32;
py += 32;
{
- context.draw_center_text(normal_font, std::string("- ") + _("Best Level Statistics") + std::string(" -"), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_hdr_color);
- py += static_cast<int>(normal_font->get_height());
+ context.draw_center_text(Resources::normal_font, std::string("- ") + _("Best Level Statistics") + std::string(" -"), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_hdr_color);
+ py += static_cast<int>(Resources::normal_font->get_height());
}
{
std::stringstream ss;
ss << _("Coins") << ": " << Statistics::coins_to_string((best_level_statistics && (best_level_statistics->coins >= 0)) ? best_level_statistics->coins : 0, stats.total_coins);
- context.draw_center_text(normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_color);
- py += static_cast<int>(normal_font->get_height());
+ context.draw_center_text(Resources::normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_color);
+ py += static_cast<int>(Resources::normal_font->get_height());
}
{
std::stringstream ss;
ss << _("Secrets") << ": " << Statistics::secrets_to_string((best_level_statistics && (best_level_statistics->coins >= 0)) ? best_level_statistics->secrets : 0, stats.total_secrets);
- context.draw_center_text(normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
- py += static_cast<int>(normal_font->get_height());
+ context.draw_center_text(Resources::normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
+ py += static_cast<int>(Resources::normal_font->get_height());
}
{
std::stringstream ss;
ss << _("Time") << ": " << Statistics::time_to_string((best_level_statistics && (best_level_statistics->coins >= 0)) ? best_level_statistics->time : 0);
- context.draw_center_text(normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
- py += static_cast<int>(normal_font->get_height());
+ context.draw_center_text(Resources::normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
+ py += static_cast<int>(Resources::normal_font->get_height());
}
}
Scripting::init_squirrel(g_config->enable_script_debugger);
timelog("resources");
- load_shared();
+ Resources::load_shared();
timelog(0);
delete g_main_loop;
g_main_loop = NULL;
- unload_shared();
+ Resources::unload_shared();
quit_audio();
if(g_config)
char str[60];
snprintf(str, sizeof(str), "%3.1f", fps_fps);
const char* fpstext = "FPS";
- context.draw_text(small_font, fpstext, Vector(SCREEN_WIDTH - small_font->get_text_width(fpstext) - small_font->get_text_width(" 99999") - BORDER_X, BORDER_Y + 20), ALIGN_LEFT, LAYER_HUD);
- context.draw_text(small_font, str, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y + 20), ALIGN_RIGHT, LAYER_HUD);
+ context.draw_text(Resources::small_font, fpstext,
+ Vector(SCREEN_WIDTH - Resources::small_font->get_text_width(fpstext) - Resources::small_font->get_text_width(" 99999") - BORDER_X,
+ BORDER_Y + 20), ALIGN_LEFT, LAYER_HUD);
+ context.draw_text(Resources::small_font, str, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y + 20), ALIGN_RIGHT, LAYER_HUD);
}
void
Surface* coin_surf = coin_surface.get();
if (coin_surf) {
- context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - fixed_font->get_text_width(coins_text), BORDER_Y + 1), LAYER_HUD);
+ context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - Resources::fixed_font->get_text_width(coins_text),
+ BORDER_Y + 1), LAYER_HUD);
}
- context.draw_text(fixed_font, coins_text, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y), ALIGN_RIGHT, LAYER_HUD, PlayerStatus::text_color);
+ context.draw_text(Resources::fixed_font, coins_text, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y), ALIGN_RIGHT, LAYER_HUD, PlayerStatus::text_color);
context.pop_transform();
}
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//#include <config.h>
-//#include "supertux/resources.hpp"
+#include "supertux/resources.hpp"
#include "gui/mousecursor.hpp"
#include "sprite/sprite_manager.hpp"
#include "supertux/tile_manager.hpp"
#include "video/font.hpp"
-MouseCursor* mouse_cursor = NULL;
+MouseCursor* Resources::mouse_cursor = NULL;
-Font* fixed_font = NULL;
-Font* normal_font = NULL;
-Font* small_font = NULL;
-Font* big_font = NULL;
+Font* Resources::fixed_font = NULL;
+Font* Resources::normal_font = NULL;
+Font* Resources::small_font = NULL;
+Font* Resources::big_font = NULL;
/* Load graphics/sounds shared between all levels: */
-void load_shared()
+void
+Resources::load_shared()
{
/* Load the mouse-cursor */
mouse_cursor = new MouseCursor("images/engine/menu/mousecursor.png");
}
/* Free shared data: */
-void unload_shared()
+void
+Resources::unload_shared()
{
/* Free global images: */
delete normal_font;
class Font;
class MouseCursor;
-extern MouseCursor* mouse_cursor;
+class Resources
+{
+public:
+ static MouseCursor* mouse_cursor;
-extern Font* fixed_font;
-extern Font* normal_font;
-extern Font* small_font;
-extern Font* big_font;
+ static Font* fixed_font;
+ static Font* normal_font;
+ static Font* small_font;
+ static Font* big_font;
-void load_shared();
-void unload_shared();
+public:
+ static void load_shared();
+ static void unload_shared();
+};
#endif
// skip draw if stats were declared invalid
if (!valid) return;
- context.draw_text(small_font, std::string("- ") + _("Best Level Statistics") + " -", Vector((WMAP_INFO_LEFT_X + WMAP_INFO_RIGHT_X) / 2, WMAP_INFO_TOP_Y1), ALIGN_CENTER, LAYER_GUI,Statistics::header_color);
+ context.draw_text(Resources::small_font, std::string("- ") + _("Best Level Statistics") + " -",
+ Vector((WMAP_INFO_LEFT_X + WMAP_INFO_RIGHT_X) / 2, WMAP_INFO_TOP_Y1),
+ ALIGN_CENTER, LAYER_GUI,Statistics::header_color);
std::string caption_buf;
std::string stat_buf;
break;
}
- context.draw_text(small_font, caption_buf, Vector(WMAP_INFO_LEFT_X, posy), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
- context.draw_text(small_font, stat_buf, Vector(WMAP_INFO_RIGHT_X, posy), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
- posy += small_font->get_height() + 2;
+ context.draw_text(Resources::small_font, caption_buf, Vector(WMAP_INFO_LEFT_X, posy), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
+ context.draw_text(Resources::small_font, stat_buf, Vector(WMAP_INFO_RIGHT_X, posy), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
+ posy += Resources::small_font->get_height() + 2;
}
}
context.draw_surface(backdrop, Vector(bd_x, bd_y), LAYER_GUI);
context.pop_transform();
- context.draw_text(normal_font, _("You"), Vector(col2_x, row1_y), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
- context.draw_text(normal_font, _("Best"), Vector(col3_x, row1_y), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
+ context.draw_text(Resources::normal_font, _("You"), Vector(col2_x, row1_y), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
+ context.draw_text(Resources::normal_font, _("Best"), Vector(col3_x, row1_y), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
- context.draw_text(normal_font, _("Coins"), Vector(col2_x-16, row3_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
+ context.draw_text(Resources::normal_font, _("Coins"), Vector(col2_x-16, row3_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
int coins_best = (best_stats && (best_stats->coins > coins)) ? best_stats->coins : coins;
int total_coins_best = (best_stats && (best_stats->total_coins > total_coins)) ? best_stats->total_coins : total_coins;
- context.draw_text(normal_font, coins_to_string(coins, total_coins), Vector(col2_x, row3_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
- context.draw_text(normal_font, coins_to_string(coins_best, total_coins_best), Vector(col3_x, row3_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+ context.draw_text(Resources::normal_font, coins_to_string(coins, total_coins), Vector(col2_x, row3_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+ context.draw_text(Resources::normal_font, coins_to_string(coins_best, total_coins_best), Vector(col3_x, row3_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
- context.draw_text(normal_font, _("Secrets"), Vector(col2_x-16, row4_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
+ context.draw_text(Resources::normal_font, _("Secrets"), Vector(col2_x-16, row4_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
int secrets_best = (best_stats && (best_stats->secrets > secrets)) ? best_stats->secrets : secrets;
int total_secrets_best = (best_stats && (best_stats->total_secrets > total_secrets)) ? best_stats->total_secrets : total_secrets;
- context.draw_text(normal_font, secrets_to_string(secrets, total_secrets), Vector(col2_x, row4_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
- context.draw_text(normal_font, secrets_to_string(secrets_best, total_secrets_best), Vector(col3_x, row4_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+ context.draw_text(Resources::normal_font, secrets_to_string(secrets, total_secrets), Vector(col2_x, row4_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+ context.draw_text(Resources::normal_font, secrets_to_string(secrets_best, total_secrets_best), Vector(col3_x, row4_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
- context.draw_text(normal_font, _("Time"), Vector(col2_x-16, row2_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
+ context.draw_text(Resources::normal_font, _("Time"), Vector(col2_x-16, row2_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
float time_best = (best_stats && (best_stats->time < time)) ? best_stats->time : time;
- context.draw_text(normal_font, time_to_string(time), Vector(col2_x, row2_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
- context.draw_text(normal_font, time_to_string(time_best), Vector(col3_x, row2_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+ context.draw_text(Resources::normal_font, time_to_string(time), Vector(col2_x, row2_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+ context.draw_text(Resources::normal_font, time_to_string(time_best), Vector(col3_x, row2_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
}
void
// FIXME: Add something to scale the frame to the resolution of the screen
context.draw_surface(frame.get(), Vector(0,0),LAYER_FOREGROUND1);
- context.draw_text(small_font, "SuperTux " PACKAGE_VERSION "\n",
+ context.draw_text(Resources::small_font, "SuperTux " PACKAGE_VERSION "\n",
Vector(5, SCREEN_HEIGHT - 50), ALIGN_LEFT, LAYER_FOREGROUND1);
- context.draw_text(small_font,
+ context.draw_text(Resources::small_font,
_(
"Copyright (c) 2007 SuperTux Devel Team\n"
"This game comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to\n"
"redistribute it under certain conditions; see the file COPYING for details.\n"
),
- Vector(5, SCREEN_HEIGHT - 50 + small_font->get_height() + 5),
+ Vector(5, SCREEN_HEIGHT - 50 + Resources::small_font->get_height() + 5),
ALIGN_LEFT, LAYER_FOREGROUND1);
}
if (climbed_by) {
context.push_transform();
context.set_translation(Vector(0, 0));
- Vector pos = Vector(0, SCREEN_HEIGHT/2 - normal_font->get_height()/2);
- context.draw_center_text(normal_font, _("Up we go..."), pos, LAYER_GUI, Climbable::text_color);
+ Vector pos = Vector(0, SCREEN_HEIGHT/2 - Resources::normal_font->get_height()/2);
+ context.draw_center_text(Resources::normal_font, _("Up we go..."), pos, LAYER_GUI, Climbable::text_color);
context.pop_transform();
}
}
if (message_timer.started()) {
context.push_transform();
context.set_translation(Vector(0, 0));
- Vector pos = Vector(0, SCREEN_HEIGHT/2 - normal_font->get_height()/2);
- context.draw_center_text(normal_font, _("You found a secret area!"), pos, LAYER_GUI, SecretAreaTrigger::text_color);
+ Vector pos = Vector(0, SCREEN_HEIGHT/2 - Resources::normal_font->get_height()/2);
+ context.draw_center_text(Resources::normal_font, _("You found a secret area!"), pos, LAYER_GUI, SecretAreaTrigger::text_color);
context.pop_transform();
}
if (message_timer.check()) {
if(level->title == "")
get_level_title(*level);
- context.draw_text(normal_font, level->title,
+ context.draw_text(Resources::normal_font, level->title,
Vector(SCREEN_WIDTH/2,
- SCREEN_HEIGHT - normal_font->get_height() - 30),
+ SCREEN_HEIGHT - Resources::normal_font->get_height() - 30),
ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::level_title_color);
// if level is solved, draw level picture behind stats
if (special_tile->pos == tux->get_tile_pos()) {
/* Display an in-map message in the map, if any as been selected */
if(!special_tile->map_message.empty() && !special_tile->passive_message)
- context.draw_text(normal_font, special_tile->map_message,
+ context.draw_text(Resources::normal_font, special_tile->map_message,
Vector(SCREEN_WIDTH/2,
- SCREEN_HEIGHT - normal_font->get_height() - 60),
+ SCREEN_HEIGHT - Resources::normal_font->get_height() - 60),
ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::message_color);
break;
}
// display teleporter messages
Teleporter* teleporter = at_teleporter(tux->get_tile_pos());
if (teleporter && (teleporter->message != "")) {
- Vector pos = Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - normal_font->get_height() - 30);
- context.draw_text(normal_font, teleporter->message, pos, ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::teleporter_message_color);
+ Vector pos = Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - Resources::normal_font->get_height() - 30);
+ context.draw_text(Resources::normal_font, teleporter->message, pos, ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::teleporter_message_color);
}
}
/* Display a passive message in the map, if needed */
if(passive_message_timer.started())
- context.draw_text(normal_font, passive_message,
- Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - normal_font->get_height() - 60),
+ context.draw_text(Resources::normal_font, passive_message,
+ Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - Resources::normal_font->get_height() - 60),
ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::message_color);
context.pop_transform();