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

Pages: [1]
1
General / Thor not able to load resources on Mac OS X 10.10
« on: December 22, 2014, 07:00:28 pm »
Hey guys, I'm trying to load some resources using the Resource module from the Thor library, and it doesn't seem to work.  I compiled and looked at the examples in Thor, and they seem to be doing the same thing (failing to load any resource), which tells me the problem is probably in the way I built Thor.  I played around with the build setting in cmake but was unable to get it to work, everything else seems to work fine.  Using the debugger I found that the ResourceKey for any resource never actually gets put in the map in ResourceCache.  I can't figure out why this is happening!

This is what I'm using to test
    thor::ResourceKey<sf::Font> fontKey = thor::Resources::fromFile<sf::Font>("Font/sansation.ttf");
    try
    {
        mFont = resourceCache.acquire(fontKey);
    }
    catch (thor::ResourceLoadingException &e)
    {
        std::cout << e.what() << std::endl;
    }
 
(FYI: The file is most definitely present.)

the output (this is similar to each example in Thor that loads resources)
Failed to load font "Font/sansation.ttf" (failed to create the font face)
Failed to load resource "[FromFile] Font/sansation.ttf"
 

platform: Mac OS X 10.10, Xcode 6.1
compiler: Apple LLVM 6.0, using libc++ and c++11 language dialect

2
General / Re: thor::CallbackTimer with SFML 2.1
« on: October 02, 2013, 05:43:39 pm »
I must have looked at the documentation at least three times, turns out I was restarting the timer before my call to update(), so as far as update knew, the timer was never expired.  The problem was solved by updating before restarting the timer.  Thanks for the help.

3
General / thor::CallbackTimer with SFML 2.1
« on: October 02, 2013, 01:51:25 am »
Hey guys, i'm writing a little snake game to get acquainted with SFML 2.1, Thor, and some of the new c++11 features.

I'm having some trouble getting a thor::CallbackTimer to fire.  The timer is counting down, being updated every frame, and the connection is valid, but the callbacks aren't being called when the timer expires.

This is how i'm connecting the callback. In the documentation of Thor it looked like it needed a thor::CallbackTimer parameter, but that didn't solve the problem.
mSpecialFoodTimer.connect(std::bind(&Snake::setUpSpecialFood, this));

This is very similar to what is in the examples for Thor, yet it doesn't fire either.
mSpecialFoodTimer.connect(std::bind(&sf::RectangleShape::setFillColor, &gameBoard, sf::Color::Blue));

I also tried it by just putting a lambda statement in there, same behavior.  (i'm not sure if this would work in the first place, no compile errors though.)
connect = mSpecialFoodTimer.connect([this] (thor::CallbackTimer & timer) -> void
                                              {
                                                  std::cout << "food timer called\n";
                                                  food new_food;
                                                  sf::Vector2i pos = this->getOpenPosition();
                                                  new_food.mapPos = pos;
                                                  new_food.type = (thor::random(0,1) == 0 ? FOOD_TYPE::GRAPE : FOOD_TYPE::ORANGE);
                                                  mFood.push_back(new_food);
                                              });

Any help would be appreciated !

Pages: [1]
anything