Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int tileXEndPos = std::min(lvlTileAmountX,(sceneEditorViewRect.x+sceneEditorViewRect.w)/lvlTileWidth );
- int tileYEndPos = std::min(lvlTileAmountY,(sceneEditorViewRect.y+sceneEditorViewRect.h)/lvlTileHeight );
- SDL_Rect foundTsRect;
- int cTileXPos = 0;
- int cTileYPos = 0;
- GPE_ResourceContainer * foundTSResource = NULL;
- tilesheetResource * foundHeldTSRes = NULL;
- for( i = 0; i < (int)sceneLayers.size();i++)
- {
- cTileLayer = sceneLayers.at(i);
- if( cTileLayer!=NULL)
- {
- for( j = tileXStartPos; j < tileXEndPos;j++)
- {
- for( k = tileYStartPos; k < tileYEndPos;k++)
- {
- foundTilePos = j+k*lvlTileAmountX;
- cTileXPos = editorView.x+j*lvlTileWidth-sceneEditorViewRect.x;
- cTileYPos = editorView.y+k*lvlTileHeight-sceneEditorViewRect.y;
- if( (int)cTileLayer->mapTiles.size() > foundTilePos)
- {
- fSceneTile = cTileLayer->mapTiles.at(foundTilePos);
- if( fSceneTile!=NULL)
- {
- if( fSceneTile->tilesheetIndexId>=0 && fSceneTile->tileIndexId>=0)
- {
- foundTSResource = allTilesheetsFolder->find_resource_from_id(fSceneTile->tilesheetIndexId);
- if( foundTSResource!=NULL)
- {
- foundHeldTSRes = (tilesheetResource * )foundTSResource->get_held_resource();
- if( foundHeldTSRes->tilesheetInEditor!=NULL)
- {
- if( foundHeldTSRes->tilesheetInEditor->tsImage!=NULL && fSceneTile->tileIndexId < (int)foundHeldTSRes->tilesheetInEditor->tsRects.size() )
- {
- foundTsRect = foundHeldTSRes->tilesheetInEditor->tsRects.at(fSceneTile->tileIndexId );
- foundHeldTSRes->tilesheetInEditor->tsImage->render_tex(cRender,cTileXPos,cTileYPos, &foundTsRect );
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement