Hello,
so I was trying to program something in SFML 2.1 with Microsoft Visual C++ 2010 Express. I downloaded and linked the 32bit version correctly and it all works fine - from the IDE.
When I double click on the .exe in windows, the window opens (filled with white) and windows says: "The .exe has stopped working."
I don't get it, because all the .dlls are in place (I even tried both linking dynamically and statically) and it works just fine when started from the IDE
>_o many despairs, such helpless
main.cpp
#include <SFML\Graphics.hpp>
#include "Map.h"
int main()
{
sf::RenderWindow window(sf::VideoMode(800,600), "Fo:E");
sf::View view2(sf::Vector2f(400, 300), sf::Vector2f(800, 600));
// create the tilemap from the level definition
Map NewMap;
if (!NewMap.load("graphics/hex.png", sf::Vector2u(128, 64), level, 16, 8)) return -1;
//Game Loop
while(window.isOpen()) {
sf::Event Event;
while(window.pollEvent(Event)) {
/* Do Keyboard Stuff*/
}
window.clear(sf::Color::Black);
window.setView(view2);
window.draw(NewMap);
window.display();
}
return 0;
}
map.h
#include <vector>
#include <SFML\Graphics.hpp>
class Map : public sf::Drawable, public sf::Transformable {
public:
bool Map::load(const std::string& tileset, sf::Vector2u tileSize, const int* tiles, unsigned int width, unsigned int height);
private:
virtual void Map::draw(sf::RenderTarget& target, sf::RenderStates states) const;
sf::VertexArray m_vertices;
sf::Texture m_tileset;
};
map.cpp is copied 1:1 from the SFML Tutorial for Designing your own Entitity with Vertex Shaders, Chapter Example Tile-Map (with two minor changes for supporting hexagonal tiles)
http://www.sfml-dev.org/tutorials/2.1/graphics-vertex-array.php#example-tile-map