void inventory_tick(void) { // run the selectors RunSelector(inv.curselector); // draw DrawScene(); DrawInventory(); textbox.Draw(); }
void UIManager::Draw(sf::RenderWindow& rw) { rw.draw(m_playerHPBar); rw.draw(m_playerHPBarFill); rw.draw(m_playerStaminaBar); rw.draw(m_playerStaminaBarFill); if (m_playerObserver->InventoryOpen()) DrawInventory(rw); if (m_playerObserver->EquipmentOpen()) DrawEquipment(rw); newOpMenu->Draw(rw); //m_playerInventory.Draw(rw); }
/** *@brief Draws the main game in inventory */ int StateInventory() { SDL_RenderClear(GetRenderer()); SDL_SetRenderTarget(GetRenderer(),game->mainSceneTexture); SDL_RenderClear(GetRenderer()); SDL_SetRenderTarget(GetRenderer(),NULL); DrawMap(1,0,0,game->mainSceneTexture); DrawMap(2,0,0,game->mainSceneTexture); DrawMap(3,0,0,game->mainSceneTexture); DrawMap(0,0,0,game->mainSceneTexture); SetCamera(*game->camera,hotBox); DrawEntities(); DrawMainScene(); DrawSpecialLayer(map); DrawInventory(playerData->inventory); NextFrame(); return 0; }
void DrawHUD() { player_t * CPlayer = StatusBar->CPlayer; players[consoleplayer].inventorytics = 0; if (hud_althudscale && SCREENWIDTH>640) { hudwidth=SCREENWIDTH/2; if (hud_althudscale == 2) { // Optionally just double the pixels to reduce scaling artifacts. hudheight=SCREENHEIGHT/2; } else { if (WidescreenRatio == 4) { hudheight = hudwidth * 30 / BaseRatioSizes[WidescreenRatio][3]; // BaseRatioSizes is inverted for this mode } else { hudheight = hudwidth * 30 / (48*48/BaseRatioSizes[WidescreenRatio][3]); } } } else { hudwidth=SCREENWIDTH; hudheight=SCREENHEIGHT; } if (!automapactive) { int i; // No HUD in the title level! if (gamestate == GS_TITLELEVEL || !CPlayer) return; if (!deathmatch) DrawStatus(CPlayer, 5, hudheight-50); else { DrawStatus(CPlayer, 5, hudheight-75); DrawFrags(CPlayer, 5, hudheight-70); } DrawHealth(CPlayer, 5, hudheight-45); DrawArmor(CPlayer->mo->FindInventory<ABasicArmor>(), CPlayer->mo->FindInventory<AHexenArmor>(), 5, hudheight-20); i=DrawKeys(CPlayer, hudwidth-4, hudheight-10); i=DrawAmmo(CPlayer, hudwidth-5, i); if (hud_showweapons) DrawWeapons(CPlayer, hudwidth - 5, i); DrawInventory(CPlayer, 144, hudheight-28); if (CPlayer->camera && CPlayer->camera->player) { StatusBar->DrawCrosshair(); } if (idmypos) DrawCoordinates(CPlayer); DrawTime(); DrawLatency(); } else { FString mapname; char printstr[256]; int seconds; int length=8*SmallFont->GetCharWidth('0'); int fonth=SmallFont->GetHeight()+1; int bottom=hudheight-1; if (am_showtotaltime) { seconds = Tics2Seconds(level.totaltime); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } if (am_showtime) { if (level.clusterflags&CLUSTER_HUB) { seconds = Tics2Seconds(level.time); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } // Single level time for hubs seconds= Tics2Seconds(level.maptime); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT); } ST_FormatMapName(mapname); screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, mapname, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); DrawCoordinates(CPlayer); } }
//----------------------------------------------------------------------------- // Purpose: Display the user's stats and achievements //----------------------------------------------------------------------------- void CStatsAndAchievements::Render() { const int32 width = m_pGameEngine->GetViewportWidth(); const int32 height = m_pGameEngine->GetViewportHeight(); const int32 pxColumn1Left = width / 2 - ACHDISP_COLUMN_WIDTH - ACHDISP_CENTER_SPACING / 2; const int32 pxColumn2Left = width / 2 + ACHDISP_CENTER_SPACING / 2; RECT rect; if ( !m_bStatsValid ) { rect.top = 0; rect.bottom = m_pGameEngine->GetViewportHeight(); rect.left = 0; rect.right = width; char rgchBuffer[256]; sprintf_safe( rgchBuffer, "Unable to retrieve data from Steam\n" ); m_pGameEngine->BDrawString( m_hDisplayFont, rect, D3DCOLOR_ARGB( 255, 25, 200, 25 ), TEXTPOS_CENTER|TEXTPOS_VCENTER, rgchBuffer ); rect.left = 0; rect.right = width; rect.top = LONG(m_pGameEngine->GetViewportHeight() * 0.7); rect.bottom = m_pGameEngine->GetViewportHeight(); sprintf_safe( rgchBuffer, "Press ESC to return to the Main Menu" ); m_pGameEngine->BDrawString( m_hDisplayFont, rect, D3DCOLOR_ARGB( 255, 25, 200, 25 ), TEXTPOS_CENTER|TEXTPOS_TOP, rgchBuffer ); } else { // COLUMN 1 // Achievements above the midline int32 pxVertOffset = height / 2 - 3 * ( ACHDISP_IMG_SIZE + ACHDISP_VERT_SPACING ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_IMG_SIZE; rect.left = pxColumn1Left; rect.right = rect.left + ACHDISP_COLUMN_WIDTH; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawAchievementInfo( rect, g_rgAchievements[0] ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_IMG_SIZE; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawAchievementInfo( rect, g_rgAchievements[1] ); // Stats below the midline pxVertOffset = height / 2 + ACHDISP_VERT_SPACING - 1 * ( ACHDISP_IMG_SIZE + ACHDISP_VERT_SPACING ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_FONT_HEIGHT; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawStatInfo( rect, "Games Played", static_cast<float>( m_nTotalGamesPlayed ) ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_FONT_HEIGHT; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawStatInfo( rect, "Games Won", static_cast<float>( m_nTotalNumWins ) ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_FONT_HEIGHT; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawStatInfo( rect, "Games Lost", static_cast<float>( m_nTotalNumLosses ) ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_FONT_HEIGHT; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; m_pGameEngine->BDrawString( m_hDisplayFont, rect, D3DCOLOR_ARGB( 255, 25, 200, 25 ), TEXTPOS_LEFT|TEXTPOS_VCENTER, "Inventory" ); std::list<CSpaceWarItem *>::const_iterator iter; for ( iter = SpaceWarLocalInventory()->GetItemList().begin(); iter != SpaceWarLocalInventory()->GetItemList().end(); ++iter ) { rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_FONT_HEIGHT; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawInventory( rect, ( *iter )->GetItemId() ); } // COLUMN 2 // Achievements above the midline pxVertOffset = height / 2 - 3 * ( ACHDISP_IMG_SIZE + ACHDISP_VERT_SPACING ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_IMG_SIZE; rect.left = pxColumn2Left; rect.right = rect.left + ACHDISP_COLUMN_WIDTH; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawAchievementInfo( rect, g_rgAchievements[2] ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_IMG_SIZE; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawAchievementInfo( rect, g_rgAchievements[3] ); // Stats below the midline pxVertOffset = height / 2 + ACHDISP_VERT_SPACING - 1 * ( ACHDISP_IMG_SIZE + ACHDISP_VERT_SPACING ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_FONT_HEIGHT; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawStatInfo( rect, "Feet Traveled", m_flTotalFeetTraveled ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_FONT_HEIGHT; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawStatInfo( rect, "Max Feet Traveled", m_flMaxFeetTraveled ); rect.top = pxVertOffset; rect.bottom = rect.top + ACHDISP_FONT_HEIGHT; pxVertOffset = rect.bottom + ACHDISP_VERT_SPACING; DrawStatInfo( rect, "Average Inches / Second", m_flAverageSpeed * 12.0f ); // Footer rect.left = 0; rect.right = width; rect.top = LONG(m_pGameEngine->GetViewportHeight() * 0.8); rect.bottom = m_pGameEngine->GetViewportHeight(); char rgchBuffer[256]; sprintf_safe( rgchBuffer, "Press ESC to return to the Main Menu" ); m_pGameEngine->BDrawString( m_hDisplayFont, rect, D3DCOLOR_ARGB( 255, 25, 200, 25 ), TEXTPOS_CENTER|TEXTPOS_TOP, rgchBuffer ); } }
void DrawHUD() { player_t * CPlayer = StatusBar->CPlayer; // [BB] The player may not have a body while connecting. if ( CPlayer->mo == NULL ) return; players[consoleplayer].inventorytics = 0; if (hud_althudscale && SCREENWIDTH>640) { hudwidth=SCREENWIDTH/2; if (hud_althudscale == 2) { // Optionally just double the pixels to reduce scaling artifacts. hudheight=SCREENHEIGHT/2; } else { if (WidescreenRatio == 4) { hudheight = hudwidth * 30 / BaseRatioSizes[WidescreenRatio][3]; // BaseRatioSizes is inverted for this mode } else { hudheight = hudwidth * 30 / (48*48/BaseRatioSizes[WidescreenRatio][3]); } } } else { hudwidth=SCREENWIDTH; hudheight=SCREENHEIGHT; } if (!automapactive) { int i; // No HUD in the title level! if (gamestate == GS_TITLELEVEL || !CPlayer) return; if (!deathmatch) DrawStatus(CPlayer, 5, hudheight-50); else { DrawStatus(CPlayer, 5, hudheight-75); // [TP] Only draw frags if not playing in teams if (( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) == 0 ) DrawFrags(CPlayer, 5, hudheight-70); } // [TP] Only draw health and armor if we are allowed to know those stats. Also don't // draw spectator's health/armor stats. if ( ShouldDrawHealth( CPlayer )) { DrawHealth(CPlayer, 5, hudheight-45); DrawArmor(CPlayer->mo->FindInventory<ABasicArmor>(), CPlayer->mo->FindInventory<AHexenArmor>(), 5, hudheight-20); } // [TP] Draw team stuff. DrawTeamScores( 10, hudheight - 90 ); i=DrawKeys(CPlayer, hudwidth-4, hudheight-10); i=DrawAmmo(CPlayer, hudwidth-5, i); DrawWeapons(CPlayer, hudwidth-5, i); DrawInventory(CPlayer, 144, hudheight-28); if (CPlayer->camera && CPlayer->camera->player) { StatusBar->DrawCrosshair(); } if (idmypos) DrawCoordinates(CPlayer); DrawTime(); } else { FString mapname; char printstr[256]; int seconds; int length=8*SmallFont->GetCharWidth('0'); int fonth=SmallFont->GetHeight()+1; int bottom=hudheight-1; if (am_showtotaltime) { seconds = level.totaltime / TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } if (am_showtime) { if (level.clusterflags&CLUSTER_HUB) { seconds = level.time /TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } // Single level time for hubs seconds= level.maptime /TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT); } ST_FormatMapName(mapname); screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, mapname, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); DrawCoordinates(CPlayer); } }