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

Pages: [1]
1
General / Rotating a Sprite
« on: June 25, 2013, 11:59:51 pm »
I'm having problems with this, I have a Ship class, that inherits the Sprite class... I change It's origin to the center, but if I try to rotate the Sprite, It's seems like it rotates the sprite from the top-left corner, there's my code:

Quote
Ship::Ship()
    : sf::Sprite()
{
   texture.loadFromFile("10B.png");
   this->setTexture(texture);
 
   this->setOrigin( this->getGlobalBounds().width / 2, this->getGlobalBounds().height / 2 );
   this->scale(sf::Vector2f(0.25f, 0.25f));   
   this->setPosition(100.0f, 100.0f);
 
   // Definimos la velocidad
   this->speed.x = 300.0f;
   this->speed.y = 300.0f;

}
 
void Ship::update(sf::Time& delta)
{   
   float left = this->getPosition().x;
   float right = this->getPosition().x + this->getGlobalBounds().width;
   float top = this->getPosition().y;
   float bottom = this->getPosition().y + this->getGlobalBounds().height;

   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up) && top > 0)
      //this->setRotation(this->getRotation() + 5);
      this->move(0.0f, -delta.asSeconds() * speed.y);
   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
      this->move(0.0f, delta.asSeconds() * speed.y);
   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left) && left > 0)
      this->move(-delta.asSeconds() * speed.x, 0.0f);
   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
      this->move(delta.asSeconds() * speed.x, 0.0f);

   if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
      this->rotate(5);

   if( top < 0 )
   {
      this->setPosition( this->getPosition().x, 0 );
   }
   if( left < 0 )
   {
      this->setPosition( 0, this->getPosition().y );
   }
    
}

2
General / Re: Having problems on 64 bits
« on: June 22, 2013, 07:48:57 pm »
Problem solved, wrong graphics configuration. Thanks anyway  :)

3
General / Having problems on 64 bits
« on: June 22, 2013, 05:05:26 pm »
I'm having some problems running SFML on 64 bits, the thing is, when I try to render text, the console shows this message:

An internal OpenGL call failed in Texture.cpp <327> : GL_INVALID_VALUE, a numeric argument is out of range

and It doesn't show any text...

Otherwise, the fps seems crazy, even with "Vertical Sync" enabled. I test exactly the same code on my desktop pc and It works perfectly.

These are my laptop's specifications:

------------------
System Information
------------------
Time of this report: 6/22/2013, 10:25:49
Machine name: CARLOS-PC
Operating System: Windows Vistaâ„¢ Home Premium (6.0, Build 6001) Service Pack 1 (6001.longhorn_rtm.080118-1840)
Language: Spanish (Regional Setting: Spanish)
System Manufacturer: Hewlett-Packard
System Model: HP Pavilion dv5 Notebook PC
BIOS: Default System BIOS
Processor: Intel(R) Core(TM)2 Duo CPU     T5800  @ 2.00GHz (2 CPUs), ~2.0GHz
Memory: 4026MB RAM
Page File: 2402MB used, 5853MB available
Windows Dir: C:\Windows
DirectX Version: DirectX 10
DX Setup Parameters: Not found
DxDiag Version: 6.00.6001.18000 64bit Unicode

----------------------------------------------------------------------------------------------------------------------------------

Apologies for my English, btw.

4
Graphics / Re: Can't draw text and either load font
« on: June 21, 2013, 03:11:34 am »
Well, I link the debug version of the libraries and it works, thanks :)

5
Graphics / Re: Can't draw text and either load font
« on: June 21, 2013, 03:06:14 am »
What do you mean? I paste all the files in /bin folder to system32 directly, is it wrong? I didn't understand how to setup the dll's when I read the tutorial yesterday, lol

6
Graphics / Re: Can't draw text and either load font
« on: June 21, 2013, 02:49:24 am »
It doesn't change anything, same error

7
Graphics / Can't draw text and either load font
« on: June 21, 2013, 02:45:48 am »
I'm trying to draw some text to a game, but I'm having trouble with it.




#include <SFML\Graphics.hpp>

sf::Font font;

int main()
{
   sf::RenderWindow window( sf::VideoMode( 800, 600 ), "Texto" );

   font.loadFromFile("BROADW.ttf");

   sf::Text text;
   text.setFont(font);
   text.setCharacterSize(40);
   text.setColor(sf::Color::Blue);
   text.setPosition( 100.0f, 100.0f );
   text.setString( "Hola Mundo!" );

   while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
         if (event.type == sf::Event::Closed)
                window.close();
        }

      window.clear( sf::Color::Black );
      window.draw(text);
      window.display();
   }

   return 0;
}




When I try to load the font, I'm getting this error: "Unhandled exception in 0x66c41f34 (msvcr100.dll) in Text.exe: 0xC0000005: Access violation reading location 0x00357000."
Even if I try to draw text without font, It doesn't draw anything. What's going on?




Pages: [1]
anything