Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Buffer overrun  (Read 3180 times)

0 Members and 1 Guest are viewing this topic.

accelleon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Buffer overrun
« on: June 25, 2009, 11:30:03 pm »
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:

Code: [Select]

#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]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Buffer overrun
« Reply #1 on: June 26, 2009, 08:28:42 am »
Are you using the debug libraries of SFML (-d) in debug mode?
Laurent Gomila - SFML developer

 

anything