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

Pages: [1]
1
Graphics / Re: Position relative to a sprite
« on: December 29, 2014, 06:03:53 pm »
@Cepcter I honestly didn't get you, but still thank you for your help :)
@Laurent I was kinda confused me too, that I didn't know what I wanted. But Thanks to you the function gave me seems to be what I needed :)

2
Graphics / Re: Position relative to a sprite
« on: December 28, 2014, 08:16:34 pm »
@Ixrec I'm afraid that only applies to custom view but still i'll experiment with it
@Laurent 
sf::Vector2f newPoint = sprite.getTransform().transformPoint(pointToTransform);

is this what i'm looking for ? And does it get affected by rotation ? scale ?

3
Graphics / Re: Position relative to a sprite
« on: December 28, 2014, 07:23:14 pm »
@Ixrec what i wanted is to use coordinates of a sprite instead of coordinates (not coordinated) of screen
@Laurent Thanks ! I'll experiment with that !

4
Graphics / Re: Position relative to a sprite
« on: December 28, 2014, 03:50:10 pm »
I didn't get it, how you're gonna get it when you're the one who will give the offset parameter.
 the example that I provided is not what i exactly needed,I just want to get a position relative to a sprite in a vector2 that ignores rotations.
To be more specific, that position uses the sprite as coordinate system.

5
Graphics / Position relative to a sprite
« on: December 28, 2014, 03:38:23 pm »
Hi how do i get and use a vector2 that has coordinates relative to a sprite ?
say setPosition(vector2f PosRelativeToSprite)

6
Graphics / Re: Sprite is showing up white !
« on: December 28, 2014, 02:00:50 pm »
Yep, that works too !

7
Graphics / Re: Sprite is showing up white !
« on: December 28, 2014, 01:51:12 pm »
@eXpl0it3r you're a hero member :D it worked by passing in a pointer instead.
@Laurent adding it to the vector didn't cause me a trouble for now I hope it doesn't
And thank you for your time and efforts :)

8
Graphics / Re: Sprite is showing up white !
« on: December 28, 2014, 01:28:58 pm »
I will update the code above, and add what's missing :)

9
Graphics / Re: Sprite is showing up white !
« on: December 28, 2014, 01:18:32 pm »
The thing is, the texture exists fine in the memory, when I set it to the player him self becomes the bullet, plus the player texture is loaded within the same scope and still exists.These set of sprites particularly refuse to take any texture.
Also note that the playerspaceship class doesnt get destroyed during run-time.

10
Graphics / Sprite is showing up white !
« on: December 28, 2014, 12:36:14 pm »
Hi I have a vector of sprites created in real-time and they are added to it (to be more specific instantiating bullets) and every one of the uses the same texture created in a constructor of another class that contains them, the texture is fine because when I use it on static sprites it works fine, but this array of sprites refuses to get any texture what so ever and stays white all the time.
Any help is appreciated.

EDIT:I even tried to put the texture in main() before the main loop and assign it to every bullet before drawing it, same thing. I'm afraid this is a bad bug.


void PlayerSpaceShip::DrawBullets(sf::RenderWindow &win)
{
        for(int i = 0;i < bulletShot.size();i++)
        {
                bulletShot[i].Draw(win);
        }
}


void Projectile::SetPosition(int x, int y)
{
        m_sprite.setOrigin(m_sprite.getLocalBounds().width/2,m_sprite.getLocalBounds().height/2);
        m_sprite.setPosition(x,y);
}

void Projectile::SetTexture(sf::Texture texture)
{
        m_sprite.setTexture(texture);
}

void Projectile::Draw(sf::RenderWindow &win)
{
        win.draw(m_sprite);
}

void Projectile::Move()
{
        m_sprite.move(direction);
}
 

Pages: [1]
anything