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

Pages: 1 ... 117 118 [119] 120 121 ... 124
1771
Graphics / Re: Sprite and Texture errors
« on: September 04, 2012, 07:53:44 pm »
Quote
OpenGL somehow releases the texture
Don't be cussin like that around me. ;)
void Sprite::draw(RenderTarget& target, RenderStates states) const
{
    if (m_texture)
    {
        states.transform *= getTransform();
        states.texture = m_texture;
        target.draw(m_vertices, 4, Quads, states);
    }
}
But sprite holds pointer to sf texture not anything opengl and draws like that so there is garbage in the space where old texture pointer points to(maybe)?

1772
Graphics / Re: Sprite and Texture errors
« on: September 04, 2012, 07:43:22 pm »
Vectors are guaranteed to lay their contents like c-style arrays did(one after another, so random acess is fast) and they reserve a bit of extra space for few objects when they get constructed but if you add too many they will run out of this extra space and then realocate their content to another chunk of space, bigger than the last to prepare for next push_backs.
You can check how many objects there are with size() and how much more space is ready for next objects with capacity().

1773
Graphics / Re: SetOrigin function makes the sprite disappear
« on: September 04, 2012, 07:38:38 pm »
Do other sprites appear?
Also, what class/type is that:
index x = -25

1774
Graphics / Re: Sprite and Texture errors
« on: September 04, 2012, 07:34:22 pm »
Use vector of raw pointers or smart pointers or try do: vector.reserve() with int amount of textures you will ever load(but if you load more than that the vector will realocate and any removal will invalidate pointers to all elements after removed element). If reserve doesn't work then just go with some pointers.

1775
Graphics / Re: SetOrigin function makes the sprite disappear
« on: September 04, 2012, 07:31:21 pm »
Sprite.setOrigin(400, 300);
Sprite.setPosition(Sprite.getOrigin());
This should make the sprite appear in same spot as if you didn't move it at all. Does it appear then?

1776
Graphics / Re: Sprite and Texture errors
« on: September 04, 2012, 07:19:33 pm »
Try use std::list instead of vector and see if it fixes anything. Just replace std::vector<sf::Texture> with std::list<sf::Texture>, they have same interfaces, it shouldn't break any code.

1777
Graphics / Re: Sprite and Texture errors
« on: September 04, 2012, 06:50:10 pm »
Content of vectors realocate after push_back if they run out of reserved memory(invalidates all pointers and references). Try using list, map or vector of pointers instead.

1778
Graphics / Re: SetOrigin function makes the sprite disappear
« on: September 04, 2012, 06:48:15 pm »
The transform get's recalculated that most likely is intended. There is position, rotation, origin and scale but if any of these changes, entire transform does. You can't set position to something and then set origin to something else and rotate/whatever with new origin while keeping position same. The position, center of rotation and scaling of something transformable is position of it's origin.

1779
Graphics / Re: Sprite and Texture errors
« on: September 04, 2012, 06:30:13 pm »
Derive from sf::drawable for easier syntax. than your _draw.
Do you add textures to vector after setting some sprites? If yes then vector might realocated your textures already before you drew them.

1780
General / Re: Why doesn't my fullscreen window display?
« on: September 04, 2012, 11:44:08 am »
That's what convertcoords is for in render window, it'll give you the position of the click in sfml coordinates from sf::mouse or sf::event coordinates.

1781
General / Re: Why doesn't my fullscreen window display?
« on: September 03, 2012, 11:44:02 pm »
You call setPosition after creating the window, right?
:D :D :D :D
Quote
Why don't you just use fullscreen mode, since you want to cover the whole screen?
This. Also these values for resolution are quite big imo, that'd not fit into my screen, if someone launches your game with smaller desktop resolution it'll not appear or display any error ordo anything at all. Just get one of valid video modes and run in fullscreen.

1782
Graphics / Re: No way to transform VertexArray?
« on: September 03, 2012, 08:09:44 pm »
Pass sf::RederStates object, it can contain a transformation or derieve from vertexarray and transformable and impelement own virtual draw function.

1783
General / Re: Why doesn't my fullscreen window display?
« on: September 03, 2012, 02:47:27 pm »
Do
App.create(sf::VideoMode::getFullscreenModes()[0],"CRAPS",sf::Style::Fullscreen);
instead if you want 'real' full screen and make sure your video mode is not fubar for fullscreening.
App also shouldn't be global but inside main.

If you want to fit sprite of a texture bigger or smaller into entire window then scale sprite with origin 0,0 with window.x/texture.x and window.y/texture.y

1784
System / Re: Questions and problems with sf::thread
« on: September 02, 2012, 12:48:34 pm »
Almost everything is in documentation, what isn't is primitives explanation(but that can be googles/guessed) and how to texture them(by passing &texture as second parameter to draw).

1785
System / Re: Questions and problems with sf::thread
« on: September 02, 2012, 12:32:51 pm »
That is quite a lot of tiles, arrays won't do probably.

Pages: 1 ... 117 118 [119] 120 121 ... 124