public override void Update(InputStates pInputStates, long pFrames) { upgradesButton.Update(pInputStates, pFrames); playerShip.Update(pInputStates, pFrames); if (pInputStates.Quit) GraphicsWindow.Instance.ShouldQuit = true; }
public override void Update(InputStates pInputStates, long pFrames) { MainTitle.Update(pInputStates, pFrames); NewGameButton.Update(pInputStates, pFrames); OptionsButton.Update(pInputStates, pFrames); QuitButton.Update(pInputStates, pFrames); if (NewGameButton.LoopResultStates.Activate) GameController.SwitchLevel(new LevelOne()); if (QuitButton.LoopResultStates.Activate || pInputStates.Quit) GraphicsWindow.Instance.ShouldQuit = true; }
// Only current mouse position is used public void Add(InputStates pOther) { MouseLeft = MouseLeft || pOther.MouseLeft; MouseRight = MouseRight || pOther.MouseRight; QuickClickLeft = QuickClickLeft || pOther.QuickClickLeft; QuickClickRight = QuickClickRight || pOther.QuickClickRight; Up = Up || pOther.Up; Down = Down || pOther.Down; Left = Left || pOther.Left; Right = Right || pOther.Right; Fire = Fire || pOther.Fire; Secondary = Secondary || pOther.Secondary; Upgrade = Upgrade || pOther.Upgrade; Quit = Quit || pOther.Quit; }
protected override void LoopControlPhysics(InputStates pInputStates, long pFrames) { if (pInputStates.Up) { dx += 1.2f * (float)Math.Sin(MathUtil.DegreesToRadians(a)); dy += 1.2f * (float)Math.Cos(MathUtil.DegreesToRadians(a)); } if (pInputStates.Left) { da += 2.5f; } if (pInputStates.Right) { da -= 2.5f; } }
protected override void LoopControlPhysics(InputStates pInputStates, long pFrames) { // Exit if no hit detected if (pInputStates.MousePosition.X < x || pInputStates.MousePosition.X >= x + width || pInputStates.MousePosition.Y < y || pInputStates.MousePosition.Y >= y + height) { highlight = false; return; } if (pInputStates.DeltaMouseLeft || pInputStates.QuickClickLeft) { LoopResultStates.Activate = true; } else { highlight = true; } }
public void Update(InputStates pInputStates, long pFrames) { LoopResultStates.Clear(); // Store old position and angle ox = x; oy = y; odx = dx; ody = dy; oa = a; oda = da; // Overridable control and friction physics LoopControlPhysics(pInputStates, pFrames); LoopFrictionPhysics(pFrames); LoopCollisionPhysics(pFrames); AdvancePosition(); // Update collision body }
public GraphicsWindow() { InitializeComponent(); instance = this; inputStates = new InputStates(); }
public abstract void Update(InputStates pInputStates, long pFrames);
public static void Update(InputStates pInputStates, long pFrames) { currentLevel.Update(pInputStates, pFrames); }
protected override void LoopControlPhysics(InputStates pInputStates, long pFrames) { brush.Transform = Matrix3x2.Identity; }
protected abstract void LoopControlPhysics(InputStates pInputStates, long pFrames);