[console] Get menu rendering working again

For certain values of working. The whole thing needs a rewrite but it's
nice that using an ECS doesn't force everything to conform to that
model.
This commit is contained in:
Bill Currie 2022-11-04 10:38:07 +09:00
parent 70dae21ea6
commit 99e12872e5
3 changed files with 16 additions and 6 deletions

View file

@ -110,8 +110,8 @@ void C_DrawInputLine (struct inputline_s *il);
struct view_s;
void Menu_Init (void);
void Menu_Load (void);
void Menu_Draw (struct view_s *view);
void Menu_Draw_Hud (struct view_s *view);
void Menu_Draw (struct view_s view);
void Menu_Draw_Hud (struct view_s view);
struct IE_event_s;
int Menu_EventHandler (const struct IE_event_s *ie_event);
void Menu_Enter (void);

View file

@ -200,6 +200,7 @@ static view_t command_view;
static view_t download_view;
static view_t notify_view;
static view_t say_view;
static view_t menu_view;
#define CON_BUFFER_SIZE 32768
#define CON_LINES 1024
@ -740,6 +741,10 @@ C_DrawConsole (void)
View_SetPos (console_view, pos.x, ypos);
View_UpdateHierarchy (console_view);
}
if (con_state == con_menu) {
Menu_Draw (menu_view);
return;
}
if (con_state == con_message) {
con_setcomponent (say_view, client_charbuff, &say_line.buffer);
@ -1011,6 +1016,7 @@ C_Init (void)
download_view = View_New (client_reg, console_view);
notify_view = View_New (client_reg, screen_view);
say_view = View_New (client_reg, screen_view);
menu_view = View_New (client_reg, screen_view);
View_SetGravity (screen_view, grav_northwest);
View_SetGravity (console_view, grav_northwest);
@ -1019,6 +1025,7 @@ C_Init (void)
View_SetGravity (download_view, grav_southwest);
View_SetGravity (notify_view, grav_northwest);
View_SetGravity (say_view, grav_northwest);
View_SetGravity (menu_view, grav_center);
View_SetResize (screen_view, 1, 1);
View_SetResize (console_view, 1, 1);
@ -1027,6 +1034,7 @@ C_Init (void)
View_SetResize (download_view, 1, 0);
View_SetResize (notify_view, 1, 0);
View_SetResize (say_view, 1, 0);
View_SetResize (menu_view, 0, 0);
View_SetPos (screen_view, 0, 0);
View_SetPos (console_view, 0, 0);
@ -1043,6 +1051,7 @@ C_Init (void)
View_SetLen (download_view, 320, 8);
View_SetLen (notify_view, 312, NOTIFY_LINES * 8);
View_SetLen (say_view, 320, 8);
View_SetLen (menu_view, 320, 200);
cmd_line.prompt = "";
cmd_line.input_line = Con_CreateInputLine (32, MAXCMDLINE, ']');

View file

@ -670,7 +670,7 @@ Menu_Load (void)
}
void
Menu_Draw (view_t *view)
Menu_Draw (view_t view)
{
menu_pic_t *m_pic;
int i, x, y;
@ -679,8 +679,9 @@ Menu_Draw (view_t *view)
if (!menu)
return;
x = 0;//view->xabs;
y = 0;//view->yabs;
view_pos_t abs = View_GetAbs (view);
x = abs.x;
y = abs.y;
if (menu->fadescreen)
r_funcs->Draw_FadeScreen ();
@ -743,7 +744,7 @@ Menu_Draw (view_t *view)
}
void
Menu_Draw_Hud (view_t *view)
Menu_Draw_Hud (view_t view)
{
run_menu_pre ();
*menu_pr_state.globals.ftime = *con_data.realtime;//FIXME double time