@@ -403,6 +403,7 @@ pub const Context = *opaque {};
403403pub const DrawData = * cimgui .ImDrawData ;
404404pub const Font = * cimgui .ImFont ;
405405pub const Ident = u32 ;
406+ pub const Vec2 = cimgui .ImVec2 ;
406407pub const TextureIdent = cimgui .ImTextureID ; //TODO <tonitch>: not sure, was *anyopaque
407408pub const Wchar = if (@import ("zgui_options" ).use_wchar32 ) u32 else u16 ;
408409pub const Key = enum (c_int ) {
@@ -755,9 +756,7 @@ const Begin = struct {
755756pub fn begin (name : [:0 ]const u8 , args : Begin ) bool {
756757 return cimgui .igBegin (name , args .popen , @bitCast (args .flags ));
757758}
758- /// `pub fn end() void`
759759pub const end = cimgui .igEnd ;
760- extern fn zguiBegin (name : [* :0 ]const u8 , popen : ? * bool , flags : WindowFlags ) bool ;
761760//--------------------------------------------------------------------------------------------------
762761const BeginChild = struct {
763762 w : f32 = 0.0 ,
@@ -766,65 +765,24 @@ const BeginChild = struct {
766765 window_flags : WindowFlags = .{},
767766};
768767pub fn beginChild (str_id : [:0 ]const u8 , args : BeginChild ) bool {
769- return zguiBeginChild (str_id , args .w , args .h , args .child_flags , args .window_flags );
768+ return cimgui . igBeginChild_Str (str_id , .{ args .w , args .h }, @bitCast ( args .child_flags ), @bitCast ( args .window_flags ) );
770769}
771770pub fn beginChildId (id : Ident , args : BeginChild ) bool {
772- return zguiBeginChildId (id , args .w , args .h , args .child_flags , args .window_flags );
773- }
774- /// `pub fn endChild() void`
775- pub const endChild = zguiEndChild ;
776- extern fn zguiBeginChild (str_id : [* :0 ]const u8 , w : f32 , h : f32 , flags : ChildFlags , window_flags : WindowFlags ) bool ;
777- extern fn zguiBeginChildId (id : Ident , w : f32 , h : f32 , flags : ChildFlags , window_flags : WindowFlags ) bool ;
778- extern fn zguiEndChild () void ;
779- //--------------------------------------------------------------------------------------------------
780- /// `pub fn zguiGetScrollX() f32`
781- pub const getScrollX = zguiGetScrollX ;
782- /// `pub fn zguiGetScrollY() f32`
783- pub const getScrollY = zguiGetScrollY ;
784- /// `pub fn zguiSetScrollX(scroll_x: f32) void`
785- pub const setScrollX = zguiSetScrollX ;
786- /// `pub fn zguiSetScrollY(scroll_y: f32) void`
787- pub const setScrollY = zguiSetScrollY ;
788- /// `pub fn zguiGetScrollMaxX() f32`
789- pub const getScrollMaxX = zguiGetScrollMaxX ;
790- /// `pub fn zguiGetScrollMaxY() f32`
791- pub const getScrollMaxY = zguiGetScrollMaxY ;
792- extern fn zguiGetScrollX () f32 ;
793- extern fn zguiGetScrollY () f32 ;
794- extern fn zguiSetScrollX (scroll_x : f32 ) void ;
795- extern fn zguiSetScrollY (scroll_y : f32 ) void ;
796- extern fn zguiGetScrollMaxX () f32 ;
797- extern fn zguiGetScrollMaxY () f32 ;
798- const SetScrollHereX = struct {
799- center_x_ratio : f32 = 0.5 ,
800- };
801- const SetScrollHereY = struct {
802- center_y_ratio : f32 = 0.5 ,
803- };
804- pub fn setScrollHereX (args : SetScrollHereX ) void {
805- zguiSetScrollHereX (args .center_x_ratio );
806- }
807- pub fn setScrollHereY (args : SetScrollHereY ) void {
808- zguiSetScrollHereY (args .center_y_ratio );
809- }
810- const SetScrollFromPosX = struct {
811- local_x : f32 ,
812- center_x_ratio : f32 = 0.5 ,
813- };
814- const SetScrollFromPosY = struct {
815- local_y : f32 ,
816- center_y_ratio : f32 = 0.5 ,
817- };
818- pub fn setScrollFromPosX (args : SetScrollFromPosX ) void {
819- zguiSetScrollFromPosX (args .local_x , args .center_x_ratio );
820- }
821- pub fn setScrollFromPosY (args : SetScrollFromPosY ) void {
822- zguiSetScrollFromPosY (args .local_y , args .center_y_ratio );
823- }
824- extern fn zguiSetScrollHereX (center_x_ratio : f32 ) void ;
825- extern fn zguiSetScrollHereY (center_y_ratio : f32 ) void ;
826- extern fn zguiSetScrollFromPosX (local_x : f32 , center_x_ratio : f32 ) void ;
827- extern fn zguiSetScrollFromPosY (local_y : f32 , center_y_ratio : f32 ) void ;
771+ return cimgui .igBeginChild_ID (id , .{args .w , args .h }, @bitCast (args .child_flags ), @bitCast (args .window_flags ));
772+ }
773+ // fn igEndChild() void;
774+ pub const endChild = cimgui .igEndChild ;
775+ //--------------------------------------------------------------------------------------------------
776+ pub const getScrollX = cimgui .igGetScrollX ;
777+ pub const getScrollY = cimgui .igGetScrollY ;
778+ pub const setScrollX = cimgui .igSetScrollX_Float ;
779+ pub const setScrollY = cimgui .igSetScrollY_Float ;
780+ pub const getScrollMaxX = cimgui .igGetScrollMaxX ;
781+ pub const getScrollMaxY = cimgui .igGetScrollMaxY ;
782+ pub const setScrollHereX = cimgui .igSetScrollHereX ;
783+ pub const setScrollHereY = cimgui .igSetScrollHereY ;
784+ pub const setScrollFromPosX = cimgui .igSetScrollFromPosX_Float ;
785+ pub const setScrollFromPosY = cimgui .igSetScrollFromPosY_Float ;
828786//--------------------------------------------------------------------------------------------------
829787pub const FocusedFlags = packed struct (c_int ) {
830788 child_windows : bool = false ,
@@ -867,68 +825,38 @@ pub const HoveredFlags = packed struct(c_int) {
867825 pub const root_and_child_windows = HoveredFlags { .root_window = true , .child_windows = true };
868826};
869827//--------------------------------------------------------------------------------------------------
870- /// `pub fn isWindowAppearing() bool`
871- pub const isWindowAppearing = zguiIsWindowAppearing ;
872- /// `pub fn isWindowCollapsed() bool`
873- pub const isWindowCollapsed = zguiIsWindowCollapsed ;
828+ pub const isWindowAppearing = cimgui .igIsWindowAppearing ;
829+ pub const isWindowCollapsed = cimgui .igIsWindowCollapsed ;
874830pub fn isWindowFocused (flags : FocusedFlags ) bool {
875- return zguiIsWindowFocused ( flags );
831+ return cimgui . igIsWindowFocused ( @bitCast ( flags ))
876832}
877833pub fn isWindowHovered (flags : HoveredFlags ) bool {
878- return zguiIsWindowHovered ( flags );
834+ return cimgui . igIsWindowHovered ( @bitCast ( flags ))
879835}
880- extern fn zguiIsWindowAppearing () bool ;
881- extern fn zguiIsWindowCollapsed () bool ;
882- extern fn zguiIsWindowFocused (flags : FocusedFlags ) bool ;
883- extern fn zguiIsWindowHovered (flags : HoveredFlags ) bool ;
884836//--------------------------------------------------------------------------------------------------
885- pub fn getWindowPos () [ 2 ] f32 {
886- var pos : [ 2 ] f32 = undefined ;
887- zguiGetWindowPos (& pos );
837+ pub fn getWindowPos () Vec2 {
838+ var pos : Vec2 = undefined ;
839+ cimgui . igGetWindowPos (& pos );
888840 return pos ;
889841}
890- pub fn getWindowSize () [2 ]f32 {
891- var size : [2 ]f32 = undefined ;
892- zguiGetWindowSize (& size );
893- return size ;
894- }
895-
896- pub fn getContentRegionAvail () [2 ]f32 {
897- var size : [2 ]f32 = undefined ;
898- zguiGetContentRegionAvail (& size );
899- return size ;
900- }
901-
902- pub fn getContentRegionMax () [2 ]f32 {
903- var size : [2 ]f32 = undefined ;
904- zguiGetContentRegionMax (& size );
842+ pub fn getWindowSize () Vec2 {
843+ var size : Vec2 = undefined ;
844+ cimgui .igGetWindowSize (& size );
905845 return size ;
906846}
907847
908- pub fn getWindowContentRegionMin () [ 2 ] f32 {
909- var size : [ 2 ] f32 = undefined ;
910- zguiGetWindowContentRegionMin (& size );
848+ pub fn getContentRegionAvail () Vec2 {
849+ var size : Vec2 = undefined ;
850+ cimgui . igGetContentRegionAvail (& size );
911851 return size ;
912852}
853+ // https://github.com/ocornut/imgui/issues/7838
854+ // pub fn getContentRegionMax() Vec2;
855+ // pub fn getWindowContentRegionMin() Vec2 ;
856+ // pub fn getWindowContentRegionMax() Vec2;
913857
914- pub fn getWindowContentRegionMax () [2 ]f32 {
915- var size : [2 ]f32 = undefined ;
916- zguiGetWindowContentRegionMax (& size );
917- return size ;
918- }
919-
920- /// `pub fn getWindowWidth() f32`
921- pub const getWindowWidth = zguiGetWindowWidth ;
922- /// `pub fn getWindowHeight() f32`
923- pub const getWindowHeight = zguiGetWindowHeight ;
924- extern fn zguiGetWindowPos (pos : * [2 ]f32 ) void ;
925- extern fn zguiGetWindowSize (size : * [2 ]f32 ) void ;
926- extern fn zguiGetWindowWidth () f32 ;
927- extern fn zguiGetWindowHeight () f32 ;
928- extern fn zguiGetContentRegionAvail (size : * [2 ]f32 ) void ;
929- extern fn zguiGetContentRegionMax (size : * [2 ]f32 ) void ;
930- extern fn zguiGetWindowContentRegionMin (size : * [2 ]f32 ) void ;
931- extern fn zguiGetWindowContentRegionMax (size : * [2 ]f32 ) void ;
858+ pub const getWindowWidth = cimgui .igGetWindowWidth ;
859+ pub const getWindowHeight = cimgui .igGetWindowHeight ;
932860//--------------------------------------------------------------------------------------------------
933861//
934862// Docking
@@ -961,57 +889,13 @@ pub const DockNodeFlags = packed struct(c_int) {
961889 no_docking_over_empty : bool = false ,
962890 _padding_1 : u9 = 0 ,
963891};
964- extern fn zguiDockSpace (str_id : [* :0 ]const u8 , size : * const [2 ]f32 , flags : DockNodeFlags ) Ident ;
965892
966- pub fn DockSpace (str_id : [:0 ]const u8 , size : [ 2 ] f32 , flags : DockNodeFlags ) Ident {
967- return zguiDockSpace ( str_id . ptr , & size , flags );
893+ pub fn DockSpace (str_id : [:0 ]const u8 , size : Vec2 , flags : DockNodeFlags ) Ident {
894+ return cimgui . igDockSpace ( cimgui . igGetID_Str , size , @bitCast ( flags ) );
968895}
969896
970- extern fn zguiDockSpaceOverViewport (dockspace_id : Ident , viewport : Viewport , flags : DockNodeFlags ) Ident ;
971- pub const DockSpaceOverViewport = zguiDockSpaceOverViewport ;
897+ pub const DockSpaceOverViewport = cimgui .igDockSpaceOverViewport ;
972898
973- //--------------------------------------------------------------------------------------------------
974- //
975- // DockBuilder (Unstable internal imgui API, subject to change, use at own risk)
976- //
977- //--------------------------------------------------------------------------------------------------
978- const DockNode = anyopaque ;
979- pub fn dockNodeRect (node : * const DockNode , out_rect : * [4 ]f32 ) void {
980- return zguiDockNodeRect (node , out_rect );
981- }
982- extern fn zguiDockNodeRect (node : * const DockNode , out_rect : * [4 ]f32 ) void ;
983-
984- pub fn dockBuilderDockWindow (window_name : [:0 ]const u8 , node_id : Ident ) void {
985- zguiDockBuilderDockWindow (window_name .ptr , node_id );
986- }
987- pub const dockBuilderGetNode = zguiDockBuilderGetNode ;
988- pub const dockBuilderGetCentralNode = zguiDockBuilderGetCentralNode ;
989- pub const dockBuilderAddNode = zguiDockBuilderAddNode ;
990- pub const dockBuilderRemoveNode = zguiDockBuilderRemoveNode ;
991- pub fn dockBuilderSetNodePos (node_id : Ident , pos : [2 ]f32 ) void {
992- zguiDockBuilderSetNodePos (node_id , & pos );
993- }
994- pub fn dockBuilderSetNodeSize (node_id : Ident , size : [2 ]f32 ) void {
995- zguiDockBuilderSetNodeSize (node_id , & size );
996- }
997- pub const dockBuilderSplitNode = zguiDockBuilderSplitNode ;
998- pub const dockBuilderFinish = zguiDockBuilderFinish ;
999-
1000- extern fn zguiDockBuilderDockWindow (window_name : [* :0 ]const u8 , node_id : Ident ) void ;
1001- extern fn zguiDockBuilderGetNode (node_id : Ident ) ? * DockNode ;
1002- extern fn zguiDockBuilderGetCentralNode (node_id : Ident ) ? * DockNode ;
1003- extern fn zguiDockBuilderAddNode (node_id : Ident , flags : DockNodeFlags ) Ident ;
1004- extern fn zguiDockBuilderRemoveNode (node_id : Ident ) void ;
1005- extern fn zguiDockBuilderSetNodePos (node_id : Ident , pos : * const [2 ]f32 ) void ;
1006- extern fn zguiDockBuilderSetNodeSize (node_id : Ident , size : * const [2 ]f32 ) void ;
1007- extern fn zguiDockBuilderSplitNode (
1008- node_id : Ident ,
1009- split_dir : Direction ,
1010- size_ratio_for_node_at_dir : f32 ,
1011- out_id_at_dir : ? * Ident ,
1012- out_id_at_opposite_dir : ? * Ident ,
1013- ) Ident ;
1014- extern fn zguiDockBuilderFinish (node_id : Ident ) void ;
1015899
1016900//--------------------------------------------------------------------------------------------------
1017901//
0 commit comments