Ejemplo n.º 1
0
        public void CreateTileMap(ProgressBar _progressbarProcess)
        {
            CTile _Tile = null;

            for (int i = 0; i < this.m_BitMap.Height / CTile.HEIGHT_TILE; ++i)
            {
                for (int j = 0; j < this.m_BitMap.Width / CTile.WIDTH_TILE; ++j)
                {
                    _Tile = new CTile(GetTile(j, i), CTile.CountID);

                    if (this.m_TileMap.Count == 0)
                    {
                        this.m_TileMap.Add(_Tile);
                        this.m_ArrMap[i, j] = CTile.CountID;
                        Bitmap a = new Bitmap(CTile.WIDTH_TILE, CTile.HEIGHT_TILE);
                        for (int y = 0; y < CTile.HEIGHT_TILE; y++)
                        {
                            for (int x = 0; x < CTile.WIDTH_TILE; x++)
                            {
                                a.SetPixel(x, y, _Tile.ArrPixel[y, x]);
                            }
                        }
                        a.Save(CTile.CountID.ToString() + ".png");
                        ++CTile.CountID;
                    }
                    else
                    {
                        for (int k = 0; k < this.m_TileMap.Count; ++k)
                        {
                            if (CTile.CompareTile(_Tile, this.m_TileMap[k]) == true)
                            {
                                this.m_ArrMap[i, j] = this.m_TileMap[k].ID;
                                break;
                            }

                            if (k == this.m_TileMap.Count - 1)
                            {
                                this.m_TileMap.Add(_Tile);
                                this.m_ArrMap[i, j] = CTile.CountID;
                                Bitmap a = new Bitmap(CTile.WIDTH_TILE, CTile.HEIGHT_TILE);
                                for (int y = 0; y < CTile.HEIGHT_TILE; y++)
                                {
                                    for (int x = 0; x < CTile.WIDTH_TILE; x++)
                                    {
                                        a.SetPixel(x, y, _Tile.ArrPixel[y, x]);
                                    }
                                }
                                a.Save(CTile.CountID.ToString() + ".png");
                                ++CTile.CountID;
                            }
                        }
                    }

                    _progressbarProcess.PerformStep();
                }

            }
        }
Ejemplo n.º 2
0
        public void CreateTileMap(ProgressBar _progressbarProcess)
        {
            CTile _Tile = null;

            for (int i = 0; i < this.m_BitMap.Height / CTile.HEIGHT_TILE; ++i)
            {
                for (int j = 0; j < this.m_BitMap.Width / CTile.WIDTH_TILE; ++j)
                {
                    _Tile = new CTile(GetTile(j, i), CTile.CountID);

                    if (this.m_TileMap.Count == 0)
                    {
                        this.m_TileMap.Add(_Tile);
                        this.m_ArrMap[i, j] = CTile.CountID;
                        Bitmap a = new Bitmap(CTile.WIDTH_TILE, CTile.HEIGHT_TILE);
                        for (int y = 0; y < CTile.HEIGHT_TILE; y++)
                        {
                            for (int x = 0; x < CTile.WIDTH_TILE; x++)
                            {
                                a.SetPixel(x, y, _Tile.ArrPixel[y, x]);
                            }
                        }
                        a.Save(CTile.CountID.ToString() + ".png");
                        ++CTile.CountID;
                    }
                    else
                    {
                        for (int k = 0; k < this.m_TileMap.Count; ++k)
                        {
                            if (CTile.CompareTile(_Tile, this.m_TileMap[k]) == true)
                            {
                                this.m_ArrMap[i, j] = this.m_TileMap[k].ID;
                                break;
                            }

                            if (k == this.m_TileMap.Count - 1)
                            {
                                this.m_TileMap.Add(_Tile);
                                this.m_ArrMap[i, j] = CTile.CountID;
                                Bitmap a = new Bitmap(CTile.WIDTH_TILE, CTile.HEIGHT_TILE);
                                for (int y = 0; y < CTile.HEIGHT_TILE; y++)
                                {
                                    for (int x = 0; x < CTile.WIDTH_TILE; x++)
                                    {
                                        a.SetPixel(x, y, _Tile.ArrPixel[y, x]);
                                    }
                                }
                                a.Save(CTile.CountID.ToString() + ".png");
                                ++CTile.CountID;
                            }
                        }
                    }

                    _progressbarProcess.PerformStep();
                }
            }
        }
Ejemplo n.º 3
0
        public static bool CompareTile(CTile _paraFirst, CTile _paraSecond)
        {
            for (int i = 0; i < CTile.HEIGHT_TILE; ++i)
            {
                for (int j = 0; j < CTile.WIDTH_TILE; ++j)
                {
                    if (_paraFirst.ArrPixel[i, j] != _paraSecond.ArrPixel[i, j])
                        return false;
                }
            }

            return true;
        }
Ejemplo n.º 4
0
        public static bool CompareTile(CTile _paraFirst, CTile _paraSecond)
        {
            for (int i = 0; i < Support.HEIGHT_OF_TILE; ++i)
            {
                for (int j = 0; j < Support.WIDTH_OF_TILE; ++j)
                {
                    if (_paraFirst.ArrPixel[i, j] != _paraSecond.ArrPixel[i, j])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 5
0
        public void CreateTileMap()
        {
            CTile _Tile = null;

            for (int i = 0; i < (int)(this.m_BitMap.PixelHeight) / Support.HEIGHT_OF_TILE; ++i)
            {
                for (int j = 0; j < (int)(this.m_BitMap.PixelWidth) / Support.WIDTH_OF_TILE; ++j)
                {
                    _Tile = new CTile(GetTile(j, i), CTile.CountID);

                    if (this.m_TileMap.Count == 0)
                    {
                        this.m_TileMap.Add(_Tile);
                        this.m_ArrMap[i, j] = CTile.CountID;
                        ++CTile.CountID;
                    }
                    else
                    {
                        for (int k = 0; k < this.m_TileMap.Count; ++k)
                        {
                            if (CTile.CompareTile(_Tile, this.m_TileMap[k]) == true)
                            {
                                this.m_ArrMap[i, j] = this.m_TileMap[k].ID;
                                break;
                            }

                            if (k == this.m_TileMap.Count - 1)
                            {
                                this.m_TileMap.Add(_Tile);
                                this.m_ArrMap[i, j] = CTile.CountID;
                                ++CTile.CountID;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void CreateTileMap()
        {
            CTile _Tile = null;

            for (int i = 0; i < (int)(this.m_BitMap.PixelHeight)/ Support.HEIGHT_OF_TILE; ++i)
            {
                for (int j = 0; j < (int)(this.m_BitMap.PixelWidth) / Support.WIDTH_OF_TILE; ++j)
                {
                    _Tile = new CTile(GetTile(j, i), CTile.CountID);

                    if (this.m_TileMap.Count == 0)
                    {
                        this.m_TileMap.Add(_Tile);
                        this.m_ArrMap[i, j] = CTile.CountID;
                        ++CTile.CountID;
                    }
                    else
                    {
                        for (int k = 0; k < this.m_TileMap.Count; ++k)
                        {
                            if (CTile.CompareTile(_Tile, this.m_TileMap[k]) == true)
                            {
                                this.m_ArrMap[i, j] = this.m_TileMap[k].ID;
                                break;
                            }

                            if (k == this.m_TileMap.Count - 1)
                            {
                                this.m_TileMap.Add(_Tile);
                                this.m_ArrMap[i, j] = CTile.CountID;
                                ++CTile.CountID;
                            }
                        }
                    }
                }
            }
        }