CocosSharp
CocosSharp copied to clipboard
Sizing and positioning of isometric maps incorrect/inconsistent
Using CCTileMap
with non-squared dimensions displays the map incorrectly. See screenshot:
The map above is 28x33 tiles.
A squared map is rendered correctly:

In both cases, the VisibleBoundsWorldspace
returns the following values:
{CCRect : (x=0, y=0, width=1920, height=1080)}
Center: {CCPoint : (x=960, y=540)}
InvertedSize: {CCRect : (x=0, y=0, width=1080, height=1920)}
LowerLeft: {CCPoint : (x=0, y=0)}
MaxX: 1920
MaxY: 1080
MidX: 960
MidY: 540
MinX: 0
MinY: 0
Origin: {CCPoint : (x=0, y=0)}
Size: {1920 x 1080}
UpperRight: {CCPoint : (x=1920, y=1080)}
The visible bounds match the design resolution of 1920x1080 I'm using.
Related to this problem: the CCTileMap
is always using the complete screen, even if it gets added to a CCLayer
with smaller dimensions. I tried the following:
var smallLayer = new CCLayer(new CCSize(500, 500), CCClipMode.Bounds);
smallLayer.AddChild(tileLayer);
gameLayer.AddChild(smallLayer);
I'd expect the tile map to be clipped to the smallLayer
bounds but still the map renders exactly as seen in the screenshots above.
A test project can be found here: https://github.com/Krumelur/Carcass/tree/issue_tilemap_offset