mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Merge remote-tracking branch 'origin' into 2016-02-colorpicker
This commit is contained in:
commit
ef10b984fe
1
examples/.gitignore
vendored
1
examples/.gitignore
vendored
@ -33,6 +33,7 @@ opengl3_example/opengl3_example
|
|||||||
*.obj
|
*.obj
|
||||||
*.exe
|
*.exe
|
||||||
*.pdb
|
*.pdb
|
||||||
|
*.ilk
|
||||||
|
|
||||||
## Ini files
|
## Ini files
|
||||||
imgui.ini
|
imgui.ini
|
||||||
|
@ -661,19 +661,16 @@ bool ImGui_ImplGlfwVulkan_CreateDeviceObjects()
|
|||||||
|
|
||||||
if (!g_PipelineLayout)
|
if (!g_PipelineLayout)
|
||||||
{
|
{
|
||||||
VkPushConstantRange push_constants[2] = {};
|
VkPushConstantRange push_constants[1] = {};
|
||||||
push_constants[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
|
push_constants[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
|
||||||
push_constants[0].offset = sizeof(float) * 0;
|
push_constants[0].offset = sizeof(float) * 0;
|
||||||
push_constants[0].size = sizeof(float) * 2;
|
push_constants[0].size = sizeof(float) * 4;
|
||||||
push_constants[1].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
|
|
||||||
push_constants[1].offset = sizeof(float) * 2;
|
|
||||||
push_constants[1].size = sizeof(float) * 2;
|
|
||||||
VkDescriptorSetLayout set_layout[1] = {g_DescriptorSetLayout};
|
VkDescriptorSetLayout set_layout[1] = {g_DescriptorSetLayout};
|
||||||
VkPipelineLayoutCreateInfo layout_info = {};
|
VkPipelineLayoutCreateInfo layout_info = {};
|
||||||
layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||||
layout_info.setLayoutCount = 1;
|
layout_info.setLayoutCount = 1;
|
||||||
layout_info.pSetLayouts = set_layout;
|
layout_info.pSetLayouts = set_layout;
|
||||||
layout_info.pushConstantRangeCount = 2;
|
layout_info.pushConstantRangeCount = 1;
|
||||||
layout_info.pPushConstantRanges = push_constants;
|
layout_info.pPushConstantRanges = push_constants;
|
||||||
err = vkCreatePipelineLayout(g_Device, &layout_info, g_Allocator, &g_PipelineLayout);
|
err = vkCreatePipelineLayout(g_Device, &layout_info, g_Allocator, &g_PipelineLayout);
|
||||||
ImGui_ImplGlfwVulkan_VkResult(err);
|
ImGui_ImplGlfwVulkan_VkResult(err);
|
||||||
@ -750,6 +747,7 @@ bool ImGui_ImplGlfwVulkan_CreateDeviceObjects()
|
|||||||
|
|
||||||
VkDynamicState dynamic_states[2] = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
|
VkDynamicState dynamic_states[2] = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
|
||||||
VkPipelineDynamicStateCreateInfo dynamic_state = {};
|
VkPipelineDynamicStateCreateInfo dynamic_state = {};
|
||||||
|
dynamic_state.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
||||||
dynamic_state.dynamicStateCount = 2;
|
dynamic_state.dynamicStateCount = 2;
|
||||||
dynamic_state.pDynamicStates = dynamic_states;
|
dynamic_state.pDynamicStates = dynamic_states;
|
||||||
|
|
||||||
|
@ -88,7 +88,10 @@ static void resize_vulkan(GLFWwindow* /*window*/, int w, int h)
|
|||||||
VkSurfaceCapabilitiesKHR cap;
|
VkSurfaceCapabilitiesKHR cap;
|
||||||
err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(g_Gpu, g_Surface, &cap);
|
err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(g_Gpu, g_Surface, &cap);
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
|
if (cap.maxImageCount > 0)
|
||||||
info.minImageCount = (cap.minImageCount + 2 < cap.maxImageCount) ? (cap.minImageCount + 2) : cap.maxImageCount;
|
info.minImageCount = (cap.minImageCount + 2 < cap.maxImageCount) ? (cap.minImageCount + 2) : cap.maxImageCount;
|
||||||
|
else
|
||||||
|
info.minImageCount = cap.minImageCount + 2;
|
||||||
if (cap.currentExtent.width == 0xffffffff)
|
if (cap.currentExtent.width == 0xffffffff)
|
||||||
{
|
{
|
||||||
fb_width = w;
|
fb_width = w;
|
||||||
|
17
imgui.cpp
17
imgui.cpp
@ -946,21 +946,30 @@ const char* ImStristr(const char* haystack, const char* haystack_end, const char
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size).
|
||||||
|
// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm.
|
||||||
int ImFormatString(char* buf, int buf_size, const char* fmt, ...)
|
int ImFormatString(char* buf, int buf_size, const char* fmt, ...)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT(buf_size > 0);
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
int w = vsnprintf(buf, buf_size, fmt, args);
|
int w = vsnprintf(buf, buf_size, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
buf[buf_size-1] = 0;
|
if (w == -1 || w >= buf_size)
|
||||||
return (w == -1) ? buf_size : w;
|
w = buf_size - 1;
|
||||||
|
buf[w] = 0;
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args)
|
int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT(buf_size > 0);
|
||||||
int w = vsnprintf(buf, buf_size, fmt, args);
|
int w = vsnprintf(buf, buf_size, fmt, args);
|
||||||
buf[buf_size-1] = 0;
|
if (w == -1 || w >= buf_size)
|
||||||
return (w == -1) ? buf_size : w;
|
w = buf_size - 1;
|
||||||
|
buf[w] = 0;
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass data_size==0 for zero-terminated strings
|
// Pass data_size==0 for zero-terminated strings
|
||||||
|
@ -1670,7 +1670,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
}
|
}
|
||||||
ImGui::LogFinish();
|
ImGui::LogFinish();
|
||||||
}
|
}
|
||||||
ImGui::SameLine(); ImGui::PushItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY"); ImGui::PopItemWidth();
|
ImGui::SameLine(); ImGui::PushItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0"); ImGui::PopItemWidth();
|
||||||
ImGui::SameLine(); ImGui::Checkbox("Only Modified Fields", &output_only_modified);
|
ImGui::SameLine(); ImGui::Checkbox("Only Modified Fields", &output_only_modified);
|
||||||
|
|
||||||
static ImGuiColorEditFlags color_edit_flags = ImGuiColorEditFlags_RGB;
|
static ImGuiColorEditFlags color_edit_flags = ImGuiColorEditFlags_RGB;
|
||||||
|
Loading…
Reference in New Issue
Block a user