예제 #1
0
        public TestSpriteClassState(TextureManager textureManager)
        {
            something = 0;

            // TODO: Complete member initialization
            _textureManager     = textureManager;
            _testSprite.Texture = _textureManager.Get("face_alpha");
            _testSprite.SetHeight(256 * 0.5f);

            _testSprite2.Texture = _textureManager.Get("face_alpha");
            _testSprite2.SetPosition(-256, -256);
            _testSprite2.SetColor(new Color(1, 0, 0, 1));
        }
예제 #2
0
 public TextTestState(TextureManager textureManager)
 {
     _text.Texture = textureManager.Get("font");
     _text.SetUVs(new Point(0.113f, 0), new Point(0.171f, 0.101f));
     _text.SetWidth(15);
     _text.SetHeight(26);
 }
 public TextRenderState(TextureManager textureManager)
 {
     _textureManager = textureManager;
     _font           = new Font(textureManager.Get("font"),
                                FontParser.Parse("font.fnt"));
     _text = new Text("Hello", _font);
 }
 public FPSTestState(TextureManager textureManager)
 {
     _textureManager = textureManager;
     _font           = new Font(textureManager.Get("font"),
                                FontParser.Parse("font.fnt"));
     _fpsText = new Text("FPS: ", _font);
 }
        public MatrixTestState(TextureManager textureManager)
        {
            _faceSprite.Texture = textureManager.Get("face");

            m.SetRotate(new Vector(0, 0, 1), Math.PI / 5);
            mScale.SetScale(new Vector(2.0, 2.0, 0.0));

            m *= mScale;

            for (int i = 0; i < _faceSprite.VertexPositions.Length; i++)
            {
                _faceSprite.VertexPositions[i] *= m;
            }

            Gl.glEnable(Gl.GL_TEXTURE_2D);
        }
예제 #6
0
        public void Render()
        {
            Texture texture = _textureManager.Get("face_alpha");

            Gl.glEnable(Gl.GL_TEXTURE_2D);
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture.Id);
            Gl.glEnable(Gl.GL_BLEND);
            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);

            float topUV    = 0;
            float bottomUV = 1;
            float leftUV   = 0;
            float rightUV  = 1;

            float red   = 1;
            float green = 0;
            float blue  = 0;
            float alpha = 1;

            Gl.glBegin(Gl.GL_TRIANGLES);
            {
                Gl.glColor4d(red, green, blue, alpha);

                Gl.glTexCoord2d(leftUV, topUV);
                Gl.glVertex3d(x - halfWidth, y + halfHeight, z);
                Gl.glTexCoord2d(rightUV, topUV);
                Gl.glVertex3d(x + halfWidth, y + halfHeight, z);
                Gl.glTexCoord2d(leftUV, bottomUV);
                Gl.glVertex3d(x - halfWidth, y - halfHeight, 0);

                Gl.glTexCoord2d(rightUV, topUV);
                Gl.glVertex3d(x + halfWidth, y + halfHeight, z);
                Gl.glTexCoord2d(bottomUV, rightUV);
                Gl.glVertex3d(x + halfWidth, y - halfHeight, z);
                Gl.glTexCoord2d(leftUV, bottomUV);
                Gl.glVertex3d(x - halfWidth, y - halfHeight, 0);
            }
            Gl.glEnd();
        }
예제 #7
0
 public TweenTestState(TextureManager textureManager)
 {
     _faceSprite.Texture = textureManager.Get("face");
     _faceSprite.SetHeight(0);
     _faceSprite.SetWidth(0);
 }
 public SpecialEffectsState(TextureManager manager)
 {
     _font = new Font(manager.Get("font"), FontParser.Parse("font.fnt"));
     _text = new Text("Hello", _font);
 }