diff options
| author | Jakob Fries <jakob.fries@gmail.com> | 2007-12-10 23:28:37 +0000 |
|---|---|---|
| committer | Jakob Fries <jakob.fries@gmail.com> | 2007-12-10 23:28:37 +0000 |
| commit | c896ce54ea7bede13b8574aa185cad0783d26e55 (patch) | |
| tree | 31f027ba4f436f81b908c9fc872a754d8ba1bbab /src/game | |
| parent | f5066fe62bd62f8a5bfb488fe6da8d5648e431bc (diff) | |
| download | zcatch-c896ce54ea7bede13b8574aa185cad0783d26e55.tar.gz zcatch-c896ce54ea7bede13b8574aa185cad0783d26e55.zip | |
foundation for widescreen support... still needs to fix ingame gui
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/game_client.cpp | 45 | ||||
| -rw-r--r-- | src/game/client/menu2.cpp | 22 |
2 files changed, 43 insertions, 24 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index b8af6e06..a461fdee 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -43,6 +43,12 @@ enum CHATMODE_REMOTECONSOLE, }; +typedef struct +{ + float x, y, w, h; +} RECT; +RECT *ui2_screen(); + static int chat_mode = CHATMODE_NONE; bool menu_active = false; bool menu_game_active = false; @@ -526,14 +532,15 @@ extern int render_popup(const char *caption, const char *text, const char *butto static void render_loading(float percent) { gfx_clear(0.65f,0.78f,0.9f); - gfx_mapscreen(0,0,800.0f,600.0f); + RECT screen = *ui2_screen(); + gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); float tw; float w = 700; float h = 200; - float x = 800/2-w/2; - float y = 600/2-h/2; + float x = screen.w/2-w/2; + float y = screen.h/2-h/2; gfx_blend_normal(); @@ -1688,35 +1695,35 @@ int emoticon_selector_render() emoticon_selector_mouse.x += x; emoticon_selector_mouse.y += y; - if (length(emoticon_selector_mouse) > 70) - emoticon_selector_mouse = normalize(emoticon_selector_mouse) * 70; + if (length(emoticon_selector_mouse) > 140) + emoticon_selector_mouse = normalize(emoticon_selector_mouse) * 140; float selected_angle = get_angle(emoticon_selector_mouse) + 2*pi/24; if (selected_angle < 0) selected_angle += 2*pi; - //static bool mouse_down = false; bool return_now = false; int selected_emoticon = -1; - if (length(emoticon_selector_mouse) > 50) + if (length(emoticon_selector_mouse) > 100) selected_emoticon = (int)(selected_angle / (2*pi) * 12.0f); if(!inp_key_pressed(config.key_emoticon)) { return_now = true; emoticon_selector_active = false; - //emoticon_selector_inactive_override = true; } - gfx_mapscreen(0,0,400,300); + RECT screen = *ui2_screen(); + + gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); gfx_blend_normal(); gfx_texture_set(-1); gfx_quads_begin(); gfx_setcolor(0,0,0,0.3f); - draw_circle(200, 150, 80, 64); + draw_circle(screen.w/2, screen.h/2, 160, 64); gfx_quads_end(); gfx_texture_set(data->images[IMAGE_EMOTICONS].id); @@ -1730,12 +1737,12 @@ int emoticon_selector_render() bool selected = selected_emoticon == i; - float size = selected ? 48 : 32; + float size = selected ? 96 : 64; - float nudge_x = 60 * cos(angle); - float nudge_y = 60 * sin(angle); + float nudge_x = 120 * cos(angle); + float nudge_y = 120 * sin(angle); select_sprite(SPRITE_OOP + i); - gfx_quads_draw(200 + nudge_x, 150 + nudge_y, size, size); + gfx_quads_draw(screen.w/2 + nudge_x, screen.h/2 + nudge_y, size, size); } gfx_quads_end(); @@ -1743,7 +1750,7 @@ int emoticon_selector_render() gfx_texture_set(data->images[IMAGE_CURSOR].id); gfx_quads_begin(); gfx_setcolor(1,1,1,1); - gfx_quads_drawTL(emoticon_selector_mouse.x+200,emoticon_selector_mouse.y+150,12,12); + gfx_quads_drawTL(emoticon_selector_mouse.x+screen.w/2,emoticon_selector_mouse.y+screen.h/2,24,24); gfx_quads_end(); return return_now ? selected_emoticon : -1; @@ -1910,9 +1917,11 @@ void render_scoreboard(float x, float y, float w, int team, const char *title) void mapscreen_to_world(float center_x, float center_y, float zoom) { - const float default_zoom = 3.0f; - float width = 400*default_zoom*zoom; - float height = 300*default_zoom*zoom; + RECT screen = *ui2_screen(); + + const float default_zoom = 1.5f; + float width = screen.w*default_zoom*zoom; + float height = screen.h*default_zoom*zoom; gfx_mapscreen(center_x-width/2, center_y-height/2, center_x+width/2, center_y+height/2); } diff --git a/src/game/client/menu2.cpp b/src/game/client/menu2.cpp index f2752e05..bc23173b 100644 --- a/src/game/client/menu2.cpp +++ b/src/game/client/menu2.cpp @@ -89,13 +89,21 @@ typedef struct float x, y, w, h; } RECT; -//static float scale = 1.0f; -static RECT screen = { 0.0f, 0.0f, 800.0f, 600.0f }; +static RECT screen = { 0.0f, 0.0f, 848.0f, 480.0f }; extern void select_sprite(int id, int flags=0, int sx=0, int sy=0); RECT *ui2_screen() { + float aspect = gfx_screenaspect(); + float w, h; + + h = 600; + w = aspect*h; + + screen.w = w; + screen.h = h; + return &screen; } @@ -1625,7 +1633,8 @@ int menu2_render() return 0; } - gfx_mapscreen(0,0,800,600); + RECT screen = *ui2_screen(); + gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); static bool first = true; if(first) @@ -1649,7 +1658,6 @@ int menu2_render() color_tabbar_active = color_tabbar_active_outgame; } - RECT screen = *ui2_screen(); RECT tab_bar; RECT main_view; @@ -1799,6 +1807,7 @@ void modmenu_render() static int mouse_x = 0; static int mouse_y = 0; + // handle mouse movement float mx, my; { @@ -1812,8 +1821,9 @@ void modmenu_render() if(mouse_y > gfx_screenheight()) mouse_y = gfx_screenheight(); // update the ui - mx = (mouse_x/(float)gfx_screenwidth())*800.0f; - my = (mouse_y/(float)gfx_screenheight())*600.0f; + RECT *screen = ui2_screen(); + mx = (mouse_x/(float)gfx_screenwidth())*screen->w; + my = (mouse_y/(float)gfx_screenheight())*screen->h; int buttons = 0; if(inp_key_pressed(KEY_MOUSE_1)) buttons |= 1; |