From 332bfa22a6319cacee88883ef177ff2b52b509c0 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 22 May 2010 15:04:04 +0200 Subject: Replaced snprintf with boost::format. --- engine/application.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/application.cpp b/engine/application.cpp index 2ef8e79..e814ac2 100644 --- a/engine/application.cpp +++ b/engine/application.cpp @@ -75,6 +75,7 @@ class BulletPattern2 : public BulletPattern { } }; +#include Application::Application() { // Initialize SDL @@ -224,8 +225,6 @@ void Application::main_loop(unsigned int tick, unsigned int step) { glDisable(GL_TEXTURE_2D); glColor4f(1, 1, 0, 1); - char s[0xff]; - if(tick - lastframes >= 1000) { fps = (float)frames * ((float)(tick - lastframes) / 1000.0f); frames = 1; @@ -233,9 +232,9 @@ void Application::main_loop(unsigned int tick, unsigned int step) { } else { frames++; } - snprintf(s, 0xff, "FPS: %.2f", fps); + glRasterPos2f(Config::fps_x, Config::fps_y); - font->Render(s); + font->Render((boost::format("FPS: %.2f") % fps).str().c_str()); float v_x = Config::window_w * (Config::viewport_x + xo) / (1 + 2 * xo); float v_y = Config::window_h * Config::viewport_y; -- cgit v1.2.3