but what I don't get at all is the process of "moving" the right vertexs to the left top corner of the screen in order to start drawing the tiles.
I've no idea what you're talking about here...
never mind xd
Trying to figure out which Vertex are inside the View rect isn't good Idea either because some points of the 4 that compose the vertex will not been draw, thus, showing just three, two or one of them
In the logic part for culling you don't 'think' about points but about quads - you don't see 4 individual points, but a package of 4 points.
Hmm, yes, indeed that approach makes more sense!
EDIT:I'm doing some progress but without testing it...
So, I'm thinking on packages of 4 points as eXpl0it3r told me, and I must say that this is really easy than I thought before. Consider the following image:
The trick here is to calculate correctly the coordinates for the first vertex (Vertex1 or v1), and then, use the position or tex_coords of the first Vertex to calculate the other 3 vertex of a Quad:
# We calculate the first vertex
v1 = sfml.Vertex(tex_coods=sfml.Vector2(
float(x), float(y)))
# Then use v1.tex_coords to calculate the others
v2 = sfml.Vertex(tex_coords=sfml.Vector2(
v1.tex_coords.x + tilewidth,
v1.tex_coords.y))
v3 = sfml.Vertex(tex_coords=sfml.Vector2(
v1.tex_coords.x + tilewidth,
v1.tex_coords.y + tileheight))
v4 = sfml.Vertex(tex_coords=sfml.Vector2(
v1.tex_coords.x,
v1.tex_coords.y + tileheight))
# store the quad somewhere
tileimg = (v1, v2, v3, v4,)
very easy, right?
This should
(yes, I didn't run any test yet) work also for positioning the quads on screen. Orthographic or Isometric maps, that no matters, just calculate the first vertex position correctly and everything else should flow naturally!