effect_progress(),
effect_start_time(),
arrange_left(),
- active_item(),
- checkbox(),
- checkbox_checked(),
- back(),
- arrow_left(),
- arrow_right()
+ active_item()
{
MenuManager::all_menus.push_back(this);
effect_progress = 0.0f;
effect_start_time = 0.0f;
-
- checkbox = Surface::create("images/engine/menu/checkbox-unchecked.png");
- checkbox_checked = Surface::create("images/engine/menu/checkbox-checked.png");
- back = Surface::create("images/engine/menu/arrow-back.png");
- arrow_left = Surface::create("images/engine/menu/arrow-left.png");
- arrow_right = Surface::create("images/engine/menu/arrow-right.png");
}
Menu::~Menu()
}
case MN_STRINGSELECT:
{
- float roff = arrow_left->get_width();
+ float roff = Resources::arrow_left->get_width();
// Draw left side
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_left,
+ context.draw_surface(Resources::arrow_left,
Vector(right - list_width - roff - roff, y_pos - 8),
LAYER_GUI);
- context.draw_surface(arrow_right,
+ context.draw_surface(Resources::arrow_right,
Vector(right - roff, y_pos - 8),
LAYER_GUI);
context.draw_text(Resources::normal_font, pitem.list[pitem.selected],
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,
+ context.draw_surface(Resources::back,
Vector(x_pos + text_width/2 + 16, y_pos - 8),
LAYER_GUI);
break;
ALIGN_LEFT, LAYER_GUI, text_color);
if(pitem.toggled)
- context.draw_surface(checkbox_checked,
- Vector(x_pos + (menu_width/2-16) - checkbox->get_width(), y_pos - 8),
+ context.draw_surface(Resources::checkbox_checked,
+ Vector(x_pos + (menu_width/2-16) - Resources::checkbox->get_width(), y_pos - 8),
LAYER_GUI + 1);
else
- context.draw_surface(checkbox,
- Vector(x_pos + (menu_width/2-16) - checkbox->get_width(), y_pos - 8),
+ context.draw_surface(Resources::checkbox,
+ Vector(x_pos + (menu_width/2-16) - Resources::checkbox->get_width(), y_pos - 8),
LAYER_GUI + 1);
break;
}
FontPtr Resources::small_font;
FontPtr Resources::big_font;
+SurfacePtr Resources::checkbox;
+SurfacePtr Resources::checkbox_checked;
+SurfacePtr Resources::back;
+SurfacePtr Resources::arrow_left;
+SurfacePtr Resources::arrow_right;
+
/* Load graphics/sounds shared between all levels: */
void
Resources::load_shared()
small_font.reset(new Font(Font::VARIABLE, "fonts/white-small.stf", 1));
big_font.reset(new Font(Font::VARIABLE, "fonts/white-big.stf", 3));
+ /* Load menu images */
+ checkbox = Surface::create("images/engine/menu/checkbox-unchecked.png");
+ checkbox_checked = Surface::create("images/engine/menu/checkbox-checked.png");
+ back = Surface::create("images/engine/menu/arrow-back.png");
+ arrow_left = Surface::create("images/engine/menu/arrow-left.png");
+ arrow_right = Surface::create("images/engine/menu/arrow-right.png");
+
tile_manager = new TileManager();
sprite_manager = new SpriteManager();
}
void
Resources::unload_shared()
{
+ /* Free menu images */
+ checkbox.reset();
+ checkbox_checked.reset();
+ back.reset();
+ arrow_left.reset();
+ arrow_right.reset();
+
/* Free global images: */
fixed_font.reset();
normal_font.reset();
#define HEADER_SUPERTUX_SUPERTUX_RESOURCES_HPP
#include "video/font_ptr.hpp"
+#include "video/surface_ptr.hpp"
class MouseCursor;
static FontPtr small_font;
static FontPtr big_font;
+ static SurfacePtr checkbox;
+ static SurfacePtr checkbox_checked;
+ static SurfacePtr back;
+ static SurfacePtr arrow_left;
+ static SurfacePtr arrow_right;
+
public:
static void load_shared();
static void unload_shared();