vulkan/overlay: add a margin to the size of the window
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sat, 2 Mar 2019 17:29:12 +0000 (17:29 +0000)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 2 May 2019 16:02:07 +0000 (17:02 +0100)
Looks a bit better.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/vulkan/overlay-layer/overlay.cpp

index 2aa0bf93e6bd25082303e1f3271ca2cc734f87f8..28a63fbbf92c88d347d5cfd9abf14d5be259cbb0 100644 (file)
@@ -571,24 +571,25 @@ static void position_layer(struct swapchain_data *data)
 {
    struct device_data *device_data = data->device;
    struct instance_data *instance_data = device_data->instance;
 {
    struct device_data *device_data = data->device;
    struct instance_data *instance_data = device_data->instance;
+   const float margin = 10.0f;
 
    ImGui::SetNextWindowBgAlpha(0.5);
    ImGui::SetNextWindowSize(data->window_size, ImGuiCond_Always);
    switch (instance_data->params.position) {
    case LAYER_POSITION_TOP_LEFT:
 
    ImGui::SetNextWindowBgAlpha(0.5);
    ImGui::SetNextWindowSize(data->window_size, ImGuiCond_Always);
    switch (instance_data->params.position) {
    case LAYER_POSITION_TOP_LEFT:
-      ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
+      ImGui::SetNextWindowPos(ImVec2(margin, margin), ImGuiCond_Always);
       break;
    case LAYER_POSITION_TOP_RIGHT:
       break;
    case LAYER_POSITION_TOP_RIGHT:
-      ImGui::SetNextWindowPos(ImVec2(data->width - data->window_size.x, 0),
+      ImGui::SetNextWindowPos(ImVec2(data->width - data->window_size.x - margin, margin),
                               ImGuiCond_Always);
       break;
    case LAYER_POSITION_BOTTOM_LEFT:
                               ImGuiCond_Always);
       break;
    case LAYER_POSITION_BOTTOM_LEFT:
-      ImGui::SetNextWindowPos(ImVec2(0, data->height - data->window_size.y),
+      ImGui::SetNextWindowPos(ImVec2(margin, data->height - data->window_size.y - margin),
                               ImGuiCond_Always);
       break;
    case LAYER_POSITION_BOTTOM_RIGHT:
                               ImGuiCond_Always);
       break;
    case LAYER_POSITION_BOTTOM_RIGHT:
-      ImGui::SetNextWindowPos(ImVec2(data->width - data->window_size.x,
-                                     data->height - data->window_size.y),
+      ImGui::SetNextWindowPos(ImVec2(data->width - data->window_size.x - margin,
+                                     data->height - data->window_size.y - margin),
                               ImGuiCond_Always);
       break;
    }
                               ImGuiCond_Always);
       break;
    }