public BitmapFont(BitmapFontFile file, Bitmap bitmap) { var regions = GenerateRegions(file); this.regions = regions.ToDictionary(r => r.Character); Texture = new Texture(bitmap); LineHeight = file.Common.LineHeight; TextureSize = new Vector2(bitmap.Width, bitmap.Height); }
protected void OnLoad(object sender, EventArgs e) { spriteBatch = new SpriteBatch(); texture = new Texture(new Bitmap(@"Content/test.png")); sprite = new Sprite(texture); arial = new BitmapFont("Content/arial_test"); text = new Text(arial, "The quick brown fox \njumps over the lazy dog.", new Vector2(0, 256), Color.Black); fpsFont = new BitmapFont(@"Content/fps_font"); fpsCounter = new ClockDisplay(Game.Clock, fpsFont, Vector2.Zero, Color.Black); // White is also default camera = Camera.CreateOrthographic(Game.ClientSize.Width, Game.ClientSize.Height, -1, 1); }
public Sprite(Texture texture, Transform transform) { VAO = GL.GenVertexArray(); VBO = GL.GenBuffer(); UBO = GL.GenBuffer(); this.texture = texture; this.Transform = transform; Tint = Vector4.One; GenerateVerts(); }
public Sprite(Texture texture, Transform transform, Vector4 tint) : this(texture, transform) { Tint = tint; }
public Sprite(Texture texture, Color tint) : this(texture) { Tint = new Vector4((float)tint.R / 255, (float)tint.G / 255, (float)tint.B / 255, (float)tint.A / 255); }