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 - Polpopolitan

Pages: [1]
1
Window / Re: Window does not react while app's main loop is in a thread
« on: September 08, 2012, 01:50:16 pm »
Oh I see, thanks i'll try that immediately  :)

2
Window / Re: Window does not react while app's main loop is in a thread
« on: September 08, 2012, 11:47:51 am »
I'm definitly sure I didn't miss anything on the tutorial, and my application is still frozen  ???

3
Window / Re: Window does not react while app's main loop is in a thread
« on: September 08, 2012, 11:16:27 am »
I am on a Windows 7 Starter 32 bits.
Well, I don't think I missed anything on the tutorial, but i'm going to read it again anyway.

4
Window / Window does not react while app's main loop is in a thread
« on: September 08, 2012, 10:57:43 am »
Hey There,

I've got some issue with the program i'm currently coding. No error at all, but the window doesn't react to any event. Here's the concerned code :

main.cpp
#include <iostream> // mostly for debug
#include <cstdlib> // for atoi()
#include <SFGUI/SFGUI.hpp>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>

#include "ServerWindow.hpp"
#include "constants.hpp"

int main(int argc, char* argv[]) {

        #ifdef DEBUG
                std::cout << "DEBUG : Pour desactiver les messages de debug, retirer la definition de DEBUG et la remplacer par #define RELEASE dans constants.hpp" << std::endl << std::endl;
                std::cout << "DEBUG : Initialisation de l'interface graphique." << std::endl;
                sf::Clock debugClock;
        #endif // DEBUG
               
        ServerWindow window;
        window.initialize();

        #ifdef DEBUG
                std::cout << "DEBUG : Interface graphice initialisee avec succes en " << debugClock.getElapsedTime().asSeconds() << " secondes." << std::endl;
        #endif // DEBUG

        window.setActive(false); // cause we use threads
        sf::Thread guiThread(&ServerWindow::go, &window);
        guiThread.launch();

        return EXIT_SUCCESS;
}

ServerWindow's go method (ServerWindow inherits sf::RenderWindow)
void ServerWindow::go() {

        setActive(true);
        o_running = true;
        this->resetGLStates(); // else we wouldn't see anything
        this->setFramerateLimit(60); // because it's enough

        o_clock.restart();

        // main loop
        while(this->isOpen()) {

                // event handling
                while(this->pollEvent(o_event)) {

                        // sfgui event handling
                        o_desktop.HandleEvent(o_event);

                        // closing
                        if(o_event.type == sf::Event::Closed) {

                                o_running = false;
                                this->close();
                        }
                }

                o_desktop.Update(o_clock.restart().asSeconds());

                this->clear(sf::Color::Black);
                // bad but necessary
                o_sfgui.Display(*(const_cast<ServerWindow*>(this)));
                this->display();
        }
}

As you can see, I use SFGUI but I don't think it's related to the problem, since I can't even close the window, which is a regular sfml event.

Thanks in advance !

Pages: [1]