Advertisement
Guest User

Untitled

a guest
Jan 24th, 2021
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. use@fhome:~/imgui_project$ more cimgtest.zig
  2. const ig = @cImport({
  3. // @cInclude("cimgui/cimgui.h");
  4. @cInclude("cimgui/imgui/examples/imgui_impl_sdl.h");
  5. });
  6.  
  7. pub fn main() void {
  8. _ = ig.igCreateContext(null);
  9. const io: *ig.ImGuiIO = ig.igGetIO();
  10.  
  11. var text_pixels: [*c]u8 = null;
  12. var text_w: c_int = 0;
  13. var text_h: c_int = 0;
  14. ig.ImFontAtlas_GetTexDataAsRGBA32(io.Fonts, &text_pixels, &text_w, &text_h, null);
  15.  
  16. while (true) {
  17. var display_size: ig.ImVec2 = .{
  18. .x = 800,
  19. .y = 600,
  20. };
  21.  
  22. io.DisplaySize = display_size;
  23. var f: f32 = 0.0;
  24. ig.igNewFrame();
  25.  
  26. const hello = "Hello World!\x00";
  27. _ = ig.igSliderFloat("float", &f, 0.0, 1.0, "%.3f", 1.0);
  28. ig.igText(hello);
  29. ig.igRender();
  30. }
  31.  
  32. ig.igDestroyContext(null);
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement