public static TexturedEffectButton createButton(ContentManager content, Vector2 position, String name) { const float SPACE = 65f; PulseEffectParams effectParms = new PulseEffectParams { ScaleBy = 1f, ScaleDownTo = .9f, ScaleUpTo = 1.1f }; Vector2 origin = new Vector2(128f, 64f); Vector2 scale = new Vector2(1f, .5f); TexturedEffectButtonParams buttonParms = new TexturedEffectButtonParams { Position = position, Origin = origin, Scale = scale, Effects = new List <BaseEffect> { new PulseEffect(effectParms) }, PickableArea = CollisionGenerationUtils.getButtonRectangle(origin, position), ResetDelegate = delegate(StaticDrawable2D button) { button.Scale = scale; } }; buttonParms.Texture = LoadingUtils.load <Texture2D>(content, name); buttonParms.Position = new Vector2(buttonParms.Position.X, buttonParms.Position.Y + SPACE * 1.3f); buttonParms.PickableArea = CollisionGenerationUtils.getButtonRectangle(origin, buttonParms.Position); return(new TexturedEffectButton(buttonParms)); }
public MainMenu(ContentManager content) : base(content, "MainMenu", new Vector2(Constants.RESOLUTION_X / 2, Constants.RESOLUTION_Y / 8 * 3)) { this.effectParms = new PulseEffectParams { ScaleBy = 1f, ScaleDownTo = .9f, ScaleUpTo = 1.1f }; this.index = 0; this.menuItems = new StaticDrawable2D[BUTTON_NAMES.Length]; Vector2 startPosition = new Vector2(Constants.RESOLUTION_X / 2, (Constants.RESOLUTION_Y / 8 * 3) + 250f); StaticDrawable2DParams parms = new StaticDrawable2DParams { Origin = new Vector2(128f), Scale = DEFAULT_SCALE, }; for (int i = 0; i < this.menuItems.Length; i++) { parms.Position = new Vector2(startPosition.X, startPosition.Y + (i * SPACE)); parms.Texture = LoadingUtils.load <Texture2D>(content, BUTTON_NAMES[i]); this.menuItems[i] = new StaticDrawable2D(parms); } this.menuItems[0].addEffect(new PulseEffect(this.effectParms)); }
public Sun(ContentManager content) { StaticDrawable2DParams parms = new StaticDrawable2DParams(); Texture2D sunTx = LoadingUtils.load <Texture2D>(content, "SunLayer1"); parms.Texture = sunTx; parms.Scale = new Vector2(START_SCALE, START_SCALE); parms.Origin = new Vector2(48f, 48f); parms.Position = new Vector2(70f, 70f); this.innerLayer = new StaticDrawable2D(parms); parms.Texture = LoadingUtils.load <Texture2D>(content, "SunLayer2"); this.outterLayer = new StaticDrawable2D(parms); PulseEffectParams effectParms = new PulseEffectParams { Reference = this.outterLayer, ScaleBy = .25f, ScaleDownTo = START_SCALE, ScaleUpTo = END_SCALE }; this.outterLayer.addEffect(new PulseEffect(effectParms)); #if WINDOWS #if DEBUG if (this.innerLayer != null) { ScriptManager.getInstance().registerObject(this.innerLayer, "sunInner"); } if (this.outterLayer != null) { ScriptManager.getInstance().registerObject(this.outterLayer, "sunOutter"); } #endif #endif }
/// <summary> /// Constructs a PulseEffect object /// </summary> /// <param name="parms">PulseEffectParams object</param> public PulseEffect(PulseEffectParams parms) : base(parms) { this.ScaleBy = parms.ScaleBy; this.ScaleDownTo = parms.ScaleDownTo; this.ScaleUpTo = parms.ScaleUpTo; }
public OptionsMenu(ContentManager content) : base(content, "OptionsMenu", new Vector2(Constants.RESOLUTION_X / 2, 100f)) { this.effectParms = new PulseEffectParams { ScaleBy = 1f, ScaleDownTo = .9f, ScaleUpTo = 1.1f }; float x = Constants.RESOLUTION_X / 10; float leftSideX = Constants.RESOLUTION_X / 2 - 25f; float rightSideX = leftSideX + 250f; float bindingsStartPaddingX = 125f; this.playerOneSection = new OptionsSection(content, new Vector2(x, 325f), x + bindingsStartPaddingX, "One", ConfigurationManager.getInstance().PlayerOnesControls); this.playerTwoSection = new OptionsSection(content, new Vector2(x * 6, 325f), x * 6 + bindingsStartPaddingX, "Two", ConfigurationManager.getInstance().PlayerTwosControls); SpriteFont font = LoadingUtils.load <SpriteFont>(content, "SpriteFont1"); Vector2 position = new Vector2(leftSideX, 200f); SoundEngineSliderParams soundEngineParams = new SoundEngineSliderParams { Position = position, BallColour = Constants.TEXT_COLOUR, BarColour = Constants.TEXT_COLOUR, Content = content, CurrentValue = SoundManager.getInstance().MusicEngine.Volume, Font = font, LightColour = Constants.TEXT_COLOUR, SoundEngine = SoundManager.getInstance().MusicEngine, CheckBoxPosition = new Vector2(position.X + 250f, position.Y), Checked = SoundManager.getInstance().MusicEngine.Muted, CheckBoxText = "Muted", }; this.musicSlider = new SoundEngineSlider(soundEngineParams); Text2DParams textParms = new Text2DParams { Font = font, LightColour = Constants.TEXT_COLOUR, Position = new Vector2(position.X - 300f, position.Y), WrittenText = "Music", Origin = new Vector2(16f) }; this.musicSliderText = new Text2D(textParms); soundEngineParams.Position = new Vector2(position.X, position.Y + SPACE); soundEngineParams.CheckBoxPosition = new Vector2(soundEngineParams.CheckBoxPosition.X, position.Y + SPACE); soundEngineParams.SoundEngine = SoundManager.getInstance().SFXEngine; soundEngineParams.CurrentValue = SoundManager.getInstance().SFXEngine.Volume; soundEngineParams.Checked = SoundManager.getInstance().SFXEngine.Muted; this.sfxSlider = new SoundEngineSlider(soundEngineParams); textParms.Position = new Vector2(position.X - 300f, position.Y + SPACE); textParms.WrittenText = "SFX"; this.sfxSliderText = new Text2D(textParms); this.buttons = new List <TexturedEffectButton>(); Vector2 origin = new Vector2(90f, 64f); position = new Vector2(position.X, position.Y + 275f); TexturedEffectButtonParams buttonParms = new TexturedEffectButtonParams { Position = position, Origin = origin, Scale = new Vector2(1f), Effects = new List <BaseEffect> { new PulseEffect(this.effectParms) }, PickableArea = getRect(origin, position), ResetDelegate = delegate(StaticDrawable2D button) { button.Scale = new Vector2(1f); } }; for (int i = 0; i < this.BUTTON_NAMES.Length; i++) { buttonParms.Texture = LoadingUtils.load <Texture2D>(content, BUTTON_NAMES[i]); buttonParms.Position = new Vector2(buttonParms.Position.X, buttonParms.Position.Y + SPACE * 1.3f); buttonParms.PickableArea = getRect(origin, buttonParms.Position); this.buttons.Add(new TexturedEffectButton(buttonParms)); } #if DEBUG this.debugTexture = LoadingUtils.load <Texture2D>(content, "Chip"); StaticDrawable2DParams centerParms = new StaticDrawable2DParams { Position = new Vector2(Constants.RESOLUTION_X / 2, 0), Scale = new Vector2(1f, Constants.RESOLUTION_Y), Texture = this.debugTexture, LightColour = Color.Green }; this.center = new StaticDrawable2D(centerParms); #endif }