Пример #1
0
 public NameTable()
 {
     m_Tiles      = new int[_w * _h];
     m_Attributes = new int[_w * _h / 4];
     m_V          = new Core.Graphics.VertexPositionTextureHueExtra[_w * _h * 4];
     Scale        = 2;
 }
Пример #2
0
        private void setupTiles()
        {
            m_V = new Core.Graphics.VertexPositionTextureHueExtra[64 * 4];
            float   x = (float)Area.Width / (float)_tilesAcross;
            float   y = (float)Area.Height / (float)(64 / _tilesAcross);
            int     h = (64 / _tilesAcross);
            int     i = 0, j = 0;
            Vector4 t = new Vector4(0, 0, 0, 1);

            for (int iy = 0; iy < h; iy++)
            {
                for (int ix = 0; ix < _tilesAcross; ix++)
                {
                    t.X      = (j / 64.0f);
                    t.W      = ((float)(j++ + 1) / 64.0f);
                    m_V[i++] = new Core.Graphics.VertexPositionTextureHueExtra(new Vector3(ix * x, iy * y, 0), new Vector2(t.X, t.Y), Color.White, new Vector2());
                    m_V[i++] = new Core.Graphics.VertexPositionTextureHueExtra(new Vector3(ix * x + x, iy * y, 0), new Vector2(t.W, t.Y), Color.White, new Vector2());
                    m_V[i++] = new Core.Graphics.VertexPositionTextureHueExtra(new Vector3(ix * x, iy * y + y, 0), new Vector2(t.X, t.Z), Color.White, new Vector2());
                    m_V[i++] = new Core.Graphics.VertexPositionTextureHueExtra(new Vector3(ix * x + x, iy * y + y, 0), new Vector2(t.W, t.Z), Color.White, new Vector2());
                }
            }
        }