Just built a basic orthographic/2D camera control:
Supports:
- panning with mouse (cursor stays at the same world position while panning)
- zooming (cursor stays at the same world position while zooming, i.e. “zoom into the mouse cursor”)
- centering the view onto a given point
Interface:
- Provides methods onMouseDown/onMouseUp/onMouseMove to make wiring with your preferred windowing framework (for example GLFW with LWJGL3 or simple Java2D) really easy
- obtain the view-projection matrix to submit to a shader or the GL fixed-function pipeline, or use with Java 2D and its AffineTransform
- (more info on the JavaDocs of the class)
Example with LWJGL3/GLFW: https://github.com/JOML-CI/joml-lwjgl3-demos/blob/master/src/org/joml/lwjgl/OrthoDemo.java