Hi everybody,
today I started to make a skeleton for any applications I'm going to create. It's a very simple Application class:
Header:
#ifndef H_APPLICATION
#define H_APPLICATION
#include <SFML/Graphics.hpp>
class Application {
public:
int Run();
private:
bool InitApp();
sf::RenderWindow MainWindow;
};
#endif
Implementation:
#include "Application.h"
int Application::Run(){
if (!InitApp()){
return -1;
}
while (MainWindow.IsOpened()){
// Process events
sf::Event Event;
while (MainWindow.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
MainWindow.Close();
}
// Display window contents on screen
MainWindow.Display();
}
return 0;
};
bool Application::InitApp() {
MainWindow.Create(sf::VideoMode(640, 480), "TheEye");
return true;
};
main.cpp
#include "Application.h"
int main() {
Application TheApp;
return TheApp.Run();
}
As you see, I'd like to seperate initialisation, event handling etc in seperate methods of my class Application. Straight OOP.
My Problem now is a exception that occurs just after closing the window in Release mode.
Error message is
A buffer overrun has occurred in TheEye.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.
The program breaks at line 298 in the file gs_report.c from Microsoft.
Any ideas how to solve this? CRT is dynamically linked, Unicode enabled, I'm using sfml-main-d.lib, sfml-window-d.lib and sfml-graphics-d.lib in Debug mode and sfml-main.lib, sfml-window.lib and sfml-graphics.lib in Release mode.
greetings
Martin