I’ll just comment on one class: your Camera class.
- Storing input (
KeyboardInput) with your camera is a little sketchy- If anything that should be the responsibility of some sort of external
CameraControllerto disambiguate your camera’s duties from control duties - It’s really your call though, cameras and control are often tight-knit (unless it’s a shadowmap camera)
- If anything that should be the responsibility of some sort of external
- I get why you’re using a rectangle for bounds, but do be prepared to add a Frustum that’s been computed for orthographic projection in the future
- I wouldn’t do it now, but I would add a comment noting that if you’ll want to add one before anything that would have you mixing 3d with 2d (ie. ortho 3d models)
- Your zoom handling is awful, either:
- Use fixed zoom levels (
static readonly float zoomLevels[] = { 0.25f, 0.5f, 0.75f, 1.0f, ... }) and movement speeds - Change that
if ... elsecluster for movement speed to use the closest value from a table (float zoomSpeedTable[,] = new float[,] { { 0.25 /*zoom*/, 11.0f /*speed*/ }, { 0.5f, 20.0f } })- What I mean is store a table, and use the speed from whatever zoom-value is closest to the current zoom value (shortest distance / nearest /
abs(tableZoomValue - currentZoomValue))- For such a one-off like this that you’ll really do only once a frame, just use LINQ - don’t fuss with the garbage
- That
if .. elsecluster inCamera::UpdateCamerais really the worst thing in that whole class.
- What I mean is store a table, and use the speed from whatever zoom-value is closest to the current zoom value (shortest distance / nearest /
- Use fixed zoom levels (