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 ... 123
1771
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.

1772
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?

1773
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.

1774
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.

1775
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.

1776
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.

1777
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.

1778
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.

1779
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.

1780
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

1781
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).

1782
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.

1783
System / Re: Questions and problems with sf::thread
« on: September 02, 2012, 12:10:33 am »
I mean your tiles, the ones from which the graphics come, not rendertextures, textures, if there is one it's perfect to use vertex array there.
Vertex arrays hold vertices(a 'better point' that is point on texture and point in sfml space, optionally colored) and the form they are supposed to take(the interesting one for tiles is quads, it means that each 4(0-3,4-7,8-11,ect..) vertices will form a 4 sided shape). You have to pass texture pointer as state in the draw call if you want it textured.
The removal and adding(but mostly removal) with arrays might be problematic but class that'd take care of that could probably be written with a bit of trouble.

1784
Window / Re: Github Keyboard.hpp mistake
« on: September 01, 2012, 11:32:57 pm »
Thanks.  :)

1785
Window / Re: Github Keyboard.hpp mistake
« on: September 01, 2012, 11:25:17 pm »
By the way, are all valid keys guaranteed to be all natural numbers in [0,count) range?

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