changing to imgui sdl - #9
Conversation
| sdl.get_window_size(window, &w, &h); | ||
| if sdl.get_window_flags(window) & u32(sdl.Window_Flags.Minimized) != 0 { | ||
| sdl.GetWindowSize(window, &w, &h); | ||
| if sdl.GetWindowFlags(window) & u32(sdl.WindowFlags.MINIMIZED) == 0 { |
There was a problem hiding this comment.
Now I suck at bit operations but changing the condition from != to == should be wrong?
There was a problem hiding this comment.
This "appears to work" but I think it's actually because WindowFlags.MINIMIZED == 6 when the mask should be 1 << 6.
WindowFlag is the enum, WindowFlags (with an s) is the bit_set of WindowFlag. If GetWindowFlags returned WindowFlags you would expect .MINIMIZED in sdl.GetWindowFlags(window) to work here. So maybe for the time being it can just be casted?
| ok: i32; | ||
| gl.GetProgramiv(program_h, gl.LINK_STATUS, &ok); | ||
| if ok != gl.TRUE { | ||
| if ok != 1/*i32(gl.TRUE)*/ { |
| ok: i32; | ||
| gl.GetShaderiv(h, gl.COMPILE_STATUS, &ok); | ||
| if ok != gl.TRUE { | ||
| if ok != 1/*gl.TRUE*/ { |
| gl.VertexAttribPointer(u32(state.attrib_vtx_pos), 2, gl.FLOAT, gl.FALSE, size_of(imgui.Draw_Vert), rawptr(offset_of(imgui.Draw_Vert, pos))); | ||
| gl.VertexAttribPointer(u32(state.attrib_vtx_uv), 2, gl.FLOAT, gl.FALSE, size_of(imgui.Draw_Vert), rawptr(offset_of(imgui.Draw_Vert, uv))); | ||
| gl.VertexAttribPointer(u32(state.attrib_vtx_color), 4, gl.UNSIGNED_BYTE, gl.TRUE, size_of(imgui.Draw_Vert), rawptr(offset_of(imgui.Draw_Vert, col))); | ||
| gl.VertexAttribPointer(u32(state.attrib_vtx_pos), 2, gl.FLOAT, gl.FALSE, size_of(imgui.Draw_Vert), uintptr(rawptr(offset_of(imgui.Draw_Vert, pos)))); |
There was a problem hiding this comment.
I can't remember if offset_of doesn't already just output a uintptr or maybe can be directly cast to one?
| io.key_map[imgui.Key.Space] = i32(sdl.Scancode.SPACE); | ||
| io.key_map[imgui.Key.Enter] = i32(sdl.Scancode.RETURN); | ||
| io.key_map[imgui.Key.Escape] = i32(sdl.Scancode.ESCAPE); | ||
| io.key_map[imgui.Key.KeyPadEnter] = i32(sdl.Scancode.KP_ENTER); |
There was a problem hiding this comment.
For the enums in this file, the package and enum name could be elided.
|
I just now notice that you guys have been reviewing this. Somehow missed it. |
|
Just I revistd this to get my osx working with odin-imgui and I fixed a bunch of errors. I also noticed on OSX there is a huge issue where it simply wont work out of the box because shaders require a version but you might chose a different version when starting up the context. I had to setup shader error logging to finally figure what was causing my opengl to error out on osx. So... I think that needs to be addressed honestly. Perhaps Ill just note it somewhere. |
fixes for super button in sdlodin
…ix_vendor # Conflicts: # impl/opengl/opengl.odin # impl/sdl/sdl.odin
now up to spec with the newest release of odin vendor
Fix vendor
Fix vendor
| io.mouse_down[0] = state.mouse_down[0] || (buttons & u32(sdl.BUTTON_LEFT)) != 0; | ||
| io.mouse_down[1] = state.mouse_down[1] || (buttons & u32(sdl.BUTTON_RIGHT)) != 0; | ||
| io.mouse_down[2] = state.mouse_down[2] || (buttons & u32(sdl.BUTTON_MIDDLE)) != 0; |
There was a problem hiding this comment.
In testing I found this to be incorrect, this needs to be changed to BUTTON_LMASK, BUTTON_RMASK and BUTTON_MMASK.
|
Bump |
Adds example for using multiple fonts in imgui.
Adds helper function for loading in a font with opengl.
# Conflicts: # foreign.odin # impl/opengl/opengl.odin
| // qe := sdl.Event{}; | ||
| // qe.type = .Quit; | ||
| // sdl.push_event(&qe); | ||
| } |
There was a problem hiding this comment.
This line needs to be commented out too, otherwise it introduces syntax errors.
(while I also not sure that this "commenting out" actually should be included in the PR, perhaps these are some forgotten "debug" changes.
Switch examples to the odin's native vendor libraries