1
SFML projects / Before the Reign
« on: March 15, 2012, 03:43:15 pm »
Works for me with a AMD gpu. How did you sort the depth in the game?
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.
int tx = (TileActual % NumCols) * AnchoTile;
int ty = (TileActual / NumCols) * AltoTile;
mapa[VerticeActual + 0].TexCoords = sf::Vector2f((tx + 0) * AnchoTile, (ty + 0) * AltoTile);
mapa[VerticeActual + 1].TexCoords = sf::Vector2f((tx + 0) * AnchoTile, (ty + 1) * AltoTile);
mapa[VerticeActual + 2].TexCoords = sf::Vector2f((tx + 1) * AnchoTile, (ty + 1) * AltoTile);
mapa[VerticeActual + 3].TexCoords = sf::Vector2f((tx + 1) * AnchoTile, (ty + 0) * AltoTile);
int tx = (TileActual % NumCols);
int ty = (TileActual / NumCols) ;
mapa[VerticeActual + 0].TexCoords = sf::Vector2f((tx + 0) * AnchoTile, (ty + 0) * AltoTile);
mapa[VerticeActual + 1].TexCoords = sf::Vector2f((tx + 0) * AnchoTile, (ty + 1) * AltoTile);
mapa[VerticeActual + 2].TexCoords = sf::Vector2f((tx + 1) * AnchoTile, (ty + 1) * AltoTile);
mapa[VerticeActual + 3].TexCoords = sf::Vector2f((tx + 1) * AnchoTile, (ty + 0) * AltoTile);
Quote from: "BlueMagic"Just curious about this. How do you achieve it?
Is it storing the keystrokes in memory and then outputting to a file?
Yeah, that's the way.
for (x=0;x<mapw;x++){
for (y=0;y<maph;y++){
//Set vertex position
//tx and ty are the coordinates in the tetxure of the tile that we are referring to in the current iteration of the loop.
map[current + 0].TexCoords = sf::Vector2f( (tx + 0)* tileWidth, (ty + 0)* tileHeight);
map[current + 1].TexCoords = sf::Vector2f( (tx + 0)* tileWidth, (ty + 1)* tileHeight-0.0075);
map[current + 2].TexCoords = sf::Vector2f( (tx + 1)* tileWidth-0.0075, (ty + 1)* tileHeight-0.0075);
map[current + 3].TexCoords = sf::Vector2f( (tx + 1)* tileWidth-0.0075, (ty + 0)* tileHeight);
}
}