Exemplo n.º 1
0
/*This is the render loop
At this point, you should know exactly what to draw onto the screen, so just draw it!
To get an idea of the values for colours, look at console.h and the URL listed there*/
void render() {
    
	//Clears the current screen and draw from scratch.
	clearScreen();
    renderMap();
	renderShooter();
	renderCharacter(mummy.charDirection);
	renderBoxes();
	renderMonsters();
	renderMessages();

	//Dump the contents of the buffer to the screen. One frame worth of the game.
    renderToScreen();

}
Exemplo n.º 2
0
void ChatUserInterface::render() const
{
   // If there is an underlying menu or other UI screen, render and dim it.
   //
   // We will skip rendering if the editor is a parent UI because of a couple
   // of difficult-to-solve issues:
   //  1. Fullscreen mode in editor usually has a different aspect ratio when
   //     compared to the rest of the game (incl. the chat UI)
   //  2. The editor may have other sub-UIs opened (like QuickMenuUIs) that
   //     may not handle the UIManager stack appropriately (likely a bug) and
   //     will cause stack overflows
   if((mRenderUnderlyingUI && getUIManager()->hasPrevUI()) &&
         !getUIManager()->cameFrom<EditorUserInterface>())
   {
      getUIManager()->renderPrevUI(this);  // ...render it...
      dimUnderlyingUI();
   }

   // Render header
   renderHeader();

   // And footer
   S32 vertFooterPos = DisplayManager::getScreenInfo()->getGameCanvasHeight() - vertMargin - VERT_FOOTER_SIZE;
   RenderUtils::drawCenteredString_fixed(vertFooterPos + VERT_FOOTER_SIZE - 2, VERT_FOOTER_SIZE - 2, Colors::green, "Type your message | ENTER to send | ESC exits");

   renderChatters(horizMargin, vertFooterPos - CHAT_FONT_MARGIN * 2);

   // Render incoming chat msgs
   //mGL->glColor(Colors::white);

   U32 y = vertMargin + 60;

   static const S32 chatAreaHeight = DisplayManager::getScreenInfo()->getGameCanvasHeight() - 2 * vertMargin -   // Screen area less margins
                     VERT_FOOTER_SIZE -                                                     // Instructions at the bottom
                     CHAT_NAMELIST_SIZE - CHAT_FONT_MARGIN * 2  -                           // Names of those in chatroom
                     MENU_TITLE_SIZE - TITLE_SUBTITLE_GAP - MENU_SUBTITLE_SIZE -            // Title/subtitle display
                     CHAT_FONT_SIZE - CHAT_FONT_MARGIN -                                    // Chat composition
                     CHAT_FONT_SIZE;                                                        // Not sure... just need a little more space??

   static const S32 MessageDisplayCount = chatAreaHeight / (CHAT_FONT_SIZE + CHAT_FONT_MARGIN);

   renderMessages(y, MessageDisplayCount);
   renderMessageComposition(vertFooterPos - 45 + CHAT_FONT_SIZE);

   // Give user notice that there is no connection to master, and thus chatting is ineffectual
   MasterServerConnection *masterConn = getGame()->getConnectionToMaster();
   if(!(masterConn && masterConn->getConnectionState() == NetConnection::Connected))
   {
      static const S32 fontsize = 20;
      static const S32 fontgap = 5;
      static const S32 margin = 20;

      static const char* line1 = "Not connected to Master Server";
      static const char* line2 = "Your chat messages cannot be relayed";

      static const S32 CORNER_INSET = 15;
      S32 yPos1 = 200;
      S32 yPos2 = yPos1 + (2 * (fontsize + fontgap + margin));

      S32 width = RenderUtils::getStringWidth(fontsize, line2);

      S32 canvasWidth = DisplayManager::getScreenInfo()->getGameCanvasWidth();
      S32 xPos1 = (canvasWidth - width) / 2 - margin;
      S32 xPos2 = xPos1 + width + (2 * margin);

      RenderUtils::drawFilledFancyBox(xPos1, yPos1, xPos2, yPos2, CORNER_INSET, Colors::red40, 1.0, Colors::red);

      yPos1 += margin + fontsize;
      RenderUtils::drawCenteredString_fixed(yPos1, fontsize, Colors::white, line1);
      RenderUtils::drawCenteredString_fixed(yPos1 + fontsize + fontgap, fontsize, Colors::white, line2);
   }
}