Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::drawable* Problem  (Read 1137 times)

0 Members and 1 Guest are viewing this topic.

Koschi

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
sf::drawable* Problem
« on: May 24, 2012, 08:21:42 am »
Hello everyone

I got a little problem with sf::drawable* and sf::String. I use SFML 1.6 and CodeBlocks.
I try to write a UI class for all UI Elements i wrote a abstract baseclass. This class has a function to give back a sf::drawable*
sf::drawable* Render_Element() = 0
 
My 2 UI elements class inherit from this baseclass.
CUI_Button works well the Render_Element():
// in h file
sf::Sprite*Sprite;

// in cpp file
sf::drawable* CUI_Button::Render_Element()
{
     return sprite;
}
 
With this Code i can Render my Sprite.
Now to the problem. In my CUI_Text class i go the same way but i didn't work.
// in h file
sf::String* text;

// in cpp file
sf::drawable* CUI_Button::Render_Element()
{
     return text;
}
 
This Function give the drawable* Object to the Draw function.

If the String empty it works, if something in the String it dont work.

I don't understand why this code Not work. I Hope someone can help.

Sorry for my bad englisch i hope you guys understand if :)

Koschi
« Last Edit: May 24, 2012, 08:32:47 am by Koschi »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::drawable* Problem
« Reply #1 on: May 24, 2012, 08:28:42 am »
What does "doesn't work" mean? Compile error, crash, unexpected results, ...?
Laurent Gomila - SFML developer

Koschi

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: sf::drawable* Problem
« Reply #2 on: May 24, 2012, 08:36:32 am »
It Compiels well. The programm crash (only when the string is not empty).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::drawable* Problem
« Reply #3 on: May 24, 2012, 09:29:02 am »
Run the debugger, and see where/why it crashes. Debuggers are made for that :P
Laurent Gomila - SFML developer