Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.44 KB | None | 0 0
  1. int tileXEndPos = std::min(lvlTileAmountX,(sceneEditorViewRect.x+sceneEditorViewRect.w)/lvlTileWidth );
  2.     int tileYEndPos = std::min(lvlTileAmountY,(sceneEditorViewRect.y+sceneEditorViewRect.h)/lvlTileHeight );
  3.     SDL_Rect foundTsRect;
  4.     int cTileXPos = 0;
  5.     int cTileYPos = 0;
  6.     GPE_ResourceContainer * foundTSResource = NULL;
  7.     tilesheetResource * foundHeldTSRes = NULL;
  8.     for(  i = 0; i < (int)sceneLayers.size();i++)
  9.     {
  10.         cTileLayer = sceneLayers.at(i);
  11.         if( cTileLayer!=NULL)
  12.         {
  13.             for(  j = tileXStartPos; j < tileXEndPos;j++)
  14.             {
  15.                 for(  k = tileYStartPos; k < tileYEndPos;k++)
  16.                 {
  17.                     foundTilePos = j+k*lvlTileAmountX;
  18.                     cTileXPos = editorView.x+j*lvlTileWidth-sceneEditorViewRect.x;
  19.                     cTileYPos = editorView.y+k*lvlTileHeight-sceneEditorViewRect.y;
  20.                     if( (int)cTileLayer->mapTiles.size() > foundTilePos)
  21.                     {
  22.                         fSceneTile = cTileLayer->mapTiles.at(foundTilePos);
  23.                         if( fSceneTile!=NULL)
  24.                         {
  25.                             if( fSceneTile->tilesheetIndexId>=0 && fSceneTile->tileIndexId>=0)
  26.                             {
  27.                                 foundTSResource = allTilesheetsFolder->find_resource_from_id(fSceneTile->tilesheetIndexId);
  28.                                 if( foundTSResource!=NULL)
  29.                                 {
  30.                                     foundHeldTSRes = (tilesheetResource * )foundTSResource->get_held_resource();
  31.                                     if( foundHeldTSRes->tilesheetInEditor!=NULL)
  32.                                     {
  33.                                         if( foundHeldTSRes->tilesheetInEditor->tsImage!=NULL && fSceneTile->tileIndexId < (int)foundHeldTSRes->tilesheetInEditor->tsRects.size() )
  34.                                         {
  35.                                             foundTsRect = foundHeldTSRes->tilesheetInEditor->tsRects.at(fSceneTile->tileIndexId );
  36.                                             foundHeldTSRes->tilesheetInEditor->tsImage->render_tex(cRender,cTileXPos,cTileYPos, &foundTsRect );
  37.                                         }
  38.                                     }
  39.                                 }
  40.                             }
  41.                         }
  42.                     }
  43.                 }
  44.             }
  45.         }
  46.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement