Compare commits

..

28 Commits

Author SHA1 Message Date
sonoro1234
ce3b504e11 update readme version 2022-11-15 17:40:22 +01:00
sonoro1234
4230a5566e pull imgui 1.89 and generate 2022-11-15 17:38:24 +01:00
sonoro1234
9ce2c32dad add info about comments generation 2022-10-06 11:11:50 +02:00
sonoro1234
3d676ffb8b cpp2ffi: skip enum forward declarations 2022-09-27 12:58:11 +02:00
sonoro1234
b9ebd289e0 CleanImU32 not called when value is sizeof(ImU32) 2022-09-16 15:34:21 +02:00
sonoro1234
9da5c5fe7c repair_defaults from generator to cpp2ffi 2022-09-16 14:07:24 +02:00
sonoro1234
3d50615659 cpp2ffi: cleanStruct and parseStructLine comments correction 2022-09-09 15:44:51 +02:00
sonoro1234
938d146a41 cpp2ffi and generator: delete bad comments on functionD_re, repair split_comment 2022-09-09 12:00:01 +02:00
sonoro1234
7225c4ae3c generator.lua: prepare for comments 2022-09-08 13:46:03 +02:00
sonoro1234
feb7829edc cpp2ffi: prepare parser:parseItems for comments 2022-09-08 13:31:13 +02:00
sonoro1234
6eb85e7d5c generator: Clearly fail when parse fails; exclude obsolete fns for cl. Thanks to @idbrii 2022-09-01 19:06:19 +02:00
sonoro1234
068e91970d cpp2ffi: add custom generation machinery 2022-08-30 12:56:58 +02:00
sonoro1234
b5cce9f1a5 update .gitsubmodules 2022-08-08 11:03:54 +02:00
sonoro1234
ea5b077fbe vardef_re modified for = {} initialization 2022-08-05 14:49:26 +02:00
sonoro1234
a44ce77641 cpp2ffi: add clean_functypedef (cimplot needs it https://github.com/cimgui/cimplot/issues/11) 2022-07-25 13:11:24 +02:00
sonoro1234
15e4f5015d backend test sdl: add c++11 to CMakeLists.txt 2022-07-18 10:48:47 +02:00
sonoro1234
9b7d045962 Merge branch 'master' into docking_inter 2022-06-22 18:32:03 +02:00
sonoro1234
44b388121a generator: dont error if VULKAN_SDK==nil (because it is executed in no vulkan generation also) 2022-06-22 12:43:41 +02:00
sonoro1234
13c4f47172 generator: use VULKAN_SDK env variable to find vulkan 2022-06-22 12:33:46 +02:00
sonoro1234
d1f60f24e1 example_vulkan: add CIMGUI_USE_VULKAN and SDL 2022-06-22 12:18:03 +02:00
Victor Bombi
4c1fd9fc0a Merge pull request #204 from Sand3r-/example/sdl_vulkan
Add Vulkan example
2022-06-22 11:45:13 +02:00
sonoro1234
1616776d77 extraclean 2022-06-22 11:42:23 +02:00
Michal 'Sand3r-' Gallus
eccb961bc7 Add vulkan example info to README.md 2022-06-21 22:38:30 +02:00
Michal 'Sand3r-' Gallus
e3d115bce2 Add SDL2+Vulkan example 2022-06-21 22:38:27 +02:00
sonoro1234
82b8c66f59 extraclean 2022-06-21 22:21:25 +02:00
sonoro1234
08d5ad7f93 pull imgui 1.88 and generate 2022-06-21 20:03:54 +02:00
sonoro1234
0b8015191d Merge branch 'docking_inter' 2022-06-21 19:43:16 +02:00
sonoro1234
261250f88f generation 2022-02-25 11:22:51 +01:00
22 changed files with 8599 additions and 5531 deletions

2
.gitmodules vendored
View File

@@ -1,4 +1,4 @@
[submodule "imgui"]
path = imgui
url = https://github.com/ocornut/imgui.git
branch = master
branch = docking

View File

@@ -11,7 +11,7 @@ History:
Initially cimgui was developed by Stephan Dilly as hand-written code but lately turned into an auto-generated version by sonoro1234 in order to keep up with imgui more easily (letting the user select the desired branch and commit)
Notes:
* currently this wrapper is based on version [1.88 of Dear ImGui with internal api]
* currently this wrapper is based on version [1.89 of Dear ImGui with internal api]
* only functions, structs and enums from imgui.h (an optionally imgui_internal.h) are wrapped.
* if you are interested in imgui backends you should look [LuaJIT-ImGui](https://github.com/sonoro1234/LuaJIT-ImGui) project.
* All naming is algorithmic except for those names that were coded in cimgui_overloads table (https://github.com/cimgui/cimgui/blob/master/generator/generator.lua#L60). In the official version this table is empty.
@@ -27,7 +27,8 @@ Notes:
* cmake options are IMGUI_STATIC (compiling as static library), IMGUI_FREETYPE (for using Freetype2) and FREETYPE_PATH (Freetype2 cmake install location) (only if cimgui is generated with freetype option)
* or as in https://github.com/sonoro1234/LuaJIT-ImGui/tree/master/build
For compiling with backends there is now an example with SDL2 and opengl3 in folder backend_test. It will generate a cimgui_sdl module and a test_sdl executable.
For compiling with backends there are now examples with SDL2 and opengl3/vulkan in folder backend_test.
They'll generate a cimgui_sdl module and a test_sdl executable.
# using generator
@@ -36,8 +37,8 @@ Notes:
* you will need LuaJIT (https://github.com/LuaJIT/LuaJIT.git better 2.1 branch) or precompiled for linux/macOS/windows in https://luapower.com/luajit/download
* you need to use also a C++ compiler for doing preprocessing: gcc (In windows MinGW-W64-builds for example), clang or cl (MSVC). (this repo was done with gcc)
* update `imgui` folder to the version you desire.
* edit `generator/generator.bat` on windows, or `generator/generator.sh` on linux, to choose between gcc, clang, or cl and to choose desired backends and whether imgui_internal is generated or not and Freetype2 is used or not.
* the defaults of generator are gcc as compiler, imgui_internal included and sdl, glfw, opengl2 and opengl3 as backends.
* edit `generator/generator.bat` on windows, or `generator/generator.sh` on linux, to choose between gcc, clang, or cl and to choose desired backends and whether imgui_internal is generated or not, Freetype2 is used or not and comments are generated or not
* the defaults of generator are gcc as compiler, imgui_internal included and sdl, glfw, vulkan, opengl2 and opengl3 as backends.
* edit config_generator.lua for adding includes needed by your chosen backends (vulkan needs that).
* Run generator.bat or generator.sh with gcc, clang or cl and LuaJIT on your PATH.
* as a result some files are generated: `cimgui.cpp`, `cimgui.h` and `cimgui_impl.h` for compiling and some lua/json files with information about the binding: `definitions.json` with function info, `structs_and_enums.json` with struct and enum info, `impl_definitions.json` with functions from the backends info.

View File

@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 2.8)
if(WIN32) #to mingw work as all the others
set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif(WIN32)
set (CMAKE_CXX_STANDARD 11)
#general settings

View File

@@ -0,0 +1,100 @@
Project(cimgui_sdl_vk)
cmake_minimum_required(VERSION 2.8)
if(WIN32) # to make mingw work as all the others
set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif(WIN32)
# general settings
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../imgui/backends)
set(BACKENDS_FOLDER "../../imgui/backends/")
else()
set(BACKENDS_FOLDER "../../imgui/examples/")
endif()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../imgui/imgui_tables.cpp)
set(TABLES_SOURCE "../../imgui/imgui_tables.cpp")
else()
set(TABLES_SOURCE "")
endif()
include_directories(../../imgui)
add_definitions("-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS=1")
include_directories(../../)
set(IMGUI_SOURCES ../../cimgui.cpp
../../imgui/imgui.cpp
../../imgui/imgui_draw.cpp
../../imgui/imgui_demo.cpp
../../imgui/imgui_widgets.cpp
${TABLES_SOURCE}
)
set(IMGUI_SOURCES_sdl)
set(IMGUI_LIBRARIES )
if (WIN32)
add_definitions("-DIMGUI_IMPL_API=extern \"C\" __declspec\(dllexport\)")
else(WIN32)
add_definitions("-DIMGUI_IMPL_API=extern \"C\" ")
endif(WIN32)
#optional adding freetype
option(IMGUI_FREETYPE "add Freetype2" OFF)
if(IMGUI_FREETYPE)
FIND_PACKAGE(freetype REQUIRED PATHS ${FREETYPE_PATH})
list(APPEND IMGUI_LIBRARIES freetype)
list(APPEND IMGUI_SOURCES ../../imgui/misc/freetype/imgui_freetype.cpp)
add_definitions("-DCIMGUI_FREETYPE=1")
endif(IMGUI_FREETYPE)
# vulkan
find_package(Vulkan REQUIRED FATAL_ERROR)
list(APPEND IMGUI_LIBRARIES Vulkan::Vulkan)
list(APPEND IMGUI_SOURCES ${BACKENDS_FOLDER}imgui_impl_vulkan.cpp)
#sdl2
list(APPEND IMGUI_SOURCES ${BACKENDS_FOLDER}imgui_impl_sdl.cpp)
if(DEFINED SDL_PATH)
message(STATUS "SDL_PATH defined as " ${SDL_PATH})
FIND_PACKAGE(SDL2 PATHS ${SDL_PATH})
else(DEFINED SDL_PATH)
# If SDL_PATH is not set, fallback and attempt to find SDL cmake script at a default location
find_package(SDL2)
endif(DEFINED SDL_PATH)
if(SDL2_FOUND)
get_target_property(SDL_INCLUDE SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "sdlinclude is " ${SDL_INCLUDE})
if ("${SDL_INCLUDE}" STREQUAL "" OR "${SDL_INCLUDE}" STREQUAL "SDL_INCLUDE-NOTFOUND") #if not found latest SDL2 cmake config use older
message(STATUS "sdlinclude2 is " ${SDL2_INCLUDE_DIRS})
include_directories(${SDL2_INCLUDE_DIRS})
set(IMGUI_SDL_LIBRARY ${SDL2_LIBRARIES})
message(STATUS IMGUI_SDL_LIBRARY ${SDL2_LIBRARIES})
else()#use new one SDL2 config
include_directories(${SDL_INCLUDE})
set(IMGUI_SDL_LIBRARY SDL2::SDL2)
set(SDL_MAIN SDL2::SDL2main)
message(STATUS ${SDL_MAIN} ${IMGUI_SDL_LIBRARY})
endif()
else(SDL2_FOUND)
if(DEFINED SDL_PATH)
message(FATAL_ERROR "Cannot find SDL at SDL_PATH")
else(DEFINED SDL_PATH)
message(FATAL_ERROR "Cannot find SDL. Maybe try specifying SDL_PATH?")
endif(DEFINED SDL_PATH)
endif(SDL2_FOUND)
add_library(cimgui_sdl SHARED ${IMGUI_SOURCES})
target_link_libraries(cimgui_sdl ${IMGUI_LIBRARIES} ${IMGUI_SDL_LIBRARY})
#using library
include_directories(../../generator/output/)
add_executable(test_sdl main.c)
target_compile_definitions(test_sdl PUBLIC -DCIMGUI_USE_VULKAN -DCIMGUI_USE_SDL)
if (MINGW)
target_link_options(test_sdl PRIVATE "-mconsole")
endif()
target_link_libraries(test_sdl ${IMGUI_SDL_LIBRARY} cimgui_sdl)

View File

@@ -0,0 +1,571 @@
#include <stdio.h>
#include <assert.h>
#define SDL_MAIN_HANDLED
#include <SDL.h>
#include <SDL_vulkan.h>
#include <vulkan/vulkan.h>
#ifdef _MSC_VER
#include <windows.h>
#endif
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "cimgui.h"
#include "cimgui_impl.h"
#ifdef IMGUI_HAS_IMSTR
#define igBegin igBegin_Str
#define igSliderFloat igSliderFloat_Str
#define igCheckbox igCheckbox_Str
#define igColorEdit3 igColorEdit3_Str
#define igButton igButton_Str
#endif
#define IM_UNUSED(_VAR) ((void)(_VAR))
#define IM_ASSERT(_EXPR) assert(_EXPR)
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR))))
static VkAllocationCallbacks* g_Allocator = NULL;
static VkInstance g_Instance = VK_NULL_HANDLE;
static VkPhysicalDevice g_PhysicalDevice = VK_NULL_HANDLE;
static VkDevice g_Device = VK_NULL_HANDLE;
static uint32_t g_QueueFamily = (uint32_t)-1;
static VkQueue g_Queue = VK_NULL_HANDLE;
static VkDebugReportCallbackEXT g_DebugReport = VK_NULL_HANDLE;
static VkPipelineCache g_PipelineCache = VK_NULL_HANDLE;
static VkDescriptorPool g_DescriptorPool = VK_NULL_HANDLE;
static ImGui_ImplVulkanH_Window g_MainWindowData;
static uint32_t g_MinImageCount = 2;
static bool g_SwapChainRebuild = false;
static void check_vk_result(VkResult err)
{
if (err == 0)
return;
fprintf(stderr, "[vulkan] Error: VkResult = %d\n", err);
if (err < 0)
abort();
}
#ifdef IMGUI_VULKAN_DEBUG_REPORT
static VKAPI_ATTR VkBool32 VKAPI_CALL debug_report(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location,
int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData)
{
(void)flags; (void)object; (void)location; (void)messageCode;
(void)pUserData; (void)pLayerPrefix; // Unused arguments
fprintf(stderr, "[vulkan] Debug report from ObjectType: %i\nMessage: %s\n\n",
objectType, pMessage);
return VK_FALSE;
}
#endif // IMGUI_VULKAN_DEBUG_REPORT
static void SetupVulkan(const char** extensions, uint32_t extensions_count)
{
VkResult err;
// Create Vulkan Instance
VkInstanceCreateInfo inst_create_info = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.enabledExtensionCount = extensions_count,
.ppEnabledExtensionNames = extensions,
};
#ifdef IMGUI_VULKAN_DEBUG_REPORT
// Enabling validation layers
const char* layers[] = { "VK_LAYER_KHRONOS_validation" };
inst_create_info.enabledLayerCount = 1;
inst_create_info.ppEnabledLayerNames = layers;
// Enable debug report extension (we need additional storage, so we duplicate the user array to add our new extension to it)
const char** extensions_ext = (const char**)malloc(
sizeof(const char*) * (extensions_count + 1));
memcpy(extensions_ext, extensions, extensions_count * sizeof(const char*));
extensions_ext[extensions_count] = "VK_EXT_debug_report";
inst_create_info.enabledExtensionCount = extensions_count + 1;
inst_create_info.ppEnabledExtensionNames = extensions_ext;
// Create Vulkan Instance
err = vkCreateInstance(&inst_create_info, g_Allocator, &g_Instance);
check_vk_result(err);
free(extensions_ext);
// Get the function pointer (required for any extensions)
PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT =
(PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance,
"vkCreateDebugReportCallbackEXT");
IM_ASSERT(vkCreateDebugReportCallbackEXT != NULL);
// Setup the debug report callback
VkDebugReportCallbackCreateInfoEXT debug_report_ci = {
.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT,
.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
.pfnCallback = debug_report,
.pUserData = NULL,
};
err = vkCreateDebugReportCallbackEXT(g_Instance, &debug_report_ci, g_Allocator,
&g_DebugReport);
check_vk_result(err);
#else
// Create Vulkan Instance without any debug feature
err = vkCreateInstance(&inst_create_info, g_Allocator, &g_Instance);
check_vk_result(err);
IM_UNUSED(g_DebugReport);
#endif
// Select GPU
uint32_t gpu_count;
err = vkEnumeratePhysicalDevices(g_Instance, &gpu_count, NULL);
check_vk_result(err);
IM_ASSERT(gpu_count > 0);
VkPhysicalDevice* gpus = (VkPhysicalDevice*)malloc(sizeof(VkPhysicalDevice) * gpu_count);
err = vkEnumeratePhysicalDevices(g_Instance, &gpu_count, gpus);
check_vk_result(err);
// If a number >1 of GPUs got reported, find discrete GPU if present, or use first one available. This covers
// most common cases (multi-gpu/integrated+dedicated graphics). Handling more complicated setups (multiple
// dedicated GPUs) is out of scope of this sample.
int use_gpu = 0;
for (int i = 0; i < (int)gpu_count; i++)
{
VkPhysicalDeviceProperties properties;
vkGetPhysicalDeviceProperties(gpus[i], &properties);
if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
{
use_gpu = i;
break;
}
}
g_PhysicalDevice = gpus[use_gpu];
free(gpus);
// Select graphics queue family
uint32_t count;
vkGetPhysicalDeviceQueueFamilyProperties(g_PhysicalDevice, &count, NULL);
VkQueueFamilyProperties* queues = (VkQueueFamilyProperties*)malloc(
sizeof(VkQueueFamilyProperties) * count);
vkGetPhysicalDeviceQueueFamilyProperties(g_PhysicalDevice, &count, queues);
for (uint32_t i = 0; i < count; i++)
if (queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
{
g_QueueFamily = i;
break;
}
free(queues);
IM_ASSERT(g_QueueFamily != (uint32_t)-1);
// Create Logical Device (with 1 queue)
int device_extension_count = 1;
const char* device_extensions[] = { "VK_KHR_swapchain" };
const float queue_priority[] = { 1.0f };
VkDeviceQueueCreateInfo queue_info[1] = {
[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
[0].queueFamilyIndex = g_QueueFamily,
[0].queueCount = 1,
[0].pQueuePriorities = queue_priority,
};
VkDeviceCreateInfo create_info = {
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
.queueCreateInfoCount = sizeof(queue_info) / sizeof(queue_info[0]),
.pQueueCreateInfos = queue_info,
.enabledExtensionCount = device_extension_count,
.ppEnabledExtensionNames = device_extensions,
};
err = vkCreateDevice(g_PhysicalDevice, &create_info, g_Allocator, &g_Device);
check_vk_result(err);
vkGetDeviceQueue(g_Device, g_QueueFamily, 0, &g_Queue);
// Create Descriptor Pool
VkDescriptorPoolSize pool_sizes[] = {
{ VK_DESCRIPTOR_TYPE_SAMPLER, 1000 },
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1000 },
{ VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1000 },
{ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1000 },
{ VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1000 },
{ VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1000 },
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1000 },
{ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1000 },
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1000 },
{ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 1000 },
{ VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1000 }
};
VkDescriptorPoolCreateInfo pool_info = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
.maxSets = 1000 * IM_ARRAYSIZE(pool_sizes),
.poolSizeCount = (uint32_t)IM_ARRAYSIZE(pool_sizes),
.pPoolSizes = pool_sizes,
};
err = vkCreateDescriptorPool(g_Device, &pool_info, g_Allocator, &g_DescriptorPool);
check_vk_result(err);
}
// All the ImGui_ImplVulkanH_XXX structures/functions are optional helpers used by the demo.
// Your real engine/app may not use them.
static void SetupVulkanWindow(ImGui_ImplVulkanH_Window* wd, VkSurfaceKHR surface,
int width, int height)
{
wd->Surface = surface;
// Check for WSI support
VkBool32 res;
vkGetPhysicalDeviceSurfaceSupportKHR(g_PhysicalDevice, g_QueueFamily, wd->Surface, &res);
if (res != VK_TRUE)
{
fprintf(stderr, "Error no WSI support on physical device 0\n");
exit(-1);
}
// Select Surface Format
const VkFormat requestSurfaceImageFormat[] = {
VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM,
VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM
};
const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(
g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat,
(size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);
// Select Present Mode
#ifdef IMGUI_UNLIMITED_FRAME_RATE
VkPresentModeKHR present_modes[] = {
VK_PRESENT_MODE_MAILBOX_KHR,VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR
};
#else
VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR };
#endif
wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(
g_PhysicalDevice, wd->Surface, &present_modes[0], IM_ARRAYSIZE(present_modes));
// Create SwapChain, RenderPass, Framebuffer, etc.
IM_ASSERT(g_MinImageCount >= 2);
ImGui_ImplVulkanH_CreateOrResizeWindow(
g_Instance, g_PhysicalDevice, g_Device, wd, g_QueueFamily, g_Allocator,
width, height, g_MinImageCount);
}
static void CleanupVulkan()
{
vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator);
#ifdef IMGUI_VULKAN_DEBUG_REPORT
// Remove the debug report callback
PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT =
(PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT");
vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator);
#endif // IMGUI_VULKAN_DEBUG_REPORT
vkDestroyDevice(g_Device, g_Allocator);
vkDestroyInstance(g_Instance, g_Allocator);
}
static void CleanupVulkanWindow()
{
ImGui_ImplVulkanH_DestroyWindow(g_Instance, g_Device, &g_MainWindowData, g_Allocator);
}
static void FrameRender(ImGui_ImplVulkanH_Window* wd, ImDrawData* draw_data)
{
VkResult err;
VkSemaphore image_acquired_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].ImageAcquiredSemaphore;
VkSemaphore render_complete_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].RenderCompleteSemaphore;
err = vkAcquireNextImageKHR(g_Device, wd->Swapchain, UINT64_MAX, image_acquired_semaphore, VK_NULL_HANDLE, &wd->FrameIndex);
if (err == VK_ERROR_OUT_OF_DATE_KHR || err == VK_SUBOPTIMAL_KHR)
{
g_SwapChainRebuild = true;
return;
}
check_vk_result(err);
ImGui_ImplVulkanH_Frame* fd = &wd->Frames[wd->FrameIndex];
err = vkWaitForFences(g_Device, 1, &fd->Fence, VK_TRUE, UINT64_MAX); // wait indefinitely instead of periodically checking
check_vk_result(err);
err = vkResetFences(g_Device, 1, &fd->Fence);
check_vk_result(err);
err = vkResetCommandPool(g_Device, fd->CommandPool, 0);
check_vk_result(err);
VkCommandBufferBeginInfo info = {
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
};
err = vkBeginCommandBuffer(fd->CommandBuffer, &info);
check_vk_result(err);
VkRenderPassBeginInfo rp_info = {
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
.renderPass = wd->RenderPass,
.framebuffer = fd->Framebuffer,
.renderArea.extent.width = wd->Width,
.renderArea.extent.height = wd->Height,
.clearValueCount = 1,
.pClearValues = &wd->ClearValue,
};
vkCmdBeginRenderPass(fd->CommandBuffer, &rp_info, VK_SUBPASS_CONTENTS_INLINE);
// Record dear imgui primitives into command buffer
ImGui_ImplVulkan_RenderDrawData(draw_data, fd->CommandBuffer, VK_NULL_HANDLE);
// Submit command buffer
vkCmdEndRenderPass(fd->CommandBuffer);
VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
VkSubmitInfo sub_info = {
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
.waitSemaphoreCount = 1,
.pWaitSemaphores = &image_acquired_semaphore,
.pWaitDstStageMask = &wait_stage,
.commandBufferCount = 1,
.pCommandBuffers = &fd->CommandBuffer,
.signalSemaphoreCount = 1,
.pSignalSemaphores = &render_complete_semaphore,
};
err = vkEndCommandBuffer(fd->CommandBuffer);
check_vk_result(err);
err = vkQueueSubmit(g_Queue, 1, &sub_info, fd->Fence);
check_vk_result(err);
}
static void FramePresent(ImGui_ImplVulkanH_Window* wd)
{
if (g_SwapChainRebuild) return;
VkSemaphore render_complete_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].RenderCompleteSemaphore;
VkPresentInfoKHR info = {
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
.waitSemaphoreCount = 1,
.pWaitSemaphores = &render_complete_semaphore,
.swapchainCount = 1,
.pSwapchains = &wd->Swapchain,
.pImageIndices = &wd->FrameIndex,
};
VkResult err = vkQueuePresentKHR(g_Queue, &info);
if (err == VK_ERROR_OUT_OF_DATE_KHR || err == VK_SUBOPTIMAL_KHR)
{
g_SwapChainRebuild = true;
return;
}
check_vk_result(err);
wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->ImageCount; // Now we can use the next set of semaphores
}
int main(int argc, char* argv[])
{
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
SDL_Log("failed to init: %s", SDL_GetError());
return -1;
}
/// Setup window
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_VULKAN |
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
SDL_Window* window = SDL_CreateWindow("cImGui SDL2+Vulkan example",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
if (window == NULL) {
SDL_Log("Failed to create window: %s", SDL_GetError());
return -1;
}
// Setup Vulkan
uint32_t extensions_count = 0;
SDL_Vulkan_GetInstanceExtensions(window, &extensions_count, NULL);
const char** extensions = malloc(extensions_count * sizeof(const char*));
SDL_Vulkan_GetInstanceExtensions(window, &extensions_count, extensions);
SetupVulkan(extensions, extensions_count);
free(extensions);
// Create Window Surface
VkSurfaceKHR surface;
VkResult err;
if (SDL_Vulkan_CreateSurface(window, g_Instance, &surface) == 0)
{
printf("Failed to create Vulkan surface.\n");
return 1;
}
// Create Framebuffers
int w, h;
SDL_GetWindowSize(window, &w, &h);
ImGui_ImplVulkanH_Window* wd = &g_MainWindowData;
SetupVulkanWindow(wd, surface, w, h);
// setup imgui
igCreateContext(NULL);
//set docking
ImGuiIO* ioptr = igGetIO();
ioptr->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
//ioptr->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
// Setup Platform/Renderer backends
ImGui_ImplSDL2_InitForVulkan(window);
ImGui_ImplVulkan_InitInfo init_info = {
.Instance = g_Instance,
.PhysicalDevice = g_PhysicalDevice,
.Device = g_Device,
.QueueFamily = g_QueueFamily,
.Queue = g_Queue,
.PipelineCache = g_PipelineCache,
.DescriptorPool = g_DescriptorPool,
.Subpass = 0,
.MinImageCount = g_MinImageCount,
.ImageCount = wd->ImageCount,
.MSAASamples = VK_SAMPLE_COUNT_1_BIT,
.Allocator = g_Allocator,
.CheckVkResultFn = check_vk_result
};
ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
igStyleColorsDark(NULL);
// Upload Fonts
// Use any command queue
VkCommandPool command_pool = wd->Frames[wd->FrameIndex].CommandPool;
VkCommandBuffer command_buffer = wd->Frames[wd->FrameIndex].CommandBuffer;
err = vkResetCommandPool(g_Device, command_pool, 0);
check_vk_result(err);
VkCommandBufferBeginInfo begin_info = {
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
};
err = vkBeginCommandBuffer(command_buffer, &begin_info);
check_vk_result(err);
ImGui_ImplVulkan_CreateFontsTexture(command_buffer);
VkSubmitInfo end_info = {
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
.commandBufferCount = 1,
.pCommandBuffers = &command_buffer,
};
err = vkEndCommandBuffer(command_buffer);
check_vk_result(err);
err = vkQueueSubmit(g_Queue, 1, &end_info, VK_NULL_HANDLE);
check_vk_result(err);
err = vkDeviceWaitIdle(g_Device);
check_vk_result(err);
ImGui_ImplVulkan_DestroyFontUploadObjects();
bool showDemoWindow = true;
bool showAnotherWindow = false;
ImVec4 clearColor;
clearColor.x = 0.45f;
clearColor.y = 0.55f;
clearColor.z = 0.60f;
clearColor.w = 1.00f;
bool quit = false;
while (!quit)
{
SDL_Event e;
// we need to call SDL_PollEvent to let window rendered, otherwise
// no window will be shown
while (SDL_PollEvent(&e) != 0)
{
ImGui_ImplSDL2_ProcessEvent(&e);
if (e.type == SDL_QUIT)
quit = true;
if (e.type == SDL_WINDOWEVENT && e.window.event == SDL_WINDOWEVENT_CLOSE &&
e.window.windowID == SDL_GetWindowID(window))
quit = true;
}
// Resize swap chain
if (g_SwapChainRebuild)
{
int width, height;
SDL_GetWindowSize(window, &width, &height);
if (width > 0 && height > 0)
{
ImGui_ImplVulkan_SetMinImageCount(g_MinImageCount);
ImGui_ImplVulkanH_CreateOrResizeWindow(
g_Instance, g_PhysicalDevice, g_Device, &g_MainWindowData,
g_QueueFamily, g_Allocator, width, height, g_MinImageCount);
g_MainWindowData.FrameIndex = 0;
g_SwapChainRebuild = false;
}
}
// start imgui frame
ImGui_ImplVulkan_NewFrame();
ImGui_ImplSDL2_NewFrame();
igNewFrame();
if (showDemoWindow)
igShowDemoWindow(&showDemoWindow);
// show a simple window that we created ourselves.
{
static float f = 0.0f;
static int counter = 0;
igBegin("Hello, world!", NULL, 0);
igText("This is some useful text");
igCheckbox("Demo window", &showDemoWindow);
igCheckbox("Another window", &showAnotherWindow);
igSliderFloat("Float", &f, 0.0f, 1.0f, "%.3f", 0);
igColorEdit3("clear color", (float*)&clearColor, 0);
ImVec2 buttonSize;
buttonSize.x = 0;
buttonSize.y = 0;
if (igButton("Button", buttonSize))
counter++;
igSameLine(0.0f, -1.0f);
igText("counter = %d", counter);
igText("Application average %.3f ms/frame (%.1f FPS)",
1000.0f / igGetIO()->Framerate, igGetIO()->Framerate);
igEnd();
}
if (showAnotherWindow)
{
igBegin("imgui Another Window", &showAnotherWindow, 0);
igText("Hello from imgui");
ImVec2 buttonSize;
buttonSize.x = 0; buttonSize.y = 0;
if (igButton("Close me", buttonSize))
{
showAnotherWindow = false;
}
igEnd();
}
// render
igRender();
ImDrawData* draw_data = igGetDrawData();
const bool is_minimized = (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f);
if (!is_minimized)
{
wd->ClearValue.color.float32[0] = clearColor.x * clearColor.w;
wd->ClearValue.color.float32[1] = clearColor.y * clearColor.w;
wd->ClearValue.color.float32[2] = clearColor.z * clearColor.w;
wd->ClearValue.color.float32[3] = clearColor.w;
FrameRender(wd, draw_data);
FramePresent(wd);
}
}
// Cleanup
err = vkDeviceWaitIdle(g_Device);
check_vk_result(err);
ImGui_ImplVulkan_Shutdown();
ImGui_ImplSDL2_Shutdown();
igDestroyContext(NULL);
CleanupVulkanWindow();
CleanupVulkan();
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}

View File

@@ -1,5 +1,5 @@
//This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui
//based on imgui.h file version "1.88" from Dear ImGui https://github.com/ocornut/imgui
//based on imgui.h file version "1.89" from Dear ImGui https://github.com/ocornut/imgui
//with imgui_internal.h api
//docking branch
#ifdef IMGUI_ENABLE_FREETYPE
@@ -224,6 +224,10 @@ CIMGUI_API void igSetNextWindowFocus()
{
return ImGui::SetNextWindowFocus();
}
CIMGUI_API void igSetNextWindowScroll(const ImVec2 scroll)
{
return ImGui::SetNextWindowScroll(scroll);
}
CIMGUI_API void igSetNextWindowBgAlpha(float alpha)
{
return ImGui::SetNextWindowBgAlpha(alpha);
@@ -634,14 +638,6 @@ CIMGUI_API bool igArrowButton(const char* str_id,ImGuiDir dir)
{
return ImGui::ArrowButton(str_id,dir);
}
CIMGUI_API void igImage(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 tint_col,const ImVec4 border_col)
{
return ImGui::Image(user_texture_id,size,uv0,uv1,tint_col,border_col);
}
CIMGUI_API bool igImageButton(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,int frame_padding,const ImVec4 bg_col,const ImVec4 tint_col)
{
return ImGui::ImageButton(user_texture_id,size,uv0,uv1,frame_padding,bg_col,tint_col);
}
CIMGUI_API bool igCheckbox(const char* label,bool* v)
{
return ImGui::Checkbox(label,v);
@@ -670,6 +666,14 @@ CIMGUI_API void igBullet()
{
return ImGui::Bullet();
}
CIMGUI_API void igImage(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 tint_col,const ImVec4 border_col)
{
return ImGui::Image(user_texture_id,size,uv0,uv1,tint_col,border_col);
}
CIMGUI_API bool igImageButton(const char* str_id,ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col)
{
return ImGui::ImageButton(str_id,user_texture_id,size,uv0,uv1,bg_col,tint_col);
}
CIMGUI_API bool igBeginCombo(const char* label,const char* preview_value,ImGuiComboFlags flags)
{
return ImGui::BeginCombo(label,preview_value,flags);
@@ -1481,15 +1485,15 @@ CIMGUI_API void igColorConvertHSVtoRGB(float h,float s,float v,float* out_r,floa
{
return ImGui::ColorConvertHSVtoRGB(h,s,v,*out_r,*out_g,*out_b);
}
CIMGUI_API bool igIsKeyDown(ImGuiKey key)
CIMGUI_API bool igIsKeyDown_Nil(ImGuiKey key)
{
return ImGui::IsKeyDown(key);
}
CIMGUI_API bool igIsKeyPressed(ImGuiKey key,bool repeat)
CIMGUI_API bool igIsKeyPressed_Bool(ImGuiKey key,bool repeat)
{
return ImGui::IsKeyPressed(key,repeat);
}
CIMGUI_API bool igIsKeyReleased(ImGuiKey key)
CIMGUI_API bool igIsKeyReleased_Nil(ImGuiKey key)
{
return ImGui::IsKeyReleased(key);
}
@@ -1505,15 +1509,15 @@ CIMGUI_API void igSetNextFrameWantCaptureKeyboard(bool want_capture_keyboard)
{
return ImGui::SetNextFrameWantCaptureKeyboard(want_capture_keyboard);
}
CIMGUI_API bool igIsMouseDown(ImGuiMouseButton button)
CIMGUI_API bool igIsMouseDown_Nil(ImGuiMouseButton button)
{
return ImGui::IsMouseDown(button);
}
CIMGUI_API bool igIsMouseClicked(ImGuiMouseButton button,bool repeat)
CIMGUI_API bool igIsMouseClicked_Bool(ImGuiMouseButton button,bool repeat)
{
return ImGui::IsMouseClicked(button,repeat);
}
CIMGUI_API bool igIsMouseReleased(ImGuiMouseButton button)
CIMGUI_API bool igIsMouseReleased_Nil(ImGuiMouseButton button)
{
return ImGui::IsMouseReleased(button);
}
@@ -2065,7 +2069,7 @@ CIMGUI_API void ImDrawListSplitter_SetCurrentChannel(ImDrawListSplitter* self,Im
{
return self->SetCurrentChannel(draw_list,channel_idx);
}
CIMGUI_API ImDrawList* ImDrawList_ImDrawList(const ImDrawListSharedData* shared_data)
CIMGUI_API ImDrawList* ImDrawList_ImDrawList(ImDrawListSharedData* shared_data)
{
return IM_NEW(ImDrawList)(shared_data);
}
@@ -2469,6 +2473,10 @@ CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesDefault(ImFontAtlas* self)
{
return self->GetGlyphRangesDefault();
}
CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesGreek(ImFontAtlas* self)
{
return self->GetGlyphRangesGreek();
}
CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesKorean(ImFontAtlas* self)
{
return self->GetGlyphRangesKorean();
@@ -2629,7 +2637,7 @@ CIMGUI_API void ImGuiPlatformImeData_destroy(ImGuiPlatformImeData* self)
{
IM_DELETE(self);
}
CIMGUI_API int igGetKeyIndex(ImGuiKey key)
CIMGUI_API ImGuiKey igGetKeyIndex(ImGuiKey key)
{
return ImGui::GetKeyIndex(key);
}
@@ -2709,6 +2717,10 @@ CIMGUI_API const char* igImStrSkipBlank(const char* str)
{
return ImStrSkipBlank(str);
}
CIMGUI_API char igImToUpper(char c)
{
return ImToUpper(c);
}
CIMGUI_API bool igImCharIsBlankA(char c)
{
return ImCharIsBlankA(c);
@@ -3160,6 +3172,26 @@ CIMGUI_API void ImBitVector_ClearBit(ImBitVector* self,int n)
{
return self->ClearBit(n);
}
CIMGUI_API void ImGuiTextIndex_clear(ImGuiTextIndex* self)
{
return self->clear();
}
CIMGUI_API int ImGuiTextIndex_size(ImGuiTextIndex* self)
{
return self->size();
}
CIMGUI_API const char* ImGuiTextIndex_get_line_begin(ImGuiTextIndex* self,const char* base,int n)
{
return self->get_line_begin(base,n);
}
CIMGUI_API const char* ImGuiTextIndex_get_line_end(ImGuiTextIndex* self,const char* base,int n)
{
return self->get_line_end(base,n);
}
CIMGUI_API void ImGuiTextIndex_append(ImGuiTextIndex* self,const char* base,int old_size,int new_size)
{
return self->append(base,old_size,new_size);
}
CIMGUI_API ImDrawListSharedData* ImDrawListSharedData_ImDrawListSharedData(void)
{
return IM_NEW(ImDrawListSharedData)();
@@ -3368,6 +3400,34 @@ CIMGUI_API void ImGuiInputEvent_destroy(ImGuiInputEvent* self)
{
IM_DELETE(self);
}
CIMGUI_API ImGuiKeyRoutingData* ImGuiKeyRoutingData_ImGuiKeyRoutingData(void)
{
return IM_NEW(ImGuiKeyRoutingData)();
}
CIMGUI_API void ImGuiKeyRoutingData_destroy(ImGuiKeyRoutingData* self)
{
IM_DELETE(self);
}
CIMGUI_API ImGuiKeyRoutingTable* ImGuiKeyRoutingTable_ImGuiKeyRoutingTable(void)
{
return IM_NEW(ImGuiKeyRoutingTable)();
}
CIMGUI_API void ImGuiKeyRoutingTable_destroy(ImGuiKeyRoutingTable* self)
{
IM_DELETE(self);
}
CIMGUI_API void ImGuiKeyRoutingTable_Clear(ImGuiKeyRoutingTable* self)
{
return self->Clear();
}
CIMGUI_API ImGuiKeyOwnerData* ImGuiKeyOwnerData_ImGuiKeyOwnerData(void)
{
return IM_NEW(ImGuiKeyOwnerData)();
}
CIMGUI_API void ImGuiKeyOwnerData_destroy(ImGuiKeyOwnerData* self)
{
IM_DELETE(self);
}
CIMGUI_API ImGuiListClipperRange ImGuiListClipperRange_FromIndices(int min,int max)
{
return ImGuiListClipperRange::FromIndices(min,max);
@@ -3916,10 +3976,6 @@ CIMGUI_API ImGuiSettingsHandler* igFindSettingsHandler(const char* type_name)
{
return ImGui::FindSettingsHandler(type_name);
}
CIMGUI_API void igSetNextWindowScroll(const ImVec2 scroll)
{
return ImGui::SetNextWindowScroll(scroll);
}
CIMGUI_API void igSetScrollX_WindowPtr(ImGuiWindow* window,float scroll_x)
{
return ImGui::SetScrollX(window,scroll_x);
@@ -4192,22 +4248,6 @@ CIMGUI_API void igNavMoveRequestTryWrapping(ImGuiWindow* window,ImGuiNavMoveFlag
{
return ImGui::NavMoveRequestTryWrapping(window,move_flags);
}
CIMGUI_API const char* igGetNavInputName(ImGuiNavInput n)
{
return ImGui::GetNavInputName(n);
}
CIMGUI_API float igGetNavInputAmount(ImGuiNavInput n,ImGuiNavReadMode mode)
{
return ImGui::GetNavInputAmount(n,mode);
}
CIMGUI_API void igGetNavInputAmount2d(ImVec2 *pOut,ImGuiNavDirSourceFlags dir_sources,ImGuiNavReadMode mode,float slow_factor,float fast_factor)
{
*pOut = ImGui::GetNavInputAmount2d(dir_sources,mode,slow_factor,fast_factor);
}
CIMGUI_API int igCalcTypematicRepeatAmount(float t0,float t1,float repeat_delay,float repeat_rate)
{
return ImGui::CalcTypematicRepeatAmount(t0,t1,repeat_delay,repeat_rate);
}
CIMGUI_API void igActivateItem(ImGuiID id)
{
return ImGui::ActivateItem(id);
@@ -4220,26 +4260,14 @@ CIMGUI_API void igSetNavID(ImGuiID id,ImGuiNavLayer nav_layer,ImGuiID focus_scop
{
return ImGui::SetNavID(id,nav_layer,focus_scope_id,rect_rel);
}
CIMGUI_API void igPushFocusScope(ImGuiID id)
{
return ImGui::PushFocusScope(id);
}
CIMGUI_API void igPopFocusScope()
{
return ImGui::PopFocusScope();
}
CIMGUI_API ImGuiID igGetFocusedFocusScope()
{
return ImGui::GetFocusedFocusScope();
}
CIMGUI_API ImGuiID igGetFocusScope()
{
return ImGui::GetFocusScope();
}
CIMGUI_API bool igIsNamedKey(ImGuiKey key)
{
return ImGui::IsNamedKey(key);
}
CIMGUI_API bool igIsNamedKeyOrModKey(ImGuiKey key)
{
return ImGui::IsNamedKeyOrModKey(key);
}
CIMGUI_API bool igIsLegacyKey(ImGuiKey key)
{
return ImGui::IsLegacyKey(key);
@@ -4248,53 +4276,113 @@ CIMGUI_API bool igIsGamepadKey(ImGuiKey key)
{
return ImGui::IsGamepadKey(key);
}
CIMGUI_API bool igIsAliasKey(ImGuiKey key)
{
return ImGui::IsAliasKey(key);
}
CIMGUI_API ImGuiKey igConvertSingleModFlagToKey(ImGuiKey key)
{
return ImGui::ConvertSingleModFlagToKey(key);
}
CIMGUI_API ImGuiKeyData* igGetKeyData(ImGuiKey key)
{
return ImGui::GetKeyData(key);
}
CIMGUI_API void igSetItemUsingMouseWheel()
CIMGUI_API void igGetKeyChordName(ImGuiKeyChord key_chord,char* out_buf,int out_buf_size)
{
return ImGui::SetItemUsingMouseWheel();
return ImGui::GetKeyChordName(key_chord,out_buf,out_buf_size);
}
CIMGUI_API void igSetActiveIdUsingNavAndKeys()
CIMGUI_API ImGuiKey igMouseButtonToKey(ImGuiMouseButton button)
{
return ImGui::SetActiveIdUsingNavAndKeys();
}
CIMGUI_API bool igIsActiveIdUsingNavDir(ImGuiDir dir)
{
return ImGui::IsActiveIdUsingNavDir(dir);
}
CIMGUI_API bool igIsActiveIdUsingNavInput(ImGuiNavInput input)
{
return ImGui::IsActiveIdUsingNavInput(input);
}
CIMGUI_API bool igIsActiveIdUsingKey(ImGuiKey key)
{
return ImGui::IsActiveIdUsingKey(key);
}
CIMGUI_API void igSetActiveIdUsingKey(ImGuiKey key)
{
return ImGui::SetActiveIdUsingKey(key);
return ImGui::MouseButtonToKey(button);
}
CIMGUI_API bool igIsMouseDragPastThreshold(ImGuiMouseButton button,float lock_threshold)
{
return ImGui::IsMouseDragPastThreshold(button,lock_threshold);
}
CIMGUI_API bool igIsNavInputDown(ImGuiNavInput n)
CIMGUI_API void igGetKeyVector2d(ImVec2 *pOut,ImGuiKey key_left,ImGuiKey key_right,ImGuiKey key_up,ImGuiKey key_down)
{
return ImGui::IsNavInputDown(n);
*pOut = ImGui::GetKeyVector2d(key_left,key_right,key_up,key_down);
}
CIMGUI_API bool igIsNavInputTest(ImGuiNavInput n,ImGuiNavReadMode rm)
CIMGUI_API float igGetNavTweakPressedAmount(ImGuiAxis axis)
{
return ImGui::IsNavInputTest(n,rm);
return ImGui::GetNavTweakPressedAmount(axis);
}
CIMGUI_API ImGuiModFlags igGetMergedModFlags()
CIMGUI_API int igCalcTypematicRepeatAmount(float t0,float t1,float repeat_delay,float repeat_rate)
{
return ImGui::GetMergedModFlags();
return ImGui::CalcTypematicRepeatAmount(t0,t1,repeat_delay,repeat_rate);
}
CIMGUI_API bool igIsKeyPressedMap(ImGuiKey key,bool repeat)
CIMGUI_API void igGetTypematicRepeatRate(ImGuiInputFlags flags,float* repeat_delay,float* repeat_rate)
{
return ImGui::IsKeyPressedMap(key,repeat);
return ImGui::GetTypematicRepeatRate(flags,repeat_delay,repeat_rate);
}
CIMGUI_API void igSetActiveIdUsingAllKeyboardKeys()
{
return ImGui::SetActiveIdUsingAllKeyboardKeys();
}
CIMGUI_API bool igIsActiveIdUsingNavDir(ImGuiDir dir)
{
return ImGui::IsActiveIdUsingNavDir(dir);
}
CIMGUI_API ImGuiID igGetKeyOwner(ImGuiKey key)
{
return ImGui::GetKeyOwner(key);
}
CIMGUI_API void igSetKeyOwner(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags)
{
return ImGui::SetKeyOwner(key,owner_id,flags);
}
CIMGUI_API void igSetItemKeyOwner(ImGuiKey key,ImGuiInputFlags flags)
{
return ImGui::SetItemKeyOwner(key,flags);
}
CIMGUI_API bool igTestKeyOwner(ImGuiKey key,ImGuiID owner_id)
{
return ImGui::TestKeyOwner(key,owner_id);
}
CIMGUI_API ImGuiKeyOwnerData* igGetKeyOwnerData(ImGuiKey key)
{
return ImGui::GetKeyOwnerData(key);
}
CIMGUI_API bool igIsKeyDown_ID(ImGuiKey key,ImGuiID owner_id)
{
return ImGui::IsKeyDown(key,owner_id);
}
CIMGUI_API bool igIsKeyPressed_ID(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags)
{
return ImGui::IsKeyPressed(key,owner_id,flags);
}
CIMGUI_API bool igIsKeyReleased_ID(ImGuiKey key,ImGuiID owner_id)
{
return ImGui::IsKeyReleased(key,owner_id);
}
CIMGUI_API bool igIsMouseDown_ID(ImGuiMouseButton button,ImGuiID owner_id)
{
return ImGui::IsMouseDown(button,owner_id);
}
CIMGUI_API bool igIsMouseClicked_ID(ImGuiMouseButton button,ImGuiID owner_id,ImGuiInputFlags flags)
{
return ImGui::IsMouseClicked(button,owner_id,flags);
}
CIMGUI_API bool igIsMouseReleased_ID(ImGuiMouseButton button,ImGuiID owner_id)
{
return ImGui::IsMouseReleased(button,owner_id);
}
CIMGUI_API bool igShortcut(ImGuiKeyChord key_chord,ImGuiID owner_id,ImGuiInputFlags flags)
{
return ImGui::Shortcut(key_chord,owner_id,flags);
}
CIMGUI_API bool igSetShortcutRouting(ImGuiKeyChord key_chord,ImGuiID owner_id,ImGuiInputFlags flags)
{
return ImGui::SetShortcutRouting(key_chord,owner_id,flags);
}
CIMGUI_API bool igTestShortcutRouting(ImGuiKeyChord key_chord,ImGuiID owner_id)
{
return ImGui::TestShortcutRouting(key_chord,owner_id);
}
CIMGUI_API ImGuiKeyRoutingData* igGetShortcutRoutingData(ImGuiKeyChord key_chord)
{
return ImGui::GetShortcutRoutingData(key_chord);
}
CIMGUI_API void igDockContextInitialize(ImGuiContext* ctx)
{
@@ -4340,9 +4428,13 @@ CIMGUI_API void igDockContextQueueUndockNode(ImGuiContext* ctx,ImGuiDockNode* no
{
return ImGui::DockContextQueueUndockNode(ctx,node);
}
CIMGUI_API bool igDockContextCalcDropPosForDocking(ImGuiWindow* target,ImGuiDockNode* target_node,ImGuiWindow* payload,ImGuiDir split_dir,bool split_outer,ImVec2* out_pos)
CIMGUI_API bool igDockContextCalcDropPosForDocking(ImGuiWindow* target,ImGuiDockNode* target_node,ImGuiWindow* payload_window,ImGuiDockNode* payload_node,ImGuiDir split_dir,bool split_outer,ImVec2* out_pos)
{
return ImGui::DockContextCalcDropPosForDocking(target,target_node,payload,split_dir,split_outer,out_pos);
return ImGui::DockContextCalcDropPosForDocking(target,target_node,payload_window,payload_node,split_dir,split_outer,out_pos);
}
CIMGUI_API ImGuiDockNode* igDockContextFindNodeByID(ImGuiContext* ctx,ImGuiID id)
{
return ImGui::DockContextFindNodeByID(ctx,id);
}
CIMGUI_API bool igDockNodeBeginAmendTabBar(ImGuiDockNode* node)
{
@@ -4448,6 +4540,18 @@ CIMGUI_API void igDockBuilderFinish(ImGuiID node_id)
{
return ImGui::DockBuilderFinish(node_id);
}
CIMGUI_API void igPushFocusScope(ImGuiID id)
{
return ImGui::PushFocusScope(id);
}
CIMGUI_API void igPopFocusScope()
{
return ImGui::PopFocusScope();
}
CIMGUI_API ImGuiID igGetCurrentFocusScope()
{
return ImGui::GetCurrentFocusScope();
}
CIMGUI_API bool igIsDragDropActive()
{
return ImGui::IsDragDropActive();
@@ -4464,6 +4568,10 @@ CIMGUI_API bool igIsDragDropPayloadBeingAccepted()
{
return ImGui::IsDragDropPayloadBeingAccepted();
}
CIMGUI_API void igRenderDragDropTargetRect(const ImRect bb)
{
return ImGui::RenderDragDropTargetRect(bb);
}
CIMGUI_API void igSetWindowClipRectBeforeSetChannel(ImGuiWindow* window,const ImRect clip_rect)
{
return ImGui::SetWindowClipRectBeforeSetChannel(window,clip_rect);
@@ -4576,6 +4684,10 @@ CIMGUI_API void igTableDrawContextMenu(ImGuiTable* table)
{
return ImGui::TableDrawContextMenu(table);
}
CIMGUI_API bool igTableBeginContextMenuPopup(ImGuiTable* table)
{
return ImGui::TableBeginContextMenuPopup(table);
}
CIMGUI_API void igTableMergeDrawChannels(ImGuiTable* table)
{
return ImGui::TableMergeDrawChannels(table);
@@ -4728,9 +4840,13 @@ CIMGUI_API bool igTabItemEx(ImGuiTabBar* tab_bar,const char* label,bool* p_open,
{
return ImGui::TabItemEx(tab_bar,label,p_open,flags,docked_window);
}
CIMGUI_API void igTabItemCalcSize(ImVec2 *pOut,const char* label,bool has_close_button)
CIMGUI_API void igTabItemCalcSize_Str(ImVec2 *pOut,const char* label,bool has_close_button_or_unsaved_marker)
{
*pOut = ImGui::TabItemCalcSize(label,has_close_button);
*pOut = ImGui::TabItemCalcSize(label,has_close_button_or_unsaved_marker);
}
CIMGUI_API void igTabItemCalcSize_WindowPtr(ImVec2 *pOut,ImGuiWindow* window)
{
*pOut = ImGui::TabItemCalcSize(window);
}
CIMGUI_API void igTabItemBackground(ImDrawList* draw_list,const ImRect bb,ImGuiTabItemFlags flags,ImU32 col)
{
@@ -4844,9 +4960,9 @@ CIMGUI_API bool igScrollbarEx(const ImRect bb,ImGuiID id,ImGuiAxis axis,ImS64* p
{
return ImGui::ScrollbarEx(bb,id,axis,p_scroll_v,avail_v,contents_v,flags);
}
CIMGUI_API bool igImageButtonEx(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec2 padding,const ImVec4 bg_col,const ImVec4 tint_col)
CIMGUI_API bool igImageButtonEx(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col)
{
return ImGui::ImageButtonEx(id,texture_id,size,uv0,uv1,padding,bg_col,tint_col);
return ImGui::ImageButtonEx(id,texture_id,size,uv0,uv1,bg_col,tint_col);
}
CIMGUI_API void igGetWindowScrollbarRect(ImRect *pOut,ImGuiWindow* window,ImGuiAxis axis)
{
@@ -4896,14 +5012,18 @@ CIMGUI_API bool igTreeNodeBehavior(ImGuiID id,ImGuiTreeNodeFlags flags,const cha
{
return ImGui::TreeNodeBehavior(id,flags,label,label_end);
}
CIMGUI_API bool igTreeNodeBehaviorIsOpen(ImGuiID id,ImGuiTreeNodeFlags flags)
{
return ImGui::TreeNodeBehaviorIsOpen(id,flags);
}
CIMGUI_API void igTreePushOverrideID(ImGuiID id)
{
return ImGui::TreePushOverrideID(id);
}
CIMGUI_API void igTreeNodeSetOpen(ImGuiID id,bool open)
{
return ImGui::TreeNodeSetOpen(id,open);
}
CIMGUI_API bool igTreeNodeUpdateNextOpen(ImGuiID id,ImGuiTreeNodeFlags flags)
{
return ImGui::TreeNodeUpdateNextOpen(id,flags);
}
CIMGUI_API const ImGuiDataTypeInfo* igDataTypeGetInfo(ImGuiDataType data_type)
{
return ImGui::DataTypeGetInfo(data_type);
@@ -5003,6 +5123,22 @@ CIMGUI_API void igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback,
{
return ImGui::ErrorCheckEndWindowRecover(log_callback,user_data);
}
CIMGUI_API void igErrorCheckUsingSetCursorPosToExtendParentBoundaries()
{
return ImGui::ErrorCheckUsingSetCursorPosToExtendParentBoundaries();
}
CIMGUI_API void igDebugLocateItem(ImGuiID target_id)
{
return ImGui::DebugLocateItem(target_id);
}
CIMGUI_API void igDebugLocateItemOnHover(ImGuiID target_id)
{
return ImGui::DebugLocateItemOnHover(target_id);
}
CIMGUI_API void igDebugLocateItemResolveWithLastItem()
{
return ImGui::DebugLocateItemResolveWithLastItem();
}
CIMGUI_API void igDebugDrawItemRect(ImU32 col)
{
return ImGui::DebugDrawItemRect(col);
@@ -5087,6 +5223,10 @@ CIMGUI_API void igDebugRenderViewportThumbnail(ImDrawList* draw_list,ImGuiViewpo
{
return ImGui::DebugRenderViewportThumbnail(draw_list,viewport,bb);
}
CIMGUI_API bool igIsKeyPressedMap(ImGuiKey key,bool repeat)
{
return ImGui::IsKeyPressedMap(key,repeat);
}
CIMGUI_API const ImFontBuilderIO* igImFontAtlasGetBuilderForStbTruetype()
{
return ImFontAtlasGetBuilderForStbTruetype();

634
cimgui.h

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,3 @@
return {
vulkan = {[[C:\VulkanSDK\1.1.130.0\Include]]}
vulkan = {(os.getenv("VULKAN_SDK") or "vulkan_SDK_not_found").."/Include"}, --{[[C:\VulkanSDK\1.3.216.0\Include]]}
}

View File

@@ -116,7 +116,7 @@ end
M.strsplit = strsplit
local function split_comment(line)
local comment = line:match("(%s*//.*)") --or ""
line = line:gsub("%s*//.*","")
line = line:gsub("%s*//[^\n]*","")
line = line:gsub("%s*$","")
return line,comment
end
@@ -312,7 +312,8 @@ local function getRE()
--vardef_re = "^\n*([^;{}%(%)]+;)",
--change for things as
--[[ImU8 Used4kPagesMap[((sizeof(ImWchar16) == 2 ? 0xFFFF : 0x10FFFF)+1)/4096/8];]]
vardef_re = "^\n*([^;{}]+;)",
--vardef_re = "^\n*([^;{}]+;)",
vardef_re = "^\n*([^;]+;)",
functionD_re = "^([^;{}]-%b()[\n%s%w]*%b{}%s-;*)",
--functionD_re = "^([^;{}]-%b()[^{}%(%)]*%b{})",
functype_re = "^%s*[%w%s%*]+%(%*[%w_]+%)%([^%(%)]*%)%s*;",
@@ -569,7 +570,77 @@ local function clean_names_from_signature(self,signat)
result = result:sub(1,-2) .. ")"
return result
end
local function clean_functypedef(line)
local first, args = line:match("(typedef .-%(%*[_%w]+%))%s*(%b())")
if not args then
print"not getting args in"
print(line)
print(first,"args",args)
error"clean_functypedef not getting args"
end
local argsp = args:sub(2,-2)..","
local argsTa = {}
for tynam in argsp:gmatch("([^,]+),") do
if tynam:match("%)") and not tynam:match("%b()") then
--patenthesis not closed are merged in previous (happens in some defaults)
argsTa[#argsTa] = argsTa[#argsTa]..","..tynam
while argsTa[#argsTa]:match("%)") and not argsTa[#argsTa]:match("%b()") do
argsTa[#argsTa-1] = argsTa[#argsTa-1] .. "," .. argsTa[#argsTa]
argsTa[#argsTa] = nil
end
else
argsTa[#argsTa+1] = tynam
end
end
local result = "\n"..first.."("
for i,ar in ipairs(argsTa) do
if ar:match("&") then
if ar:match("const") then
argsTa[i] = ar:gsub("&","")
else
argsTa[i] = ar:gsub("&","*")
end
end
result = result..argsTa[i]..(i==#argsTa and ");" or ",")
end
--M.prtable(argsTa)
--print(result)
return result
end
local function CleanImU32(def)
local function deleteOuterPars(def)
local w = def:match("^%b()$")
if w then
w = w:gsub("^%((.+)%)$","%1")
return w
else
return def
end
end
def = def:gsub("%(ImU32%)","")
--quitar () de numeros
def = def:gsub("%((%d+)%)","%1")
def = deleteOuterPars(def)
local bb=strsplit(def,"|")
for i=1,#bb do
local val = deleteOuterPars(bb[i])
if val:match"<<" then
local v1,v2 = val:match("(%d+)%s*<<%s*(%d+)")
val = v1*2^v2
bb[i] = val
end
assert(type(bb[i])=="number",bb[i])
end
local res = 0
for i=1,#bb do res = res + bb[i] end
return res
end
local function parseFunction(self,stname,itt,namespace,locat)
local lineorig,comment = split_comment(itt.item)
line = clean_spaces(lineorig)
--move *
@@ -593,6 +664,7 @@ local function parseFunction(self,stname,itt,namespace,locat)
line = line:gsub("mutable","")
line = line:gsub("explicit","")
line = line:gsub("constexpr","")
line = clean_spaces(line)
--skip operator
if line:match("operator") then return end
--skip template
@@ -750,6 +822,15 @@ local function parseFunction(self,stname,itt,namespace,locat)
defT.defaults = {}
for i,ar in ipairs(argsArr) do
if ar.default then
--clean defaults
--do only if not a c string
local is_cstring = ar.default:sub(1,1)=='"' and ar.default:sub(-1,-1) =='"'
if not is_cstring then
ar.default = ar.default:gsub("%(%(void%s*%*%)0%)","NULL")
if ar.default:match"%(ImU32%)" and not ar.default:match"sizeof" then
ar.default = tostring(CleanImU32(ar.default))
end
end
defT.defaults[ar.name] = ar.default
ar.default = nil
end
@@ -1088,6 +1169,9 @@ function M.Parser()
return par.skipped[def.ov_cimguiname] or par.skipped[def.cimguiname]
end
function par:take_lines(cmd_line,names,compiler)
if self.COMMENTS_GENERATION then
cmd_line = cmd_line .. (compiler=="cl" and " /C " or " -C ")
end
local pipe,err = io.popen(cmd_line,"r")
if not pipe then
error("could not execute COMPILER "..err)
@@ -1189,21 +1273,49 @@ function M.Parser()
self.linenumdict = {}
local cdefs2 = {}
for i,cdef in ipairs(cdefs) do
if self.linenumdict[cdef[1]] then
local cdef1 = clean_comments(cdef[1])
if self.linenumdict[cdef1] then
--print("linenumdict already defined for", cdef[1],type(self.linenumdict[cdef[1]]))
if type(self.linenumdict[cdef[1]])=="string" then
self.linenumdict[cdef[1]] = {self.linenumdict[cdef[1]], cdef[2]}
if type(self.linenumdict[cdef1])=="string" then
self.linenumdict[cdef1] = {self.linenumdict[cdef1], cdef[2]}
else -- must be table already
table.insert(self.linenumdict[cdef[1]],cdef[2])
table.insert(self.linenumdict[cdef1],cdef[2])
end
else
--print("nuevo linenumdict es",cdef[1],cdef[2])
self.linenumdict[cdef[1]]=cdef[2]
self.linenumdict[cdef1]=cdef[2]
end
table.insert(cdefs2,cdef[1])
end
local txt = table.concat(cdefs2,"\n")
--clean bad positioned comments inside functionD_re
if self.COMMENTS_GENERATION then
print"cleaning comments inside functionD_re--------------"
---[[
local nn = 0
local txtclean = {}
local reg = "(\n[%w%s]-[%w]+%s*%b())(%s*//[^\n]*)([\n%s%w]*%b{}%s-;*)"
--reg = "^([^;{}]-%b()[\n%s%w]*%b{}%s-;*)"
local ini = 1
local i,e,a,b,c = txt:find(reg,ini)
while i do
print(i,e,#txt)
table.insert(txtclean,txt:sub(ini,i-1))
table.insert(txtclean,a)
print("a:",a)
print("b:",b)
print("c:",c)
c = c:gsub("(%s*//[^\n]*)","")
table.insert(txtclean,c)
nn = nn + 1
ini = e + 1
i,e,a,b,c = txt:find(reg,ini)
end
table.insert(txtclean,txt:sub(ini))
print("end cleaning ------------------------------",nn)
txt = table.concat(txtclean)
end
--]]
self.itemsarr = par:parseItemsR2(txt)
itemsarr = self.itemsarr
end
@@ -1261,11 +1373,11 @@ function M.Parser()
--table.insert(outtab,stru:match("(.-)%b{}"))
table.insert(outtab,"\nstruct "..stname.."\n")
table.insert(outtab,"{")
table.insert(commtab,nil)--"")
table.insert(commtab,nil)--"")
table.insert(commtab,"")
table.insert(commtab,"")
if derived then
table.insert(outtab,"\n "..derived.." _"..derived..";")
table.insert(commtab,nil)--"")
table.insert(commtab,"")
end
--local itlist,itemsin = parseItems(iner, false,locat)
local itlist = itst.childs
@@ -1301,14 +1413,14 @@ function M.Parser()
it2 = it2:gsub("%s*=.+;",";")
end
table.insert(outtab,it2)
table.insert(commtab,it.comments )--or "")
table.insert(commtab,it.comments or "")
end
elseif it.re_name == "struct_re" then
--check if has declaration
local decl = it.item:match"%b{}%s*([^%s}{]+)%s*;"
if decl then
table.insert(outtab,"\n "..it.name.." "..decl..";")
table.insert(commtab,it.comments )--or "")
table.insert(commtab,it.comments or "")
end
local cleanst,structname,strtab,comstab,predec = self:clean_structR1(it,doheader)
if doheader then
@@ -1378,7 +1490,14 @@ function M.Parser()
local tdt = self:gentemplatetypedef(ttype,template,te)
it2 = tdt..code2
end
elseif it.re_name == "functypedef_re" then
it2 = clean_functypedef(it2)
else
assert(it.re_name == "vardef_re")
if it2:match"enum" then
print("--skip enum forward declaration:",it2)
it2 = ""
end
end
--table.insert(outtabpre,it2)
table.insert(outtab,it2)
@@ -1505,6 +1624,7 @@ function M.Parser()
end
-----------
function par:parse_struct_line(line,outtab,comment)
comment = comment ~= "" and comment or nil
local functype_re = "^%s*[%w%s%*]+%(%*[%w_]+%)%([^%(%)]*%)"
local functype_reex = "^(%s*[%w%s%*]+%(%*)([%w_]+)(%)%([^%(%)]*%))"
line = clean_spaces(line)
@@ -2153,8 +2273,12 @@ local function func_implementation(FP)
local cimf = FP.defsT[t.cimguiname]
local def = cimf[t.signature]
assert(def)
local custom
if FP.custom_implementation then
custom = FP.custom_implementation(outtab, def)
end
local manual = FP.get_manuals(def)
if not manual and not def.templated and not FP.get_skipped(def) then
if not custom and not manual and not def.templated and not FP.get_skipped(def) then
if def.constructor then
assert(def.stname ~= "","constructor without struct")
local empty = def.args:match("^%(%)") --no args
@@ -2220,8 +2344,12 @@ local function func_header_generate_funcs(FP)
local cimf = FP.defsT[t.cimguiname]
local def = cimf[t.signature]
assert(def,t.signature..t.cimguiname)
local custom
if FP.custom_header then
custom = FP.custom_header(outtab, def)
end
local manual = FP.get_manuals(def)
if not manual and not def.templated and not FP.get_skipped(def) then
if not custom and not manual and not def.templated and not FP.get_skipped(def) then
local addcoment = "" --def.comment or ""
local empty = def.args:match("^%(%)") --no args
@@ -2264,24 +2392,10 @@ end
M.func_header_generate = func_header_generate
--[=[
-- tests
local code = [[
bool BeginPlot(const char* title_id,
const char* x_label, const char* y_label,
const ImVec2& size = ImVec2(-1,0),
ImPlotFlags flags = ImPlotFlags_None,
ImPlotAxisFlags x_flags = ImPlotAxisFlags_None,
ImPlotAxisFlags y_flags = ImPlotAxisFlags_None,
ImPlotAxisFlags y2_flags = ImPlotAxisFlags_AuxDefault,
ImPlotAxisFlags y3_flags = ImPlotAxisFlags_AuxDefault,
const char* y2_label = ((void *)0),
const char* y3_label = ((void *)0)) __attribute__( ( deprecated ) );
]]
local code = [[
bool BeginPlot(const char* title_id, const char* x_label, const char* y_label, const ImVec2& size = ImVec2(-1,0), ImPlotFlags flags = ImPlotFlags_None, ImPlotAxisFlags x_flags = ImPlotAxisFlags_None, ImPlotAxisFlags y_flags = ImPlotAxisFlags_None, ImPlotAxisFlags y2_flags = ImPlotAxisFlags_AuxDefault, ImPlotAxisFlags y3_flags = ImPlotAxisFlags_AuxDefault, const char* y2_label = ((void *)0), const char* y3_label = ((void *)0)) __attribute__( ( deprecated ) )
;
enum pedro : int ;
]]
local parser = M.Parser()
@@ -2291,7 +2405,7 @@ for line in code:gmatch("[^\n]+") do
end
parser:do_parse()
M.prtable(parser)
--M.prtable(parser:gen_structs_and_enums_table())
M.prtable(parser:gen_structs_and_enums_table())
--]=]
--print(clean_spaces[[ImVec2 ArcFastVtx[12 * 1];]])
--[=[

View File

@@ -15,8 +15,8 @@ set PATH=%PATH%;C:\anima;C:\mingws\i686-7.2.0-release-posix-dwarf-rt_v5-rev1\min
:: set PATH=%PATH%;C:\luaGL\sources\luajit-master\luajit-master\bin\mingw32;C:\mingw32\bin;
::process files
:: arg[1] compiler name gcc, clang or cl
:: arg[2] options as words in one string: internal for imgui_internal generation, freetype for freetype generation
:: examples: "" "internal" "internal freetype"
:: arg[2] options as words in one string: internal for imgui_internal generation, freetype for freetype generation, comments for comments generation
:: examples: "" "internal" "internal freetype comments"
:: arg[3..n] name of implementations to generate and/or CFLAGS (e.g. -DIMGUI_USER_CONFIG or -DIMGUI_USE_WCHAR32)
luajit ./generator.lua gcc "internal" glfw opengl3 opengl2 sdl

View File

@@ -8,6 +8,7 @@ local script_args = {...}
local COMPILER = script_args[1]
local INTERNAL_GENERATION = script_args[2]:match("internal") and true or false
local FREETYPE_GENERATION = script_args[2]:match("freetype") and true or false
local COMMENTS_GENERATION = script_args[2]:match("comments") and true or false
local IMGUI_PATH = os.getenv"IMGUI_PATH" or "../imgui"
local CFLAGS = ""
local CPRE,CTEST
@@ -63,6 +64,7 @@ assert(HAVE_COMPILER,"gcc, clang or cl needed to run script")
print("HAVE_COMPILER",HAVE_COMPILER)
print("INTERNAL_GENERATION",INTERNAL_GENERATION)
print("FREETYPE_GENERATION",FREETYPE_GENERATION)
print("COMMENTS_GENERATION",COMMENTS_GENERATION)
print("CPRE",CPRE)
--------------------------------------------------------------------------
--this table has the functions to be skipped in generation
@@ -143,16 +145,18 @@ local func_implementation = cpp2ffi.func_implementation
-------------------functions for getting and setting defines
local function get_defines(t)
local compiler_cmd = COMPILER == "cl"
and COMPILER..[[ /TP /nologo /c /Fo"NUL" /I "]]..IMGUI_PATH..[[" print_defines.cpp]]..CFLAGS
and COMPILER..[[ /TP /nologo /c /Fo"NUL" /DIMGUI_DISABLE_OBSOLETE_FUNCTIONS ]]..CFLAGS..[[ /I"]]..IMGUI_PATH..[[" print_defines.cpp]]
or COMPILER..[[ -E -dM -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ]]..IMGUI_PATH..[[/imgui.h]]..CFLAGS
print(compiler_cmd)
local pipe,err = io.popen(compiler_cmd,"r")
local defines = {}
local compiler_output = {"There were fails in compilation."}
while true do
local line = pipe:read"*l"
if not line then break end
local key,value = line:match([[^#define%s+(%S+)%s*(.*)]])
if not key then --or not value then
table.insert(compiler_output, line)
--print(line)
else
defines[key]=value or ""
@@ -161,7 +165,7 @@ local function get_defines(t)
pipe:close()
--require"anima.utils"
--prtable(defines)
--FLT_MAX
assert(next(defines), table.concat(compiler_output, "\n"))
local ret = {}
for i,v in ipairs(t) do
local aa = defines[v]
@@ -203,52 +207,6 @@ local function DefsByStruct(FP)
FP.defsBystruct = structs
end
-- function for repairing funcdefs default values
local function repair_defaults(defsT,str_and_enu)
local function deleteOuterPars(def)
local w = def:match("^%b()$")
if w then
w = w:gsub("^%((.+)%)$","%1")
return w
else
return def
end
end
local function CleanImU32(def)
def = def:gsub("%(ImU32%)","")
--quitar () de numeros
def = def:gsub("%((%d+)%)","%1")
def = deleteOuterPars(def)
local bb=cpp2ffi.strsplit(def,"|")
for i=1,#bb do
local val = deleteOuterPars(bb[i])
if val:match"<<" then
local v1,v2 = val:match("(%d+)%s*<<%s*(%d+)")
val = v1*2^v2
bb[i] = val
end
assert(type(bb[i])=="number")
end
local res = 0
for i=1,#bb do res = res + bb[i] end
return res
end
for k,defT in pairs(defsT) do
for i,def in ipairs(defT) do
for k,v in pairs(def.defaults) do
--do only if not a c string
local is_cstring = v:sub(1,1)=='"' and v:sub(-1,-1) =='"'
if not is_cstring then
def.defaults[k] = def.defaults[k]:gsub("%(%(void%s*%*%)0%)","NULL")
if def.defaults[k]:match"%(ImU32%)" then
def.defaults[k] = tostring(CleanImU32(def.defaults[k]))
end
end
end
end
end
end
--generate cimgui.cpp cimgui.h
local function cimgui_generation(parser)
@@ -348,7 +306,7 @@ local function parseImGuiHeader(header,names)
parser.manuals = cimgui_manuals
parser.UDTs = {"ImVec2","ImVec4","ImColor","ImRect"}
--parser.gen_template_typedef = gen_template_typedef --use auto
parser.COMMENTS_GENERATION = COMMENTS_GENERATION
local defines = parser:take_lines(CPRE..header,names,COMPILER)
return parser
@@ -394,7 +352,6 @@ save_data("./output/typedefs_dict.lua",serializeTableF(parser1.typedefs_dict))
----------save fundefs in definitions.lua for using in bindings
--DefsByStruct(pFP)
set_defines(parser1.defsT)
repair_defaults(parser1.defsT, structs_and_enums_table)
save_data("./output/definitions.lua",serializeTableF(parser1.defsT))
--check every function has ov_cimguiname

View File

@@ -13,7 +13,7 @@
#process files
# arg[1] compiler name gcc, clang, or cl
# arg[2] options as words in one string: internal for imgui_internal generation, freetype for freetype generation
# examples: "" "internal" "internal freetype"
# arg[2] options as words in one string: internal for imgui_internal generation, freetype for freetype generation, comments for comments generation
# examples: "" "internal" "internal freetype" "comments internal"
# arg[3..n] name of implementations to generate and/or CLFLAGS (e.g. -DIMGUI_USER_CONFIG or -DIMGUI_USE_WCHAR32)
luajit ./generator.lua gcc "internal" glfw opengl3 opengl2 sdl

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@
"cimguiname": "ImGui_ImplGlfw_CharCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_CharCallback",
"location": "imgui_impl_glfw:50",
"location": "imgui_impl_glfw:46",
"ov_cimguiname": "ImGui_ImplGlfw_CharCallback",
"ret": "void",
"signature": "(GLFWwindow*,unsigned int)",
@@ -42,7 +42,7 @@
"cimguiname": "ImGui_ImplGlfw_CursorEnterCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_CursorEnterCallback",
"location": "imgui_impl_glfw:45",
"location": "imgui_impl_glfw:41",
"ov_cimguiname": "ImGui_ImplGlfw_CursorEnterCallback",
"ret": "void",
"signature": "(GLFWwindow*,int)",
@@ -71,7 +71,7 @@
"cimguiname": "ImGui_ImplGlfw_CursorPosCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_CursorPosCallback",
"location": "imgui_impl_glfw:46",
"location": "imgui_impl_glfw:42",
"ov_cimguiname": "ImGui_ImplGlfw_CursorPosCallback",
"ret": "void",
"signature": "(GLFWwindow*,double,double)",
@@ -96,7 +96,7 @@
"cimguiname": "ImGui_ImplGlfw_InitForOpenGL",
"defaults": {},
"funcname": "ImGui_ImplGlfw_InitForOpenGL",
"location": "imgui_impl_glfw:31",
"location": "imgui_impl_glfw:27",
"ov_cimguiname": "ImGui_ImplGlfw_InitForOpenGL",
"ret": "bool",
"signature": "(GLFWwindow*,bool)",
@@ -121,7 +121,7 @@
"cimguiname": "ImGui_ImplGlfw_InitForOther",
"defaults": {},
"funcname": "ImGui_ImplGlfw_InitForOther",
"location": "imgui_impl_glfw:33",
"location": "imgui_impl_glfw:29",
"ov_cimguiname": "ImGui_ImplGlfw_InitForOther",
"ret": "bool",
"signature": "(GLFWwindow*,bool)",
@@ -146,7 +146,7 @@
"cimguiname": "ImGui_ImplGlfw_InitForVulkan",
"defaults": {},
"funcname": "ImGui_ImplGlfw_InitForVulkan",
"location": "imgui_impl_glfw:32",
"location": "imgui_impl_glfw:28",
"ov_cimguiname": "ImGui_ImplGlfw_InitForVulkan",
"ret": "bool",
"signature": "(GLFWwindow*,bool)",
@@ -167,7 +167,7 @@
"cimguiname": "ImGui_ImplGlfw_InstallCallbacks",
"defaults": {},
"funcname": "ImGui_ImplGlfw_InstallCallbacks",
"location": "imgui_impl_glfw:40",
"location": "imgui_impl_glfw:36",
"ov_cimguiname": "ImGui_ImplGlfw_InstallCallbacks",
"ret": "void",
"signature": "(GLFWwindow*)",
@@ -204,7 +204,7 @@
"cimguiname": "ImGui_ImplGlfw_KeyCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_KeyCallback",
"location": "imgui_impl_glfw:49",
"location": "imgui_impl_glfw:45",
"ov_cimguiname": "ImGui_ImplGlfw_KeyCallback",
"ret": "void",
"signature": "(GLFWwindow*,int,int,int,int)",
@@ -229,7 +229,7 @@
"cimguiname": "ImGui_ImplGlfw_MonitorCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_MonitorCallback",
"location": "imgui_impl_glfw:51",
"location": "imgui_impl_glfw:47",
"ov_cimguiname": "ImGui_ImplGlfw_MonitorCallback",
"ret": "void",
"signature": "(GLFWmonitor*,int)",
@@ -262,7 +262,7 @@
"cimguiname": "ImGui_ImplGlfw_MouseButtonCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_MouseButtonCallback",
"location": "imgui_impl_glfw:47",
"location": "imgui_impl_glfw:43",
"ov_cimguiname": "ImGui_ImplGlfw_MouseButtonCallback",
"ret": "void",
"signature": "(GLFWwindow*,int,int,int)",
@@ -278,7 +278,7 @@
"cimguiname": "ImGui_ImplGlfw_NewFrame",
"defaults": {},
"funcname": "ImGui_ImplGlfw_NewFrame",
"location": "imgui_impl_glfw:35",
"location": "imgui_impl_glfw:31",
"ov_cimguiname": "ImGui_ImplGlfw_NewFrame",
"ret": "void",
"signature": "()",
@@ -299,7 +299,7 @@
"cimguiname": "ImGui_ImplGlfw_RestoreCallbacks",
"defaults": {},
"funcname": "ImGui_ImplGlfw_RestoreCallbacks",
"location": "imgui_impl_glfw:41",
"location": "imgui_impl_glfw:37",
"ov_cimguiname": "ImGui_ImplGlfw_RestoreCallbacks",
"ret": "void",
"signature": "(GLFWwindow*)",
@@ -328,7 +328,7 @@
"cimguiname": "ImGui_ImplGlfw_ScrollCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_ScrollCallback",
"location": "imgui_impl_glfw:48",
"location": "imgui_impl_glfw:44",
"ov_cimguiname": "ImGui_ImplGlfw_ScrollCallback",
"ret": "void",
"signature": "(GLFWwindow*,double,double)",
@@ -344,7 +344,7 @@
"cimguiname": "ImGui_ImplGlfw_Shutdown",
"defaults": {},
"funcname": "ImGui_ImplGlfw_Shutdown",
"location": "imgui_impl_glfw:34",
"location": "imgui_impl_glfw:30",
"ov_cimguiname": "ImGui_ImplGlfw_Shutdown",
"ret": "void",
"signature": "()",
@@ -369,7 +369,7 @@
"cimguiname": "ImGui_ImplGlfw_WindowFocusCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_WindowFocusCallback",
"location": "imgui_impl_glfw:44",
"location": "imgui_impl_glfw:40",
"ov_cimguiname": "ImGui_ImplGlfw_WindowFocusCallback",
"ret": "void",
"signature": "(GLFWwindow*,int)",
@@ -582,11 +582,11 @@
"type": "const char*"
}
],
"argsoriginal": "(const char* glsl_version=((void*)0))",
"argsoriginal": "(const char* glsl_version=nullptr)",
"call_args": "(glsl_version)",
"cimguiname": "ImGui_ImplOpenGL3_Init",
"defaults": {
"glsl_version": "((void*)0)"
"glsl_version": "nullptr"
},
"funcname": "ImGui_ImplOpenGL3_Init",
"location": "imgui_impl_opengl3:25",

View File

@@ -14,7 +14,7 @@ defs["ImGui_ImplGlfw_CharCallback"][1]["call_args"] = "(window,c)"
defs["ImGui_ImplGlfw_CharCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_CharCallback"
defs["ImGui_ImplGlfw_CharCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_CharCallback"][1]["funcname"] = "ImGui_ImplGlfw_CharCallback"
defs["ImGui_ImplGlfw_CharCallback"][1]["location"] = "imgui_impl_glfw:50"
defs["ImGui_ImplGlfw_CharCallback"][1]["location"] = "imgui_impl_glfw:46"
defs["ImGui_ImplGlfw_CharCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_CharCallback"
defs["ImGui_ImplGlfw_CharCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_CharCallback"][1]["signature"] = "(GLFWwindow*,unsigned int)"
@@ -35,7 +35,7 @@ defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["call_args"] = "(window,entered)"
defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_CursorEnterCallback"
defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["funcname"] = "ImGui_ImplGlfw_CursorEnterCallback"
defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["location"] = "imgui_impl_glfw:45"
defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["location"] = "imgui_impl_glfw:41"
defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_CursorEnterCallback"
defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_CursorEnterCallback"][1]["signature"] = "(GLFWwindow*,int)"
@@ -59,7 +59,7 @@ defs["ImGui_ImplGlfw_CursorPosCallback"][1]["call_args"] = "(window,x,y)"
defs["ImGui_ImplGlfw_CursorPosCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_CursorPosCallback"
defs["ImGui_ImplGlfw_CursorPosCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_CursorPosCallback"][1]["funcname"] = "ImGui_ImplGlfw_CursorPosCallback"
defs["ImGui_ImplGlfw_CursorPosCallback"][1]["location"] = "imgui_impl_glfw:46"
defs["ImGui_ImplGlfw_CursorPosCallback"][1]["location"] = "imgui_impl_glfw:42"
defs["ImGui_ImplGlfw_CursorPosCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_CursorPosCallback"
defs["ImGui_ImplGlfw_CursorPosCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_CursorPosCallback"][1]["signature"] = "(GLFWwindow*,double,double)"
@@ -80,7 +80,7 @@ defs["ImGui_ImplGlfw_InitForOpenGL"][1]["call_args"] = "(window,install_callback
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["cimguiname"] = "ImGui_ImplGlfw_InitForOpenGL"
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["funcname"] = "ImGui_ImplGlfw_InitForOpenGL"
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["location"] = "imgui_impl_glfw:31"
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["location"] = "imgui_impl_glfw:27"
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_InitForOpenGL"
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["ret"] = "bool"
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["signature"] = "(GLFWwindow*,bool)"
@@ -101,7 +101,7 @@ defs["ImGui_ImplGlfw_InitForOther"][1]["call_args"] = "(window,install_callbacks
defs["ImGui_ImplGlfw_InitForOther"][1]["cimguiname"] = "ImGui_ImplGlfw_InitForOther"
defs["ImGui_ImplGlfw_InitForOther"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_InitForOther"][1]["funcname"] = "ImGui_ImplGlfw_InitForOther"
defs["ImGui_ImplGlfw_InitForOther"][1]["location"] = "imgui_impl_glfw:33"
defs["ImGui_ImplGlfw_InitForOther"][1]["location"] = "imgui_impl_glfw:29"
defs["ImGui_ImplGlfw_InitForOther"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_InitForOther"
defs["ImGui_ImplGlfw_InitForOther"][1]["ret"] = "bool"
defs["ImGui_ImplGlfw_InitForOther"][1]["signature"] = "(GLFWwindow*,bool)"
@@ -122,7 +122,7 @@ defs["ImGui_ImplGlfw_InitForVulkan"][1]["call_args"] = "(window,install_callback
defs["ImGui_ImplGlfw_InitForVulkan"][1]["cimguiname"] = "ImGui_ImplGlfw_InitForVulkan"
defs["ImGui_ImplGlfw_InitForVulkan"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_InitForVulkan"][1]["funcname"] = "ImGui_ImplGlfw_InitForVulkan"
defs["ImGui_ImplGlfw_InitForVulkan"][1]["location"] = "imgui_impl_glfw:32"
defs["ImGui_ImplGlfw_InitForVulkan"][1]["location"] = "imgui_impl_glfw:28"
defs["ImGui_ImplGlfw_InitForVulkan"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_InitForVulkan"
defs["ImGui_ImplGlfw_InitForVulkan"][1]["ret"] = "bool"
defs["ImGui_ImplGlfw_InitForVulkan"][1]["signature"] = "(GLFWwindow*,bool)"
@@ -140,7 +140,7 @@ defs["ImGui_ImplGlfw_InstallCallbacks"][1]["call_args"] = "(window)"
defs["ImGui_ImplGlfw_InstallCallbacks"][1]["cimguiname"] = "ImGui_ImplGlfw_InstallCallbacks"
defs["ImGui_ImplGlfw_InstallCallbacks"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_InstallCallbacks"][1]["funcname"] = "ImGui_ImplGlfw_InstallCallbacks"
defs["ImGui_ImplGlfw_InstallCallbacks"][1]["location"] = "imgui_impl_glfw:40"
defs["ImGui_ImplGlfw_InstallCallbacks"][1]["location"] = "imgui_impl_glfw:36"
defs["ImGui_ImplGlfw_InstallCallbacks"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_InstallCallbacks"
defs["ImGui_ImplGlfw_InstallCallbacks"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_InstallCallbacks"][1]["signature"] = "(GLFWwindow*)"
@@ -170,7 +170,7 @@ defs["ImGui_ImplGlfw_KeyCallback"][1]["call_args"] = "(window,key,scancode,actio
defs["ImGui_ImplGlfw_KeyCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_KeyCallback"
defs["ImGui_ImplGlfw_KeyCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_KeyCallback"][1]["funcname"] = "ImGui_ImplGlfw_KeyCallback"
defs["ImGui_ImplGlfw_KeyCallback"][1]["location"] = "imgui_impl_glfw:49"
defs["ImGui_ImplGlfw_KeyCallback"][1]["location"] = "imgui_impl_glfw:45"
defs["ImGui_ImplGlfw_KeyCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_KeyCallback"
defs["ImGui_ImplGlfw_KeyCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_KeyCallback"][1]["signature"] = "(GLFWwindow*,int,int,int,int)"
@@ -191,7 +191,7 @@ defs["ImGui_ImplGlfw_MonitorCallback"][1]["call_args"] = "(monitor,event)"
defs["ImGui_ImplGlfw_MonitorCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_MonitorCallback"
defs["ImGui_ImplGlfw_MonitorCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_MonitorCallback"][1]["funcname"] = "ImGui_ImplGlfw_MonitorCallback"
defs["ImGui_ImplGlfw_MonitorCallback"][1]["location"] = "imgui_impl_glfw:51"
defs["ImGui_ImplGlfw_MonitorCallback"][1]["location"] = "imgui_impl_glfw:47"
defs["ImGui_ImplGlfw_MonitorCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_MonitorCallback"
defs["ImGui_ImplGlfw_MonitorCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_MonitorCallback"][1]["signature"] = "(GLFWmonitor*,int)"
@@ -218,7 +218,7 @@ defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["call_args"] = "(window,button,act
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_MouseButtonCallback"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["funcname"] = "ImGui_ImplGlfw_MouseButtonCallback"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["location"] = "imgui_impl_glfw:47"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["location"] = "imgui_impl_glfw:43"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_MouseButtonCallback"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["signature"] = "(GLFWwindow*,int,int,int)"
@@ -233,7 +233,7 @@ defs["ImGui_ImplGlfw_NewFrame"][1]["call_args"] = "()"
defs["ImGui_ImplGlfw_NewFrame"][1]["cimguiname"] = "ImGui_ImplGlfw_NewFrame"
defs["ImGui_ImplGlfw_NewFrame"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_NewFrame"][1]["funcname"] = "ImGui_ImplGlfw_NewFrame"
defs["ImGui_ImplGlfw_NewFrame"][1]["location"] = "imgui_impl_glfw:35"
defs["ImGui_ImplGlfw_NewFrame"][1]["location"] = "imgui_impl_glfw:31"
defs["ImGui_ImplGlfw_NewFrame"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_NewFrame"
defs["ImGui_ImplGlfw_NewFrame"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_NewFrame"][1]["signature"] = "()"
@@ -251,7 +251,7 @@ defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["call_args"] = "(window)"
defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["cimguiname"] = "ImGui_ImplGlfw_RestoreCallbacks"
defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["funcname"] = "ImGui_ImplGlfw_RestoreCallbacks"
defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["location"] = "imgui_impl_glfw:41"
defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["location"] = "imgui_impl_glfw:37"
defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_RestoreCallbacks"
defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_RestoreCallbacks"][1]["signature"] = "(GLFWwindow*)"
@@ -275,7 +275,7 @@ defs["ImGui_ImplGlfw_ScrollCallback"][1]["call_args"] = "(window,xoffset,yoffset
defs["ImGui_ImplGlfw_ScrollCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_ScrollCallback"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_ScrollCallback"][1]["funcname"] = "ImGui_ImplGlfw_ScrollCallback"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["location"] = "imgui_impl_glfw:48"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["location"] = "imgui_impl_glfw:44"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_ScrollCallback"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["signature"] = "(GLFWwindow*,double,double)"
@@ -290,7 +290,7 @@ defs["ImGui_ImplGlfw_Shutdown"][1]["call_args"] = "()"
defs["ImGui_ImplGlfw_Shutdown"][1]["cimguiname"] = "ImGui_ImplGlfw_Shutdown"
defs["ImGui_ImplGlfw_Shutdown"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_Shutdown"][1]["funcname"] = "ImGui_ImplGlfw_Shutdown"
defs["ImGui_ImplGlfw_Shutdown"][1]["location"] = "imgui_impl_glfw:34"
defs["ImGui_ImplGlfw_Shutdown"][1]["location"] = "imgui_impl_glfw:30"
defs["ImGui_ImplGlfw_Shutdown"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_Shutdown"
defs["ImGui_ImplGlfw_Shutdown"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_Shutdown"][1]["signature"] = "()"
@@ -311,7 +311,7 @@ defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["call_args"] = "(window,focused)"
defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_WindowFocusCallback"
defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["funcname"] = "ImGui_ImplGlfw_WindowFocusCallback"
defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["location"] = "imgui_impl_glfw:44"
defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["location"] = "imgui_impl_glfw:40"
defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_WindowFocusCallback"
defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_WindowFocusCallback"][1]["signature"] = "(GLFWwindow*,int)"
@@ -507,11 +507,11 @@ defs["ImGui_ImplOpenGL3_Init"][1]["argsT"] = {}
defs["ImGui_ImplOpenGL3_Init"][1]["argsT"][1] = {}
defs["ImGui_ImplOpenGL3_Init"][1]["argsT"][1]["name"] = "glsl_version"
defs["ImGui_ImplOpenGL3_Init"][1]["argsT"][1]["type"] = "const char*"
defs["ImGui_ImplOpenGL3_Init"][1]["argsoriginal"] = "(const char* glsl_version=((void*)0))"
defs["ImGui_ImplOpenGL3_Init"][1]["argsoriginal"] = "(const char* glsl_version=nullptr)"
defs["ImGui_ImplOpenGL3_Init"][1]["call_args"] = "(glsl_version)"
defs["ImGui_ImplOpenGL3_Init"][1]["cimguiname"] = "ImGui_ImplOpenGL3_Init"
defs["ImGui_ImplOpenGL3_Init"][1]["defaults"] = {}
defs["ImGui_ImplOpenGL3_Init"][1]["defaults"]["glsl_version"] = "((void*)0)"
defs["ImGui_ImplOpenGL3_Init"][1]["defaults"]["glsl_version"] = "nullptr"
defs["ImGui_ImplOpenGL3_Init"][1]["funcname"] = "ImGui_ImplOpenGL3_Init"
defs["ImGui_ImplOpenGL3_Init"][1]["location"] = "imgui_impl_opengl3:25"
defs["ImGui_ImplOpenGL3_Init"][1]["ov_cimguiname"] = "ImGui_ImplOpenGL3_Init"

View File

@@ -65,7 +65,7 @@ ImVec2_ImVec2 2
ImVec2ih_ImVec2ih 3
1 nil ImVec2ih_ImVec2ih_Nil ()
2 nil ImVec2ih_ImVec2ih_short (short,short)
3 ImVec2ih_ImVec2ih_Vec2 (const ImVec2)
3 nil ImVec2ih_ImVec2ih_Vec2 (const ImVec2)
ImVec4_ImVec4 2
1 nil ImVec4_ImVec4_Nil ()
2 nil ImVec4_ImVec4_Float (float,float,float,float)
@@ -155,6 +155,24 @@ igImRsqrt 2
igImSign 2
1 float igImSign_Float (float)
2 double igImSign_double (double)
igIsKeyDown 2
1 bool igIsKeyDown_Nil (ImGuiKey)
2 bool igIsKeyDown_ID (ImGuiKey,ImGuiID)
igIsKeyPressed 2
1 bool igIsKeyPressed_Bool (ImGuiKey,bool)
2 bool igIsKeyPressed_ID (ImGuiKey,ImGuiID,ImGuiInputFlags)
igIsKeyReleased 2
1 bool igIsKeyReleased_Nil (ImGuiKey)
2 bool igIsKeyReleased_ID (ImGuiKey,ImGuiID)
igIsMouseClicked 2
1 bool igIsMouseClicked_Bool (ImGuiMouseButton,bool)
2 bool igIsMouseClicked_ID (ImGuiMouseButton,ImGuiID,ImGuiInputFlags)
igIsMouseDown 2
1 bool igIsMouseDown_Nil (ImGuiMouseButton)
2 bool igIsMouseDown_ID (ImGuiMouseButton,ImGuiID)
igIsMouseReleased 2
1 bool igIsMouseReleased_Nil (ImGuiMouseButton)
2 bool igIsMouseReleased_ID (ImGuiMouseButton,ImGuiID)
igIsPopupOpen 2
1 bool igIsPopupOpen_Str (const char*,ImGuiPopupFlags)
2 bool igIsPopupOpen_ID (ImGuiID,ImGuiPopupFlags)
@@ -226,6 +244,9 @@ igSetWindowSize 3
1 void igSetWindowSize_Vec2 (const ImVec2,ImGuiCond)
2 void igSetWindowSize_Str (const char*,const ImVec2,ImGuiCond)
3 void igSetWindowSize_WindowPtr (ImGuiWindow*,const ImVec2,ImGuiCond)
igTabItemCalcSize 2
1 ImVec2 igTabItemCalcSize_Str (const char*,bool)
2 ImVec2 igTabItemCalcSize_WindowPtr (ImGuiWindow*)
igTableGcCompactTransientBuffers 2
1 void igTableGcCompactTransientBuffers_TablePtr (ImGuiTable*)
2 void igTableGcCompactTransientBuffers_TableTempDataPtr (ImGuiTableTempData*)
@@ -254,4 +275,4 @@ igValue 4
2 void igValue_Int (const char*,int)
3 void igValue_Uint (const char*,unsigned int)
4 void igValue_Float (const char*,float,const char*)
179 overloaded
193 overloaded

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -63,14 +63,19 @@
"ImGuiInputEventMouseViewport": "struct ImGuiInputEventMouseViewport",
"ImGuiInputEventMouseWheel": "struct ImGuiInputEventMouseWheel",
"ImGuiInputEventText": "struct ImGuiInputEventText",
"ImGuiInputFlags": "int",
"ImGuiInputTextCallback": "int(*)(ImGuiInputTextCallbackData* data);",
"ImGuiInputTextCallbackData": "struct ImGuiInputTextCallbackData",
"ImGuiInputTextFlags": "int",
"ImGuiInputTextState": "struct ImGuiInputTextState",
"ImGuiItemFlags": "int",
"ImGuiItemStatusFlags": "int",
"ImGuiKey": "int",
"ImGuiKeyChord": "int",
"ImGuiKeyData": "struct ImGuiKeyData",
"ImGuiKeyOwnerData": "struct ImGuiKeyOwnerData",
"ImGuiKeyRoutingData": "struct ImGuiKeyRoutingData",
"ImGuiKeyRoutingIndex": "ImS16",
"ImGuiKeyRoutingTable": "struct ImGuiKeyRoutingTable",
"ImGuiLastItemData": "struct ImGuiLastItemData",
"ImGuiLayoutType": "int",
"ImGuiListClipper": "struct ImGuiListClipper",
@@ -80,12 +85,9 @@
"ImGuiMemFreeFunc": "void(*)(void* ptr,void* user_data);",
"ImGuiMenuColumns": "struct ImGuiMenuColumns",
"ImGuiMetricsConfig": "struct ImGuiMetricsConfig",
"ImGuiModFlags": "int",
"ImGuiMouseButton": "int",
"ImGuiMouseCursor": "int",
"ImGuiNavDirSourceFlags": "int",
"ImGuiNavHighlightFlags": "int",
"ImGuiNavInput": "int",
"ImGuiNavItemData": "struct ImGuiNavItemData",
"ImGuiNavMoveFlags": "int",
"ImGuiNextItemData": "struct ImGuiNextItemData",
@@ -143,6 +145,7 @@
"ImGuiTextBuffer": "struct ImGuiTextBuffer",
"ImGuiTextFilter": "struct ImGuiTextFilter",
"ImGuiTextFlags": "int",
"ImGuiTextIndex": "struct ImGuiTextIndex",
"ImGuiTextRange": "struct ImGuiTextRange",
"ImGuiTooltipFlags": "int",
"ImGuiTreeNodeFlags": "int",

View File

@@ -63,14 +63,19 @@ defs["ImGuiInputEventMousePos"] = "struct ImGuiInputEventMousePos"
defs["ImGuiInputEventMouseViewport"] = "struct ImGuiInputEventMouseViewport"
defs["ImGuiInputEventMouseWheel"] = "struct ImGuiInputEventMouseWheel"
defs["ImGuiInputEventText"] = "struct ImGuiInputEventText"
defs["ImGuiInputFlags"] = "int"
defs["ImGuiInputTextCallback"] = "int(*)(ImGuiInputTextCallbackData* data);"
defs["ImGuiInputTextCallbackData"] = "struct ImGuiInputTextCallbackData"
defs["ImGuiInputTextFlags"] = "int"
defs["ImGuiInputTextState"] = "struct ImGuiInputTextState"
defs["ImGuiItemFlags"] = "int"
defs["ImGuiItemStatusFlags"] = "int"
defs["ImGuiKey"] = "int"
defs["ImGuiKeyChord"] = "int"
defs["ImGuiKeyData"] = "struct ImGuiKeyData"
defs["ImGuiKeyOwnerData"] = "struct ImGuiKeyOwnerData"
defs["ImGuiKeyRoutingData"] = "struct ImGuiKeyRoutingData"
defs["ImGuiKeyRoutingIndex"] = "ImS16"
defs["ImGuiKeyRoutingTable"] = "struct ImGuiKeyRoutingTable"
defs["ImGuiLastItemData"] = "struct ImGuiLastItemData"
defs["ImGuiLayoutType"] = "int"
defs["ImGuiListClipper"] = "struct ImGuiListClipper"
@@ -80,12 +85,9 @@ defs["ImGuiMemAllocFunc"] = "void*(*)(size_t sz,void* user_data);"
defs["ImGuiMemFreeFunc"] = "void(*)(void* ptr,void* user_data);"
defs["ImGuiMenuColumns"] = "struct ImGuiMenuColumns"
defs["ImGuiMetricsConfig"] = "struct ImGuiMetricsConfig"
defs["ImGuiModFlags"] = "int"
defs["ImGuiMouseButton"] = "int"
defs["ImGuiMouseCursor"] = "int"
defs["ImGuiNavDirSourceFlags"] = "int"
defs["ImGuiNavHighlightFlags"] = "int"
defs["ImGuiNavInput"] = "int"
defs["ImGuiNavItemData"] = "struct ImGuiNavItemData"
defs["ImGuiNavMoveFlags"] = "int"
defs["ImGuiNextItemData"] = "struct ImGuiNextItemData"
@@ -143,6 +145,7 @@ defs["ImGuiTableTempData"] = "struct ImGuiTableTempData"
defs["ImGuiTextBuffer"] = "struct ImGuiTextBuffer"
defs["ImGuiTextFilter"] = "struct ImGuiTextFilter"
defs["ImGuiTextFlags"] = "int"
defs["ImGuiTextIndex"] = "struct ImGuiTextIndex"
defs["ImGuiTextRange"] = "struct ImGuiTextRange"
defs["ImGuiTooltipFlags"] = "int"
defs["ImGuiTreeNodeFlags"] = "int"

2
imgui

Submodule imgui updated: 9cd9c2eff9...94e850fd6f