public virtual void Move(asd.Vector2DI dir) { if (CanMove(Position + dir)) { Position += dir; } }
public void Update() { var pos = new asd.Vector2DF( (int)(Parent.Position.X / Consts.CharSize.X) * Consts.CharSize.X, (int)(Parent.Position.Y / Consts.CharSize.Y) * Consts.CharSize.Y); var size = new asd.Vector2DI(); foreach (var chara in Charas) { size.X = Math.Max(size.X, chara.Key.Item1); size.Y = Math.Max(size.Y, chara.Key.Item2); } pos -= new asd.Vector2DF( Consts.CharSize.X * size.X, Consts.CharSize.Y * size.Y) / 2; pos += Position; foreach (var c in Charas) { c.Value.Position = new asd.Vector2DF( pos.X + c.Key.Item1 * Consts.CharSize.X, pos.Y + c.Key.Item2 * Consts.CharSize.Y ); } }
public Button(string text, float x, float y, int fontsize, asd.Color color) { font = asd.Engine.Graphics.CreateDynamicFont(string.Empty, fontsize, color, 1, new asd.Color(255, 255, 255, 255)); Font = font; size = font.CalcTextureSize(text, asd.WritingDirection.Horizontal); CenterPosition = new asd.Vector2DF(size.X / 2.0f, size.Y / 2.0f); Position = new asd.Vector2DF(x, y); Text = text; }
public virtual bool CanMove(asd.Vector2DI pos) { if (pos.X > 0 && pos.Y > 0 && pos.X < RoomIn.Width && pos.Y < RoomIn.Height) { if (RoomIn.GetBlock(pos).Wall) { return(false); } return(true); } return(false); }
protected override void OnDraw(asd.RenderTexture2D dst, asd.RenderTexture2D src) { Material2d.SetFloat("g_second", second); second += asd.Engine.DeltaTime; var wsi = asd.Engine.WindowSize; if (_lastWindowSize != wsi) { _lastWindowSize = wsi; var ws = wsi.To2DF(); Material2d.SetVector2DF("g_resolution", ws / Math.Min(ws.X, ws.Y)); Material2d.SetVector2DF("g_size", ws); } Material2d.SetTexture2D("g_texture", src); DrawOnTexture2DWithMaterial(dst, Material2d); OnDrawEvent(); }
public Block GetBlock(asd.Vector2DI pos) { return(Blocks[pos.X, pos.Y]); }
public virtual void AddToRoom(Room room, asd.Vector2DI pos) { Room = room; Position = pos; Pressed = false; }