Created
February 24, 2009 12:13
-
-
Save simonask/69540 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void render() { | |
// Tiles | |
for (int i = 0; i < columns; ++i) | |
{ | |
for (int j = 0; j < rows; ++j) | |
{ | |
glBegin(GL_QUADS); | |
glColor3f(0.0, 1.0, 0.0); | |
glVertex2f(i*tile_width, j*tile_height); | |
glVertex2f(i*tile_width+tile_width, j*tile_height); | |
glVertex2f(i*tile_width+tile_width, j*tile_height+tile_height); | |
glVertex2f(i*tile_width, j*tile_height+tile_height); | |
glEnd(); | |
} | |
} | |
// Player | |
glBegin(GL_QUADS); | |
glColor3f(0.0, 0.0, 1.0); | |
glVertex2f(player_x*tile_width, player_y*tile_height); | |
glVertex2f(player_x*tile_width+tile_width, player_y*tile_height); | |
glVertex2f(player_x*tile_width+tile_width, player_y*tile_height+tile_height); | |
glVertex2f(player_x*tile_width, player_y*tile_height+tile_height); | |
glEnd(); | |
glFlush(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment