private static void simulate_touch( ButtonState buttonThisFrame, ButtonState buttonLastFrame, Vector2 posThisFrame, Vector2 posLastFrame, bool mirrorPosition) { if (buttonThisFrame == ButtonState.Pressed || buttonLastFrame == ButtonState.Pressed) { TouchLocationState state; Vector2 position; // Pressed if (buttonLastFrame == ButtonState.Released) { state = TouchLocationState.Pressed; position = posThisFrame; } // Released else if (buttonThisFrame == ButtonState.Released) { state = TouchLocationState.Released; position = posLastFrame; } // Moved else { state = TouchLocationState.Moved; position = posThisFrame; } if (mirrorPosition) { position = new Vector2( Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT) * ScreenScaleZoom - position; } TouchPanel.AddMouseEvent(mirrorPosition ? 1 : 0, state, position); } }