void Con_DrawConsole(int pixellines) { unsigned int linelength; unsigned char tmpline[2048]; Draw_ConsoleBackground(pixellines); Con_DrawTextLines((pixellines+2)%8, (pixellines - 22) / 8, displayline); if (key_linepos && key_linepos - 1 < editlinepos) editlinepos = key_linepos - 1; else if (key_linepos >= editlinepos + textcolumns) editlinepos = key_linepos - textcolumns + 1; linelength = strlen(key_lines[edit_line] + editlinepos); if (linelength > textcolumns) linelength = textcolumns; if (linelength > sizeof(tmpline) - 1) linelength = sizeof(tmpline) - 1; strlcpy(tmpline, key_lines[edit_line] + editlinepos, linelength + 1); if ((int) (Sys_DoubleTime() * con_cursorspeed) & 1) { if (tmpline[key_linepos - editlinepos] == 0) linelength++; tmpline[key_linepos - editlinepos] = 11; } Draw_String_Length(8, pixellines - 22, tmpline, linelength); }
void DrawRift2d () { qboolean draw_sbar = false; vec3_t menu_angles, forward, right, up, target; float scale_hud = 0.13; int oldglwidth = glwidth, oldglheight = glheight, oldconwidth = vid.conwidth, oldconheight = vid.conheight; glwidth = 320; glheight = 200; vid.conwidth = 320; vid.conheight = 200; // draw 2d elements 1m from the users face, centered glPushMatrix(); glDisable (GL_DEPTH_TEST); // prevents drawing sprites on sprites from interferring with one another glEnable (GL_BLEND); VectorCopy(r_refdef.aimangles, menu_angles) if (vr_aimmode.value == VR_AIMMODE_HEAD_MYAW || vr_aimmode.value == VR_AIMMODE_HEAD_MYAW_MPITCH) menu_angles[PITCH] = 0; AngleVectors (menu_angles, forward, right, up); VectorMA (r_refdef.vieworg, 32, forward, target); glTranslatef (target[0], target[1], target[2]); glRotatef(menu_angles[YAW] - 90, 0, 0, 1); // rotate around z glRotatef(90 + menu_angles[PITCH], -1, 0, 0); // keep bar at constant angled pitch towards user glTranslatef (-(320.0 * scale_hud / 2), -(200.0 * scale_hud / 2), 0); // center the status bar glScalef(scale_hud, scale_hud, scale_hud); if (scr_drawdialog) //new game confirm { if (con_forcedup) Draw_ConsoleBackground (); else draw_sbar = true; //Sbar_Draw (); Draw_FadeScreen (); SCR_DrawNotifyString (); } else if (scr_drawloading) //loading { SCR_DrawLoading (); draw_sbar = true; //Sbar_Draw (); } else if (cl.intermission == 1 && key_dest == key_game) //end of level { Sbar_IntermissionOverlay (); } else if (cl.intermission == 2 && key_dest == key_game) //end of episode { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); } else { //SCR_DrawCrosshair (); //johnfitz SCR_DrawRam (); SCR_DrawNet (); SCR_DrawTurtle (); SCR_DrawPause (); SCR_CheckDrawCenterString (); draw_sbar = true; //Sbar_Draw (); SCR_DrawDevStats (); //johnfitz SCR_DrawFPS (); //johnfitz SCR_DrawClock (); //johnfitz SCR_DrawConsole (); M_Draw (); } glDisable (GL_BLEND); glEnable (GL_DEPTH_TEST); glPopMatrix(); if(draw_sbar) VR_Sbar_Draw(); glwidth = oldglwidth; glheight = oldglheight; vid.conwidth = oldconwidth; vid.conheight = oldconheight; }
/* ================== SCR_UpdateScreen This is called every frame, and can also be called explicitly to flush text to the screen. WARNING: be very careful calling this from elsewhere, because the refresh needs almost the entire 256k of stack space! ================== */ void SCR_UpdateScreen (void) { vid.numpages = (gl_triplebuffer.value) ? 3 : 2; if (scr_disabled_for_loading) { if (realtime - scr_disabled_time > 60) { scr_disabled_for_loading = false; Con_Printf ("load failed.\n"); } else return; } if (!scr_initialized || !con_initialized) return; // not initialized yet GL_BeginRendering (&glx, &gly, &glwidth, &glheight); // // determine size of refresh window // if (vid.recalc_refdef) SCR_CalcRefdef (); // // do 3D refresh drawing, and then update the screen // SCR_SetUpToDrawConsole (); V_RenderView (); GL_Set2D (); //FIXME: only call this when needed SCR_TileClear (); if (scr_drawdialog) //new game confirm { if (con_forcedup) Draw_ConsoleBackground (); else Sbar_Draw (); Draw_FadeScreen (); SCR_DrawNotifyString (); } else if (scr_drawloading) //loading { SCR_DrawLoading (); Sbar_Draw (); } else if (cl.intermission == 1 && key_dest == key_game) //end of level { Sbar_IntermissionOverlay (); } else if (cl.intermission == 2 && key_dest == key_game) //end of episode { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); } else { SCR_DrawCrosshair (); //johnfitz SCR_DrawRam (); SCR_DrawNet (); SCR_DrawTurtle (); SCR_DrawPause (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawDevStats (); //johnfitz SCR_DrawFPS (); //johnfitz SCR_DrawClock (); //johnfitz SCR_DrawConsole (); M_Draw (); } V_UpdateBlend (); //johnfitz -- V_UpdatePalette cleaned up and renamed GLSLGamma_GammaCorrect (); GL_EndRendering (); }
void SCR_UpdateScreenContent (void) { // // do 3D refresh drawing, and then update the screen // V_RenderView (); // test draw in 3d if(vr_enabled.value && !con_forcedup) { DrawRift2d(); } else { GL_Set2D (); //FIXME: only call this when needed SCR_TileClear (); if (scr_drawdialog) //new game confirm { if (con_forcedup) Draw_ConsoleBackground (); else Sbar_Draw (); Draw_FadeScreen (); SCR_DrawNotifyString (); } else if (scr_drawloading) //loading { SCR_DrawLoading (); Sbar_Draw (); } else if (cl.intermission == 1 && key_dest == key_game) //end of level { Sbar_IntermissionOverlay (); } else if (cl.intermission == 2 && key_dest == key_game) //end of episode { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); } else { SCR_DrawCrosshair (); //johnfitz SCR_DrawRam (); SCR_DrawNet (); SCR_DrawTurtle (); SCR_DrawPause (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawDevStats (); //johnfitz SCR_DrawFPS (); //johnfitz SCR_DrawClock (); //johnfitz SCR_DrawConsole (); M_Draw (); } } V_UpdateBlend (); //johnfitz -- V_UpdatePalette cleaned up and renamed }