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.


Topics - hanik

Pages: [1]
1
General / C++ 11 compatibility
« on: August 24, 2014, 06:33:09 pm »
I rewrote sample game from SFML Game Development book using C++ 11 standart. Specifically, I used uniform initialization syntax {} in constructor. But in one place it didn't work correctly.

Button::Button(const FontHolder& fonts, const TextureHolder& textures)
: mCallback{}
, mNormalTexture{textures.get(Textures::ButtonNormal)}               // here
, mSelectedTexture{textures.get(Textures::ButtonSelected)}
, mPressedTexture{textures.get(Textures::ButtonPressed)}
, mSprite()
, mText{"", fonts.get(Fonts::Main), 16}
, mIsToggle{false}
{
        mSprite.setTexture(mNormalTexture);

        sf::FloatRect bounds = mSprite.getLocalBounds();
        mText.setPosition(bounds.width / 2.f, bounds.height / 2.f);
}
 

Game works, but textures don't render on window. Instead of them there is only white rectangle. However, when I use old style () initialization everything is OK.

I use Code::Blocks with MinGW compiler (version is 4.5.2), Windows 7.

I wonder where is error? Maybe it is in MinGW?

Thank you.

Pages: [1]
anything