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

Pages: [1]
1
General / Re: Debugging SFML android app
« on: February 06, 2016, 10:42:14 pm »
So thanks to the help provided by texus, I found out that the crash in fact is not related to TGUI, but to font.loadFromFile().

This is a minimal reproducible example:

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

int main()
{
    sf::Window window(sf::VideoMode(800, 600), "My window");
   
    sf::Font font;

    if(!font.loadFromFile("assets/sansation.ttf")) // <-- CRASH
    {
        std::cerr << "Could not load font" << std::endl;
        return 1;
    }

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    return 0;
}

I guess I should open a bug report at Github?

EDIT: Bug report created.

2
General / Re: Debugging SFML android app
« on: February 06, 2016, 07:10:33 pm »
Ha! I removed the TGUI code and it doesn't crash, but the "sfml-error: Failed to activate the window's context" line is still there, so that's not it. I will try asking the TGUI developers.

EDIT: I narrowed it down to
gui.setFont(font);

3
General / Debugging SFML android app
« on: February 06, 2016, 05:47:11 pm »
I am starting out development of a small game using SFML and TGUI. So far I just have a bare bones menu example  which works fine on OS X, but when I launch it on Android it crashes and I see this in the adb logcat:

Quote
02-06 17:08:48.475  1407  1421 I sfml-error: Failed to activate the window's context
02-06 17:08:48.475  1407  1421 I sfml-error:
02-06 17:08:48.475  1407  1421 I sfml-error: Failed to activate the window's context
02-06 17:08:48.676   266   292 I WindowManager: Screen frozen for +2s833ms due to Window{9c6ed66 u0 Starting xyz.simek.theycome}
02-06 17:08:49.110   266   292 W art     : Long monitor contention event with owner method=int com.android.server.wm.WindowManagerService.relayoutWindow(com.android.server.wm.Session, android.view.IWindow, int, android.view.WindowManager$LayoutParams, int, int, int, int, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.content.res.Configuration, android.view.Surface) from WindowManagerService.java:3097 waiters=0 for 170ms
02-06 17:08:49.204    69   150 D AudioFlinger: mixer(0xb4480000) throttle end: throttle time(204)
02-06 17:08:49.416    69   150 D AudioFlinger: mixer(0xb4480000) throttle end: throttle time(12)
02-06 17:08:49.539  1407  1421 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x5c in tid 1421 (.simek.theycome)
02-06 17:08:49.698    66    66 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

What does it mean? I searched these forums and one post says it's threading issue, but I am not using threads (at least not that I know of). The android example bundled with SFML works fine, so it must be my mistake.

I have a simple state machine which stores states in a std::vector and each state has access to sfml::RenderWindow through a single Game object like this:

class Game
{
        public:
                sf::RenderWindow window;
                std::vector<GameState*> states;

                void pushState(GameState* state);
                void popState();
                void changeState(GameState* state);
                GameState* peekState();
};
...
class GameStateStart : public GameState
{
        public:
                Game* game;
                GameStateStart(Game* game) : game(game) {}

                virtual void draw(const float dt)
                {
                        this->game->window.draw(...);
                }
};
 

Full log is here: http://pastebin.com/WBe1BGnT

Any idea what might be wrong or a better way to go about debugging than using logcat?

4
The e-book costs €43.54 while the print+ebook costs €44.99. That's strange. I would expect e-book to be significantly cheaper. This book has everything that I would like to learn (well, except a chapter about SFML android development). I am going to buy it, but it's not exactly cheap.

Pages: [1]