Drawing a grid.

So... I used an array to create a map for a game,

1
2
3
4
5
6
7
8
9
10
11
12
int defaultmap[10] [10]{
1, 1, 1, 1, 0, 0, 3, 3, 3, 3,
1, 1, 1, 0, 0, 3, 3, 3, 3, 4,
1, 1, 0, 0, 0, 0, 3, 3, 4, 4,
1, 1, 0, 0, 0, 0, 0, 3, 4, 4,
1, 1, 1, 0, 0, 0, 0, 4, 4, 4,
1, 1, 0, 0, 0, 0, 4, 4, 4, 4,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 5, 5, 0, 0, 0, 0, 6, 6, 6,
5, 5, 5, 5, 5, 0, 0, 6, 0, 0,
5, 5, 5, 5, 5, 5, 0, 6, 0, 0
};

So, then I load it;
1
2
3
4
5
6
7
8
9
10
11
12
int glogic(){
    for(int maploop = 1; maploop != 10; maploop++){
        for(int coords = 1; coords != 10; coords++){
            Tile.setTexture(terrain);
            Tile.setTextureRect(IntRect(((defaultmap[maploop][coords])*32), 0, 32, 32));
            Tile.setPosition(Vector2f(((maploop*64)+15), ((coords*64)+15)));
            Tile.setScale(Vector2f(1, 1));
            Tile.scale(Vector2f(1, 1));
            Game.draw(Tile);
        }
    }
}

Btw I used this:
1
2
3
4
5
Sprite Tile;
Texture terrain;
RenderWindow Game(VideoMode(685, 685), "The game");
terrain.loadFromFile("Images/tiles.png");
Tile.setTexture(terrain);

(Btw I put the above code either in a function or I declared it outside of a function)
Pleas help me, they come out completely wrong.
The numbers represent a certain tile btw.
Topic archived. No new replies allowed.