Add New Tile Layer defaults
by Tom Ogburn · in Torque Game Builder · 10/15/2005 (9:08 pm) · 1 replies
I would like to suggest modifying the code for adding a new tile layer in the tile map editor to default to the sizes of the first layer if it exists. In most instances, my layers are going to all be the same size so I have to either write down what size I'm making them or view the size on the first one then add the next one.
I've already done this for my code, so for anyone else that's interested...
in tileeditor\client\editorScreen.cs, replace the old launchNewLayerDialog() with this:
I've already done this for my code, so for anyone else that's interested...
in tileeditor\client\editorScreen.cs, replace the old launchNewLayerDialog() with this:
// --------------------------------------------------------------------
// Launch New Layer Dialog.
// --------------------------------------------------------------------
function launchNewLayerDialog()
{
%tileLayer = $editorTileMap.getTileLayer(0);
// Valid Tile Layer?
if ( !isObject(%tileLayer) )
{
// No, so use defaults.
txtLayerCountX.setValue( $pref::tileEditor2D::defaultTileCountX );
txtLayerCountY.setValue( $pref::tileEditor2D::defaultTileCountY );
txtLayerSizeX.setValue( $pref::tileEditor2D::defaultTileSizeX );
txtLayerSizeY.setValue( $pref::tileEditor2D::defaultTileSizeY );
txtLayerLayers.setValue( $pref::tileEditor2D::defaultTileLayers );
}
else
{
//Yes, default to size of first tile layer
%tileCount = %tileLayer.getTileCount();
%tileSize = %tileLayer.getTileSize();
txtLayerCountX.setValue( getWord(%tileCount, 0) );
txtLayerCountY.setValue( getWord(%tileCount, 1) );
txtLayerSizeX.setValue( getWord(%tileSize, 0) );
txtLayerSizeY.setValue( getWord(%tileSize, 1) );
txtLayerLayers.setValue( $pref::tileEditor2D::defaultTileLayers );
}
// Launch Dialog.
Canvas.pushDialog(newLayerDlg);
}About the author
Owner of Starlit Sky Games, Senior Developer / Architect at Migration.Mobi
Associate Melv May
I'll add that to the codebase.
Many thanks,
- Melv.