SFML Game For Class Help

Aug 25, 2013 at 6:10am
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

the c++ file or header file is on this link
http://www.fast-files.com/getfile.aspx?file=65470

can someone please compile it and upload the exe on a file storage site
thanks :)

Aug 25, 2013 at 6:12am
sorry guys the link doesnt work so heres the code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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;
}
Last edited on Aug 25, 2013 at 6:12am
Aug 25, 2013 at 8:42am
please upload the file in another website like mediafire
because i compile it with gcc 4.7 and i get some errors!
Aug 26, 2013 at 1:39am
have you got the sfml lib and is it linked with your compiler
btw this is the only file and this code is of the whole file
Aug 26, 2013 at 1:48am
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.
Aug 29, 2013 at 6:10am
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
Last edited on Aug 29, 2013 at 6:16am
Topic archived. No new replies allowed.