public override void UpdateControllerReading(ref ControllerReading reading) { var state = Keyboard.GetState(); if (state.IsKeyDown(Keys.Up)) { reading.direction |= ControllerConsts.UP; } if (state.IsKeyDown(Keys.Down)) { reading.direction |= ControllerConsts.DOWN; } if (state.IsKeyDown(Keys.Left)) { reading.direction |= ControllerConsts.LEFT; } if (state.IsKeyDown(Keys.Right)) { reading.direction |= ControllerConsts.RIGHT; } if (state.IsKeyDown(Keys.A) || state.IsKeyDown(Keys.S) || state.IsKeyDown(Keys.D)) { reading.direction |= ControllerConsts.JUMP_BUTTON; } if (state.IsKeyDown(Keys.W)) { reading.direction |= ControllerConsts.SUPER_SONIC; } if (state.IsKeyDown(Keys.Escape)) { reading.direction |= ControllerConsts.START; } }
public Controller() { reading = new ControllerReading(); reading.keep_time = new int[0]; reading.keep_atime = new int[0]; reading.last_atime = new int[0]; reading.last_time = new int[0]; }
public abstract void UpdateControllerReading(ref ControllerReading reading);