[Using the latest 2.0 snapshot]
I'm not sure what I'm doing wrong here.
It compiles fine, but when running in debug mode I get:
"Unhandled exception at 0x77a322b2 in myprogram.exe: 0xC0000005: Access violation writing location 0x00000004."
It breaks at the GraphicsManager::GraphicsManager() constructor.
If I take out all code from the GraphicsManager class and put it all in main.cpp I get no errors.
Main.cpp
#include "GraphicsManager.h"
GraphicsManager gfx;
int main(int argc, char**argv)
{
gfx.Init();
return 0;
}
GraphicsManager.h
#include <SFML\Graphics.hpp>
class GraphicsManager
{
private:
int m_screen_x,m_screen_y,m_bit;
bool m_fullscreen
std::string m_winCaption;
sf::RenderWindow m_app;
public:
GraphicsManager();
~GraphicsManager() {m_app.Close();}
void Init();
};
GraphicsManager.cpp
#include "GraphicsManager.h"
GraphicsManager::GraphicsManager()
:m_fullscreen(false),m_screen_x(0),m_screen_y(0),m_bit(0),m_winCaption("not set")
{
}
void GraphicsManager::Init()
{
sf::VideoMode DesktopMode = sf::VideoMode::GetDesktopMode();
m_bit = DesktopMode.GetDesktopMode().BitsPerPixel;
m_screen_x = DesktopMode.GetDesktopMode().Width;
m_screen_y = DesktopMode.GetDesktopMode().Height;
m_winCaption = "MyProgram";
m_fullscreen = true;
m_app.Create(sf::VideoMode(m_screen_x, m_screen_y, m_bit), m_winCaption, sf::Style::Fullscreen);
}