2008-08-27 15:48:50 +00:00
|
|
|
#include <base/vmath.hpp>
|
|
|
|
|
|
|
|
#include <game/client/component.hpp>
|
2008-08-30 21:31:01 +00:00
|
|
|
#include <game/client/ui.hpp>
|
2008-08-27 15:48:50 +00:00
|
|
|
|
|
|
|
class MENUS : public COMPONENT
|
|
|
|
{
|
|
|
|
static vec4 gui_color;
|
|
|
|
static vec4 color_tabbar_inactive_outgame;
|
|
|
|
static vec4 color_tabbar_active_outgame;
|
|
|
|
static vec4 color_tabbar_inactive_ingame;
|
|
|
|
static vec4 color_tabbar_active_ingame;
|
|
|
|
static vec4 color_tabbar_inactive;
|
|
|
|
static vec4 color_tabbar_active;
|
|
|
|
|
|
|
|
static vec4 button_color_mul(const void *id);
|
|
|
|
|
|
|
|
static void ui_draw_browse_icon(int what, const RECT *r);
|
|
|
|
static void ui_draw_menu_button(const void *id, const char *text, int checked, const RECT *r, const void *extra);
|
|
|
|
static void ui_draw_keyselect_button(const void *id, const char *text, int checked, const RECT *r, const void *extra);
|
|
|
|
static void ui_draw_menu_tab_button(const void *id, const char *text, int checked, const RECT *r, const void *extra);
|
|
|
|
static void ui_draw_settings_tab_button(const void *id, const char *text, int checked, const RECT *r, const void *extra);
|
|
|
|
static void ui_draw_grid_header(const void *id, const char *text, int checked, const RECT *r, const void *extra);
|
|
|
|
static void ui_draw_list_row(const void *id, const char *text, int checked, const RECT *r, const void *extra);
|
|
|
|
static void ui_draw_checkbox_common(const void *id, const char *text, const char *boxtext, const RECT *r);
|
|
|
|
static void ui_draw_checkbox(const void *id, const char *text, int checked, const RECT *r, const void *extra);
|
|
|
|
static void ui_draw_checkbox_number(const void *id, const char *text, int checked, const RECT *r, const void *extra);
|
2008-09-23 13:28:57 +00:00
|
|
|
static int ui_do_edit_box(void *id, const RECT *rect, char *str, int str_size, float font_size, bool hidden=false);
|
2008-09-24 14:28:26 +00:00
|
|
|
|
2008-08-27 15:48:50 +00:00
|
|
|
static float ui_do_scrollbar_v(const void *id, const RECT *rect, float current);
|
|
|
|
static float ui_do_scrollbar_h(const void *id, const RECT *rect, float current);
|
|
|
|
|
|
|
|
static int ui_do_key_reader(void *id, const RECT *rect, int key);
|
2008-10-05 18:27:20 +00:00
|
|
|
static void ui_do_getbuttons(int start, int stop, RECT view);
|
2008-08-27 15:48:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
POPUP_NONE=0,
|
|
|
|
POPUP_FIRST_LAUNCH,
|
|
|
|
POPUP_CONNECTING,
|
|
|
|
POPUP_DISCONNECTED,
|
|
|
|
POPUP_PASSWORD,
|
|
|
|
POPUP_QUIT,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2008-10-01 18:40:09 +00:00
|
|
|
PAGE_NEWS=1,
|
2008-08-27 15:48:50 +00:00
|
|
|
PAGE_GAME,
|
|
|
|
PAGE_SERVER_INFO,
|
2008-09-29 11:34:49 +00:00
|
|
|
PAGE_CALLVOTE,
|
2008-08-27 15:48:50 +00:00
|
|
|
PAGE_INTERNET,
|
|
|
|
PAGE_LAN,
|
|
|
|
PAGE_FAVORITES,
|
|
|
|
PAGE_SETTINGS,
|
|
|
|
PAGE_SYSTEM,
|
|
|
|
};
|
|
|
|
|
|
|
|
int game_page;
|
|
|
|
int popup;
|
|
|
|
int active_page;
|
|
|
|
bool menu_active;
|
|
|
|
vec2 mouse_pos;
|
2008-09-12 07:20:26 +00:00
|
|
|
|
|
|
|
int64 last_input;
|
2008-08-30 09:28:31 +00:00
|
|
|
|
|
|
|
// TODO: this is a bit ugly but.. well.. yeah
|
|
|
|
enum { MAX_INPUTEVENTS = 32 };
|
|
|
|
static INPUT_EVENT inputevents[MAX_INPUTEVENTS];
|
|
|
|
static int num_inputevents;
|
2008-08-27 15:48:50 +00:00
|
|
|
|
2008-09-29 11:34:49 +00:00
|
|
|
// some settings
|
|
|
|
float button_height;
|
|
|
|
|
2008-08-27 15:48:50 +00:00
|
|
|
// for graphic settings
|
|
|
|
bool need_restart;
|
2008-09-29 11:34:49 +00:00
|
|
|
|
|
|
|
// for call vote
|
|
|
|
int callvote_selectedplayer;
|
|
|
|
int callvote_selectedmap;
|
2008-08-27 15:48:50 +00:00
|
|
|
|
|
|
|
// found in menus.cpp
|
|
|
|
int render();
|
|
|
|
void render_background();
|
2008-08-30 22:38:56 +00:00
|
|
|
//void render_loading(float percent);
|
2008-08-27 15:48:50 +00:00
|
|
|
int render_menubar(RECT r);
|
|
|
|
void render_news(RECT main_view);
|
2008-09-29 11:34:49 +00:00
|
|
|
|
|
|
|
// found in menus_ingame.cpp
|
2008-08-27 15:48:50 +00:00
|
|
|
void render_game(RECT main_view);
|
|
|
|
void render_serverinfo(RECT main_view);
|
2008-09-29 11:34:49 +00:00
|
|
|
void render_servercontrol(RECT main_view);
|
|
|
|
void render_servercontrol_kick(RECT main_view);
|
|
|
|
void render_servercontrol_map(RECT main_view);
|
2008-08-27 15:48:50 +00:00
|
|
|
|
|
|
|
// found in menus_browser.cpp
|
2008-09-24 14:28:26 +00:00
|
|
|
SERVER_INFO current_server_info; // should this be here?
|
2008-09-04 18:42:26 +00:00
|
|
|
int selected_index;
|
|
|
|
void render_serverbrowser_serverlist(RECT view);
|
|
|
|
void render_serverbrowser_serverdetail(RECT view);
|
|
|
|
void render_serverbrowser_filters(RECT view);
|
2008-08-27 15:48:50 +00:00
|
|
|
void render_serverbrowser(RECT main_view);
|
|
|
|
|
|
|
|
// found in menus_settings.cpp
|
|
|
|
void render_settings_player(RECT main_view);
|
|
|
|
void render_settings_controls(RECT main_view);
|
|
|
|
void render_settings_graphics(RECT main_view);
|
|
|
|
void render_settings_sound(RECT main_view);
|
|
|
|
void render_settings(RECT main_view);
|
|
|
|
|
|
|
|
public:
|
|
|
|
MENUS();
|
|
|
|
|
2008-08-30 22:38:56 +00:00
|
|
|
void render_loading(float percent);
|
|
|
|
|
|
|
|
bool is_active() const { return menu_active; }
|
|
|
|
|
2008-08-27 15:48:50 +00:00
|
|
|
void init();
|
|
|
|
|
|
|
|
virtual void on_statechange(int new_state, int old_state);
|
|
|
|
virtual void on_reset();
|
|
|
|
virtual void on_render();
|
|
|
|
virtual bool on_input(INPUT_EVENT e);
|
|
|
|
virtual bool on_mousemove(float x, float y);
|
|
|
|
};
|