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

Author Topic: Game crashes on Display  (Read 2048 times)

0 Members and 1 Guest are viewing this topic.

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Game crashes on Display
« on: September 01, 2011, 05:54:48 pm »
So after the last thread in which I was having an error with openGL I have starte to use just SFML and 2D
But now its breaking with this.

I have
Code: [Select]

std::cout << "draw sfml" << loop << std::endl;
            Game::DrawSFML();
std::cout << "display" << loop << std::endl;
            // Display window contents on screen
            App.Display();
            std::cout << "end" << loop << std::endl;

            loop++;


which gives

sqwitch0
menu0
draw sfml0
display0
[richy@fedoraLt Release]$

Im going to look through the SFMl source and my code to check if i have maybe created the window incorrectly

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Game crashes on Display
« Reply #1 on: September 01, 2011, 07:14:56 pm »
Figured out its to do with when I set the origin of the text
I think i do it right but im not sure

Code: [Select]

TitleText.SetOrigin(TitleText.GetRect().Width / 2, TitleText.GetRect().Height / 2);
    NewGameText.SetOrigin(NewGameText.GetRect().Width / 2, NewGameText.GetRect().Height / 2);
    OptionsText.SetOrigin(OptionsText.GetRect().Width / 2, OptionsText.GetRect().Height / 2);
    QuitText.SetOrigin(QuitText.GetRect().Width / 2, QuitText.GetRect().Height / 2);

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Game crashes on Display
« Reply #2 on: September 01, 2011, 07:21:54 pm »
Its when I  use st::Text::GetRect() that it breaks, dont know why as this shouldnt affect the drawing part

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Game crashes on Display
« Reply #3 on: September 02, 2011, 01:31:46 am »
It seems text needs to be drawned before you can use getRect

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Game crashes on Display
« Reply #4 on: September 02, 2011, 01:42:38 am »
Hmm, not sure if that worked or not as implementing the drawing before setting te origin created a different bug, however making a pointer to the menu class instead of not using a pointer has fixed everything.

Might be worth looking at tho