public void Draw(string SurfaceName, SurfaceContext ctx) { if (string.IsNullOrEmpty(SurfaceName)) { return; } var sprite = _textures.Get(SurfaceName); sprite.Position = new Vector2f(ctx.Position.x, ctx.Position.y); if (ctx.Rect.HasValue) { var rect = ctx.Rect.Value; sprite.TextureRect = new IntRect(rect.left, rect.top, rect.width, rect.height); sprite.Scale = new Vector2f( ctx.Size.x / rect.width, ctx.Size.y / rect.height ); } else { sprite.Scale = new Vector2f( ctx.Size.x / sprite.Texture.Size.X, ctx.Size.y / sprite.Texture.Size.Y ); } this._buffer.Draw(sprite); }
public Player() { this._ctx = new SurfaceContext() { Size = (175, 175) }; }
public Room(string backgroundImage) { this.BackgroundImage = backgroundImage; this._ctx = new SurfaceContext() { Position = (50, 50), Size = (GameWindow.WINDOW_WIDTH - 100, GameWindow.WINDOW_HEIGHT - 100) }; }