Repository navigation
1 macos fix - #3835
1 macos fix#3835
Conversation
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Fixes #3826
I cannot accept a random fix until we understand why it is necessary, why it works and for which other buffers it may be needed (now and in the future).
2b07238 to
71fe92b
Compare
yeah sorry, this was my branch with all the fixes. I put that commit now into another branch and dropped it here. |
| pub var scrollOffsetInteger: i32 = 0; | ||
| var scrollOffsetFraction: f32 = 0; | ||
| var contentXScale: f32 = 1; | ||
| var contentYScale: f32 = 1; |
There was a problem hiding this comment.
Why not make this a vector?
There was a problem hiding this comment.
you mean array? vectors + pointer + c is not allowed as we seen. and I just oriented myself at witdth, height. But I can if you want change it
There was a problem hiding this comment.
Yeah, right. Not sure if an array is really better then.
I've just been trying to get away from separate x/y/z variables everywhere.
| c.glfwGetFramebufferSize(window, &frameBuffereWidth, &frameBuffereHeight); | ||
| width = @intCast(frameBuffereWidth); | ||
| height = @intCast(frameBuffereHeight); | ||
| c.glfwGetWindowContentScale(window, &contentXScale, &contentYScale); |
There was a problem hiding this comment.
Please instead call our callbacks, and remove the already existing such call from main.zig.
There was a problem hiding this comment.
can you clarify? Do you mean I should call glfw_callbacks.framebufferSize(null, frameBuffereWidth, frameBuffereHeight); instead of setting width and height directly? That causes:
thread 43204 panic: attempt to use null value
/home/wunka/Documents/Cubyz/dropdown/.zig-cache/o/f3f487178d4ae0829abcd64e0eb253fb/c.zig:23618:37: 0x1663384 in glDeleteFramebuffers (main.zig)
return glad_glDeleteFramebuffers.?(n, framebuffers);
There was a problem hiding this comment.
Do you mean I should call glfw_callbacks.framebufferSize(null, frameBuffereWidth, frameBuffereHeight); instead of setting width and height directly?
Yes, that's what I meant. If it causes an issue here then we have to keep the frameBuffer callback as is, called in main.
However I would still prefer if you used the callback for the contentScale, so we can catch future additions inside the callback. That would also be beneficial in the current state, as it would log the initial value.
There was a problem hiding this comment.
It now uses the callback. I also put it into scope to show that's its "its own thing" with a little comment why it exists
Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
| _ = c.glfwSetCursorPosCallback(window, glfw_callbacks.cursorPosition); | ||
| _ = c.glfwSetMouseButtonCallback(window, glfw_callbacks.mouseButton); | ||
| _ = c.glfwSetScrollCallback(window, glfw_callbacks.scroll); | ||
| } |
There was a problem hiding this comment.
I'm not happy with just placing them at the end of the file, I think they should be above init or below deinit.
Also initGlfwCallbacks could also be glfw_callbacks.init().
|
|
||
| pub const glfw_callbacks = struct { // MARK: glfw_callbacks | ||
|
|
||
| pub fn init() void { |
I had this on the same branch thats why its one pr.