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

Author Topic: sfml program closes randomly, no error given  (Read 940 times)

0 Members and 1 Guest are viewing this topic.

Stormin_Norman

  • Newbie
  • *
  • Posts: 1
    • View Profile
sfml program closes randomly, no error given
« on: June 09, 2012, 11:55:04 pm »
I'm trying to use sfml to make a game with, but I'm running into quite the problem.

When I build and compile sfml the application launches, then just closes randomly with no call being given too.

This happens with anything I try to do with sfml, even the basic tutorial crashes with nothing other then just creating the window and displaying some text.

No error or crash is given, the application simple just closes after its been running for a bit.

Using Visual Studio 2010 and SFML 2.0. with ATI 4850

I'm pretty sure I set the project up correctly and put the dlls in the right places.

Here is the sample code I've been working with.

#include "Main.h"

int main()
{
    sf::RenderWindow window(sf::VideoMode(SCREEN_RESOLUTION_X, SCREEN_RESOLUTION_Y), "Test App");

        sf::Font font;
        if(!font.loadFromFile("arial.ttf"))
                return 0;

        sf::Text text;
        text.setFont(font);
        text.setString("Singleplayer");

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
           {}
        }

        window.clear();
        window.draw(text);
        window.display();
    }

    return 0;
}

this is the header

#pragma once

#ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.
#endif

#define SCREEN_RESOLUTION_X 600
#define SCREEN_RESOLUTION_Y 800

#include <SFML/Graphics.hpp>

#include <stdio.h>
#include <tchar.h>
« Last Edit: June 09, 2012, 11:58:17 pm by Stormin_Norman »