public TestSpriteClassState(TextureManager textureManager) { _textureManager = textureManager; _testSprite.Texture = _textureManager.Get("penguin"); _testSprite.SetHeight(256 * 0.5f); _testSprite2.Texture = _textureManager.Get("penguin"); _testSprite.SetPosition(-256, -256); _testSprite.SetColor(new Color(1, 0, 0, 1)); }
public void Render() { GL.ClearColor(1, 0, 0, 1); GL.Clear(ClearBufferMask.ColorBufferBit); Texture texture = _textureManager.Get("penguin"); GL.Enable(EnableCap.Texture2D); GL.BindTexture(TextureTarget.Texture2D, texture.Id); // Enable alpha blending GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); GL.Begin(PrimitiveType.Triangles); GL.Color4(red, green, blue, alpha); GL.TexCoord2(leftUV, topUV); GL.Vertex3(x - halfWidth, y + halfHeight, z); GL.TexCoord2(rightUV, topUV); GL.Vertex3(x + halfWidth, y + halfHeight, z); GL.TexCoord2(leftUV, bottomUV); GL.Vertex3(x - halfWidth, y - halfHeight, z); GL.TexCoord2(rightUV, topUV); GL.Vertex3(x + halfWidth, y + halfHeight, z); GL.TexCoord2(rightUV, bottomUV); GL.Vertex3(x + halfWidth, y - halfHeight, z); GL.TexCoord2(leftUV, bottomUV); GL.Vertex3(x - halfWidth, y - halfHeight, z); GL.End(); }
public TextTestState(TextureManager textureManager) { _textureManager = textureManager; _font = new Font(textureManager.Get("font"), FontParser.Parse("Fonts/Arial/font.fnt")); _hellowWorld = new Text("Hello", _font); }
public FPSTestState(TextureManager textureManager) { _textureManager = textureManager; _font = new Font(textureManager.Get("font"), FontParser.Parse("Fonts/Arial/font.fnt")); _fpsText = new Text("FPS:", _font); }