Use r_funcs in the client console plugin.

Getting the sw renderer's functions when running gl was nasty.
This commit is contained in:
Bill Currie 2012-04-11 16:38:15 +09:00
parent d62772e9cc
commit 6ff658afe4
2 changed files with 23 additions and 21 deletions

View File

@ -550,18 +550,18 @@ DrawInputLine (int x, int y, int cursor, inputline_t *il)
const char *s = il->lines[il->edit_line] + il->scroll;
if (il->scroll) {
Draw_Character (x, y, '<' | 0x80);
Draw_nString (x + 8, y, s + 1, il->width - 2);
r_funcs->Draw_Character (x, y, '<' | 0x80);
r_funcs->Draw_nString (x + 8, y, s + 1, il->width - 2);
} else {
Draw_nString (x, y, s, il->width - 1);
r_funcs->Draw_nString (x, y, s, il->width - 1);
}
if (cursor && con_data.realtime) {
float t = *con_data.realtime * con_cursorspeed;
int ch = 10 + ((int) (t) & 1);
Draw_Character (x + ((il->linepos - il->scroll) << 3), y, ch);
r_funcs->Draw_Character (x + ((il->linepos - il->scroll) << 3), y, ch);
}
if (strlen (s) >= il->width)
Draw_Character (x + ((il->width - 1) << 3), y, '>' | 0x80);
r_funcs->Draw_Character (x + ((il->width - 1) << 3), y, '>' | 0x80);
}
void
@ -621,7 +621,7 @@ draw_download (view_t *view)
" %02d%%", *con_data.dl_percent);
// draw it
Draw_String (view->xabs, view->yabs, dlbar);
r_funcs->Draw_String (view->xabs, view->yabs, dlbar);
}
static void
@ -639,7 +639,7 @@ draw_console_text (view_t *view)
if (con->display != con->current) {
// draw arrows to show the buffer is backscrolled
for (i = 0; i < con_linewidth; i += 4)
Draw_Character (x + (i << 3), y, '^');
r_funcs->Draw_Character (x + (i << 3), y, '^');
y -= 8;
rows--;
@ -654,7 +654,7 @@ draw_console_text (view_t *view)
text = con->text + (row % con_totallines) * con_linewidth;
Draw_nString(x, y, text, con_linewidth);
r_funcs->Draw_nString(x, y, text, con_linewidth);
}
}
@ -671,7 +671,7 @@ draw_console (view_t *view)
alpha = min (alpha, 255);
}
// draw the background
Draw_ConsoleBackground (view->ylen, alpha);
r_funcs->Draw_ConsoleBackground (view->ylen, alpha);
// draw everything else
view_draw (view);
@ -684,10 +684,10 @@ draw_say (view_t *view)
r_data->scr_copytop = 1;
if (chat_team) {
Draw_String (view->xabs + 8, view->yabs, "say_team:");
r_funcs->Draw_String (view->xabs + 8, view->yabs, "say_team:");
DrawInputLine (view->xabs + 80, view->yabs, 1, say_team_line);
} else {
Draw_String (view->xabs + 8, view->yabs, "say:");
r_funcs->Draw_String (view->xabs + 8, view->yabs, "say:");
DrawInputLine (view->xabs + 40, view->yabs, 1, say_line);
}
}
@ -718,7 +718,7 @@ draw_notify (view_t *view)
clearnotify = 0;
r_data->scr_copytop = 1;
Draw_nString (x, y, text, con_linewidth);
r_funcs->Draw_nString (x, y, text, con_linewidth);
y += 8;
}
}

View File

@ -52,6 +52,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/view.h"
#include "QF/plugin/console.h"
#include "QF/plugin/vid_render.h"
typedef struct menu_pic_s {
struct menu_pic_s *next;
@ -282,7 +283,7 @@ bi_Menu_CenterPic (progs_t *pr)
int x = P_INT (pr, 0);
int y = P_INT (pr, 1);
const char *name = P_GSTRING (pr, 2);
qpic_t *qpic = Draw_CachePic (name, 1);
qpic_t *qpic = r_funcs->Draw_CachePic (name, 1);
if (!qpic)
return;
@ -296,7 +297,7 @@ bi_Menu_CenterSubPic (progs_t *pr)
int x = P_INT (pr, 0);
int y = P_INT (pr, 1);
const char *name = P_GSTRING (pr, 2);
qpic_t *qpic = Draw_CachePic (name, 1);
qpic_t *qpic = r_funcs->Draw_CachePic (name, 1);
int srcx = P_INT (pr, 3);
int srcy = P_INT (pr, 4);
int width = P_INT (pr, 5);
@ -555,7 +556,7 @@ Menu_Draw (view_t *view)
y = view->yabs;
if (menu->fadescreen)
Draw_FadeScreen ();
r_funcs->Draw_FadeScreen ();
*menu_pr_state.globals.time = *con_data.realtime;
@ -575,19 +576,20 @@ Menu_Draw (view_t *view)
for (m_pic = menu->pics; m_pic; m_pic = m_pic->next) {
qpic_t *pic = Draw_CachePic (m_pic->name, 1);
qpic_t *pic = r_funcs->Draw_CachePic (m_pic->name, 1);
if (!pic)
continue;
if (m_pic->width > 0 && m_pic->height > 0)
Draw_SubPic (x + m_pic->x, y + m_pic->y, pic,
r_funcs->Draw_SubPic (x + m_pic->x, y + m_pic->y, pic,
m_pic->srcx, m_pic->srcy,
m_pic->width, m_pic->height);
else
Draw_Pic (x + m_pic->x, y + m_pic->y, pic);
r_funcs->Draw_Pic (x + m_pic->x, y + m_pic->y, pic);
}
for (i = 0; i < menu->num_items; i++) {
if (menu->items[i]->text) {
Draw_String (x + menu->items[i]->x + 8, y + menu->items[i]->y,
r_funcs->Draw_String (x + menu->items[i]->x + 8,
y + menu->items[i]->y,
menu->items[i]->text);
}
}
@ -602,8 +604,8 @@ Menu_Draw (view_t *view)
PR_ExecuteProgram (&menu_pr_state, menu->cursor);
run_menu_post ();
} else {
Draw_Character (x + item->x, y + item->y,
12 + ((int) (*con_data.realtime * 4) & 1));
r_funcs->Draw_Character (x + item->x, y + item->y,
12 + ((int) (*con_data.realtime * 4) & 1));
}
}