about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-01-13 22:03:32 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-01-13 22:03:32 +0000
commitc04df11f1ec1e3dd3e23fced9e1b127e5b05ab91 (patch)
tree5de978408407862833300fbdef37b200b2c51a9c /src/game/client
parente26b898b74405f7133778c2fae2609c986f040fc (diff)
downloadzcatch-c04df11f1ec1e3dd3e23fced9e1b127e5b05ab91.tar.gz
zcatch-c04df11f1ec1e3dd3e23fced9e1b127e5b05ab91.zip
editor update
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/gc_menu.cpp32
-rw-r--r--src/game/client/gc_ui.cpp16
-rw-r--r--src/game/client/gc_ui.h1
3 files changed, 37 insertions, 12 deletions
diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp
index 66137e89..c82f1f6f 100644
--- a/src/game/client/gc_menu.cpp
+++ b/src/game/client/gc_menu.cpp
@@ -631,7 +631,7 @@ static void menu2_render_serverbrowser(RECT main_view)
 	ui_vsplit_r(&view, 200.0f, &view, &server_details);
 
 	// server list
-	ui_hsplit_t(&view, 20.0f, &headers, &view);
+	ui_hsplit_t(&view, 16.0f, &headers, &view);
 	//ui_hsplit_b(&view, 110.0f, &view, &filters);
 	ui_hsplit_b(&view, 5.0f, &view, 0);
 	ui_hsplit_b(&view, 20.0f, &view, &status);
@@ -684,7 +684,7 @@ static void menu2_render_serverbrowser(RECT main_view)
 		//{COL_VERSION,	-1,						"Ver",		1, 45.0f, FIXED, {0}, {0}},
 		{-1,			-1,						" ",		1, 5.0f, 0, {0}, {0}},
 		//{COL_PROGRESS,	BROWSESORT_PROGRESSION,	"%",		1, 20.0f, FIXED, {0}, {0}},
-		{COL_PING,		BROWSESORT_PING,		"Ping",		1, 40.0f, FIXED, {0}, {0}},
+		{COL_PING,		BROWSESORT_PING,		"Ping",		1, 25.0f, FIXED, {0}, {0}},
 	};
 	
 	int num_cols = sizeof(cols)/sizeof(column);
@@ -785,6 +785,8 @@ static void menu2_render_serverbrowser(RECT main_view)
 			
 		int selected = strcmp(item->address, config.ui_server_address) == 0; //selected_index==item_index;
 		
+		
+			/*
 		if(selected)
 		{
 			selected_index = i;
@@ -832,9 +834,19 @@ static void menu2_render_serverbrowser(RECT main_view)
 		}
 		else
         {
-			ui_hsplit_t(&view, 20.0f, &row, &view);
+			*/
+			ui_hsplit_t(&view, 17.0f, &row, &view);
             select_hit_box = row;
-        }
+		//}
+
+		if(selected)
+		{
+			selected_index = i;
+			RECT r = row;
+			ui_margin(&r, 1.5f, &r);
+			ui_draw_rect(&r, vec4(1,1,1,0.5f), CORNER_ALL, 4.0f);
+		}
+
 
 		// make sure that only those in view can be selected
 		if(row.y+row.h > original_view.y)
@@ -875,18 +887,18 @@ static void menu2_render_serverbrowser(RECT main_view)
 					ui_draw_browse_icon(0x100, &button);
 			}
 			else if(id == COL_NAME)
-				ui_do_label(&button, item->name, 15.0f, -1);
+				ui_do_label(&button, item->name, 12.0f, -1);
 			else if(id == COL_MAP)
-				ui_do_label(&button, item->map, 15.0f, -1);
+				ui_do_label(&button, item->map, 12.0f, -1);
 			else if(id == COL_PLAYERS)
 			{
 				sprintf(temp, "%i/%i", item->num_players, item->max_players);
-				ui_do_label(&button, temp, 15.0f, 1);
+				ui_do_label(&button, temp, 12.0f, 1);
 			}
 			else if(id == COL_PING)
 			{
 				sprintf(temp, "%i", item->latency);
-				ui_do_label(&button, temp, 15.0f, 1);
+				ui_do_label(&button, temp, 12.0f, 1);
 			}
 			else if(id == COL_PROGRESS)
 			{
@@ -899,7 +911,7 @@ static void menu2_render_serverbrowser(RECT main_view)
 				const char *version = item->version;
 				if(strcmp(version, "0.3 e2d7973c6647a13c") == 0) // TODO: remove me later on
 					version = "0.3.0";
-				ui_do_label(&button, version, 15.0f, 1);
+				ui_do_label(&button, version, 12.0f, 1);
 			}			
 			else if(id == COL_GAMETYPE)
 			{
@@ -907,7 +919,7 @@ static void menu2_render_serverbrowser(RECT main_view)
 				if(item->game_type == GAMETYPE_DM) type = "DM";
 				else if(item->game_type == GAMETYPE_TDM) type = "TDM";
 				else if(item->game_type == GAMETYPE_CTF) type = "CTF";
-				ui_do_label(&button, type, 15.0f, 0);
+				ui_do_label(&button, type, 12.0f, 0);
 			}
 		}
 	}
diff --git a/src/game/client/gc_ui.cpp b/src/game/client/gc_ui.cpp
index 8d47c971..25693d02 100644
--- a/src/game/client/gc_ui.cpp
+++ b/src/game/client/gc_ui.cpp
@@ -27,6 +27,7 @@ void ui_set_hot_item(const void *id) { becomming_hot_item = id; }
 void ui_set_active_item(const void *id) { active_item = id; if (id) last_active_item = id; }
 void ui_clear_last_active_item() { last_active_item = 0; }
 const void *ui_hot_item() { return hot_item; }
+const void *ui_next_hot_item() { return becomming_hot_item; }
 const void *ui_active_item() { return active_item; }
 const void *ui_last_active_item() { return last_active_item; }
 
@@ -234,25 +235,36 @@ void ui_hmargin(const RECT *original, float cut, RECT *other_rect)
     other_rect->h = r.h - 2*cut;
 }
 
+
 int ui_do_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, const void *extra)
 {
     /* logic */
     int ret = 0;
     int inside = ui_mouse_inside(r);
+	static int button_used = 0;
 
 	if(ui_active_item() == id)
 	{
-		if(!ui_mouse_button(0))
+		if(!ui_mouse_button(button_used))
 		{
 			if(inside && checked >= 0)
-				ret = 1;
+				ret = 1+button_used;
 			ui_set_active_item(0);
 		}
 	}
 	else if(ui_hot_item() == id)
 	{
 		if(ui_mouse_button(0))
+		{
+			ui_set_active_item(id);
+			button_used = 0;
+		}
+		
+		if(ui_mouse_button(1))
+		{
 			ui_set_active_item(id);
+			button_used = 1;
+		}
 	}
 	
 	if(inside)
diff --git a/src/game/client/gc_ui.h b/src/game/client/gc_ui.h
index 92b8e19a..26c4dcdb 100644
--- a/src/game/client/gc_ui.h
+++ b/src/game/client/gc_ui.h
@@ -35,6 +35,7 @@ void ui_set_hot_item(const void *id);
 void ui_set_active_item(const void *id);
 void ui_clear_last_active_item();
 const void *ui_hot_item();
+const void *ui_next_hot_item();
 const void *ui_active_item();
 const void *ui_last_active_item();