Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void map::renderTileMap(Tile* tileMap, const Uint8 r, const Uint8 g, const Uint8 b, bool showText, int xoffset) {
- SDL_Rect clip2;
- SDL_Rect clip3;
- /*clip2.x = this->ViewportInfo.gui_x;
- clip2.y = this->ViewportInfo.gui_y;
- clip2.w = this->ptrScreen->VIEWPORT_WIDTH;
- clip2.h = this->ptrScreen->VIEWPORT_HEIGHT;*/
- for (int i = 0; i < this->WorldInfo.total_tiles; i++) {
- if (tileMap[i].Occupied == true) {
- //if (this->ptrWorld->Map->path_map[i].Occupied == true) {
- int yT = (int)(i / this->WorldInfo.tiles_count_x);
- int xT = fmod(i*1.0f,this->WorldInfo.tiles_count_x*1.0f);
- int xP = xT*this->WorldInfo.tile_size;
- int yP = yT*this->WorldInfo.tile_size;
- if (this->inViewport(xP,yP,this->WorldInfo.tile_size,this->WorldInfo.tile_size)) {
- clip2.x = xP;
- clip2.y = yP;
- clip2.w = 32;
- clip2.h = 32;
- //clip2 = this->clipToViewport(xP,yP,clip2);
- int xViewOffset = this->ViewportInfo.gui_x + (xP - this->ViewportInfo.x);
- int yViewOffset = this->ViewportInfo.gui_y + ((yP) - this->ViewportInfo.y);
- clip3.x = xViewOffset+xoffset;
- clip3.y = yViewOffset;
- clip3.w = 32;
- clip3.h = 32;
- SDL_FillRect( ptrScreen->screen, &clip3, SDL_MapRGB( ptrScreen->screen->format, r, g, b ) );
- #ifdef SHOW_DEBUG_TEXT
- if (showText){
- sstr.str("");
- //sstr.str("speed: ");
- //sstr<<this->vector<<" - "<<this->targetvector;
- //sstr<<tileMap[i].OccupyData.size();
- //extra if statement for thread safety
- if (tileMap[i].Occupied == true) {
- sstr<<tileMap[i].OccupyData[0];
- }
- //sstr<<this->animation_list.curAnimFrame<<" - "<<this->angle.frame;
- str1 = sstr.str();
- ptrWorld->ptrScreen->printText(xViewOffset+xoffset,yViewOffset,str1.c_str());
- }
- #endif
- //this->ptrScreen->apply_surface(xViewOffset,yViewOffset,
- //this->ResID->surface,this->ptrScreen->screen,&clip);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement