我无法在SFML中加载纹理和字体。
这是我的代码:
#include <SFML/graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#pragma comment (lib, "sfml-graphics.lib")
#pragma comment (lib, "sfml-window.lib")
#pragma comment (lib, "sfml-system.lib")
int main ()
{
sf::RenderWindow window(sf::ViewMode(X, Y), "The Chess!");
//load the texture
sf::Texture texture;
texture.loadFromFile("chessbck.png");
if(!texture)
// An error has been occurred
MessageBox(NULL, "Error!", "error", MB_ICONERROR | MB_OK);
sf::Sprite sprite(texture);
window.clear(sf::Color(0, 0, 0));
// Clear the window with black color.
window.draw(sprite);
// Draw the sprite
window.display();
// And finaly,... display the window.
}
请帮助我!
这是控制台上的图片:
我检查了目录,但这是真的。
此外,当我加载字体时也会发生这种情况。