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

Pages: 1 ... 8 9 [10]
136
Window / Access violation when referencing a SF::RenderWindow
« on: June 09, 2014, 03:25:24 pm »
I guess you could check if one of the two keys is pressed while the other hasn't been released yet

137
Yeah. I saw that after making the post, but then didn't see a reason to delete it. It might help someone else.  :)
And that's why I didn't delete it. I honestly would have never thought about something like this if it weren't for the idea of adding -Wall to the compiler's args (that should be DEFAULT on cmake DEBUG build IMO)  ;D

138
As you can see from the title and the code, I've already solved the problem.

139
 
OS: any SFML version: git build:DEBUG TGUI version:git build:DEBUG Error: SEGFAULT
#include <SFML/Window.hpp>
#include <TGUI/TGUI.hpp>

class Form
{
public:
    Form(sf::RenderWindow& window): m_Gui(window)
    {
        window.getSize();
    }
    ~Form() {}
private:
    tgui::Gui m_Gui;
};
class Game
{
public:
    Game()
        : m_Window(sf::VideoMode::getDesktopMode(), "...", sf::Style::Default)
        , m_Form(m_Window)
    {
        /*stuff*/
    }
    ~Game() {}
private:
    Form m_Form; //<----this is the error! Even though m_Window is initialized before m_Form
    sf::RenderWindow m_Window; //<---- the order is decided by the members' position in the header
    tgui::Gui m_Gui; //[-WReorder] or [-Wall] weren't set in my project so I didn't notice.
};

int main()
{
    Game game;
    return 0;
}
 

Pages: 1 ... 8 9 [10]