hi guys Ive been learning sfml and now
in class at school I have to make a game
my classmates all have powerful computers except me
my hardware is pretty ancient but by using c++
and SFML I could make a game I only have 4 weeks to do it
so I need someone to compile my code
int main()
{
sf::Window window(sf::VideoMode(800, 600), "My window");
// run the program as long as the window is open
while (window.isOpen())
{
//level--------------------------------------------
sf::Texture level;
if (!level.loadFromFile("level.png"))
{
// error...
}
sf::Sprite level1;
level1.setTexture(level);
window.draw(level1);
level.setPosition(sf::Vector2f(0, 0));
//------------------------------------------------
// -- player------------------------------------
sf::Texture player;
if (!player.loadFromFile("player.png"))
{
// error...
}
sf::Sprite player;
player.setTexture(player);
window.draw(player);
player.setPosition(sf::Vector2f(0, -16));
//------------------------------------------------
//--- boss----------------------------------------
sf::Texture enemy;
if (!enemy.loadFromFile("enemy.png"))
{
// error...
}
sf::Sprite enemy;
enemy.setTexture(enemy);
window.draw(enemy);
enemy.setPosition(sf::Vector2f(368, -32));
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}
I believe you'll be wanting to use an sf::RenderWindow, not an sf::Window.
You also seem to be confusing your similarly named variables level and level1. You have a sprite named player and a texture named player in the same scope.
In short, your code is riddled with errors. Use a compiler to compile it and pay attention to the output when you do. This "I need you to compile my code for me" is not, in any way, a practical solution to your problem.
yes, i have the SFML library, and linked with your code
but i recommend you to compile it yourself
for windows: http://www.mingw.org
and for linux: http://gcc.gnu.org
then compile and execute it