Ejemplo n.º 1
0
//
// V_TextFPSDrawer
//
void V_TextFPSDrawer(void)
{
   static char fpsStr[16];
   static int  fhistory[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
   static int  lasttic = 0, slot = 0;
   vfont_t *font;
   
   float fps = 0;
   int   i, thistic, totaltics = 0;
   
   thistic = I_GetTime();
   
   fhistory[slot & 15] = thistic != lasttic ? thistic - lasttic : 1;
   slot++;

   for(i = 0; i < 16; i++)
      totaltics += fhistory[i];
   
   if(totaltics)
      fps = (float)TICRATE / (totaltics / 16.0f);
   
   psnprintf(fpsStr, sizeof(fpsStr), FC_GRAY "FPS: %.2f", fps);
   
   lasttic = thistic;

   font = E_FontForName("ee_smallfont");
      
   V_FontWriteText(font, fpsStr, 5, 10);
}
Ejemplo n.º 2
0
//
// MN_SkinInstructions
//
// Draws some v_font strings to the screen to tell the user how
// to operate this beast.
//
static void MN_SkinInstructions()
{
   const char *msg = FC_RED "skin viewer";

   int x = 160 - V_FontStringWidth(menu_font_big, msg) / 2;
   int y = 8;
   int color = GameModeInfo->titleColor;

   // draw a title at the top, too
   if(GameModeInfo->flags & GIF_SHADOWTITLES)
   {
      V_FontWriteTextShadowed(menu_font_big, msg, x, y, &subscreen43, color);
   }
   else
   {
      V_FontWriteTextColored(menu_font_big, msg, color, x, y, &subscreen43);
   }

   // haleyjd 05/29/06: rewrote to be binding neutral and to draw all of
   // it with one call to V_FontWriteText instead of five.
   V_FontWriteText(menu_font_normal, 
               "Instructions:\n"
               FC_GRAY "left"  FC_RED " = rotate left, "
               FC_GRAY "right" FC_RED " = rotate right\n"
               FC_GRAY "ctrl"  FC_RED " = fire, "
               FC_GRAY "p"     FC_RED " = pain, "
               FC_GRAY "d"     FC_RED " = die, "
               FC_GRAY "x"     FC_RED " = gib\n"
               FC_GRAY "space" FC_RED " = respawn, "
               FC_GRAY "h"     FC_RED " = half-speed\n"
               FC_GRAY "toggle or previous" FC_RED " = exit", 
               4, INSTR_Y, &subscreen43);
}
Ejemplo n.º 3
0
//
// WriteCenteredText
//
// Local routine to draw centered messages. Candidate for
// absorption into future generalized font code. Rewritten
// 02/22/04 to use qstring module. 
//
static void WriteCenteredText(char *message)
{
   static qstring qstr;
   char *rover;
   const char *buffer;
   int x, y;
   int w, h;

   qstr.clearOrCreate(128);
   
   // rather than reallocate memory every time we draw it,
   // use one buffer and increase the size as neccesary
   // haleyjd 02/22/04: qstring handles this for us now

   w = V_FontStringWidth(menu_font_normal, popup_message);
   h = V_FontStringHeight(menu_font_normal, popup_message);

   x = (SCREENWIDTH  - w) / 2;
   y = (SCREENHEIGHT - h) / 2;
   qstr.clear();
   rover = message;

   if(popup_widget.prev) // up over another widget?
      V_DrawBox(x - 8, y - 8, w + 16, h + 16);

   while(*rover)
   {
      if(*rover == '\n')
      {
         buffer = qstr.constPtr();
         x = (SCREENWIDTH - V_FontStringWidth(menu_font_normal, buffer)) / 2;
         V_FontWriteText(menu_font_normal, buffer, x, y, &subscreen43);         
         qstr.clear(); // clear buffer
         y += menu_font_normal->absh; // next line
      }
      else      // add next char
         qstr += *rover;

      ++rover;
   }

   // dont forget the last line.. prob. not \n terminated
   buffer = qstr.constPtr();
   x = (SCREENWIDTH - V_FontStringWidth(menu_font_normal, buffer)) / 2;
   V_FontWriteText(menu_font_normal, buffer, x, y, &subscreen43);   
}
Ejemplo n.º 4
0
//
// HI_drawDMStats
//
// Draws deathmatch statistics.
//
static void HI_drawDMStats(void)
{
   int i;
   int xpos, ypos, kpos;
   const char *killers = HIS_KILLERS;

   V_FontWriteTextShadowed(in_bigfont, HIS_TOTAL, 265, 30, &subscreen43);
   V_FontWriteText(in_font, HIS_VICTIMS, 140, 8, &subscreen43);

   for(i = 0; i < 7; ++i)
      V_FontWriteText(in_font, killers + i*2, 10, 80 + 9 * i, &subscreen43);

   xpos = 90;
   ypos = 55;

   if(intertime <= 1)
      return;

   if(intertime < 20)
   {
      dmstatstage = 0;

      for(i = 0; i < MAXPLAYERS; ++i)
      {
         if(HI_playerInGame(i))
         {
            V_DrawPatchGeneral(40, 
               (ypos*FRACUNIT + dSlideY[i]*intertime)>>FRACBITS,
               &subscreen43,
               PatchLoader::CacheNum(wGlobalDir, hi_faces[i], PU_CACHE), 
               false);
            V_DrawPatchGeneral((xpos*FRACUNIT + dSlideX[i]*intertime)>>FRACBITS,
               18,
               &subscreen43,
               PatchLoader::CacheNum(wGlobalDir, hi_dead_faces[i], PU_CACHE),
               false);
         }
      }
   }
Ejemplo n.º 5
0
//
// HI_drawOldLevelName
//
// Draws previous level name and "FINISHED" centered,
// starting at the given y coordinate.
//
static void HI_drawOldLevelName(int y)
{
   int x;
   const char *oldLevelName;

   if(mapName)
      oldLevelName = mapName;
   else
      oldLevelName = "new level";

   x = (SCREENWIDTH - V_FontStringWidth(in_bigfont, oldLevelName)) / 2;
   V_FontWriteTextShadowed(in_bigfont, oldLevelName, x, y, &subscreen43);

   x = (SCREENWIDTH - V_FontStringWidth(in_font, HIS_FINISHED)) / 2;
   V_FontWriteText(in_font, HIS_FINISHED, x, y + 22, &subscreen43);
}
Ejemplo n.º 6
0
//
// HI_drawNewLevelName
//
// Draws "NOW ENTERING:" and the destination level name centered,
// starting at the given y coordinate.
//
static void HI_drawNewLevelName(int y)
{
   int x;
   const char *thisLevelName;

   x = (SCREENWIDTH - V_FontStringWidth(in_font, HIS_NOWENTERING)) >> 1;
   V_FontWriteText(in_font, HIS_NOWENTERING, x, y, &subscreen43);

   if(nextMapName)
      thisLevelName = nextMapName;
   else
      thisLevelName = "new level";

   x = (SCREENWIDTH - V_FontStringWidth(in_bigfont, thisLevelName)) >> 1;
   V_FontWriteTextShadowed(in_bigfont, thisLevelName, x, y + 10, &subscreen43);
}
Ejemplo n.º 7
0
//
// G_BindDrawer
//
// Draw the prompt box
//
void G_BindDrawer(void)
{
   const char *msg = "\n -= input new key =- \n";
   int x, y, width, height;
   
   // draw the menu in the background   
   MN_DrawMenu(current_menu);
   
   width  = V_FontStringWidth(menu_font_normal, msg);
   height = V_FontStringHeight(menu_font_normal, msg);
   x = (SCREENWIDTH  - width)  / 2;
   y = (SCREENHEIGHT - height) / 2;
   
   // draw box   
   V_DrawBox(x - 4, y - 4, width + 8, height + 8);

   // write text in box   
   V_FontWriteText(menu_font_normal, msg, x, y, &subscreen43);
}
Ejemplo n.º 8
0
//
// V_DrawLoading
//
void V_DrawLoading(void)
{
   int x, y;
   int linelen;
   vfont_t *font;

   // haleyjd 11/30/02: get palette indices from GameModeInfo
   int white = GameModeInfo->whiteIndex;
   int black = GameModeInfo->blackIndex;

   // haleyjd 01/29/09: not if -nodraw was used
   if(nodrawers)
      return;

   if(!loading_message)
      return;

   // 05/02/10: update console
   C_Drawer();
  
   V_DrawBox((SCREENWIDTH/2)-50, (SCREENHEIGHT/2)-30, 100, 40);

   font = E_FontForName("ee_smallfont");
   
   V_FontWriteText(font, loading_message, (SCREENWIDTH/2)-30, 
                   (SCREENHEIGHT/2)-20, &subscreen43);
  
   x = ((SCREENWIDTH/2)-45);
   y = (SCREENHEIGHT/2);
   linelen = (90*loading_amount) / loading_total;

   // White line
   if(linelen > 0)
      V_ColorBlockScaled(&subscreen43, (byte)white, x, y, linelen, 1);
   // Black line
   if(linelen < 90)
      V_ColorBlockScaled(&subscreen43, (byte)black, x + linelen, y, 90 - linelen, 1);

   I_FinishUpdate();
}
Ejemplo n.º 9
0
//
// sf: write a text line to x, y
// haleyjd 01/14/05: now uses vfont engine
//
static void HU_WriteText(const char *s, int x, int y)
{
   if(hud_fontsloaded)
      V_FontWriteText(hud_overfont, s, x, y, &subscreen43);
}