Hello,
I have several questions about efficency and praxis in general. I know (more or less) how to use the different classes, but i'm not sure about what kind of component to use for different tasks.
(SFML 2.0)
Please excuse my cruce and inaccurate MS paint drawins
I have the scenario (1), and I draw the shadows the scenario would cast (2), then draw the shadows over the scenario (3).
The shadows (2) have to be redrawn each time the light source moves, which could be every game cicle. This means that I need to draw over a texture and then draw the texture over the screen.
Which classes fit this task. Currently
I'm using a RenderTexture and a Sprite that share the same texture. I draw the primitives over the renderTexture, and then draw the Sprite over the window.
Is there a better class for this kind of task?
My map is tile based. Currently, when I load the map, I draw all the tiles over a RenderTexture, then load it's texture into a sprite. I use this sprite during the execution to draw the map in the screen. This is ok for a small map, but if the map grows bigger this will turn into a problem, or so I think.
I was considerng having a matrix of textures, of 500x500 pixels, and load the sections as you advance and unload them as you leave them behind.
Is there a better approach for this matter? I keep reading about Vertex Arrays, but I fail how they are helpful in this scenario (related to last point).
As a rule of thumb, when I want to manipulate an image regulary and display it, I make a RenderTexture and a Sprite share a texture, and use the RenderTexture to draw on it, and the Sprite to display it on screen.
I have seen the Image class, but I'm not really sure about the difference between it and the RenderTexture class. What kind of task do they fit better?
- Vertex Arrays and ConvexShapes:
I'm drawing the shadows mentioned in the first point ConvexShapes. I have seen the VertexArray class, and using the trianglestrip primitive type could be used to draw the shadows, and it would let me draw non convex shadows in one go, but besides that I don't really see an advantage on using VertexArrays.
Are ConvexShapes heavier than Vertex Arrays?
[/list]
I bet most of my questions are dumb/basic, but until now I have just
blited my way through using the allegro library for basic stuff
Thanks for the help!