コード例 #1
0
ファイル: Map.cs プロジェクト: marvelman610/tmntactis
        // isometric Map constructor
        public CMap(int isoWidth, int isoHeight, int numCols, int numRows, int zoomIncrement, bool bisometric, int type, int clientHeight, int clientWidth)
        {
            m_nCurrLayer = (int)LAYER.LAYER_ONE;
            m_nLayerMode = (int)LAYER_MODE.SHOW_L1;
            mTM = ManagedTextureManager.Instance;
            mD3d = ManagedDirect3D.Instance;
            m_nMapWidth = isoWidth * numCols;
            m_nMapHeight = isoHeight * numRows;

            // TODO:: how to do zoom with iso?
            /*            nCellSize = cellSize;*/
            m_nCellWidth = isoWidth;
            m_nCellHeight = isoHeight;
            m_nType = type;
            m_nNumCols = numCols;
            m_nNumRows = numRows;
            m_nZoom = 1.0f;
            nZoomIncrement = zoomIncrement;
            m_nTotalNumTiles = numCols * numRows;
            m_bIsIsometric = bisometric;

            m_gMapGrid = new CGrid(isoWidth, isoHeight, m_nNumRows, m_nNumCols, 0, nZoomIncrement, yOffset, yOffset, true, type);
            if (type == (int)IsoType.ISO_DIAMOND)
                m_gMapGrid.CenterOnY(clientHeight, m_nMapHeight);
            else if (type == (int)IsoType.ISO_STAG)
            {
                m_nMapHeight = (isoHeight >> 1) * numRows;
                if (m_nMapHeight < clientHeight-100)
                    m_gMapGrid.CenterOnY(clientHeight-100, m_nMapHeight);
                else
                    m_gMapGrid.SetMapY(m_nCellHeight);
                m_gMapGrid.CenterOnX(clientWidth, m_nMapWidth);
            }
            SetClearStrings();
            NewMapTileArray();
        }
コード例 #2
0
ファイル: Tileset.cs プロジェクト: marvelman610/tmntactis
        public CTileset(int imageID, Color key, int width, int height, int cellWidth, int cellHeight,  string filepath)
        {
            mD3d = ManagedDirect3D.Instance;
            mTM = ManagedTextureManager.Instance;
            m_nCurrLayer      = 0;
            nTilesetImageID   = imageID;
            m_nImageWidth     = m_nTilesetWidth = width;
            m_nImageHeight    = m_nTilesetHeight = height;
            m_strFilePath     = filepath;
            m_nCellSize       = cellWidth;
            NCellWidth        = cellWidth;
            m_nCellHeight     = cellHeight;
            m_nNumCols        = m_nImageWidth / cellWidth;
            m_nNumRows        = m_nImageHeight / cellHeight;
            m_nTotalNumTiles  = m_nNumCols * m_nNumRows;

            m_gTilesetGrid = new CGrid(cellWidth, cellHeight, m_nNumCols, m_nNumRows, 0, 0, nOffsetX, nOffsetY, false, -1);
            m_gTilesetGrid.NImageHeight = m_nImageHeight;
            m_gTilesetGrid.NImageWidth = m_nImageWidth;
            m_strFilePath = filepath;
            if (key != null)
                clrKey = key;
            else
                clrKey = Color.White;
            if (cellHeight == cellWidth)
                SetupTileset(0, imageID);
            else
                SetupTilesetNotSquare(0, imageID);
        }
コード例 #3
0
ファイル: Map.cs プロジェクト: marvelman610/tmntactis
        public CMap(int cellSize, int numCols, int numRows, int zoomIncrement, bool bisometric)
        {
            m_nCurrLayer = (int)LAYER.LAYER_ONE;
            m_nLayerMode = (int)LAYER_MODE.SHOW_L1;
            mTM = ManagedTextureManager.Instance;
            mD3d = ManagedDirect3D.Instance;
            m_nMapWidth = cellSize * numCols;
            m_nMapHeight = cellSize * numRows;
            m_nCellSize = cellSize;
            m_nCellWidth = cellSize;
            m_nCellHeight = cellSize;
            m_nNumCols = numCols;
            m_nNumRows = numRows;
            m_nZoom = 1.0f;
            nZoomIncrement = zoomIncrement;
            m_nTotalNumTiles = numCols * numRows;
            m_bIsIsometric = bisometric;

            m_gMapGrid = new CGrid(m_nCellSize, m_nCellSize, m_nNumRows, m_nNumCols, 0, nZoomIncrement, 0, 0, false, -1);
            SetClearStrings();
            NewMapTileArray();
        }