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.


Messages - g33kz0rd

Pages: [1]
1
System / Using sf::Thread to display Animations?
« on: April 13, 2010, 10:10:41 pm »
But... i mean, i think u r on the wrong way, meanin that the fact that if you have sync the event manager with the frame rate, that would mean, that in a low frame rate, you will have less response from the event manager.

PD. Sorry my bad english, just not from english speakin countrys.

2
System / Hi
« on: April 13, 2010, 09:03:16 pm »
Ive been just readin about Game Loops and stuff a while ago. And it comes to that is totally right some article that ive readed in that time that they say that the graphics should be totally separated from event manager.

Reasons?

It wont care if your machine its really slow generating graphics, your Event response will be the same anyway.

The fact is that i really wanted to take advantage of that.

How?

Making this

And it wont work -_-

Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>

// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(1024, 768, 32), "Teh Game");

bool appRuning = true;

void ThreadFunction(void* UserData)
{
    sf::Event Event;
    while (appRuning)
    {
            if (Event.Key.Code == sf::Key::F1)
            {
                appRuning = false;
            }
    }
}

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create a thread with our function
    sf::Thread Thread(&ThreadFunction);
    // Start it !
    Thread.Launch();

    sf::Image imgIntroLogo;
    imgIntroLogo.LoadFromFile("images/introLogo.png");
    sf::Sprite sprIntroLogo(imgIntroLogo);

    // Hides original SO mouse cursor
    App.ShowMouseCursor(false);

    // Disable vertical synchronization to get maximum framerate
    App.UseVerticalSync(true);

     // Start game loop
    while (appRuning)
    {
        // Clear the screen with red color
        App.Clear(sf::Color(255,0,255));

        // Draw teh Logo
        App.Draw(sprIntroLogo);
    }

    return EXIT_SUCCESS;
}


Why this dosnt works?

Btw, the problem is that it wount take any event. Ive tried in so much ways, it dosnt want to work!

Pages: [1]
anything