diff --git a/.github/workflows/demo-release.yml b/.github/workflows/demo-release.yml
index 1cd662f..5d4fca4 100644
--- a/.github/workflows/demo-release.yml
+++ b/.github/workflows/demo-release.yml
@@ -24,32 +24,44 @@ jobs:
GLFW_INCLUDE: /usr/include
GLFW_LIB: /usr/lib/x86_64-linux-gnu
steps:
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
path: source/modules/antono2/imgui
submodules: recursive
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: antono2/vulkan
+ ref: v2.0.0
path: source/modules/antono2/vulkan
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: antono2/glfw
+ ref: e9a367938577919b4a5140a477c1250112978d8e
path: source/modules/antono2/glfw
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: antono2/v_imgui_examples
- ref: c2b5083d42f052cfe73952542e86e4163c64ce79
+ ref: 1e444971dd4f70a6edf281ce648e136c01d08ab6
path: source/demo
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: vlang/v
ref: 1f128c94619fb6e4863c5f81883e1b860405c8fa
path: toolchain/v
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: vlang/vc
+ ref: 4a1ba4d772f19c2752c9850d3b5421c71f54a4d6
+ path: toolchain/v/vc
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: vlang/tccbin
+ ref: d6e7ac1b1bcc98aed734a6ecbfa8509f24606c74
+ path: toolchain/v/thirdparty/tcc
- name: Build official V compiler
working-directory: toolchain/v
run: |
- make
+ make local=1
echo "$GITHUB_WORKSPACE/toolchain/v" >> "$GITHUB_PATH"
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential cmake libglfw3-dev libvulkan-dev libvulkan-volk-dev patchelf pkg-config xvfb zip
@@ -106,7 +118,7 @@ jobs:
unzip -t "$RUNNER_TEMP/$archive" >/dev/null
sha256sum "$RUNNER_TEMP/$archive"
- name: Upload Ubuntu demo package
- uses: actions/upload-artifact@v7
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
path: ${{ runner.temp }}/v-imgui-demo-${{ steps.variant.outputs.name }}-ubuntu24-amd64.zip
archive: false
@@ -117,31 +129,36 @@ jobs:
runs-on: windows-2022
timeout-minutes: 45
steps:
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
path: source/modules/antono2/imgui
submodules: recursive
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: antono2/vulkan
- ref: d9ad9fc5151aa19f58cd2fed1b6bcda9b210f098
+ ref: v2.0.0
path: source/modules/antono2/vulkan
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: antono2/glfw
ref: 3d7c1ddacb7215a7bbeb5fef0d7a68c90ba392ed
path: source/modules/antono2/glfw
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: antono2/v_imgui_examples
- ref: c2b5083d42f052cfe73952542e86e4163c64ce79
+ ref: 1e444971dd4f70a6edf281ce648e136c01d08ab6
path: source/demo
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: vlang/v
ref: 1f128c94619fb6e4863c5f81883e1b860405c8fa
path: toolchain/v
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: vlang/vc
+ ref: 4a1ba4d772f19c2752c9850d3b5421c71f54a4d6
+ path: toolchain/v/vc
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: zeux/volk
ref: 58689c063427f5bad4f133625049b1a3c5dd8287
@@ -149,7 +166,7 @@ jobs:
- name: Build official V compiler
shell: cmd
working-directory: toolchain/v
- run: makev.bat
+ run: makev.bat -msvc --local
- name: Add V compiler to PATH
shell: pwsh
run: |
@@ -211,22 +228,131 @@ jobs:
}
Get-FileHash -Algorithm SHA256 $Archive
- name: Upload Windows demo package
- uses: actions/upload-artifact@v7
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
path: ${{ runner.temp }}/v-imgui-demo-${{ steps.variant.outputs.name }}-windows-x64.zip
archive: false
retention-days: 7
if-no-files-found: error
+ strict-v3-frontend:
+ name: Required pinned V3 frontend
+ runs-on: ubuntu-24.04
+ timeout-minutes: 45
+ env:
+ VMODULES: ${{ github.workspace }}/source/modules
+ VULKAN_SDK: /usr
+ GLFW_INCLUDE: /usr/include
+ GLFW_LIB: /usr/lib/x86_64-linux-gnu
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ path: source/modules/antono2/imgui
+ submodules: recursive
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: antono2/vulkan
+ ref: 42e6c381e37952ef07f4cd560c9996fd2435cd41
+ path: source/modules/antono2/vulkan
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: antono2/glfw
+ ref: e9a367938577919b4a5140a477c1250112978d8e
+ path: source/modules/antono2/glfw
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: antono2/v_imgui_examples
+ ref: 1e444971dd4f70a6edf281ce648e136c01d08ab6
+ path: source/demo
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: vlang/v
+ ref: f59b886d2564e37d8626d715236fdfa928e13dda
+ path: toolchain/v
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: vlang/vc
+ ref: 4598bc7e4894c154b27391e4442005fff2fbbd68
+ path: toolchain/v/vc
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: vlang/tccbin
+ ref: d6e7ac1b1bcc98aed734a6ecbfa8509f24606c74
+ path: toolchain/v/thirdparty/tcc
+ - name: Build pinned V3 compiler
+ run: |
+ make -C toolchain/v local=1
+ echo "$GITHUB_WORKSPACE/toolchain/v" >> "$GITHUB_PATH"
+ - name: Check generated bindings and demo
+ run: |
+ v -new-compiler -check-syntax source/modules/antono2/imgui/imgui.v
+ v -new-compiler -check-syntax source/modules/antono2/imgui/implot/implot.v
+ v -new-compiler -check -path "$VMODULES/antono2|@vlib|@vmodules" source/demo
+
+ linux-v-master:
+ name: Advisory current V master and dependency masters
+ continue-on-error: true
+ runs-on: ubuntu-24.04
+ timeout-minutes: 45
+ env:
+ VMODULES: ${{ github.workspace }}/source/modules
+ VULKAN_SDK: /usr
+ GLFW_INCLUDE: /usr/include
+ GLFW_LIB: /usr/lib/x86_64-linux-gnu
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ path: source/modules/antono2/imgui
+ submodules: recursive
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: antono2/vulkan
+ ref: master
+ path: source/modules/antono2/vulkan
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: antono2/glfw
+ ref: master
+ path: source/modules/antono2/glfw
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: antono2/v_imgui_examples
+ ref: 1e444971dd4f70a6edf281ce648e136c01d08ab6
+ path: source/demo
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ repository: vlang/v
+ ref: master
+ path: toolchain/v
+ - name: Build current V master
+ run: |
+ make -C toolchain/v
+ echo "$GITHUB_WORKSPACE/toolchain/v" >> "$GITHUB_PATH"
+ - name: Install native dependencies
+ run: sudo apt-get update && sudo apt-get install -y build-essential cmake libglfw3-dev libvulkan-dev libvulkan-volk-dev pkg-config
+ - name: Check generated bindings with V3
+ working-directory: source/modules/antono2/imgui
+ run: |
+ v -check-syntax imgui.v
+ v -check-syntax implot/implot.v
+ - name: Build and compile demo with V3
+ run: |
+ cd source/modules/antono2/imgui
+ v run build_vimgui.vsh --linkage shared --glfw system
+ cd "$GITHUB_WORKSPACE"
+ v -no-memory-limit -path "$VMODULES/antono2|@vlib|@vmodules" -cc gcc -o "$RUNNER_TEMP/v_imgui_demo" source/demo
+
required-checks:
if: always()
- needs: [ubuntu24, windows-native]
+ needs: [ubuntu24, windows-native, strict-v3-frontend]
runs-on: ubuntu-24.04
steps:
- name: Verify required jobs
env:
UBUNTU_RESULT: ${{ needs.ubuntu24.result }}
WINDOWS_RESULT: ${{ needs.windows-native.result }}
+ V3_RESULT: ${{ needs.strict-v3-frontend.result }}
run: |
test "$UBUNTU_RESULT" = success
test "$WINDOWS_RESULT" = success
+ test "$V3_RESULT" = success
diff --git a/QUICKSTART.md b/QUICKSTART.md
index 0ec42f4..6d69009 100644
--- a/QUICKSTART.md
+++ b/QUICKSTART.md
@@ -39,7 +39,7 @@ Install `gcc-c++`, `cmake`, `git`, `glfw-devel`, `vulkan-loader-devel`,
Install the two V dependencies and then use the same build and demo commands:
```sh
-v install antono2.vulkan
+v install antono2.vulkan@v2.0.0
v install antono2.glfw
v run build_vimgui.vsh --linkage shared --glfw system
./scripts/run_demo.sh
diff --git a/README.md b/README.md
index 7fd2fc6..9d41be1 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ The configuration functions return `false` on the standard branch. Dockspace
and secondary-viewport rendering helpers become safe no-ops there.
## Dependencies
-`v install antono2.vulkan`
+`v install antono2.vulkan@v2.0.0`
`v install antono2.glfw`
## Install
diff --git a/cleanup_imgui_implot.vsh b/cleanup_imgui_implot.vsh
index 57651ce..c8a5abb 100755
--- a/cleanup_imgui_implot.vsh
+++ b/cleanup_imgui_implot.vsh
@@ -36,6 +36,7 @@ mut:
fn usage() {
eprintln('Usage: v run cleanup_imgui_implot.vsh input.v output.v imgui|implot')
eprintln(' v run cleanup_imgui_implot.vsh --self-test')
+ eprintln(' v run cleanup_imgui_implot.vsh --v3-fixed-arrays binding.v')
}
fn config_for(kind string) !Config {
@@ -1576,6 +1577,78 @@ fn insert_after_version(input string, addition string) string {
return input[..after] + addition + input[after..]
}
+// V3 interprets an uppercase C field followed by `[N]Type` as an embedded
+// struct with attributes. A named fixed-array type preserves the C field name,
+// its layout, and compatibility with both V compilers.
+fn name_c_fixed_array_fields(input string) string {
+ mut aliases := map[string]string{}
+ mut scalar_aliases := map[string]string{}
+ for line in input.split_into_lines() {
+ if name, rhs := type_alias(line) {
+ if rhs in ['i8', 'u8', 'i16', 'u16', 'i32', 'u32', 'i64', 'u64', 'f32', 'f64'] {
+ scalar_aliases[name] = rhs
+ }
+ }
+ }
+ mut declarations := []string{}
+ mut lines := []string{}
+ mut in_c_struct := false
+ for line in input.split_into_lines() {
+ trimmed := line.trim_space()
+ if trimmed.starts_with('pub struct C.') && trimmed.ends_with('{') {
+ in_c_struct = true
+ } else if in_c_struct && trimmed == '}' {
+ in_c_struct = false
+ }
+ if in_c_struct {
+ if field, typ := field_decl(line) {
+ // V3 treats `ID ID` as an embedded ID. The scalar backing
+ // type has the same ABI and disambiguates the C field.
+ if field == typ && field in scalar_aliases {
+ lines << line[..line.last_index(typ) or { 0 }] + scalar_aliases[field]
+ continue
+ }
+ if field == 'ID' && typ == 'imgui.ID' {
+ lines << line[..line.last_index(typ) or { 0 }] + 'u32'
+ continue
+ }
+ if starts_upper(field) && typ.starts_with('[') {
+ if typ.contains('&') {
+ // Keeping pointer arrays direct avoids a V2 cgen dependency
+ // cycle for self-referential structs such as DockNode.
+ lines << '\t${field}${typ}'
+ continue
+ }
+ mut alias := aliases[typ]
+ if alias == '' {
+ alias = 'BindingFixedArray${aliases.len + 1}'
+ aliases[typ] = alias
+ declarations << 'pub type ${alias} = ${typ}'
+ }
+ lines << '\t${field} ${alias}'
+ continue
+ }
+ }
+ }
+ lines << line
+ }
+ mut output := lines.join('\n') + '\n'
+ if declarations.len > 0 {
+ output = insert_after_version(output, declarations.join('\n') + '\n\n')
+ }
+ // ImVec1 is a by-value C struct, so its binding needs its actual field.
+ output = replace_struct_block(output, 'ImVec1', 'pub struct C.ImVec1 {\npub mut:\n\tx f32\n}')
+ // These ImPlot structs are stored by value. Keep their declarations in
+ // sync with the corresponding definitions in cimplot.h.
+ output = replace_struct_block(output, 'ImPlotDateTimeSpec_c', 'pub struct C.ImPlotDateTimeSpec_c {\npub mut:\n\tDate DateFmt\n\tTime TimeFmt\n\tUseISO8601 bool\n\tUse24HourClock bool\n}')
+ output = replace_struct_block(output, 'ImPlotSpec_c', 'pub struct C.ImPlotSpec_c {\npub mut:\n\tLineColor ImVec4_c\n\tLineColors &u32\n\tLineWeight f32\n\tFillColor ImVec4_c\n\tFillColors &u32\n\tFillAlpha f32\n\tMarker i32\n\tMarkerSize f32\n\tMarkerSizes &f32\n\tMarkerLineColor ImVec4_c\n\tMarkerLineColors &u32\n\tMarkerFillColor ImVec4_c\n\tMarkerFillColors &u32\n\tSize f32\n\tOffset int\n\tStride int\n\tFlags ItemFlags\n}')
+ output = output.replace('pub type DateTimeSpec = C.DateTimeSpec_c', 'pub type DateTimeSpec = DateTimeSpec_c')
+ output = output.replace('pub type Spec = C.Spec_c', 'pub type Spec = Spec_c')
+ output = output.replace('@[typedef]\npub struct C.DateTimeSpec_c {}\n\n', '')
+ output = output.replace('@[typedef]\npub struct C.Spec_c {}\n\n', '')
+ return output
+}
+
fn clean_one(kind string, input_path string, output_path string) ! {
cfg := config_for(kind)!
source := os.read_file(input_path)!
@@ -1716,6 +1789,7 @@ fn clean_one(kind string, input_path string, output_path string) ! {
final = insert_after_version(final, header_alias_decls(ctx, final))
final = insert_after_version(final, missing_c_alias_target_decls(final, imported_structs))
final = final_sanitize(kind, final)
+ final = name_c_fixed_array_fields(final)
os.write_file(output_path, final)!
println('cleaned ${kind}: ${input_path} -> ${output_path}')
}
@@ -1731,6 +1805,12 @@ fn self_test() {
assert clean_type_expr('imgui', '&ImGuiContext') == '&Context'
assert clean_type_expr('implot', 'C.ImPlotSpec_c') == 'C.Spec_c'
assert clean_type_expr('implot', '&ImGuiContext') == '&imgui.Context'
+ assert name_c_fixed_array_fields('pub const version_num = 1\n\npub struct C.Sample {\npub mut:\n\tColors [3]f32\n}\n') == 'pub const version_num = 1\n\npub type BindingFixedArray1 = [3]f32\n\npub struct C.Sample {\npub mut:\n\tColors BindingFixedArray1\n}\n'
+ assert name_c_fixed_array_fields('pub struct C.Node {\npub mut:\n\tChildren [2]&Node\n}\n') == 'pub struct C.Node {\npub mut:\n\tChildren[2]&Node\n}\n'
+ assert name_c_fixed_array_fields('pub type ID = u32\npub struct C.Sample {\npub mut:\n\tID ID\n}\n') == 'pub type ID = u32\npub struct C.Sample {\npub mut:\n\tID u32\n}\n'
+ assert name_c_fixed_array_fields('pub struct C.ImVec1 {}\n').contains('x f32')
+ assert name_c_fixed_array_fields('pub struct C.ImPlotSpec_c {}\n').contains('Marker i32')
+ assert name_c_fixed_array_fields('pub type Spec = C.Spec_c\n') == 'pub type Spec = Spec_c\n'
assert postprocess_identifiers('value int, callback C.int(x), args va_list, c C.va_list') == 'value i32, callback (x), args Va_list, c C.va_list'
known := {
'first': i64(1 << 4)
@@ -1744,6 +1824,12 @@ fn main() {
self_test()
return
}
+ if os.args.len == 3 && os.args[1] == '--v3-fixed-arrays' {
+ path := os.args[2]
+ content := os.read_file(path) or { panic(err) }
+ os.write_file(path, name_c_fixed_array_fields(content)) or { panic(err) }
+ return
+ }
if os.args.len != 4 {
usage()
exit(2)
diff --git a/generate.vsh b/generate.vsh
index 7f3d741..41a9a62 100755
--- a/generate.vsh
+++ b/generate.vsh
@@ -126,6 +126,11 @@ fn main() {
run_at('v run ${os.quoted_path(cleanup)} ${os.quoted_path(imgui_binding)} ${os.quoted_path(imgui_binding)} imgui', repo_dir) or { panic(err) }
run_at('v run ${os.quoted_path(cleanup)} ${os.quoted_path(implot_binding)} ${os.quoted_path(implot_binding)} implot', repo_dir) or { panic(err) }
run_at('v fmt -w ${os.quoted_path(imgui_binding)}', repo_dir) or { panic(err) }
+ // vfmt restores a space before fixed-array types. V3 currently treats that
+ // form as an embedded-struct attribute when the C field name is uppercase.
+ run_at('v run ${os.quoted_path(cleanup)} --v3-fixed-arrays ${os.quoted_path(imgui_binding)}', repo_dir) or {
+ panic(err)
+ }
// Do not format ImPlot: its C field/type pair `Marker Marker` is currently
// collapsed by vfmt into invalid V.
run_at('v run ${os.quoted_path(os.join_path(repo_dir, 'build_vimgui.vsh'))}', repo_dir) or {
diff --git a/imgui.v b/imgui.v
index 8f7c29b..69584d9 100644
--- a/imgui.v
+++ b/imgui.v
@@ -65,6 +65,38 @@ SOFTWARE.
pub const version = '1.92.9b'
pub const version_num = 19291
+pub type BindingFixedArray1 = [61]ImVec4_c
+pub type BindingFixedArray2 = [5]bool
+pub type BindingFixedArray3 = [155]KeyData
+pub type BindingFixedArray4 = [5]ImVec2_c
+pub type BindingFixedArray5 = [5]f64
+pub type BindingFixedArray6 = [5]ImU16
+pub type BindingFixedArray7 = [5]f32
+pub type BindingFixedArray8 = [33]i8
+pub type BindingFixedArray9 = [40]i8
+pub type BindingFixedArray10 = [33]ImVec4_c
+pub type BindingFixedArray11 = [1]ImU8
+pub type BindingFixedArray12 = [48]ImVec2_c
+pub type BindingFixedArray13 = [64]ImU8
+pub type BindingFixedArray14 = [8]ImU8
+pub type BindingFixedArray15 = [4]ImU16
+pub type BindingFixedArray16 = [5]ImU32
+pub type BindingFixedArray17 = [155]KeyRoutingIndex
+pub type BindingFixedArray18 = [64]i8
+pub type BindingFixedArray19 = [2]ImRect_c
+pub type BindingFixedArray20 = [2]f32
+pub type BindingFixedArray21 = [6]DebugAllocEntry
+pub type BindingFixedArray22 = [16]i8
+pub type BindingFixedArray23 = [155]KeyOwnerData
+pub type BindingFixedArray24 = [16]u8
+pub type BindingFixedArray25 = [60]f32
+pub type BindingFixedArray26 = [2]ID
+pub type BindingFixedArray27 = [2]ImVec2_c
+pub type BindingFixedArray28 = [2]ImU32
+pub type BindingFixedArray29 = [80]i8
+pub type BindingFixedArray30 = [99]StbUndoRecord
+pub type BindingFixedArray31 = [999]i8
+
pub type ImWchar = u32
pub type InputTextCallback = fn (&InputTextCallbackData) i32
@@ -1096,7 +1128,7 @@ pub mut:
AntiAliasedFill bool
CurveTessellationTol f32
CircleTessellationMaxError f32
- Colors [61]ImVec4_c
+ Colors BindingFixedArray1
HoverStationaryDelay f32
HoverDelayShort f32
HoverDelayNormal f32
@@ -1132,8 +1164,8 @@ pub type IO = C.ImGuiIO
@[typedef]
pub struct C.ImGuiIO {
pub mut:
- ConfigFlags ConfigFlags
- BackendFlags BackendFlags
+ ConfigFlags i32
+ BackendFlags i32
DisplaySize ImVec2_c
DisplayFramebufferScale ImVec2_c
DeltaTime f32
@@ -1202,7 +1234,7 @@ pub mut:
MouseDelta ImVec2_c
Ctx &Context
MousePos ImVec2_c
- MouseDown [5]bool
+ MouseDown BindingFixedArray2
MouseWheel f32
MouseWheelH f32
MouseSource MouseSource
@@ -1211,24 +1243,24 @@ pub mut:
KeyAlt bool
KeySuper bool
KeyMods KeyChord
- KeysData [155]KeyData
+ KeysData BindingFixedArray3
WantCaptureMouseUnlessPopupClose bool
MousePosPrev ImVec2_c
- MouseClickedPos [5]ImVec2_c
- MouseClickedTime [5]f64
- MouseClicked [5]bool
- MouseDoubleClicked [5]bool
- MouseClickedCount [5]ImU16
- MouseClickedLastCount [5]ImU16
- MouseReleased [5]bool
- MouseReleasedTime [5]f64
- MouseDownOwned [5]bool
- MouseDownOwnedUnlessPopupClose [5]bool
+ MouseClickedPos BindingFixedArray4
+ MouseClickedTime BindingFixedArray5
+ MouseClicked BindingFixedArray2
+ MouseDoubleClicked BindingFixedArray2
+ MouseClickedCount BindingFixedArray6
+ MouseClickedLastCount BindingFixedArray6
+ MouseReleased BindingFixedArray2
+ MouseReleasedTime BindingFixedArray5
+ MouseDownOwned BindingFixedArray2
+ MouseDownOwnedUnlessPopupClose BindingFixedArray2
MouseWheelRequestAxisSwap bool
MouseCtrlLeftAsRightClick bool
- MouseDownDuration [5]f32
- MouseDownDurationPrev [5]f32
- MouseDragMaxDistanceSqr [5]f32
+ MouseDownDuration BindingFixedArray7
+ MouseDownDurationPrev BindingFixedArray7
+ MouseDragMaxDistanceSqr BindingFixedArray7
PenPressure f32
AppFocusLost bool
AppAcceptingEvents bool
@@ -1245,7 +1277,7 @@ pub mut:
EventFlag InputTextFlags
Flags InputTextFlags
UserData voidptr
- ID ID
+ ID u32
EventKey Key
EventChar ImWchar
EventActivated bool
@@ -1279,7 +1311,7 @@ pub mut:
SourceId ID
SourceParentId ID
DataFrameCount i32
- DataType [33]i8
+ DataType BindingFixedArray8
Preview bool
Delivery bool
}
@@ -1761,7 +1793,7 @@ pub type ImFontConfig = C.ImFontConfig
@[typedef]
pub struct C.ImFontConfig {
pub mut:
- Name [40]i8
+ Name BindingFixedArray9
FontData voidptr
FontDataSize i32
FontDataOwnedByAtlas bool
@@ -1903,7 +1935,7 @@ pub mut:
TexUvWhitePixel ImVec2_c
Fonts ImVector_ImFontPtr
Sources ImVector_ImFontConfig
- TexUvLines [33]ImVec4_c
+ TexUvLines BindingFixedArray10
TexNextUniqueID i32
FontNextUniqueID i32
DrawListSharedDatas ImVector_ImDrawListSharedDataPtr
@@ -2002,7 +2034,7 @@ pub mut:
Sources ImVector_ImFontConfigPtr
EllipsisChar ImWchar
FallbackChar ImWchar
- Used8kPagesMap [1]ImU8
+ Used8kPagesMap BindingFixedArray11
EllipsisAutoBake bool
RemapPairs Storage
}
@@ -2019,7 +2051,7 @@ pub type Viewport = C.ImGuiViewport
@[typedef]
pub struct C.ImGuiViewport {
pub mut:
- ID ID
+ ID u32
Flags ViewportFlags
Pos ImVec2_c
Size ImVec2_c
@@ -2123,7 +2155,10 @@ pub type ImFileHandle = &C.FILE
pub type ImVec1 = C.ImVec1
@[typedef]
-pub struct C.ImVec1 {}
+pub struct C.ImVec1 {
+pub mut:
+ x f32
+}
pub type ImVec2i_c = C.ImVec2i_c
@@ -2212,9 +2247,9 @@ pub mut:
TempBuffer ImVector_ImVec2
DrawLists ImVector_ImDrawListPtr
Context &Context
- ArcFastVtx [48]ImVec2_c
+ ArcFastVtx BindingFixedArray12
ArcFastRadiusCutoff f32
- CircleSegmentCounts [64]ImU8
+ CircleSegmentCounts BindingFixedArray13
}
pub type ImDrawDataBuilder = C.ImDrawDataBuilder
@@ -2222,7 +2257,7 @@ pub type ImDrawDataBuilder = C.ImDrawDataBuilder
@[typedef]
pub struct C.ImDrawDataBuilder {
pub mut:
- Layers [2]&ImVector_ImDrawListPtr
+ Layers[2]&ImVector_ImDrawListPtr
LayerData1 ImVector_ImDrawListPtr
}
@@ -2242,7 +2277,7 @@ pub type StyleVarInfo = C.ImGuiStyleVarInfo
pub struct C.ImGuiStyleVarInfo {
pub mut:
Count ImU32
- DataType DataType
+ DataType i32
Offset ImU32
}
@@ -2251,7 +2286,7 @@ pub type ColorMod = C.ImGuiColorMod
@[typedef]
pub struct C.ImGuiColorMod {
pub mut:
- Col Col
+ Col i32
BackupValue ImVec4_c
}
@@ -2268,7 +2303,7 @@ pub type DataTypeStorage = C.ImGuiDataTypeStorage
@[typedef]
pub struct C.ImGuiDataTypeStorage {
pub mut:
- Data [8]ImU8
+ Data BindingFixedArray14
}
pub type DataTypeInfo = C.ImGuiDataTypeInfo
@@ -2470,7 +2505,7 @@ pub mut:
OffsetLabel ImU16
OffsetShortcut ImU16
OffsetMark ImU16
- Widths [4]ImU16
+ Widths BindingFixedArray15
}
pub type InputTextDeactivatedState = C.ImGuiInputTextDeactivatedState
@@ -2478,7 +2513,7 @@ pub type InputTextDeactivatedState = C.ImGuiInputTextDeactivatedState
@[typedef]
pub struct C.ImGuiInputTextDeactivatedState {
pub mut:
- ID ID
+ ID u32
ElapseFrame i32
TextA ImVector_char
}
@@ -2496,7 +2531,7 @@ pub mut:
Ctx &Context
Stb &ImStbTexteditState
Flags InputTextFlags
- ID ID
+ ID u32
TextLen i32
TextSrc &char
TextA ImVector_char
@@ -2559,8 +2594,8 @@ pub mut:
SizeVal ImVec2_c
ContentSizeVal ImVec2_c
ScrollVal ImVec2_c
- WindowFlags WindowFlags
- ChildFlags ChildFlags
+ WindowFlags i32
+ ChildFlags i32
CollapsedVal bool
SizeConstraintRect ImRect_c
SizeCallback SizeCallback
@@ -2588,7 +2623,7 @@ pub mut:
HasFlags NextItemDataFlags
ItemFlagsSet ItemFlags
FocusScopeId ID
- SelectionUserData SelectionUserData
+ SelectionUserData i64
Width f32
Shortcut KeyChord
ShortcutFlags InputFlags
@@ -2604,8 +2639,8 @@ pub type LastItemData = C.ImGuiLastItemData
@[typedef]
pub struct C.ImGuiLastItemData {
pub mut:
- ID ID
- ItemFlags ItemFlags
+ ID u32
+ ItemFlags i32
StatusFlags ItemStatusFlags
Rect ImRect_c
NavRect ImRect_c
@@ -2619,9 +2654,9 @@ pub type TreeNodeStackData = C.ImGuiTreeNodeStackData
@[typedef]
pub struct C.ImGuiTreeNodeStackData {
pub mut:
- ID ID
+ ID u32
TreeFlags TreeNodeFlags
- ItemFlags ItemFlags
+ ItemFlags i32
NavRect ImRect_c
DrawLinesX1 f32
DrawLinesToNodesY2 f32
@@ -2682,7 +2717,7 @@ pub type DeactivatedItemData = C.ImGuiDeactivatedItemData
@[typedef]
pub struct C.ImGuiDeactivatedItemData {
pub mut:
- ID ID
+ ID u32
ElapseFrame i32
HasBeenEditedBefore bool
IsAlive bool
@@ -2714,7 +2749,7 @@ pub type ImBitArray_Key_NamedKey_COUNT__lessKey_NamedKey_BEGIN = C.ImBitArray_Im
@[typedef]
pub struct C.ImBitArray_ImGuiKey_NamedKey_COUNT__lessImGuiKey_NamedKey_BEGIN {
pub mut:
- Data [5]ImU32
+ Data BindingFixedArray16
}
pub type ImBitArrayForNamedKeys = C.ImBitArray_ImGuiKey_NamedKey_COUNT__lessImGuiKey_NamedKey_BEGIN
@@ -2835,7 +2870,7 @@ pub type KeyRoutingTable = C.ImGuiKeyRoutingTable
@[typedef]
pub struct C.ImGuiKeyRoutingTable {
pub mut:
- Index [155]KeyRoutingIndex
+ Index BindingFixedArray17
Entries ImVector_KeyRoutingData
EntriesNext ImVector_KeyRoutingData
}
@@ -2974,14 +3009,14 @@ pub type NavItemData = C.ImGuiNavItemData
pub struct C.ImGuiNavItemData {
pub mut:
Window &Window
- ID ID
+ ID u32
FocusScopeId ID
RectRel ImRect_c
- ItemFlags ItemFlags
+ ItemFlags i32
DistBox f32
DistCenter f32
DistAxial f32
- SelectionUserData SelectionUserData
+ SelectionUserData i64
}
pub type FocusScopeData = C.ImGuiFocusScopeData
@@ -2989,7 +3024,7 @@ pub type FocusScopeData = C.ImGuiFocusScopeData
@[typedef]
pub struct C.ImGuiFocusScopeData {
pub mut:
- ID ID
+ ID u32
WindowID ID
}
@@ -3018,7 +3053,7 @@ pub type TypingSelectState = C.ImGuiTypingSelectState
pub struct C.ImGuiTypingSelectState {
pub mut:
Request TypingSelectRequest
- SearchBuffer [64]i8
+ SearchBuffer BindingFixedArray18
FocusScope ID
LastRequestFrame i32
LastRequestTime f32
@@ -3060,7 +3095,7 @@ pub type OldColumns = C.ImGuiOldColumns
@[typedef]
pub struct C.ImGuiOldColumns {
pub mut:
- ID ID
+ ID u32
Flags OldColumnFlags
IsFirstFrame bool
IsBeingResized bool
@@ -3084,7 +3119,7 @@ pub type BoxSelectState = C.ImGuiBoxSelectState
@[typedef]
pub struct C.ImGuiBoxSelectState {
pub mut:
- ID ID
+ ID u32
IsActive bool
IsStarting bool
IsStartedFromVoid bool
@@ -3097,7 +3132,7 @@ pub mut:
Window &Window
UnclipMode bool
UnclipRect ImRect_c
- UnclipRects [2]ImRect_c
+ UnclipRects BindingFixedArray19
BoxSelectRectPrev ImRect_c
BoxSelectRectCurr ImRect_c
}
@@ -3131,7 +3166,7 @@ pub type MultiSelectState = C.ImGuiMultiSelectState
pub struct C.ImGuiMultiSelectState {
pub mut:
Window &Window
- ID ID
+ ID u32
LastFrameActive i32
LastSelectionSize i32
RangeSelected ImS8
@@ -3146,8 +3181,8 @@ pub type ViewportP = C.ImGuiViewportP
pub struct C.ImGuiViewportP {
pub mut:
_ImGuiViewport Viewport
- BgFgDrawListsLastTimeActive [2]f32
- BgFgDrawLists [2]&ImDrawList
+ BgFgDrawListsLastTimeActive BindingFixedArray20
+ BgFgDrawLists[2]&ImDrawList
DrawDataP ImDrawData
DrawDataBuilder ImDrawDataBuilder
WorkInsetMin ImVec2_c
@@ -3161,7 +3196,7 @@ pub type WindowSettings = C.ImGuiWindowSettings
@[typedef]
pub struct C.ImGuiWindowSettings {
pub mut:
- ID ID
+ ID u32
Pos ImVec2ih
Size ImVec2ih
LastUsedDate PackedDate
@@ -3267,7 +3302,7 @@ pub mut:
TotalAllocCount i32
TotalFreeCount i32
LastEntriesIdx ImS16
- LastEntriesBuf [6]DebugAllocEntry
+ LastEntriesBuf BindingFixedArray21
}
pub type MetricsConfig = C.ImGuiMetricsConfig
@@ -3298,7 +3333,7 @@ pub type StackLevelInfo = C.ImGuiStackLevelInfo
@[typedef]
pub struct C.ImGuiStackLevelInfo {
pub mut:
- ID ID
+ ID u32
QueryFrameCount ImS8
QuerySuccess bool
DataType ImS8
@@ -3679,7 +3714,7 @@ pub mut:
FrameCountEnded i32
FrameCountRendered i32
Time f64
- ContextName [16]i8
+ ContextName BindingFixedArray22
IO IO
PlatformIO PlatformIO
Style Style
@@ -3758,7 +3793,7 @@ pub mut:
LastKeyModsChangeFromNoneTime f64
LastKeyboardKeyPressTime f64
KeysMayBeCharInput ImBitArrayForNamedKeys
- KeysOwnerData [155]KeyOwnerData
+ KeysOwnerData BindingFixedArray23
KeysRoutingTable KeyRoutingTable
ActiveIdUsingNavDirMask ImU32
ActiveIdUsingAllKeyboardKeys bool
@@ -3812,7 +3847,7 @@ pub mut:
NavMoveSubmitted bool
NavMoveScoringItems bool
NavMoveForwardToNextFrame bool
- NavMoveFlags NavMoveFlags
+ NavMoveFlags i32
NavMoveScrollFlags ScrollFlags
NavMoveKeyMods KeyChord
NavMoveDir Dir
@@ -3867,7 +3902,7 @@ pub mut:
DragDropAcceptFrameCount i32
DragDropHoldJustPressedId ID
DragDropPayloadBufHeap ImVector_unsigned_char
- DragDropPayloadBufLocal [16]u8
+ DragDropPayloadBufLocal BindingFixedArray24
ClipperTempDataStacked i32
ClipperTempData ImVector_ListClipperData
CurrentTable &Table
@@ -3892,7 +3927,7 @@ pub mut:
HoverItemDelayClearTimer f32
HoverItemUnlockedStationaryId ID
HoverWindowUnlockedStationaryId ID
- MouseCursor MouseCursor
+ MouseCursor i32
MouseStationaryTimer f32
MouseLastValidPos ImVec2_c
InputTextState InputTextState
@@ -3942,10 +3977,10 @@ pub mut:
Hooks ImVector_ContextHook
HookIdNext ID
DemoMarkerCallback DemoMarkerCallback
- LocalizationTable [12]&char
+ LocalizationTable[12]&char
LogEnabled bool
LogLineFirstItem bool
- LogFlags LogFlags
+ LogFlags i32
LogWindow &Window
LogFile ImFileHandle
LogBuffer TextBuffer
@@ -3963,7 +3998,7 @@ pub mut:
StackSizesInNewFrame ErrorRecoveryState
StackSizesInBeginForCurrentWindow &ErrorRecoveryState
DebugDrawIdConflictsCount i32
- DebugLogFlags DebugLogFlags
+ DebugLogFlags i32
DebugLogBuf TextBuffer
DebugLogIndex TextIndex
DebugLogSkippedErrors i32
@@ -3982,7 +4017,7 @@ pub mut:
DebugItemPathQuery DebugItemPathQuery
DebugIDStackTool IDStackTool
DebugAllocInfo DebugAllocInfo
- FramerateSecPerFrame [60]f32
+ FramerateSecPerFrame BindingFixedArray25
FramerateSecPerFrameIdx i32
FramerateSecPerFrameCount i32
FramerateSecPerFrameAccum f32
@@ -3990,7 +4025,7 @@ pub mut:
WantCaptureKeyboardNextFrame i32
WantTextInputNextFrame i32
TempBuffer ImVector_char
- TempKeychordName [64]i8
+ TempKeychordName BindingFixedArray18
}
pub type WindowTempData = C.ImGuiWindowTempData
@@ -4029,7 +4064,7 @@ pub mut:
StateStorage &Storage
CurrentColumns &OldColumns
CurrentTableIdx i32
- LayoutType LayoutType
+ LayoutType i32
ParentLayoutType LayoutType
ModalDimBgColor ImU32
WindowItemStatusFlags ItemStatusFlags
@@ -4058,9 +4093,9 @@ pub struct C.ImGuiWindow {
pub mut:
Ctx &Context
Name &char
- ID ID
+ ID u32
Flags WindowFlags
- ChildFlags ChildFlags
+ ChildFlags i32
Viewport &ViewportP
Pos ImVec2_c
Size ImVec2_c
@@ -4155,9 +4190,9 @@ pub mut:
RootWindowForNav &Window
ParentWindowForFocusRoute &Window
NavLastChildNavWindow &Window
- NavLastIds [2]ID
- NavRectRel [2]ImRect_c
- NavPreferredScoringPosRel [2]ImVec2_c
+ NavLastIds BindingFixedArray26
+ NavRectRel BindingFixedArray19
+ NavPreferredScoringPosRel BindingFixedArray27
NavRootFocusScopeId ID
MemoryDrawListIdxCapacity i32
MemoryDrawListVtxCapacity i32
@@ -4182,7 +4217,7 @@ pub type TabItem = C.ImGuiTabItem
@[typedef]
pub struct C.ImGuiTabItem {
pub mut:
- ID ID
+ ID u32
Flags TabItemFlags
LastFrameVisible i32
LastFrameSelected i32
@@ -4214,7 +4249,7 @@ pub mut:
Window &Window
Tabs ImVector_TabItem
Flags TabBarFlags
- ID ID
+ ID u32
SelectedTabId ID
NextSelectedTabId ID
NextScrollToTabId ID
@@ -4265,7 +4300,7 @@ pub mut:
StretchWeight f32
InitStretchWeightOrWidth f32
ClipRect ImRect_c
- ID ID
+ ID u32
UserData ID
WorkMinX f32
WorkMaxX f32
@@ -4309,7 +4344,7 @@ pub type TableReconcileColumnData = C.ImGuiTableReconcileColumnData
@[typedef]
pub struct C.ImGuiTableReconcileColumnData {
pub mut:
- ID ID
+ ID u32
NameOffset ImS16
Flags TableColumnFlags
InitWidthOrWeight f32
@@ -4404,7 +4439,7 @@ pub type Table = C.ImGuiTable
@[typedef]
pub struct C.ImGuiTable {
pub mut:
- ID ID
+ ID u32
Flags TableFlags
RawData voidptr
TempData &TableTempData
@@ -4431,7 +4466,7 @@ pub mut:
RowFlags TableRowFlags
LastRowFlags TableRowFlags
RowBgColorCounter i32
- RowBgColor [2]ImU32
+ RowBgColor BindingFixedArray28
BorderColorStrong ImU32
BorderColorLight ImU32
BorderX1 f32
@@ -4574,7 +4609,7 @@ pub type TableColumnSettings = C.ImGuiTableColumnSettings
pub struct C.ImGuiTableColumnSettings {
pub mut:
WidthOrWeight f32
- ID ID
+ ID u32
Index TableColumnIdx
DisplayOrder TableColumnIdx
SortOrder TableColumnIdx
@@ -4589,7 +4624,7 @@ pub type TableSettings = C.ImGuiTableSettings
@[typedef]
pub struct C.ImGuiTableSettings {
pub mut:
- ID ID
+ ID u32
SaveFlags TableFlags
RefScale f32
ColumnsCount TableColumnIdx
@@ -4649,7 +4684,7 @@ pub type Stbrp_context_opaque = C.stbrp_context_opaque
@[typedef]
pub struct C.stbrp_context_opaque {
pub mut:
- Data [80]i8
+ Data BindingFixedArray29
}
pub type ImVector_stbrp_node_im = C.ImVector_stbrp_node_im
@@ -4735,8 +4770,8 @@ pub type StbUndoState = C.StbUndoState
@[typedef]
pub struct C.StbUndoState {
pub mut:
- Undo_rec [99]StbUndoRecord
- Undo_char [999]i8
+ Undo_rec BindingFixedArray30
+ Undo_char BindingFixedArray31
Undo_point i16
Redo_point i16
Undo_char_point i32
diff --git a/impl_glfw/imgui_impl_glfw.c.v b/impl_glfw/imgui_impl_glfw.c.v
index cbd7ed7..0b730e1 100644
--- a/impl_glfw/imgui_impl_glfw.c.v
+++ b/impl_glfw/imgui_impl_glfw.c.v
@@ -2,6 +2,8 @@ module impl_glfw
import antono2.glfw
+#flag -DCIMGUI_USE_GLFW
+
#define CIMGUI_USE_GLFW
#define IMGUI_IMPL_VULKAN
diff --git a/impl_vulkan/imgui_impl_vulkan.c.v b/impl_vulkan/imgui_impl_vulkan.c.v
index 39e1b6d..21e3b87 100644
--- a/impl_vulkan/imgui_impl_vulkan.c.v
+++ b/impl_vulkan/imgui_impl_vulkan.c.v
@@ -5,6 +5,7 @@ import antono2.vulkan as vk
import antono2.imgui
#flag -I @VMODROOT/include/imgui/backends
+#flag -I @VMODROOT/include
#define IMGUI_DISABLE
@@ -12,13 +13,19 @@ import antono2.imgui
//#define IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING
#define IMGUI_IMPL_VULKAN_USE_LOADER
+#define CIMGUI_USE_VULKAN
-#include "imgui_impl_vulkan.h"
+#include "cimgui_impl.h"
pub type PFN_LoaderFunc = fn (function_name &char, user_data voidptr) voidptr
-@[c: 'ImGui_ImplVulkan_LoadFunctions']
-pub fn load_functions(api_version u32, loader_func PFN_LoaderFunc, user_data voidptr) bool
+@[keep_args_alive]
+fn C.ImGui_ImplVulkan_LoadFunctions(api_version u32, loader_func PFN_LoaderFunc, user_data voidptr) bool
+
+@[inline]
+pub fn load_functions(api_version u32, loader_func PFN_LoaderFunc, user_data voidptr) bool {
+ return C.ImGui_ImplVulkan_LoadFunctions(api_version, loader_func, user_data)
+}
pub type PFN_CheckVkResult = fn (err vk.Result)
@@ -60,14 +67,29 @@ pub mut:
custom_shader_frag_create_info vk.ShaderModuleCreateInfo
}
-@[c: 'ImGui_ImplVulkan_Init']
-pub fn vkinit(init &InitInfo) bool
+@[keep_args_alive]
+fn C.ImGui_ImplVulkan_Init(init &InitInfo) bool
+
+@[inline]
+pub fn vkinit(init &InitInfo) bool {
+ return C.ImGui_ImplVulkan_Init(init)
+}
+
+@[keep_args_alive]
+fn C.ImGui_ImplVulkan_NewFrame()
-@[c: 'ImGui_ImplVulkan_NewFrame']
-pub fn new_frame()
+@[inline]
+pub fn new_frame() {
+ C.ImGui_ImplVulkan_NewFrame()
+}
+
+@[keep_args_alive]
+fn C.ImGui_ImplVulkan_RenderDrawData(draw_data &imgui.ImDrawData, command_buffer vk.CommandBuffer, pipeline vk.Pipeline)
-@[c: 'ImGui_ImplVulkan_RenderDrawData']
-pub fn render_draw_data(draw_data &imgui.ImDrawData, command_buffer vk.CommandBuffer, pipeline vk.Pipeline)
+@[inline]
+pub fn render_draw_data(draw_data &imgui.ImDrawData, command_buffer vk.CommandBuffer, pipeline vk.Pipeline) {
+ C.ImGui_ImplVulkan_RenderDrawData(draw_data, command_buffer, pipeline)
+}
// Helper structure to hold the data needed by one rendering frame
// (Used by example. Used by multi-viewport features. Probably NOT used by your own engine/app.)
@@ -176,31 +198,61 @@ pub mut:
frame_semaphores []FrameSemaphores
}
-@[c: 'ImGui_ImplVulkanH_SelectPhysicalDevice']
-pub fn select_physical_device(instance vk.Instance) vk.PhysicalDevice
+@[keep_args_alive]
+fn C.ImGui_ImplVulkanH_SelectPhysicalDevice(instance vk.Instance) vk.PhysicalDevice
+
+@[inline]
+pub fn select_physical_device(instance vk.Instance) vk.PhysicalDevice {
+ return C.ImGui_ImplVulkanH_SelectPhysicalDevice(instance)
+}
+
+@[keep_args_alive]
+fn C.ImGui_ImplVulkanH_SelectQueueFamilyIndex(physical_device vk.PhysicalDevice) u32
+
+@[inline]
+pub fn select_queue_family_index(physical_device vk.PhysicalDevice) u32 {
+ return C.ImGui_ImplVulkanH_SelectQueueFamilyIndex(physical_device)
+}
+
+@[keep_args_alive]
+fn C.ImGui_ImplVulkanH_SelectSurfaceFormat(physical_device vk.PhysicalDevice, surface vk.SurfaceKHR, const_request_formats &vk.Format, request_formats_count i32, request_color_space vk.ColorSpaceKHR) vk.SurfaceFormatKHR
+
+@[inline]
+pub fn select_surface_format(physical_device vk.PhysicalDevice, surface vk.SurfaceKHR, const_request_formats &vk.Format, request_formats_count i32, request_color_space vk.ColorSpaceKHR) vk.SurfaceFormatKHR {
+ return C.ImGui_ImplVulkanH_SelectSurfaceFormat(physical_device, surface, const_request_formats, request_formats_count, request_color_space)
+}
+
+@[keep_args_alive]
+fn C.ImGui_ImplVulkanH_SelectPresentMode(physical_device vk.PhysicalDevice, surface vk.SurfaceKHR, const_request_modes &vk.PresentModeKHR, request_modes_count i32) vk.PresentModeKHR
-@[c: 'ImGui_ImplVulkanH_SelectQueueFamilyIndex']
-pub fn select_queue_family_index(physical_device vk.PhysicalDevice) u32
+@[inline]
+pub fn select_present_mode(physical_device vk.PhysicalDevice, surface vk.SurfaceKHR, const_request_modes &vk.PresentModeKHR, request_modes_count i32) vk.PresentModeKHR {
+ return C.ImGui_ImplVulkanH_SelectPresentMode(physical_device, surface, const_request_modes, request_modes_count)
+}
-@[c: 'ImGui_ImplVulkanH_SelectSurfaceFormat']
-pub fn select_surface_format(physical_device vk.PhysicalDevice, surface vk.SurfaceKHR, const_request_formats &vk.Format, request_formats_count i32, request_color_space vk.ColorSpaceKHR) vk.SurfaceFormatKHR
+@[keep_args_alive]
+fn C.ImGui_ImplVulkan_SetMinImageCount(min_image_count u32)
-@[c: 'ImGui_ImplVulkanH_SelectPresentMode']
-pub fn select_present_mode(physical_device vk.PhysicalDevice, surface vk.SurfaceKHR, const_request_modes &vk.PresentModeKHR, request_modes_count i32) vk.PresentModeKHR
+@[inline]
+pub fn set_min_image_count(min_image_count u32) {
+ C.ImGui_ImplVulkan_SetMinImageCount(min_image_count)
+}
-@[c: 'ImGui_ImplVulkan_SetMinImageCount']
-pub fn set_min_image_count(min_image_count u32)
+@[keep_args_alive]
+fn C.ImGui_ImplVulkan_Shutdown()
-@[c: 'ImGui_ImplVulkan_Shutdown']
-pub fn shutdown()
+@[inline]
+pub fn shutdown() {
+ C.ImGui_ImplVulkan_Shutdown()
+}
-pub fn create_or_resize_window(instance vk.Instance, physical_device vk.PhysicalDevice, device vk.Device, wd &Window, queue_family u32, allocator &vk.AllocationCallbacks, width i32, height i32, min_image_count u32) {
+pub fn create_or_resize_window(instance vk.Instance, physical_device vk.PhysicalDevice, device vk.Device, mut wd Window, queue_family u32, allocator &vk.AllocationCallbacks, width i32, height i32, min_image_count u32) {
create_window_swap_chain(physical_device, device, mut wd, allocator, width, height, min_image_count)
create_window_command_buffers(physical_device, device, wd, queue_family, allocator)
}
// ImGui_ImplVulkanH_DestroyFrame
-pub fn destroy_frame(device vk.Device, fd &Frame, const_allocator &vk.AllocationCallbacks) {
+pub fn destroy_frame(device vk.Device, mut fd Frame, const_allocator &vk.AllocationCallbacks) {
vk.destroy_fence(device, fd.fence, const_allocator)
vk.free_command_buffers(device, fd.command_pool, 1, &fd.command_buffer)
vk.destroy_command_pool(device, fd.command_pool, const_allocator)
@@ -212,7 +264,7 @@ pub fn destroy_frame(device vk.Device, fd &Frame, const_allocator &vk.Allocation
}
// ImGui_ImplVulkanH_DestroyFrameSemaphores
-pub fn destroy_frame_semaphores(device vk.Device, fsd &FrameSemaphores, const_allocator &vk.AllocationCallbacks) {
+pub fn destroy_frame_semaphores(device vk.Device, mut fsd FrameSemaphores, const_allocator &vk.AllocationCallbacks) {
vk.destroy_semaphore(device, fsd.image_acquired_semaphore, const_allocator)
vk.destroy_semaphore(device, fsd.render_complete_semaphore, const_allocator)
fsd.image_acquired_semaphore = unsafe { nil }
@@ -225,7 +277,7 @@ pub fn get_min_image_count_from_present_mode(present_mode vk.PresentModeKHR) u32
.mailbox {
return 3
}
- .fifo || .fifo_relaxed {
+ .fifo, .fifo_relaxed {
return 2
}
.immediate {
@@ -240,8 +292,9 @@ pub fn get_min_image_count_from_present_mode(present_mode vk.PresentModeKHR) u32
// Also destroy old swap chain and in-flight frames data, if any.
// ImGui_ImplVulkanH_CreateWindowSwapChain
-pub fn create_window_swap_chain(physical_device vk.PhysicalDevice, device vk.Device, mut wd &Window, const_allocator &vk.AllocationCallbacks, w i32, h i32, min_image_count u32) {
+pub fn create_window_swap_chain(physical_device vk.PhysicalDevice, device vk.Device, mut wd Window, const_allocator &vk.AllocationCallbacks, w i32, h i32, min_image_count u32) {
mut res := vk.Result.error_unknown
+ mut min_images := min_image_count
old_swapchain := wd.swapchain
wd.swapchain = unsafe { nil }
res = vk.device_wait_idle(device)
@@ -249,10 +302,10 @@ pub fn create_window_swap_chain(physical_device vk.PhysicalDevice, device vk.Dev
// We don't use ImGui_ImplVulkanH_DestroyWindow() because we want to preserve the old swapchain to create the new one.
// Destroy old Framebuffer
for i in 0 .. wd.image_count {
- destroy_frame(device, &wd.frames[i], const_allocator)
+ destroy_frame(device, mut wd.frames[i], const_allocator)
}
for i in 0 .. wd.semaphore_count {
- destroy_frame_semaphores(device, &wd.frame_semaphores[i], const_allocator)
+ destroy_frame_semaphores(device, mut wd.frame_semaphores[i], const_allocator)
}
// Clears the array without deallocating the allocated data. It does it by setting the array length to 0.
// C++ clear() does destroy the elements as well.
@@ -264,8 +317,8 @@ pub fn create_window_swap_chain(physical_device vk.PhysicalDevice, device vk.Dev
}
// If min image count was not specified, request different count of images dependent on selected present mode
- if min_image_count == 0 {
- min_image_count = get_min_image_count_from_present_mode(wd.present_mode)
+ if min_images == 0 {
+ min_images = get_min_image_count_from_present_mode(wd.present_mode)
}
// Create Swapchain
@@ -275,7 +328,7 @@ pub fn create_window_swap_chain(physical_device vk.PhysicalDevice, device vk.Dev
mut swapchain_ci := vk.SwapchainCreateInfoKHR{}
swapchain_ci.surface = wd.surface
- swapchain_ci.minImageCount = min_image_count
+ swapchain_ci.minImageCount = min_images
swapchain_ci.imageFormat = wd.surface_format.format
swapchain_ci.imageColorSpace = wd.surface_format.colorSpace
swapchain_ci.imageArrayLayers = 1
@@ -313,7 +366,7 @@ pub fn create_window_swap_chain(physical_device vk.PhysicalDevice, device vk.Dev
res = vk.get_swapchain_images_khr(device, wd.swapchain, &wd.image_count, unsafe { nil })
assert res == vk.Result.success
mut backbuffers := []vk.Image{len: int(wd.image_count + 1), init: unsafe { nil }}
- assert wd.image_count >= min_image_count
+ assert wd.image_count >= min_images
res = vk.get_swapchain_images_khr(device, wd.swapchain, &wd.image_count, backbuffers.data)
assert res == vk.Result.success
@@ -331,7 +384,7 @@ pub fn create_window_swap_chain(physical_device vk.PhysicalDevice, device vk.Dev
if wd.use_dynamic_rendering == false {
mut description_att := vk.AttachmentDescription{}
description_att.format = wd.surface_format.format
- description_att.samples = vk.SampleCountFlags(vk.SampleCountFlagBits._1)
+ description_att.samples = vk.SampleCountFlagBits._1
if wd.clear_enable {
description_att.loadOp = vk.AttachmentLoadOp.clear
} else {
@@ -451,10 +504,10 @@ pub fn destroy_window(instance vk.Instance, device vk.Device, mut wd Window, con
// vk.queue_wait_idle(wd.queue)
for i in 0 .. wd.image_count {
- destroy_frame(device, &wd.frames[i], const_allocator)
+ destroy_frame(device, mut wd.frames[i], const_allocator)
}
for i in 0 .. wd.semaphore_count {
- destroy_frame_semaphores(device, &wd.frame_semaphores[i], const_allocator)
+ destroy_frame_semaphores(device, mut wd.frame_semaphores[i], const_allocator)
}
wd.frames.clear()
wd.frame_semaphores.clear()
diff --git a/implot/implot.v b/implot/implot.v
index 0a45871..ea402e9 100644
--- a/implot/implot.v
+++ b/implot/implot.v
@@ -70,25 +70,52 @@ SOFTWARE.
pub const version = '1.1 WIP'
pub const version_num = 10100
-pub type Va_list = imgui.Va_list
-
-@[typedef]
-pub struct C.DateTimeSpec_c {}
+pub type BindingFixedArray1 = [16]ImVec4_c
+pub type BindingFixedArray2 = [16]i8
+pub type BindingFixedArray3 = [6]Axis_c
+pub type BindingFixedArray4 = [2]f32
+pub type BindingFixedArray5 = [6]Cond
+pub type BindingFixedArray6 = [6]Range_c
+pub type BindingFixedArray7 = [6]bool
-@[typedef]
-pub struct C.Spec_c {}
+pub type Va_list = imgui.Va_list
// External C type declarations (from headers)
pub type DateTimeSpec_c = C.ImPlotDateTimeSpec_c
@[typedef]
-pub struct C.ImPlotDateTimeSpec_c {}
+pub struct C.ImPlotDateTimeSpec_c {
+pub mut:
+ Date DateFmt
+ Time TimeFmt
+ UseISO8601 bool
+ Use24HourClock bool
+}
pub type Spec_c = C.ImPlotSpec_c
@[typedef]
-pub struct C.ImPlotSpec_c {}
+pub struct C.ImPlotSpec_c {
+pub mut:
+ LineColor ImVec4_c
+ LineColors &u32
+ LineWeight f32
+ FillColor ImVec4_c
+ FillColors &u32
+ FillAlpha f32
+ Marker i32
+ MarkerSize f32
+ MarkerSizes &f32
+ MarkerLineColor ImVec4_c
+ MarkerLineColors &u32
+ MarkerFillColor ImVec4_c
+ MarkerFillColors &u32
+ Size f32
+ Offset int
+ Stride int
+ Flags ItemFlags
+}
pub type ImVec2_c = imgui.ImVec2
@@ -3940,7 +3967,7 @@ pub struct C.Tm {}
pub type Axis = Axis_c
-pub type DateTimeSpec = C.DateTimeSpec_c
+pub type DateTimeSpec = DateTimeSpec_c
pub type Point = Point_c
@@ -3948,7 +3975,7 @@ pub type Range = Range_c
pub type Rect = Rect_c
-pub type Spec = C.Spec_c
+pub type Spec = Spec_c
pub type Tick = Tick_c
@@ -4461,7 +4488,7 @@ pub mut:
FillColor ImVec4_c
FillColors &u32
FillAlpha f32
- Marker Marker
+ Marker i32
MarkerSize f32
MarkerSizes &f32
MarkerLineColor ImVec4_c
@@ -4517,8 +4544,8 @@ pub mut:
FitPadding ImVec2_c
DigitalPadding f32
DigitalSpacing f32
- Colors [16]ImVec4_c
- Colormap Colormap
+ Colors BindingFixedArray1
+ Colormap i32
UseLocalTime bool
UseISO8601 bool
Use24HourClock bool
@@ -4764,12 +4791,12 @@ pub type Axis_c = C.ImPlotAxis_c
@[typedef]
pub struct C.ImPlotAxis_c {
pub mut:
- ID imgui.ID
+ ID u32
Flags AxisFlags
PreviousFlags AxisFlags
Range Range_c
RangeCond Cond
- Scale Scale
+ Scale i32
FitExtents Range_c
OrthoAxis &Axis_c
ConstraintRange Range_c
@@ -4777,7 +4804,7 @@ pub mut:
Ticker Ticker
Formatter Formatter
FormatterData voidptr
- FormatSpec [16]i8
+ FormatSpec BindingFixedArray2
Locator Locator
LinkedMin &f64
LinkedMax &f64
@@ -4831,9 +4858,9 @@ pub type Item = C.ImPlotItem
@[typedef]
pub struct C.ImPlotItem {
pub mut:
- ID imgui.ID
+ ID u32
Color u32
- Marker Marker
+ Marker i32
LegendHoverRect ImRect_c
NameOffset i32
Show bool
@@ -4848,7 +4875,7 @@ pub struct C.ImPlotLegend {
pub mut:
Flags LegendFlags
PreviousFlags LegendFlags
- Location Location
+ Location i32
PreviousLocation Location
Scroll ImVec2_c
Indices ImVector_int
@@ -4886,7 +4913,7 @@ pub type ItemGroup = C.ImPlotItemGroup
@[typedef]
pub struct C.ImPlotItemGroup {
pub mut:
- ID imgui.ID
+ ID u32
Legend Legend
ItemPool ImPool_Item
ColormapIdx i32
@@ -4898,12 +4925,12 @@ pub type Plot = C.ImPlotPlot
@[typedef]
pub struct C.ImPlotPlot {
pub mut:
- ID imgui.ID
- Flags Flags
+ ID u32
+ Flags i32
PreviousFlags Flags
MouseTextLocation Location
- MouseTextFlags MouseTextFlags
- Axes [6]Axis_c
+ MouseTextFlags i32
+ Axes BindingFixedArray3
TextBuffer imgui.TextBuffer
Items ItemGroup
CurrentX ImAxis
@@ -4951,7 +4978,7 @@ pub type Subplot = C.ImPlotSubplot
@[typedef]
pub struct C.ImPlotSubplot {
pub mut:
- ID imgui.ID
+ ID u32
Flags SubplotFlags
PreviousFlags SubplotFlags
Items ItemGroup
@@ -4967,7 +4994,7 @@ pub mut:
ColRatios ImVector_float
RowLinkData ImVector_Range
ColLinkData ImVector_Range
- TempSizes [2]f32
+ TempSizes BindingFixedArray4
FrameHovered bool
HasTitle bool
}
@@ -4977,12 +5004,12 @@ pub type NextPlotData = C.ImPlotNextPlotData
@[typedef]
pub struct C.ImPlotNextPlotData {
pub mut:
- RangeCond [6]Cond
- Range [6]Range_c
- HasRange [6]bool
- Fit [6]bool
- LinkedMin [6]&f64
- LinkedMax [6]&f64
+ RangeCond BindingFixedArray5
+ Range BindingFixedArray6
+ HasRange BindingFixedArray7
+ Fit BindingFixedArray7
+ LinkedMin[6]&f64
+ LinkedMax[6]&f64
}
diff --git a/modules/antono2/glfw/alias.v b/modules/antono2/glfw/alias.v
deleted file mode 100644
index 51f7f4a..0000000
--- a/modules/antono2/glfw/alias.v
+++ /dev/null
@@ -1,2 +0,0 @@
-@[alias: '@VMODROOT/../glfw']
-module glfw
diff --git a/modules/antono2/imgui/alias.v b/modules/antono2/imgui/alias.v
deleted file mode 100644
index 7f1767d..0000000
--- a/modules/antono2/imgui/alias.v
+++ /dev/null
@@ -1,2 +0,0 @@
-@[alias: '@VMODROOT']
-module imgui
diff --git a/modules/antono2/vulkan/alias.v b/modules/antono2/vulkan/alias.v
deleted file mode 100644
index 3dc8463..0000000
--- a/modules/antono2/vulkan/alias.v
+++ /dev/null
@@ -1,2 +0,0 @@
-@[alias: '@VMODROOT/../vulkan']
-module vulkan
diff --git a/scripts/run_demo_windows.ps1 b/scripts/run_demo_windows.ps1
index 9a99cd6..1b040d2 100644
--- a/scripts/run_demo_windows.ps1
+++ b/scripts/run_demo_windows.ps1
@@ -2,7 +2,7 @@ param(
[switch]$BuildOnly,
[switch]$NativeOnly,
[string]$DemoDirectory,
- [string]$DemoRevision = "c2b5083d42f052cfe73952542e86e4163c64ce79"
+ [string]$DemoRevision = "1e444971dd4f70a6edf281ce648e136c01d08ab6"
)
$ErrorActionPreference = "Stop"
diff --git a/scripts/setup_linux.sh b/scripts/setup_linux.sh
index 627dc19..d19b9fe 100755
--- a/scripts/setup_linux.sh
+++ b/scripts/setup_linux.sh
@@ -51,7 +51,7 @@ fi
if command -v v >/dev/null 2>&1; then
printf '[ok] v: %s\n' "$(v version 2>/dev/null || true)"
if [[ $mode == install ]]; then
- v install antono2.vulkan
+ v install antono2.vulkan@v2.0.0
v install antono2.glfw
fi
else
diff --git a/setup.vsh b/setup.vsh
index 8bcc3a0..e491d71 100644
--- a/setup.vsh
+++ b/setup.vsh
@@ -17,7 +17,7 @@ fn run(command string) ! {
fn setup_vulkan(mode string) ! {
if mode == '--install' {
- run('v install antono2.vulkan')!
+ run('v install antono2.vulkan@v2.0.0')!
}
setup := os.join_path(os.vmodules_dir(), 'antono2', 'vulkan', 'setup.vsh')
if !os.is_file(setup) {
diff --git a/v.mod b/v.mod
index a9a8b78..37e996f 100644
--- a/v.mod
+++ b/v.mod
@@ -2,8 +2,8 @@ Module {
name: 'antono2.imgui'
description: 'Dear ImGui bindings for V. https://github.com/ocornut/imgui'
version: '1.0.0'
- autho: 'Anton Oreskin'
+ author: 'Anton Oreskin'
license: 'MIT'
repo_url: 'https://github.com/antono2/imgui'
- dependencies: ['antono2.vulkan', 'antono2.glfw']
+ dependencies: ['antono2.vulkan@v2.0.0', 'antono2.glfw']
}