Adapt to monitor dimensions with ortho camera?

I tried using the ortho camera and make my game not stretch to fit on different monitors. With the default render, the solution is as banal as adding the line

msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1 })

but this does not work when using the ortho asset by britzl. Solutions?

1 Like

At the very end of the README is:

msg.post("camera", "use_projection", { projection = hash("FIXED_AUTO") })

But looking at the camera script there is no definition of camera.MSG_USE_PROJECTION is missing (and usage of self.projection).

Ok, with 3.4.0 this library was updated, in Release Notes:

So you can only set zoom or use Automatic Zoom:

https://github.com/britzl/defold-orthographic?tab=readme-ov-file#auto_zoom-boolean

Linked issue: API 3.4.0 removed projection settings? · Issue #78 · britzl/defold-orthographic · GitHub

1 Like

Do I understand correctly that I would need to add to the camera script in the current version? Or does Auto Zoom work? (Sorry, I could of course just try but asking a pro seems faster than bungling around myself).

1 Like

You need to add the camera.go to your collection and configure the values of the attached camera.script:

https://github.com/britzl/defold-orthographic?tab=readme-ov-file#quick-start

1 Like