summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2011-02-09 19:10:58 +0300
committerAndrey Nazarov <skuller@skuller.net>2011-02-09 19:10:58 +0300
commit608c45df70fcd94e431c93bf04a0bac9e76bbf49 (patch)
treed7b5a042d9e79616a544e8cf81698c7033757c0a
parent0ea2bb843c9d5af80a9cec62adfbcc3d42aefb9e (diff)
Use CHAR_WIDTH/HEIGHT constants everywhere.
-rw-r--r--src/cl_scrn.c6
-rw-r--r--src/gl_draw.c11
-rw-r--r--src/ui_atoms.c10
-rw-r--r--src/ui_demos.c20
-rw-r--r--src/ui_local.h10
-rw-r--r--src/ui_menu.c4
-rw-r--r--src/ui_multiplayer.c26
7 files changed, 44 insertions, 43 deletions
diff --git a/src/cl_scrn.c b/src/cl_scrn.c
index 153dab5..2e98236 100644
--- a/src/cl_scrn.c
+++ b/src/cl_scrn.c
@@ -790,12 +790,12 @@ DEBUG STUFF
*/
static void draw_turtle( void ) {
- int x = 8;
- int y = scr.hud_height - 88;
+ int x = CHAR_WIDTH;
+ int y = scr.hud_height - 11*CHAR_HEIGHT;
#define DF( f ) if( cl.frameflags & FF_ ## f ) { \
SCR_DrawString( x, y, UI_ALTCOLOR, #f ); \
- y += 8; \
+ y += CHAR_HEIGHT; \
}
DF( SURPRESSED )
diff --git a/src/gl_draw.c b/src/gl_draw.c
index d503669..634f821 100644
--- a/src/gl_draw.c
+++ b/src/gl_draw.c
@@ -255,7 +255,8 @@ static inline void draw_char( int x, int y, int c, qboolean alt, image_t *image
c |= alt << 7;
s = ( c & 15 ) * 0.0625f;
t = ( c >> 4 ) * 0.0625f;
- GL_StretchPic( x, y, 8, 8, s, t, s + 0.0625f, t + 0.0625f, draw.colors[alt], image );
+ GL_StretchPic( x, y, CHAR_WIDTH, CHAR_HEIGHT, s, t,
+ s + 0.0625f, t + 0.0625f, draw.colors[alt], image );
}
void R_DrawChar( int x, int y, int flags, int c, qhandle_t font ) {
@@ -270,7 +271,7 @@ int R_DrawString( int x, int y, int flags, size_t maxlen, const char *s, qhandle
while( maxlen-- && *s ) {
byte c = *s++;
draw_char( x, y, c, alt, image );
- x += 8;
+ x += CHAR_WIDTH;
}
return x;
@@ -298,9 +299,9 @@ void Draw_Stringf( int x, int y, const char *fmt, ... ) {
s = ( c & 15 ) * 0.0625f;
t = ( c >> 4 ) * 0.0625f;
- GL_StretchPic( x, y, 8, 8, s, t, s + 0.0625f, t + 0.0625f,
- colorWhite, r_charset );
- x += 8;
+ GL_StretchPic( x, y, CHAR_WIDTH, CHAR_HEIGHT, s, t,
+ s + 0.0625f, t + 0.0625f, colorWhite, r_charset );
+ x += CHAR_WIDTH;
}
}
diff --git a/src/ui_atoms.c b/src/ui_atoms.c
index 4bfffc2..ce700d9 100644
--- a/src/ui_atoms.c
+++ b/src/ui_atoms.c
@@ -325,9 +325,9 @@ void UI_DrawString( int x, int y, const color_t color, int flags, const char *st
}
if( ( flags & UI_CENTER ) == UI_CENTER ) {
- x -= strlen( string ) * 8 / 2;
+ x -= strlen( string ) * CHAR_WIDTH / 2;
} else if( flags & UI_RIGHT ) {
- x -= strlen( string ) * 8;
+ x -= strlen( string ) * CHAR_WIDTH;
}
R_DrawString( x, y, flags, MAX_STRING_CHARS, string, uis.fontHandle );
@@ -341,9 +341,9 @@ void UI_DrawChar( int x, int y, int flags, int ch ) {
}
void UI_StringDimensions( vrect_t *rc, int flags, const char *string ) {
- rc->height = 8;
- rc->width = 8 * strlen( string );
-
+ rc->height = CHAR_HEIGHT;
+ rc->width = CHAR_WIDTH * strlen( string );
+
if( ( flags & UI_CENTER ) == UI_CENTER ) {
rc->x -= rc->width / 2;
} else if( flags & UI_RIGHT ) {
diff --git a/src/ui_demos.c b/src/ui_demos.c
index d0c2346..b28a001 100644
--- a/src/ui_demos.c
+++ b/src/ui_demos.c
@@ -378,21 +378,21 @@ static menuSound_t Sort( menuList_t *self, int column ) {
}
static void Size( menuFrameWork_t *self ) {
- int w = uis.width * 96 / 640;
+ int w = uis.width * 8 / 640;
- if( w > 8*15 ) {
- w = 8*15;
+ if( w > 15 ) {
+ w = 15;
}
m_demos.list.generic.x = 0;
- m_demos.list.generic.y = 8;
+ m_demos.list.generic.y = CHAR_HEIGHT;
m_demos.list.generic.width = 0;
- m_demos.list.generic.height = uis.height - 17;
-
- m_demos.list.columns[0].width = uis.width - 100 - w;
- m_demos.list.columns[1].width = 40;
- m_demos.list.columns[2].width = 60;
- m_demos.list.columns[3].width = w;
+ m_demos.list.generic.height = uis.height - CHAR_HEIGHT*2 - 1;
+
+ m_demos.list.columns[0].width = uis.width - ( 13 + w ) * CHAR_WIDTH;
+ m_demos.list.columns[1].width = 5*CHAR_WIDTH;
+ m_demos.list.columns[2].width = 8*CHAR_WIDTH;
+ m_demos.list.columns[3].width = w*CHAR_WIDTH;
}
static menuSound_t Keydown( menuFrameWork_t *self, int key ) {
diff --git a/src/ui_local.h b/src/ui_local.h
index be3814d..6e4acea 100644
--- a/src/ui_local.h
+++ b/src/ui_local.h
@@ -67,10 +67,10 @@ typedef enum {
QMS_BEEP
} menuSound_t;
-#define RCOLUMN_OFFSET 16
-#define LCOLUMN_OFFSET -16
+#define RCOLUMN_OFFSET (CHAR_WIDTH*2)
+#define LCOLUMN_OFFSET -RCOLUMN_OFFSET
-#define MENU_SPACING 12
+#define MENU_SPACING (CHAR_HEIGHT+CHAR_HEIGHT/2)
#define DOUBLE_CLICK_DELAY 300
@@ -147,9 +147,9 @@ typedef struct menuSlider_s {
#define MAX_COLUMNS 8
-#define MLIST_SPACING 10
+#define MLIST_SPACING (CHAR_HEIGHT+CHAR_HEIGHT/4)
#define MLIST_BORDER_WIDTH 1
-#define MLIST_SCROLLBAR_WIDTH 10
+#define MLIST_SCROLLBAR_WIDTH (CHAR_WIDTH+CHAR_WIDTH/4)
#define MLIST_PRESTEP 3
typedef enum {
diff --git a/src/ui_menu.c b/src/ui_menu.c
index d9265e6..42d4459 100644
--- a/src/ui_menu.c
+++ b/src/ui_menu.c
@@ -1564,8 +1564,8 @@ void Menu_Draw( menuFrameWork_t *menu ) {
// draw status bar
//
if( menu->status ) {
- R_DrawFill( 0, menu->y2 - 8, uis.width, 8, 4 );
- UI_DrawString( uis.width / 2, menu->y2 - 8, NULL,
+ R_DrawFill( 0, menu->y2 - CHAR_HEIGHT, uis.width, CHAR_HEIGHT, 4 );
+ UI_DrawString( uis.width / 2, menu->y2 - CHAR_HEIGHT, NULL,
UI_CENTER, menu->status );
}
}
diff --git a/src/ui_multiplayer.c b/src/ui_multiplayer.c
index 4404587..f769970 100644
--- a/src/ui_multiplayer.c
+++ b/src/ui_multiplayer.c
@@ -315,19 +315,19 @@ static void Size( menuFrameWork_t *self ) {
//
// server list
//
- m_join.list.generic.x = 0;
- m_join.list.generic.y = 8;
- m_join.list.generic.height = uis.height / 2 - 8;
+ m_join.list.generic.x = 0;
+ m_join.list.generic.y = CHAR_HEIGHT;
+ m_join.list.generic.height = uis.height / 2 - CHAR_HEIGHT;
- m_join.list.columns[0].width = w1 - 144;
- m_join.list.columns[1].width = 80;
- m_join.list.columns[2].width = 64;
+ m_join.list.columns[0].width = w1 - 18*CHAR_WIDTH;
+ m_join.list.columns[1].width = 10*CHAR_WIDTH;
+ m_join.list.columns[2].width = 8*CHAR_WIDTH;
//
// server info
//
m_join.info.generic.y = uis.height / 2 + 1;
- m_join.info.generic.height = uis.height / 2 - 8 - 2;
+ m_join.info.generic.height = uis.height / 2 - CHAR_HEIGHT - 2;
m_join.info.columns[0].width = w1 / 2;
m_join.info.columns[1].width = w1 - w1 / 2;
@@ -335,13 +335,13 @@ static void Size( menuFrameWork_t *self ) {
//
// player list
//
- m_join.players.generic.x = w1 + 10;
- m_join.players.generic.y = 8;
- m_join.players.generic.height = uis.height - 16 - 1;
+ m_join.players.generic.x = w1 + MLIST_SCROLLBAR_WIDTH;
+ m_join.players.generic.y = CHAR_HEIGHT;
+ m_join.players.generic.height = uis.height - CHAR_HEIGHT*2 - 1;
- m_join.players.columns[0].width = 32;
- m_join.players.columns[1].width = 32;
- m_join.players.columns[2].width = w2 - 64;
+ m_join.players.columns[0].width = 4*CHAR_WIDTH;
+ m_join.players.columns[1].width = 4*CHAR_WIDTH;
+ m_join.players.columns[2].width = w2 - MLIST_SCROLLBAR_WIDTH - 8*CHAR_WIDTH;
}