When running the time handling tutorial (the third window tut) I come across a buffer overrun error. I am using the Multibyte Character Set because in my first test try with my own application the Unicode Char Set caused a buffer overrun but when i switch to Unicode it works fine. I am using the SVN version (1.6). I compiled the dlls, libs, static libs, and debug libs. The thing is this still happened on 1.5 here is the source:
#include <SFML\Window.hpp>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
using namespace std;
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window Test");
sf::Clock Clock;
App.UseVerticalSync(false);
const float Speed = 50.f;
float Left = 0.f;
float Top = 0.f;
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}
float ElapsedTime = Clock.GetElapsedTime();
Clock.Reset();
if (App.GetInput().IsKeyDown(sf::Key::Left)) Left -= Speed * ElapsedTime;
if (App.GetInput().IsKeyDown(sf::Key::Right)) Left += Speed * ElapsedTime;
if (App.GetInput().IsKeyDown(sf::Key::Up)) Top -= Speed * ElapsedTime;
if (App.GetInput().IsKeyDown(sf::Key::Down)) Top += Speed * ElapsedTime;
App.Display();
}
return EXIT_SUCCESS;
}
I'm using Visual Studio 2010 Beta 1 (if you want to see how to configure look at my SFML and Visual Studio 2010 Beta 1 (Visual C++ 10 only) topic
here).
I don't know if this only happens with VS 2010 or if it happens with VS 2008 also I have both but i didn't use VS 2008 because in my opinion VS 2010 is better but back on topic.
I should also mention that I'm using dynamic linking because the static libs aren't linking right (look at
this post to help.[/url]