Closed Gleefre closed 1 year ago
Hello,
I think I was able to find a way for doing it: (in sketch.lisp
)
(defmethod kit.sdl2:window-event :before ((instance sketch) type ts data1 data2)
(when (eq type :size-changed)
(with-slots ((env %env) width height y-axis) instance
(setf width data1
height data2
(env-view-matrix env)
(if (eq y-axis :down)
(kit.glm:ortho-matrix 0 width height 0 -1 1)
(kit.glm:ortho-matrix 0 width 0 height -1 1)))
(gl:viewport 0 0 width height)
(kit.gl.shader:uniform-matrix
(env-programs env) :view-m 4 (vector (env-view-matrix env))))))
And to make window resizable:
(make-instance 'app :resizable t)
Will be a pull request welcome?
I must note, however, that I'm not sure what exactly is happening in here, especially for ql:viewport
part.
PRs are definitely welcome! If you see an easy way to refactor the code so that we are not copy pasting the y-axis, viewport, and uniform-matrix stuff - that would be great too. Otherwise this at least fixes a bug, so I'm happy to merge that and refactor later.
Hello,
Is there any way to make a sketch resizable? I tried to use
sdl2:sdl-set-window-resizable
, but the app wasn't able to adapt to resize properly.