public TestSpriteClassState(TextureManager textureManager) { _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)); }
public TestSpriteClassState(TextureManager textureManager) { _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)); }
public void Render() { Gl.glClearColor(0, 0, 0, 1.0f); Gl.glClear(Gl.GL_COLOR_BUFFER_BIT); 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); Gl.glBegin(Gl.GL_TRIANGLES); { Gl.glColor4f(0, 1, 0, 1); 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, z); Gl.glTexCoord2d(rightUV, topUV); Gl.glVertex3d(x + halfWidth, y + halfHeight, z); Gl.glTexCoord2d(rightUV, bottomUV); Gl.glVertex3d(x + halfWidth, y - halfHeight, z); Gl.glTexCoord2d(leftUV, bottomUV); Gl.glVertex3d(x - halfWidth, y - halfHeight, z); } Gl.glEnd(); }
public TextTestState(TextureManager textureManager) { _text.Texture = textureManager.Get("font"); //_text.SetUVs(new Point(0.113f, 0), new Point(0.17f, 0.101f)); //_text.SetWidth(15); //_text.SetHeight(26); }
public TextRenderState(TextureManager textureManager) { _textureManager = textureManager; _font = new Font(textureManager.Get("font"), FontParser.Parse("font.fnt")); _helloWorld = new Text("Hello", _font); }
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 FramesTestState(TextureManager textureManager) { _textureManager = textureManager; _font = new Font(textureManager.Get("font"), FontParser.Parse("font.fnt")); _fpsText = new Text("FPS: ", _font); }
public DrawSpriteState(TextureManager textureManager) { _textureManager = textureManager; 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); }
public TextWrapTest(TextureManager textureManager) { _textureManager = textureManager; _font = new Font(textureManager.Get("font"), FontParser.Parse("font.fnt")); _longText = new Text("The quick brown fox jumps over the lazy dog", _font, 400); }
public TweenTestState(TextureManager textureManager) { _sprite.Texture = textureManager.Get("face"); for (int i = 0; i < 10; i++) { _sprite.SetRotation(i); } }
public void Render() { Texture texture = _textureManager.Get("flower"); Gl.glEnable(Gl.GL_TEXTURE_2D); Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture.Id); double width = 600; double height = 600; double halfwidth = width / 2; double halfheight = height / 2; double x = 0; double y = 0; double z = 0; float topUV = 0; float bottomUV = 1.0f; float leftUV = 0; float rightUV = 1.0f; float red = 1; float green = 0; float blue = 0; float alpha = 0; //alpha += 0.1f; //if (alpha >= 1.0f) //{ // alpha = 0.0f; //} 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, z); Gl.glTexCoord2d(rightUV, topUV); Gl.glVertex3d(x + halfwidth, y + halfheight, z); Gl.glTexCoord2d(rightUV, bottomUV); Gl.glVertex3d(x + halfwidth, y - halfheight, z); Gl.glTexCoord2d(leftUV, bottomUV); Gl.glVertex3d(x - halfwidth, y - halfheight, z); } Gl.glEnd(); }
public MatrixTestState(TextureManager textureManager) { _faceSprite.Texture = textureManager.Get("face"); Gl.glEnable(Gl.GL_TEXTURE_2D); Matrix m = new Matrix(); m.SetRotate(new Vector(0, 0, 1), Math.PI / 5); Matrix mScale = new Matrix(); //change z to a 2 mScale.SetScale(new Vector (2.0, 2.0, 2.0)); m *= mScale; Vector scale = m.GetScale(); m *= m.Inverse(); for(int i = 0; i < _faceSprite.VertexPositions.Length; i++) { _faceSprite.VertexPositions[i] *= m; } }
public TextRenderState(TextureManager textureManager) { _textureManager = textureManager; _font = new Font(textureManager.Get("font"), FontParser.Parse("Image/font.fnt")); }
public SpecialEffectState(TextureManager manager) { _font = new Font(manager.Get("font"), FontParser.Parse("Image/font.fnt")); _text = new Text("Fermath", _font); }
public SpecialEffectState(TextureManager manager) { _font = new Font(manager.Get("font"), FontParser.Parse("font.fnt")); _text = new Text("Hello", _font); }