gluLookAt(playerX + 3.0, 3.0, playerY + 3.0, playerX, 0.0, playerY, 0.0, 1.0, 0.0); if (playerX - 10.0 >= 0) sx = (int)(playerX - 10.0); else sx = 0; if (playerY - 10.0 >= 0) sy = (int)(playerY - 10.0); else sy = 0; if (playerX + 3.0 <= 20) ex = (int)(playerX + 3.0) + 1; else ex = 21; if (playerY + 3.0 <= 20) ey = (int)(playerY + 3.0) + 1; else ey = 21; glTranslatef(sx + 0.5, 0.0, sy + 0.5); for (y = sy; y < ey; y++) { glPushMatrix(); for (x = sx; x < ex; x++) { if (maze[y * 21 + x]) drawCube(x, y); glTranslatef(1.0, 0.0, 0.0); } glPopMatrix(); glTranslatef(0.0, 0.0, 1.0); }
#define camera_max_x_screen (10) // how many tiles can be seen on the x-axe#define camera_max_z_screen(20) // how many tiles can be seen on the z-axefor(z = 0; z < camera_max_z_screen; z++){ for(x = 0; x < camera_max_x_screen; x++) { map[camera.z - (z/2)][camera.x - (x/2)]; }}