Move render stuff to draw function
This commit is contained in:
parent
451302d67e
commit
19957bbc52
@ -39,21 +39,32 @@ CockpitUI::CockpitUI() : UI() {
|
||||
}
|
||||
|
||||
void CockpitUI::Update() {
|
||||
|
||||
}
|
||||
|
||||
void CockpitUI::Draw(std::shared_ptr<sf::RenderWindow> context) {
|
||||
sf::BlendMode sBM = sf::BlendNone;
|
||||
sf::RenderStates sRS(sBM);
|
||||
|
||||
// Clear the UI screen
|
||||
mUIRender.clear(sf::Color::Transparent);
|
||||
|
||||
// Draw the static board
|
||||
sf::Sprite staticBoardSprite(mBoardTexture);
|
||||
mUIRender.draw(staticBoardSprite, sRS);
|
||||
|
||||
// Draw the radar display
|
||||
sf::CircleShape radar(95, 8);
|
||||
radar.setRotation(22.5f);
|
||||
radar.setPosition(sf::Vector2f(838,378));
|
||||
radar.setFillColor(sf::Color::Yellow);
|
||||
mUIRender.draw(radar, sRS);
|
||||
|
||||
// Do the final texture render
|
||||
mUIRender.display();
|
||||
|
||||
// OnScreen rendering
|
||||
DrawUIOnRenderWindow(context);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
CockpitUI& operator= (CockpitUI const&) = delete;
|
||||
|
||||
void Update() override;
|
||||
//void Draw(std::shared_ptr<sf::RenderWindow>) override;
|
||||
void Draw(std::shared_ptr<sf::RenderWindow>) override;
|
||||
|
||||
private:
|
||||
sf::Texture mBoardTexture;
|
||||
|
5
Game.cpp
5
Game.cpp
@ -59,8 +59,8 @@ GAME_STATUS Game::Tick(SysTimer& time) {
|
||||
|
||||
// Debug performance computations
|
||||
if (mDbgUI != nullptr && mPerfsTimer != nullptr) {
|
||||
msTicksMonitoring.push_back((mDelta - mPrevdelta) / (1000000/TARGET_FPS));
|
||||
if (mPerfsTimer->GetDeltaTime() >= 1000) { // Re-evaluate CPU usage every seconds (for FP'S')
|
||||
msTicksMonitoring.push_back((mDelta - mPrevdelta) / (1000000.f / TARGET_FPS));
|
||||
if (mPerfsTimer->GetDeltaTime() >= 1000) { // Every 1s
|
||||
double cpuUsage = 100 * std::accumulate(msTicksMonitoring.begin(), msTicksMonitoring.end(), (double)(0)) / msTicksMonitoring.size();
|
||||
|
||||
mDbgUI->UpdateDebugData(cpuUsage, ((mDelta - mPrevdelta) / 1000), mFrameCnt, (PerfsGetVirtMem() / 1000), (PerfsGetPhysMem() / 1000));
|
||||
@ -101,6 +101,7 @@ GAME_STATUS Game::Tick(SysTimer& time) {
|
||||
}
|
||||
|
||||
void Game::Update() {
|
||||
// Game logic calls should go here...
|
||||
mWorldUI->Update();
|
||||
mCockpitUI->Update();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user