about summary refs log tree commit diff
path: root/src/engine
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-20 22:19:40 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-20 22:19:40 +0000
commit52c8d980a2b65535df9853d9fcf08cc5e02b0448 (patch)
treeba88244a6e0bf80ef2d49730bc0df1e40b97da9d /src/engine
parent9c56ddd5fae42f49c8a73e5c0b5d9c7d81a43066 (diff)
downloadzcatch-52c8d980a2b65535df9853d9fcf08cc5e02b0448.tar.gz
zcatch-52c8d980a2b65535df9853d9fcf08cc5e02b0448.zip
fixed bugs in the ui code
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/client/ui.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/engine/client/ui.cpp b/src/engine/client/ui.cpp
index a28f44dc..8c8dba2c 100644
--- a/src/engine/client/ui.cpp
+++ b/src/engine/client/ui.cpp
@@ -44,6 +44,8 @@ int ui_update(float mx, float my, float mwx, float mwy, int buttons)
     mouse_wy = mwy;
     mouse_buttons = buttons;
     hot_item = becomming_hot_item;
+    if(active_item)
+    	hot_item = active_item;
     becomming_hot_item = 0;
     return 0;
 }
@@ -89,29 +91,25 @@ int ui_do_button(void *id, const char *text, int checked, float x, float y, floa
     int r = 0;
     int inside = ui_mouse_inside(x,y,w,h);
 
-	if(inside)
+	if(ui_active_item() == id)
 	{
-		ui_set_hot_item(id);
-
-		if(ui_mouse_button(0))
-			ui_set_active_item(id);
+		if(!ui_mouse_button(0))
+		{
+			if(inside)
+				r = 1;
+			ui_set_active_item(0);
+		}
 	}
-
-	// this gets rid of an annoying bug :< (but it creates another annoying bug :O)
-	if (!inside && ui_active_item() == id && !ui_mouse_button(0))
-		ui_set_active_item(0);
-
-	if(ui_active_item() == id && ui_hot_item() == id && !ui_mouse_button(0))
+	else if(ui_hot_item() == id)
 	{
-		ui_set_active_item(0);
-		r = 1;
+		if(ui_mouse_button(0))
+			ui_set_active_item(id);
 	}
-
-	if (!inside && ui_hot_item() == id)
-		ui_set_hot_item(0);
+	
+	if(inside)
+		ui_set_hot_item(id);
 
     draw_func(id, text, checked, x, y, w, h, extra);
-
     return r;
 }