public void UpdateEvents(List <SDL2.SDL.SDL_Event> events) { OldMousePosition = new Vec2(CurrentMousePosition); OldWheelPosition = new Vec2(CurrentWheelPosition); OldState = new Dictionary <uint, bool>(NewState); foreach (var e in events) { if (e.type == SDL2.SDL.SDL_EventType.SDL_MOUSEWHEEL) { CurrentWheelPosition += new Vec2(e.wheel.x, e.wheel.y); } else if (e.type == SDL2.SDL.SDL_EventType.SDL_MOUSEMOTION) { CurrentMousePosition = new Vec2(e.motion.x, e.motion.y); } bool?state = null; if (e.type == SDL2.SDL.SDL_EventType.SDL_MOUSEBUTTONDOWN && e.key.repeat == 0) { state = true; } else if (e.type == SDL2.SDL.SDL_EventType.SDL_MOUSEBUTTONUP) { state = false; } if (state.HasValue) { if (!NewState.ContainsKey(e.button.button)) { NewState.Add(e.button.button, state.Value); } else { NewState[e.button.button] = state.Value; } } } }
public void Add(OperationInvoker doChange, OperationInvoker undoChange) { OldState.Add(undoChange); NewState.Add(doChange); }