about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/client.cpp10
-rw-r--r--src/engine/client/gfx.cpp12
-rw-r--r--src/engine/client/ui.cpp3
-rw-r--r--src/engine/client/ui.h1
4 files changed, 10 insertions, 16 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();