added param frametime_color

pull/58/head
FlightlessMango 4 years ago
parent a2735693ba
commit 906a8cde23

@ -80,8 +80,8 @@ void imgui_create(void *ctx)
// Setup Dear ImGui style
ImGui::StyleColorsDark();
//ImGui::StyleColorsClassic();
imgui_custom_style();
imgui_custom_style(params);
GLint vp [4]; glGetIntegerv (GL_VIEWPORT, vp);
printf("viewport %d %d %d %d\n", vp[0], vp[1], vp[2], vp[3]);
ImGui::GetIO().IniFilename = NULL;

@ -1225,7 +1225,7 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2&
s == OVERLAY_PARAM_ENABLED_fps ||
s == OVERLAY_PARAM_ENABLED_frame)
continue;
char hash[40];
snprintf(hash, sizeof(hash), "##%s", overlay_param_names[s]);
data.stat_selector = (enum overlay_param_enabled) s;
@ -1943,15 +1943,16 @@ static void setup_swapchain_data_pipeline(struct swapchain_data *data)
write_desc[0].pImageInfo = desc_image;
device_data->vtable.UpdateDescriptorSets(device_data->device, 1, write_desc, 0, NULL);
}
void imgui_custom_style(){
void imgui_custom_style(struct overlay_params& params){
ImGuiStyle& style = ImGui::GetStyle();
style.Colors[ImGuiCol_PlotLines] = ImVec4(0.0f, 1.0f, 0.0f, 1.00f);
style.Colors[ImGuiCol_PlotLines] = ImGui::ColorConvertU32ToFloat4(params.frametime_color);
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 1.0f);
style.CellPadding.y = -2;
}
static void setup_swapchain_data(struct swapchain_data *data,
const VkSwapchainCreateInfoKHR *pCreateInfo)
const VkSwapchainCreateInfoKHR *pCreateInfo, struct overlay_params& params)
{
data->width = pCreateInfo->imageExtent.width;
data->height = pCreateInfo->imageExtent.height;
@ -1962,7 +1963,7 @@ static void setup_swapchain_data(struct swapchain_data *data,
ImGui::GetIO().IniFilename = NULL;
ImGui::GetIO().DisplaySize = ImVec2((float)data->width, (float)data->height);
imgui_custom_style();
imgui_custom_style(params);
struct device_data *device_data = data->device;
@ -2149,7 +2150,7 @@ static VkResult overlay_CreateSwapchainKHR(
VkResult result = device_data->vtable.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
if (result != VK_SUCCESS) return result;
struct swapchain_data *swapchain_data = new_swapchain_data(*pSwapchain, device_data);
setup_swapchain_data(swapchain_data, pCreateInfo);
setup_swapchain_data(swapchain_data, pCreateInfo, device_data->instance->params);
return result;
}

@ -41,4 +41,4 @@ void init_gpu_stats(uint32_t& vendorID, overlay_params& params);
void check_keybinds(struct overlay_params& params);
void init_system_info(void);
void FpsLimiter(struct fps_limit& stats);
void imgui_custom_style(void);
void imgui_custom_style(struct overlay_params& params);

@ -158,6 +158,7 @@ parse_str(const char *str)
#define parse_ram_color(s) parse_color(s)
#define parse_engine_color(s) parse_color(s)
#define parse_io_color(s) parse_color(s)
#define parse_frametime_color(s) parse_color(s)
static bool
parse_help(const char *str)
@ -309,6 +310,7 @@ parse_overlay_config(struct overlay_params *params,
params->ram_color = strtol("c26693", NULL, 16);
params->engine_color = strtol("eb5b5b", NULL, 16);
params->io_color = strtol("a491d3", NULL, 16);
params->frametime_color = strtol("00ff00", NULL, 16);
// first pass with env var
if (env)
@ -357,14 +359,15 @@ parse_overlay_config(struct overlay_params *params,
// Command buffer gets reused and timestamps cause hangs for some reason, force off for now
params->enabled[OVERLAY_PARAM_ENABLED_gpu_timing] = false;
// Convert from 0xRRGGBB to ImGui's format
std::array<unsigned *, 7> colors = {
std::array<unsigned *, 8> colors = {
&params->crosshair_color,
&params->cpu_color,
&params->gpu_color,
&params->vram_color,
&params->ram_color,
&params->engine_color,
&params->io_color
&params->io_color,
&params->frametime_color
};
for (auto color : colors){

@ -88,6 +88,7 @@ extern "C" {
OVERLAY_PARAM_CUSTOM(vram_color) \
OVERLAY_PARAM_CUSTOM(ram_color) \
OVERLAY_PARAM_CUSTOM(engine_color) \
OVERLAY_PARAM_CUSTOM(frametime_color) \
OVERLAY_PARAM_CUSTOM(io_color) \
OVERLAY_PARAM_CUSTOM(help)
@ -124,7 +125,7 @@ struct overlay_params {
unsigned offset_x;
unsigned offset_y;
unsigned vsync;
unsigned crosshair_color, cpu_color, gpu_color, vram_color, ram_color, engine_color, io_color;
unsigned crosshair_color, cpu_color, gpu_color, vram_color, ram_color, engine_color, io_color, frametime_color;
unsigned tableCols;
float font_size;
float background_alpha;

Loading…
Cancel
Save