Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Cerberus

Pages: [1]
1
General / Documentation tutorial
« on: August 30, 2011, 01:10:46 pm »
This has got me stumped and very annoyed.

Just come back to SFML, used it in my second year at uni, and then in third year we went on to OpenGL, which I hated.
So now I'm trying to make some simple 2D games for my portfolio.

However, I'm stuck at just getting a simple SFML window to display.
The clock example in the tutorial for setting up sfml worked, and I have no link errors.

Here's my code
Code: [Select]


#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    //create main window
sf::RenderWindow App(sf::VideoMode(800,600), "SFML test");


sf::Image Image;
if(!Image.LoadFromFile("ball.jpg"))
return EXIT_FAILURE;
sf::Sprite Sprite(Image);

while(App.IsOpened())
{
sf::Event Event;
std::cout << "event created" << std::endl;
while(App.GetEvent(Event))
{
std::cout << "inside while loop" << std::endl;
if(Event.Type == sf::Event::Closed)
App.Close();

}

//clear window
App.Clear();

App.Draw(Sprite);


//update window
App.Display();


}




    return EXIT_SUCCESS;
}


When I run with debugging, the error I get is :
Quote

Microsoft Visual Studio C Runtime Library has detected a fatal error in sfml-test.exe.
.
If I enter debugging, it says its on the line with "while(App.GetEvent(Event))".  (There is a green arrow on the line).


Still reacquainting myself with visual studio as I've been doing a lot of java in netbeans recently.

Can anyone help me before I start pulling my hair out?

Thanks

Pages: [1]
anything