public Object2D(Object2D parent, Vector2 size, Vector2 pos) { this.parent = parent; this.size = size; this.pos = pos; elements = new List <Object2D>(); }
public Button(Object2D parent, string texture, float scale, Vector2 pos, int[] AnimationLengths, string text, Action OnPress) : base(parent, texture, AnimationLengths, scale, pos) { this.scale = scale; name = text; this.OnPress = OnPress; }
public EffectSprite(Object2D parent, Texture2D texture, int animationsLengths, float scale, Vector2 pos, float lifeTime) : base(parent, texture, new int[1] { animationsLengths }, scale, pos) { this.lifeTime = lifeTime; life = lifeTime; }
public Scene(Action <int> exit) { this.exit = exit; Canvas = new Object2D(null, Vector2.Zero, Vector2.Zero); Effects = new Object2D(null, Vector2.Zero, Vector2.Zero); dEvents = new List <DEvent>(); debug = new DebugOuput(); }
public Slider(Object2D parent, string backTexture, string sliderTexture, float size, Vector2 pos, float value, Action onMove) : base(parent, backTexture, size, pos) { this.value = value; slider = new Sprite(this, sliderTexture, base.size.Y * 0.9f, Vector2.Zero); slider.pos.X = (scale - slider.size.X) * (this.value / 100); slider.pos.Y = base.size.Y * 0.2f; elements.Add(slider); this.onMove = onMove; }
public Sprite(Object2D parent, Texture2D texture, int[] animationsLengths, float scale, Vector2 pos) : base(parent, new Vector2(scale, scale), pos) { this.texture = texture; if (texture != null) { frameSize = new Vector2(this.texture.Width / animationsLengths.Max(), this.texture.Height / animationsLengths.Length); } this.animationsLengths = animationsLengths; this.scale = scale; base.size.Y = scale * this.frameSize.Y / this.frameSize.X; base.size.X = scale; }
public Object2D ObjUnderMouse() { for (int i = elements.Count - 1; i >= 0; i--) { Object2D buf = elements[i].ObjUnderMouse(); if (buf != null) { return(buf); } } if (UnderMouse()) { return(this); } return(null); }
public Switcher(Object2D parent, string backTexture, string switcherTexture, float size, Vector2 pos, bool value, Action onMove) : base(parent, backTexture, size, pos) { this.value = value; switcher = new Sprite(this, switcherTexture, base.size.Y * 0.95f, Vector2.Zero); if (value) { switcher.pos.X = 0; } else { switcher.pos.X = scale - switcher.size.X; } switcher.pos.Y = base.size.Y * -0.2f; elements.Add(switcher); this.onMove = onMove; }
public Sprite(Object2D parent, string texture, float size, Vector2 pos) : this(parent, texture, new int[] { 1 }, size, pos) { }
public Sprite(Object2D parent, string texture, int[] animationsLengths, float scale, Vector2 pos) : this(parent, EngineCore.content.Load <Texture2D>("Sprites/" + texture), animationsLengths, scale, pos) { }