about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-01-12 15:07:57 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-01-12 15:07:57 +0000
commit99f0a47d6b03b005d0a7dae064cb6eb7cb4f60b5 (patch)
tree6c453bff72668da6cc6f6e28621356004a06d441 /src/engine/client
parent2aba180f8c1bfa2680b1f660148de1dc82b03298 (diff)
downloadzcatch-99f0a47d6b03b005d0a7dae064cb6eb7cb4f60b5.tar.gz
zcatch-99f0a47d6b03b005d0a7dae064cb6eb7cb4f60b5.zip
first round of code cleanup
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/ec_client.c5
-rw-r--r--src/engine/client/ec_gfx.c228
-rw-r--r--src/engine/client/ec_ui.c292
-rw-r--r--src/engine/client/ec_ui.h74
4 files changed, 22 insertions, 577 deletions
diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c
index b07edf78..bae8cb5c 100644
--- a/src/engine/client/ec_client.c
+++ b/src/engine/client/ec_client.c
@@ -9,7 +9,6 @@
 #include <engine/e_system.h>
 #include <engine/e_engine.h>
 #include <engine/e_interface.h>
-#include "ec_ui.h"
 
 #include <engine/e_protocol.h>
 #include <engine/e_snapshot.h>
@@ -499,10 +498,6 @@ static void client_debug_render()
 		(int)(1.0f/frametime_avg));
 	gfx_quads_text(2, 2, 16, buffer);
 
-	sprintf(buffer, "ui: %p %p", ui_hot_item(), ui_active_item());
-	gfx_quads_text(2, 16, 16, buffer);
-
-	
 	/* render rates */
 	{
 		int i;
diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c
index a87818bc..754d5d63 100644
--- a/src/engine/client/ec_gfx.c
+++ b/src/engine/client/ec_gfx.c
@@ -82,59 +82,6 @@ static const unsigned char null_texture_data[] = {
 	0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, 
 };
 
-
-typedef struct
-{
-	float m_CharStartTable[256];
-	float m_CharEndTable[256];
-	int font_texture;
-} pretty_font;
-
-pretty_font default_font = 
-{
-{
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-        0, 0.421875, 0.359375, 0.265625, 0.25, 0.1875, 0.25, 0.4375, 0.390625, 0.390625, 0.34375, 0.28125, 0.421875, 0.390625, 0.4375, 0.203125, 
-        0.265625, 0.28125, 0.28125, 0.265625, 0.25, 0.28125, 0.28125, 0.265625, 0.28125, 0.265625, 0.4375, 0.421875, 0.3125, 0.28125, 0.3125, 0.3125, 
-        0.25, 0.234375, 0.28125, 0.265625, 0.265625, 0.296875, 0.3125, 0.25, 0.25, 0.421875, 0.28125, 0.265625, 0.328125, 0.171875, 0.234375, 0.25, 
-        0.28125, 0.234375, 0.265625, 0.265625, 0.28125, 0.265625, 0.234375, 0.09375, 0.234375, 0.234375, 0.265625, 0.390625, 0.203125, 0.390625, 0.296875, 0.28125, 
-        0.375, 0.3125, 0.3125, 0.3125, 0.296875, 0.3125, 0.359375, 0.296875, 0.3125, 0.4375, 0.390625, 0.328125, 0.4375, 0.203125, 0.3125, 0.296875, 
-        0.3125, 0.296875, 0.359375, 0.3125, 0.328125, 0.3125, 0.296875, 0.203125, 0.296875, 0.296875, 0.328125, 0.375, 0.421875, 0.375, 0.28125, 0.3125, 
-        0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 
-        0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 
-        0, 0.421875, 0.3125, 0.265625, 0.25, 0.25, 0.421875, 0.265625, 0.375, 0.21875, 0.375, 0.328125, 0.3125, 0, 0.21875, 0.28125, 
-        0.359375, 0.28125, 0.34375, 0.34375, 0.421875, 0.3125, 0.265625, 0.421875, 0.421875, 0.34375, 0.375, 0.328125, 0.125, 0.125, 0.125, 0.296875, 
-        0.234375, 0.234375, 0.234375, 0.234375, 0.234375, 0.234375, 0.109375, 0.265625, 0.296875, 0.296875, 0.296875, 0.296875, 0.375, 0.421875, 0.359375, 0.390625, 
-        0.21875, 0.234375, 0.25, 0.25, 0.25, 0.25, 0.25, 0.296875, 0.21875, 0.265625, 0.265625, 0.265625, 0.265625, 0.234375, 0.28125, 0.3125, 
-        0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.1875, 0.3125, 0.3125, 0.3125, 0.3125, 0.3125, 0.375, 0.421875, 0.359375, 0.390625, 
-        0.3125, 0.3125, 0.296875, 0.296875, 0.296875, 0.296875, 0.296875, 0.28125, 0.28125, 0.3125, 0.3125, 0.3125, 0.3125, 0.296875, 0.3125, 0.296875, 
-},
-{
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-        0.2, 0.5625, 0.625, 0.71875, 0.734375, 0.796875, 0.765625, 0.546875, 0.59375, 0.59375, 0.65625, 0.703125, 0.546875, 0.59375, 0.5625, 0.6875, 
-        0.71875, 0.609375, 0.703125, 0.703125, 0.71875, 0.703125, 0.703125, 0.6875, 0.703125, 0.703125, 0.5625, 0.546875, 0.671875, 0.703125, 0.671875, 0.671875, 
-        0.734375, 0.75, 0.734375, 0.734375, 0.734375, 0.6875, 0.6875, 0.734375, 0.71875, 0.5625, 0.65625, 0.765625, 0.703125, 0.8125, 0.75, 0.734375, 
-        0.734375, 0.765625, 0.71875, 0.71875, 0.703125, 0.71875, 0.75, 0.890625, 0.75, 0.75, 0.71875, 0.59375, 0.6875, 0.59375, 0.6875, 0.703125, 
-        0.5625, 0.671875, 0.6875, 0.671875, 0.671875, 0.671875, 0.625, 0.671875, 0.671875, 0.5625, 0.546875, 0.703125, 0.5625, 0.78125, 0.671875, 0.671875, 
-        0.6875, 0.671875, 0.65625, 0.671875, 0.65625, 0.671875, 0.6875, 0.78125, 0.6875, 0.671875, 0.65625, 0.609375, 0.546875, 0.609375, 0.703125, 0.671875, 
-        0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 
-        0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 
-        0, 0.5625, 0.671875, 0.734375, 0.734375, 0.734375, 0.546875, 0.71875, 0.609375, 0.765625, 0.609375, 0.65625, 0.671875, 0, 0.765625, 0.703125, 
-        0.625, 0.703125, 0.640625, 0.640625, 0.609375, 0.671875, 0.703125, 0.546875, 0.5625, 0.578125, 0.609375, 0.65625, 0.859375, 0.859375, 0.859375, 0.671875, 
-        0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.84375, 0.734375, 0.6875, 0.6875, 0.6875, 0.6875, 0.5625, 0.609375, 0.640625, 0.59375, 
-        0.734375, 0.75, 0.734375, 0.734375, 0.734375, 0.734375, 0.734375, 0.6875, 0.765625, 0.71875, 0.71875, 0.71875, 0.71875, 0.75, 0.734375, 0.6875, 
-        0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.796875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.5625, 0.609375, 0.625, 0.59375, 
-        0.6875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.703125, 0.703125, 0.671875, 0.671875, 0.671875, 0.671875, 0.671875, 0.6875, 0.671875, 
-},
-0
-};
-
-double extra_kerning[256*256] = {0};
-
-pretty_font *current_font = &default_font;
-
 static void flush()
 {
 	if(num_vertices == 0)
@@ -288,10 +235,6 @@ int gfx_init()
 
 	/* set vsync as needed */
 	gfx_set_vsync(config.gfx_vsync);
-
-	/* UGLY as hell, please remove */
-    current_font->font_texture = gfx_load_texture("data/big_font.png", IMG_AUTO);
-
 	return 1;
 }
 
@@ -302,10 +245,6 @@ float gfx_screenaspect()
 
 void gfx_clear_mask(int fill)
 {
-	/*if(fill)
-		glClearDepth(0.0f);
-	else*/
-	
 	int i;
 	glGetIntegerv(GL_DEPTH_WRITEMASK, &i);
 	glDepthMask(GL_TRUE);
@@ -514,35 +453,6 @@ int gfx_load_texture_raw(int w, int h, int format, const void *data, int store_f
 	mem_free(tmpdata);
 	return tex;
 }
-/*
-int gfx_load_mip_texture_raw(int w, int h, int format, const void *data)
-{
-	// grab texture
-	int tex = first_free_texture;
-	first_free_texture = textures[tex].next;
-	textures[tex].next = -1;
-	
-	// set data and return
-	// TODO: should be RGBA, not BGRA
-	dbg_msg("gfx", "%d = %dx%d", tex, w, h);
-	dbg_assert(format == IMG_RGBA, "not an RGBA image");
-
-	unsigned mip_w = w;
-	unsigned mip_h = h;
-	unsigned level = 0;
-	const unsigned char *ptr = (const unsigned char*)data;
-	while(mip_w > 0 && mip_h > 0)
-	{
-		dbg_msg("gfx mip", "%d = %dx%d", level, mip_w, mip_h);
-		textures[tex].tex.data2d_mip(mip_w, mip_h, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, level, ptr);
-		level++;
-		ptr = ptr + mip_w*mip_h*4;
-		mip_w = mip_w>>1;
-		mip_h = mip_h>>1;
-	}
-	return tex;
-}
-*/
 
 /* simple uncompressed RGBA loaders */
 int gfx_load_texture(const char *filename, int store_format)
@@ -667,8 +577,7 @@ void gfx_swap()
 			for(; index < 1000; index++)
 			{
 				IOHANDLE io;
-				sprintf(wholepath, "/home/kma/Desktop/prq/blogimg/editor/screenshot%04d.png", index);
-				/*engine_savepath(filename, wholepath, sizeof(wholepath));*/
+				engine_savepath(filename, wholepath, sizeof(wholepath));
 				
 				io = io_open(wholepath, IOFLAG_READ);
 				if(io)
@@ -955,12 +864,16 @@ static int word_length(const char *text)
 	}
 }
 
-static float pretty_r=1;
-static float pretty_g=1;
-static float pretty_b=1;
-static float pretty_a=1;
+static float text_r=1;
+static float text_g=1;
+static float text_b=1;
+static float text_a=1;
 
-FONT *gfx_font_set;
+static FONT_SET *default_font_set = 0;
+void gfx_text_set_default_font(void *font)
+{
+	default_font_set = (FONT_SET *)font;
+}
 
 float gfx_text_raw(void *font_set_v, float x, float y, float size, const char *text, int length)
 {
@@ -983,6 +896,9 @@ float gfx_text_raw(void *font_set_v, float x, float y, float size, const char *t
     actual_size = size * fake_to_screen_y;
     size = actual_size / fake_to_screen_y;
 
+    if(!font_set)
+    	font_set = default_font_set;
+
     font = font_set_pick(font_set, actual_size);
 
     if (length < 0)
@@ -1003,7 +919,7 @@ float gfx_text_raw(void *font_set_v, float x, float y, float size, const char *t
         if (i == 0)
             gfx_setcolor(0.0f, 0.0f, 0.0f, 0.3f);
         else
-            gfx_setcolor(pretty_r, pretty_g, pretty_b, pretty_a);
+            gfx_setcolor(text_r, text_g, text_b, text_a);
         
         while (to_render--)
         {
@@ -1062,124 +978,24 @@ float gfx_text_width(void *font_set_v, float size, const char *text, int length)
     FONT_SET *font_set = font_set_v;
     FONT *font;
     float fake_to_screen_y = (screen_height/(screen_y1-screen_y0));
-
     int actual_size = size * fake_to_screen_y;
     size = actual_size / fake_to_screen_y;
+    
+    if(!font_set)
+    	font_set = default_font_set;
 
     font = font_set_pick(font_set, actual_size);
-
     return font_text_width(font, text, size, length);
 }
 
-void gfx_pretty_text_color(float r, float g, float b, float a)
-{
-	pretty_r = r;
-	pretty_g = g;
-	pretty_b = b;
-	pretty_a = a;
-}
-
-float gfx_pretty_text_raw(float x, float y, float size, const char *text_, int length)
-{
-	const unsigned char *text = (unsigned char *)text_;
-	const float spacing = 0.05f;
-	gfx_texture_set(current_font->font_texture);
-	gfx_quads_begin();
-	gfx_setcolor(pretty_r, pretty_g, pretty_b, pretty_a);
-	
-	if(length < 0)
-		length = strlen(text_);
-	
-	while(length)
-	{
-		const int c = *text;
-		const float width = current_font->m_CharEndTable[c] - current_font->m_CharStartTable[c];
-		double x_nudge = 0;
-
-		text++;
-
-		x -= size * current_font->m_CharStartTable[c];
-		
-		gfx_quads_setsubset(
-			(c%16)/16.0f, /* startx */
-			(c/16)/16.0f, /* starty */
-			(c%16)/16.0f+1.0f/16.0f, /* endx */
-			(c/16)/16.0f+1.0f/16.0f); /* endy */
-
-		gfx_quads_drawTL(x, y, size, size);
-
-		if(length > 1 && text[1])
-			x_nudge = extra_kerning[text[0] + text[1] * 256];
-
-		x += (width + current_font->m_CharStartTable[c] + spacing + x_nudge) * size;
-		length--;
-	}
-
-	gfx_quads_end();
-	
-	return x;
-}
-
-void gfx_pretty_text(float x, float y, float size, const char *text, int max_width)
+void gfx_text_color(float r, float g, float b, float a)
 {
-    gfx_text(gfx_font_set, x, y, size, text, max_width);
-    return;
-    
-	if(max_width == -1)
-		gfx_pretty_text_raw(x, y, size, text, -1);
-	else
-	{
-		float startx = x;
-		while(*text)
-		{
-			int wlen = word_length(text);
-			float w = gfx_pretty_text_width(size, text, wlen);
-			if(x+w-startx > max_width)
-			{
-				y += size-2;
-				x = startx;
-			}
-			
-			x = gfx_pretty_text_raw(x, y, size, text, wlen);
-			
-			text += wlen;
-		}
-	}
-}
-
-float gfx_pretty_text_width(float size, const char *text_, int length)
-{
-    return gfx_text_width(gfx_font_set, size, text_, length);
-	/*
-	const float spacing = 0.05f;
-	float w = 0.0f;
-	const unsigned char *text = (unsigned char *)text_;
-	const unsigned char *stop;
-
-	if (length == -1)
-		stop = text + strlen((char*)text);
-	else
-		stop = text + length;
-
-	while (text < stop)
-	{
-		const int c = *text;
-		const float width = current_font->m_CharEndTable[c] - current_font->m_CharStartTable[c];
-
-		double x_nudge = 0;
-		if (text[1])
-			x_nudge = extra_kerning[text[0] + text[1] * 256];
-
-		w += (width + spacing + x_nudge) * size;
-
-		text++;
-	}
-
-	return w;*/
+	text_r = r;
+	text_g = g;
+	text_b = b;
+	text_a = a;
 }
 
-
-
 void gfx_lines_begin()
 {
 	dbg_assert(drawing == 0, "called begin twice");
diff --git a/src/engine/client/ec_ui.c b/src/engine/client/ec_ui.c
deleted file mode 100644
index 3ce40f9c..00000000
--- a/src/engine/client/ec_ui.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
-#include <engine/e_system.h>
-#include <engine/e_interface.h>
-#include <engine/e_config.h>
-#include "ec_ui.h"
-
-/********************************************************
- UI                                                      
-*********************************************************/
-
-struct pretty_font
-{
-    float m_CharStartTable[256];
-	float m_CharEndTable[256];
-	int font_texture;
-};
-
-extern struct pretty_font *current_font;
-
-static const void *hot_item = 0;
-static const void *active_item = 0;
-static const void *last_active_item = 0;
-static const void *becomming_hot_item = 0;
-static float mouse_x, mouse_y; /* in gui space */
-static float mouse_wx, mouse_wy; /* in world space */
-static unsigned mouse_buttons = 0;
-static unsigned last_mouse_buttons = 0;
-
-float ui_mouse_x() { return mouse_x; }
-float ui_mouse_y() { return mouse_y; }
-float ui_mouse_world_x() { return mouse_wx; }
-float ui_mouse_world_y() { return mouse_wy; }
-int ui_mouse_button(int index) { return (mouse_buttons>>index)&1; }
-int ui_mouse_button_clicked(int index) { return ui_mouse_button(index) && !((last_mouse_buttons>>index)&1) ; }
-
-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_active_item() { return active_item; }
-const void *ui_last_active_item() { return last_active_item; }
-
-int ui_update(float mx, float my, float mwx, float mwy, int buttons)
-{
-    mouse_x = mx;
-    mouse_y = my;
-    mouse_wx = mwx;
-    mouse_wy = mwy;
-    last_mouse_buttons = mouse_buttons;
-    mouse_buttons = buttons;
-    hot_item = becomming_hot_item;
-    if(active_item)
-    	hot_item = active_item;
-    becomming_hot_item = 0;
-    return 0;
-}
-
-int ui_mouse_inside(const RECT *r)
-{
-    if(mouse_x >= r->x && mouse_x <= r->x+r->w && mouse_y >= r->y && mouse_y <= r->y+r->h)
-        return 1;
-    return 0;
-}
-
-static RECT screen = { 0.0f, 0.0f, 848.0f, 480.0f };
-
-RECT *ui_screen()
-{
-    float aspect = gfx_screenaspect();
-    float w, h;
-
-    h = 600;
-    w = aspect*h;
-
-    screen.w = w;
-    screen.h = h;
-
-    return &screen;
-}
-
-void ui_set_scale(float s)
-{
-    config.ui_scale = (int)(s*100.0f);
-}
-
-float ui_scale()
-{
-    return config.ui_scale/100.0f;
-}
-
-void ui_clip_enable(const RECT *r)
-{
-	float xscale = gfx_screenwidth()/ui_screen()->w;
-	float yscale = gfx_screenheight()/ui_screen()->h;
-	gfx_clip_enable((int)(r->x*xscale), (int)(r->y*yscale), (int)(r->w*xscale), (int)(r->h*yscale));
-}
-
-void ui_clip_disable()
-{
-	gfx_clip_disable();
-}
-
-void ui_hsplit_t(const RECT *original, float cut, RECT *top, RECT *bottom)
-{
-    RECT r = *original;
-    cut *= ui_scale();
-
-    if (top)
-    {
-        top->x = r.x;
-        top->y = r.y;
-        top->w = r.w;
-        top->h = cut;
-    }
-
-    if (bottom)
-    {
-        bottom->x = r.x;
-        bottom->y = r.y + cut;
-        bottom->w = r.w;
-        bottom->h = r.h - cut;
-    }
-}
-
-void ui_hsplit_b(const RECT *original, float cut, RECT *top, RECT *bottom)
-{
-    RECT r = *original;
-    cut *= ui_scale();
-
-    if (top)
-    {
-        top->x = r.x;
-        top->y = r.y;
-        top->w = r.w;
-        top->h = r.h - cut;
-    }
-
-    if (bottom)
-    {
-        bottom->x = r.x;
-        bottom->y = r.y + r.h - cut;
-        bottom->w = r.w;
-        bottom->h = cut;
-    }
-}
-
-
-void ui_vsplit_mid(const RECT *original, RECT *left, RECT *right)
-{
-    RECT r = *original;
-    float cut = r.w/2;
-
-    if (left)
-    {
-        left->x = r.x;
-        left->y = r.y;
-        left->w = cut;
-        left->h = r.h;
-    }
-
-    if (right)
-    {
-        right->x = r.x + cut;
-        right->y = r.y;
-        right->w = r.w - cut;
-        right->h = r.h;
-    }
-}
-
-void ui_vsplit_l(const RECT *original, float cut, RECT *left, RECT *right)
-{
-    RECT r = *original;
-    cut *= ui_scale();
-
-    if (left)
-    {
-        left->x = r.x;
-        left->y = r.y;
-        left->w = cut;
-        left->h = r.h;
-    }
-
-    if (right)
-    {
-        right->x = r.x + cut;
-        right->y = r.y;
-        right->w = r.w - cut;
-        right->h = r.h;
-    }
-}
-
-void ui_vsplit_r(const RECT *original, float cut, RECT *left, RECT *right)
-{
-    RECT r = *original;
-    cut *= ui_scale();
-
-    if (left)
-    {
-        left->x = r.x;
-        left->y = r.y;
-        left->w = r.w - cut;
-        left->h = r.h;
-    }
-
-    if (right)
-    {
-        right->x = r.x + r.w - cut;
-        right->y = r.y;
-        right->w = cut;
-        right->h = r.h;
-    }
-}
-
-void ui_margin(const RECT *original, float cut, RECT *other_rect)
-{
-    RECT r = *original;
-	cut *= ui_scale();
-
-    other_rect->x = r.x + cut;
-    other_rect->y = r.y + cut;
-    other_rect->w = r.w - 2*cut;
-    other_rect->h = r.h - 2*cut;
-}
-
-void ui_vmargin(const RECT *original, float cut, RECT *other_rect)
-{
-    RECT r = *original;
-	cut *= ui_scale();
-
-    other_rect->x = r.x + cut;
-    other_rect->y = r.y;
-    other_rect->w = r.w - 2*cut;
-    other_rect->h = r.h;
-}
-
-void ui_hmargin(const RECT *original, float cut, RECT *other_rect)
-{
-    RECT r = *original;
-	cut *= ui_scale();
-
-    other_rect->x = r.x;
-    other_rect->y = r.y + cut;
-    other_rect->w = r.w;
-    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);
-
-	if(ui_active_item() == id)
-	{
-		if(!ui_mouse_button(0))
-		{
-			if(inside && checked >= 0)
-				ret = 1;
-			ui_set_active_item(0);
-		}
-	}
-	else if(ui_hot_item() == id)
-	{
-		if(ui_mouse_button(0))
-			ui_set_active_item(id);
-	}
-	
-	if(inside)
-		ui_set_hot_item(id);
-
-	if(draw_func)
-    	draw_func(id, text, checked, r, extra);
-    return ret;
-}
-
-void ui_do_label(const RECT *r, const char *text, float size, int align, int max_width)
-{
-    gfx_blend_normal();
-    size *= ui_scale();
-    if(align == 0)
-    {
-    	float tw = gfx_pretty_text_width(size, text, max_width);
-    	gfx_pretty_text(r->x + r->w/2-tw/2, r->y, size, text, max_width);
-	}
-	else if(align < 0)
-    	gfx_pretty_text(r->x, r->y, size, text, max_width);
-	else if(align > 0)
-	{
-    	float tw = gfx_pretty_text_width(size, text, max_width);
-    	gfx_pretty_text(r->x + r->w-tw, r->y, size, text, max_width);
-	}
-}
diff --git a/src/engine/client/ec_ui.h b/src/engine/client/ec_ui.h
deleted file mode 100644
index 83dbe37d..00000000
--- a/src/engine/client/ec_ui.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
-#ifndef _UI_H
-#define _UI_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-typedef struct 
-{
-    float x, y, w, h;
-} RECT;
-
-enum
-{
-	CORNER_TL=1,
-	CORNER_TR=2,
-	CORNER_BL=4,
-	CORNER_BR=8,
-	
-	CORNER_T=CORNER_TL|CORNER_TR,
-	CORNER_B=CORNER_BL|CORNER_BR,
-	CORNER_R=CORNER_TR|CORNER_BR,
-	CORNER_L=CORNER_TL|CORNER_BL,
-	
-	CORNER_ALL=CORNER_T|CORNER_B
-};
-
-int ui_update(float mx, float my, float mwx, float mwy, int buttons);
-
-float ui_mouse_x();
-float ui_mouse_y();
-float ui_mouse_world_x();
-float ui_mouse_world_y();
-int ui_mouse_button(int index);
-int ui_mouse_button_clicked(int index);
-
-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_active_item();
-const void *ui_last_active_item();
-
-int ui_mouse_inside(const RECT *r);
-
-RECT *ui_screen();
-void ui_set_scale(float s);
-float ui_scale();
-void ui_clip_enable(const RECT *r);
-void ui_clip_disable();
-
-void ui_hsplit_t(const RECT *original, float cut, RECT *top, RECT *bottom);
-void ui_hsplit_b(const RECT *original, float cut, RECT *top, RECT *bottom);
-void ui_vsplit_mid(const RECT *original, RECT *left, RECT *right);
-void ui_vsplit_l(const RECT *original, float cut, RECT *left, RECT *right);
-void ui_vsplit_r(const RECT *original, float cut, RECT *left, RECT *right);
-
-void ui_margin(const RECT *original, float cut, RECT *other_rect);
-void ui_vmargin(const RECT *original, float cut, RECT *other_rect);
-void ui_hmargin(const RECT *original, float cut, RECT *other_rect);
-
-typedef void (*ui_draw_button_func)(const void *id, const char *text, int checked, const RECT *r, const void *extra);
-int ui_do_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, const void *extra);
-void ui_do_label(const RECT *r, const char *text, float size, int align, int max_width);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif