Tile rendering system

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent cd8c77def2
commit 9ff1b99ac9
  1. 6
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness
  3. 8
      data.h

@ -210,10 +210,10 @@ public:
case GAMEWORLD:{ case GAMEWORLD:{
for (int y=-1;y<=HEIGHT/32;y++) { for (int y=-1;y<=HEIGHT/32;y++) {
for (int x=-1;x<=WIDTH/32;x++) { for (int x=-1;x<=WIDTH/32;x++) {
float xOffset=PLAYER_COORDS[0]-(WIDTH/64); int xOffset=PLAYER_COORDS[0]-(WIDTH/64);
float yOffset=PLAYER_COORDS[1]-(HEIGHT/64); int yOffset=PLAYER_COORDS[1]-(HEIGHT/64);
if (xOffset+x>=0&&xOffset+x<MAP_WIDTH&&yOffset+y>=0&&yOffset+y<MAP_HEIGHT) { if (xOffset+x>=0&&xOffset+x<MAP_WIDTH&&yOffset+y>=0&&yOffset+y<MAP_HEIGHT) {
DrawPartialDecal({(x-(PLAYER_COORDS[0]-(int)PLAYER_COORDS[0]))*32,(y-(PLAYER_COORDS[1]-(int)PLAYER_COORDS[1]))*32},{32,32},TILES,{0,0},{32,32}); DrawPartialDecal({(x-(PLAYER_COORDS[0]-(int)PLAYER_COORDS[0]))*32,(y-(PLAYER_COORDS[1]-(int)PLAYER_COORDS[1]))*32},{32,32},TILES,{0,0},{32,32},TILE_COLORS[MAP[yOffset+y][xOffset+x]]);
} }
} }
} }

Binary file not shown.

@ -10,4 +10,10 @@ GPSNAV-31 - UNABLE TO LOCATE
GPSNAV-33 - UNABLE TO LOCATE GPSNAV-33 - UNABLE TO LOCATE
GPSNAV-35 - UNABLE TO LOCATE GPSNAV-35 - UNABLE TO LOCATE
Press any key to continue.)"; Press any key to continue.)";
olc::Pixel TILE_COLORS[3]={
olc::Pixel(112, 88, 64),
olc::Pixel(60, 97, 49),
olc::Pixel(30, 84, 87),
};
Loading…
Cancel
Save