我用SFML制作了我的第一个游戏,但是我遇到了一些错误。当doinstalowałem几个库允许从Tiled程序播放TMX文件时,会出现这些错误。这个库:zlib,STP(SFML TMX PARSER),PugiXML。
File/Examples/Basic/AnalogReadSerial
我认为我可以对包含库做些不好的事情,但我没有看到问题。 我将Visual Studio 2013用于IDE。
我的错误:
#include <SFML/Graphics.hpp>
#include <cstdlib>
#include <cstdio>
#include "STP/TMXLoader.hpp"
#include "player.h"
int main()
{
player Gracz(50, 50, 50, 50, 32, 32, 5);
sf::RenderWindow window(sf::VideoMode(640, 480), "SFML works!");
sf::RectangleShape rectangle;
rectangle.setSize(sf::Vector2f(Gracz.width, Gracz.height));
rectangle.setOutlineColor(sf::Color::Red);
rectangle.setOutlineThickness(5);
tmx::TileMap map("maps/map1.tmx");
map.ShowObjects();
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
exit(0);
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
Gracz.changePos("up");
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
Gracz.changePos("down");
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
Gracz.changePos("left");
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
Gracz.changePos("right");
}
window.clear();
// Drawing map
window.draw(map);
rectangle.setPosition(Gracz.x, Gracz.y);
window.draw(rectangle);
window.display();
}
return 0;
}
感谢您的帮助。