public SimpleLoadingScreen() { _showAction = new FadeIn(.3f); _hideAction = _showAction.Reverse(); _frame = SkidiGame.ResourceManager.GetFrame("$px"); Scale = SkidiGame.ScreenBounds.Size.ToVector2(); }
public void Draw(TextureFrame frame, Vector2 position, Color color, Vector2? origin = null, Vector2? scale = null, float rotation = 0f, SpriteEffects effect = SpriteEffects.None) { _spriteBatch.Draw(frame.Texture, _transform.Position + position, null, frame.Bounds, origin, _transform.Rotation + rotation, scale * _transform.Scale, color * _transform.Alpha, effect); }
public Button(ButtonFrames frames) : this() { _defaultFrame = frames.Default; _hoverFrame = frames.Hover; _downFrame = frames.Down; PointerState = PointerState.Default; }
public static ButtonFrames Create(TextureFrame defaultFrame, TextureFrame hoverFrame, TextureFrame downFrame) { return new ButtonFrames { Default = defaultFrame, Hover = hoverFrame, Down = downFrame }; }
protected ButtonBase(ButtonFrames frames, TextureFrame icon) : base(frames, icon) { var iconOrigin = new Vector2(0, 4) * SkidiBirdGame.Scale; OriginState = new[] { -iconOrigin, -iconOrigin, iconOrigin }; this.AddSignalHandler(CommonSignals.Ui.Enable, () => Enabled = true); this.AddSignalHandler(CommonSignals.Ui.Disable, () => Enabled = false); }
public IconButton(ButtonFrames frames, TextureFrame icon = null) : base(frames) { _icon = new Sprite { Frame = icon }; Icon = _icon; }
public Background(Rectangle screenBounds, TextureFrame frame, VerticalAlign vertical = VerticalAlign.Middle, HorizontalAlign horizontal = HorizontalAlign.Center) { if (screenBounds == null || screenBounds.Size == Point.Zero) throw new ArgumentNullException(nameof(screenBounds)); if (frame == null) throw new ArgumentNullException(nameof(frame)); _frame = frame; Color = Color.White; Alpha = 1f; var scaleFactor = Math.Max(screenBounds.Width/frame.Size.X, screenBounds.Height/frame.Size.Y); _scale = new Vector2(scaleFactor); var pos = new Vector2(); var frameSize = frame.Size*scaleFactor; switch (vertical) { case VerticalAlign.Top: pos.Y = 0; break; case VerticalAlign.Bottom: pos.Y = SkidiGame.ScreenBounds.Height - frameSize.Y; break; case VerticalAlign.Middle: pos.Y = (SkidiGame.ScreenBounds.Height - frameSize.Y)*.5f; break; } switch (horizontal) { case HorizontalAlign.Left: pos.X = 0; break; case HorizontalAlign.Right: pos.X = (SkidiGame.ScreenBounds.Width - frameSize.X); break; case HorizontalAlign.Center: pos.X = (SkidiGame.ScreenBounds.Width - frameSize.X)*.5f; break; } Position = pos; }
protected virtual void SetFrame(TextureFrame frame) { if (_frame == frame) return; if (_frame == null) { _frame = frame; Size = frame.Size; Origin = Origin; } else { _frame = frame; if (_frame.Size.Equals(frame.Size)) return; Size = Size; Origin = Origin; Position = Position; } }
public static ButtonFrames Create(TextureFrame defaultFrame, TextureFrame downFrame) { return Create(defaultFrame, defaultFrame, downFrame); }
public void Draw(TextureFrame frame, Rectangle rect, Color color, Vector2 origin, float rotation = 0f, SpriteEffects effects = SpriteEffects.None, float layerDepth = 0f) { _spriteBatch.Draw(frame.Texture, rect, frame.Bounds, color, rotation, origin, effects, layerDepth); }
public Sprite(TextureFrame frame) : this() { Frame = frame; }
public AnimateActionState(Sprite target, Animate action) : base(target, action) { _sprite = target; Animation = action.Animation; SplitTimes = new Bag<float>(action.SplitTimes); _originalFrame = Animation.RestoreOriginalSprite ? target.Frame : null; _framesCount = Animation.Frames.Count; _nextFrame = 0; _executedLoops = 0; }
public void SetFrames(TextureFrame defaultFrame, TextureFrame hoverFrame, TextureFrame downFrame) { DefaultFrame = defaultFrame; HoverFrame = hoverFrame; DownFrame = downFrame; }
public AnimationFrame(TextureFrame spriteFrame, float delayUnits) { SpriteFrame = spriteFrame; DelayUnits = delayUnits; }