static const float MENU_REPEAT_INITIAL = 0.4f;
static const float MENU_REPEAT_RATE = 0.1f;
-extern SDL_Surface* g_screen;
-
Menu::Menu() :
hit_item(),
pos_x(),
effect_progress = 0.0f;
effect_start_time = 0.0f;
- checkbox.reset(new Surface("images/engine/menu/checkbox-unchecked.png"));
- checkbox_checked.reset(new Surface("images/engine/menu/checkbox-checked.png"));
- back.reset(new Surface("images/engine/menu/arrow-back.png"));
- arrow_left.reset(new Surface("images/engine/menu/arrow-left.png"));
- arrow_right.reset(new Surface("images/engine/menu/arrow-right.png"));
+ 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()
if(active_item == index)
{
float blink = (sinf(real_time * M_PI * 1.0f)/2.0f + 0.5f) * 0.5f + 0.25f;
- context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2 + 10 - 2, y_pos - 12 - 2),
- Vector(pos_x + menu_width/2 - 10 + 2, y_pos + 12 + 2)),
+ context.draw_filled_rect(Rectf(Vector(pos_x - menu_width/2 + 10 - 2, y_pos - 12 - 2),
+ Vector(pos_x + menu_width/2 - 10 + 2, y_pos + 12 + 2)),
Color(1.0f, 1.0f, 1.0f, blink),
14.0f,
LAYER_GUI-10);
- context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2 + 10, y_pos - 12),
- Vector(pos_x + menu_width/2 - 10, y_pos + 12)),
+ context.draw_filled_rect(Rectf(Vector(pos_x - menu_width/2 + 10, y_pos - 12),
+ Vector(pos_x + menu_width/2 - 10, y_pos + 12)),
Color(1.0f, 1.0f, 1.0f, 0.5f),
12.0f,
LAYER_GUI-10);
}
/* Draw a transparent background */
- context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2-4, pos_y - menu_height/2 - 10-4),
- Vector(pos_x + menu_width/2+4, pos_y - menu_height/2 + 10 + menu_height+4)),
+ context.draw_filled_rect(Rectf(Vector(pos_x - menu_width/2-4, pos_y - menu_height/2 - 10-4),
+ Vector(pos_x + menu_width/2+4, pos_y - menu_height/2 + 10 + menu_height+4)),
Color(0.2f, 0.3f, 0.4f, 0.8f),
20.0f,
LAYER_GUI-10);
- context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2, pos_y - menu_height/2 - 10),
- Vector(pos_x + menu_width/2, pos_y - menu_height/2 + 10 + menu_height)),
+ context.draw_filled_rect(Rectf(Vector(pos_x - menu_width/2, pos_y - menu_height/2 - 10),
+ Vector(pos_x + menu_width/2, pos_y - menu_height/2 + 10 + menu_height)),
Color(0.6f, 0.7f, 0.8f, 0.5f),
16.0f,
LAYER_GUI-10);
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,
+ Rectf text_rect(pos_x - text_width/2 - 8,
SCREEN_HEIGHT - 48 - text_height/2 - 4,
pos_x + text_width/2 + 8,
SCREEN_HEIGHT - 48 + text_height/2 + 4);
- context.draw_filled_rect(Rect(text_rect.p1 - Vector(4,4),
- text_rect.p2 + Vector(4,4)),
+ context.draw_filled_rect(Rectf(text_rect.p1 - Vector(4,4),
+ text_rect.p2 + Vector(4,4)),
Color(0.2f, 0.3f, 0.4f, 0.8f),
16.0f,
LAYER_GUI-10);