Fixed some framerate issues

This commit is contained in:
Kayne Ruse
2014-04-06 20:53:51 +10:00
parent 2bacdcdab7
commit 553f8dbfa5
4 changed files with 64 additions and 8 deletions
+10
View File
@@ -133,6 +133,12 @@ void InWorld::FrameEnd() {
//
}
void InWorld::RenderFrame() {
// SDL_FillRect(GetScreen(), 0, 0);
Render(GetScreen());
SDL_Flip(GetScreen());
}
void InWorld::Render(SDL_Surface* const screen) {
//draw the map
ForNearbyRegions([&](Region* const region) {
@@ -147,6 +153,10 @@ void InWorld::Render(SDL_Surface* const screen) {
//draw UI
disconnectButton.DrawTo(screen);
shutDownButton.DrawTo(screen);
font.DrawStringTo(to_string_custom(fps.GetFrameRate()), screen, 0, 0);
fps.Calculate();
}
//-------------------------
+3
View File
@@ -40,6 +40,7 @@
//common
#include "config_utility.hpp"
#include "frame_rate.hpp"
//client
#include "base_scene.hpp"
@@ -60,6 +61,7 @@ protected:
void FrameStart();
void Update(double delta);
void FrameEnd();
void RenderFrame();
void Render(SDL_Surface* const);
//Event handlers
@@ -90,6 +92,7 @@ protected:
//globals
ConfigUtility& config;
FrameRate fps;
UDPNetworkUtility& network;
int& clientIndex;