diff options
| author | Jakob Fries <jakob.fries@gmail.com> | 2007-07-21 16:33:01 +0000 |
|---|---|---|
| committer | Jakob Fries <jakob.fries@gmail.com> | 2007-07-21 16:33:01 +0000 |
| commit | d40868e913b9abce48de654871d2b0643c347dda (patch) | |
| tree | 42a8445f7d609b92c7bf61d225e63233829cf081 /src/engine | |
| parent | a622421cf30539352de1f73c886c525ca54b0e1d (diff) | |
| download | zcatch-d40868e913b9abce48de654871d2b0643c347dda.tar.gz zcatch-d40868e913b9abce48de654871d2b0643c347dda.zip | |
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/client/client.cpp | 10 | ||||
| -rw-r--r-- | src/engine/client/gfx.cpp | 12 | ||||
| -rw-r--r-- | src/engine/client/ui.cpp | 3 | ||||
| -rw-r--r-- | src/engine/client/ui.h | 1 | ||||
| -rw-r--r-- | src/engine/config_variables.h | 2 | ||||
| -rw-r--r-- | src/engine/interface.h | 2 |
6 files changed, 13 insertions, 17 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 80a69f8b..f3a345aa 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -173,8 +173,6 @@ public: // data to hold three snapshots // previous, - bool fullscreen; - enum { STATE_OFFLINE, @@ -193,8 +191,6 @@ public: state = s; } - void set_fullscreen(bool flag) { fullscreen = flag; } - void send_info() { recived_snapshots = 0; @@ -342,7 +338,7 @@ public: snapshot_part = 0; // init graphics and sound - if(!gfx_init(fullscreen)) + if(!gfx_init()) return; snd_init(); // sound is allowed to fail @@ -643,7 +639,6 @@ int main(int argc, char **argv) netaddr4 server_address(127, 0, 0, 1, 8303); //const char *name = "nameless jerk"; bool connect_at_once = false; - bool fullscreen = true; bool editor = false; // init network, need to be done first so we can do lookups @@ -684,7 +679,7 @@ int main(int argc, char **argv) else if(argv[i][0] == '-' && argv[i][1] == 'w' && argv[i][2] == 0) { // -w - fullscreen = false; + config.fullscreen = 0; } else if(argv[i][0] == '-' && argv[i][1] == 'e' && argv[i][2] == 0) { @@ -698,7 +693,6 @@ int main(int argc, char **argv) { // start the client client c; - c.set_fullscreen(fullscreen); c.run(connect_at_once ? &server_address : 0x0); } return 0; diff --git a/src/engine/client/gfx.cpp b/src/engine/client/gfx.cpp index 481c86b2..6e94ef26 100644 --- a/src/engine/client/gfx.cpp +++ b/src/engine/client/gfx.cpp @@ -33,8 +33,6 @@ static vec2 g_QuadTexture[4]; static opengl::vertex_buffer vertex_buffer; //static int screen_width = 800; //static int screen_height = 600; -static int screen_width = 1024; -static int screen_height = 768; static float rotation = 0; static int quads_drawing = 0; @@ -103,9 +101,9 @@ static void draw_quad(bool _bflush = false) } } -bool gfx_init(bool fullscreen) +bool gfx_init() { - if(!context.create(config.screen_width, config.screen_height, 24, 8, 16, 0, fullscreen?opengl::context::FLAG_FULLSCREEN:0)) + if(!context.create(config.screen_width, config.screen_height, 24, 8, 16, 0, config.fullscreen?opengl::context::FLAG_FULLSCREEN:0)) { dbg_msg("game", "failed to create gl context"); return false; @@ -124,7 +122,7 @@ bool gfx_init(bool fullscreen) context.version_minor(), context.version_rev());*/ - gfx_mapscreen(0,0,screen_width, screen_height); + gfx_mapscreen(0,0,config.screen_width, config.screen_height); // TODO: make wrappers for this glEnable(GL_BLEND); @@ -347,12 +345,12 @@ void gfx_swap() int gfx_screenwidth() { - return screen_width; + return config.screen_width; } int gfx_screenheight() { - return screen_height; + return config.screen_height; } void gfx_texture_set(int slot) diff --git a/src/engine/client/ui.cpp b/src/engine/client/ui.cpp index 4c13ca00..d7a0a4d8 100644 --- a/src/engine/client/ui.cpp +++ b/src/engine/client/ui.cpp @@ -32,7 +32,8 @@ float ui_mouse_world_y() { return mouse_wy; } int ui_mouse_button(int index) { return (mouse_buttons>>index)&1; } void ui_set_hot_item(void *id) { becomming_hot_item = id; } -void ui_set_active_item(void *id) { active_item = id; last_active_item = id; } +void ui_set_active_item(void *id) { active_item = id; if (id) last_active_item = id; } +void ui_clear_last_active_item() { last_active_item = 0; } void *ui_hot_item() { return hot_item; } void *ui_active_item() { return active_item; } void *ui_last_active_item() { return last_active_item; } diff --git a/src/engine/client/ui.h b/src/engine/client/ui.h index 9678453e..fb9208c1 100644 --- a/src/engine/client/ui.h +++ b/src/engine/client/ui.h @@ -18,6 +18,7 @@ int ui_mouse_button(int index); void ui_set_hot_item(void *id); void ui_set_active_item(void *id); +void ui_clear_last_active_item(); void *ui_hot_item(); void *ui_active_item(); void *ui_last_active_item(); diff --git a/src/engine/config_variables.h b/src/engine/config_variables.h index 27ca1931..590393bc 100644 --- a/src/engine/config_variables.h +++ b/src/engine/config_variables.h @@ -2,6 +2,8 @@ MACRO_CONFIG_INT(screen_width, 800, 0, 0) MACRO_CONFIG_INT(screen_height, 600, 0, 0) +MACRO_CONFIG_INT(fullscreen, 1, 0, 1) +MACRO_CONFIG_INT(color_depth, 24, 16, 24) MACRO_CONFIG_STR(player_name, 32, "nameless tee") MACRO_CONFIG_STR(clan_name, 32, "") MACRO_CONFIG_STR(password, 32, "") diff --git a/src/engine/interface.h b/src/engine/interface.h index 3509f0ca..311297de 100644 --- a/src/engine/interface.h +++ b/src/engine/interface.h @@ -57,7 +57,7 @@ int gfx_load_png(image_info *img, const char *filename); */ // graphics -bool gfx_init(bool fullscreen); // NOT EXPOSED +bool gfx_init(); // NOT EXPOSED void gfx_shutdown(); // NOT EXPOSED void gfx_swap(); // NOT EXPOSED |