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

Pages: [1]
1
Graphics / Re: Renderedwindow.draw( sf::Text ) is crashing
« on: November 16, 2014, 09:35:19 pm »
Thank u so much !!

2
Graphics / Re: Renderedwindow.draw( sf::Text ) is crashing
« on: November 16, 2014, 09:07:02 pm »
Sorry for copy/paste my message twice, while i was writing my question, the session timed out and restarted everything :(


Is this line ok ?


sf::Font* myFont = new sf::Font();
 

so.. i shouldn't use pointers to any sfml type?

Thank u for answering so quick !

3
Graphics / Re: Renderedwindow.draw( sf::Text ) is crashing
« on: November 16, 2014, 08:52:48 pm »
ohhhh I solved!!! LOL...

When I'm initializing the font :

sf::Font myFont ;
   if (!myFont.loadFromFile("arial.ttf"))
   {
            //Throw error
   }

I changed by :

sf::Font* myFont = new sf::Font();
        if (!myFont->loadFromFile("arial.ttf"))
        {
                 //Throw error
        }

text->setFont(*myFont);
 

4
Graphics / Re: Renderedwindow.draw( sf::Text ) is crashing
« on: November 16, 2014, 08:46:35 pm »
Hello Everyone!!

I'm having troubles rendering text on the screen. When my renderedwindow instance call draw method using  a sf::Text instance as a parameter, i got a memory access violation message in MS VS 2012 c++


I'm using sfml 2.1 and I have triple checked that I'm not using the debug libraries.


here is my code:

class MyClass{

void Initialize(){
   mWindow = new new sf::RenderWindow();
   sf::Font myFont ;
        if (!myFont.loadFromFile("arial.ttf"))
        {
            //Throw error
        }

       text = new sf::Text();

        text->setFont(myFont);
        text->setCharacterSize(50);
       text->setPosition(250,250);
        text->setColor(sf::Color::Red);

        // set the text style
        text->setStyle(sf::Text::Bold | sf::Text::Underlined);

        text->setString("Hello world");
}

void draw(){
              mWindow->clear();
               
                mWindow->draw(*text);   // this line throw the memory access violation message
                mWindow->display();

}

}

private:
sf::RenderWindow* mWindow;
sf::Text* text;
}


void main(){
   MyClass* mclass = new MyClass();
  mclass->Initialize();

 //game loop
  while (......)  {
     mclass->draw();
  }

}

the error is :

Unhandled exception at 0x51C12E59 (sfml-graphics-2.dll) in CDIAZ_2DENGINE.exe: 0xC0000005: Access violation reading location 0x3F800004.

I'll appreciate the help!

5
Graphics / Renderedwindow.draw( sf::Text ) is crashing
« on: November 16, 2014, 08:19:39 pm »
Hello Everyone!!

I'm having troubles rendering text on the screen. When my renderedwindow instance call draw method using  a sf::Text instance as a parameter, i got a memory access violation message in MS VS 2012 c++


I'm using sfml 2.1 and I have triple checked that I'm not using the debug libraries.


here is my code:

class MyClass{

void Initialize(){
   mWindow = new new sf::RenderWindow();
   sf::Font myFont ;
   if (!myFont.loadFromFile("arial.ttf"))
   {
            //Throw error
   }

       text = new sf::Text();

   text->setFont(myFont);
   text->setCharacterSize(50);
       text->setPosition(250,250);
         text->setColor(sf::Color::Red);

   // set the text style
   text->setStyle(sf::Text::Bold | sf::Text::Underlined);

   text->setString("Hello world");
}

void draw(){
              mWindow->clear();
      
      mWindow->draw(*text);   // this line throw the memory access violation message
      mWindow->display();

}

}

private:
sf::RenderWindow* mWindow;
sf::Text* text;
}


void main(){
   MyClass* mclass = new MyClass();
  mclass->Initialize();

 //game loop
  while (......)  {
     mclass->draw();
  }

}

the error is :

Unhandled exception at 0x51C12E59 (sfml-graphics-2.dll) in CDIAZ_2DENGINE.exe: 0xC0000005: Access violation reading location 0x3F800004.

I'll appreciate the help!

Pages: [1]