Added a crosshair and params for it

pull/28/head
FlightlessMango 4 years ago
parent 4be6d4c748
commit c5ea98a243

@ -1135,7 +1135,7 @@ static void compute_swapchain_display(struct swapchain_data *data)
if(displayHud)
ImGui::Begin("Main", &open, ImGuiWindowFlags_NoDecoration);
if(!displayHud){
ImGui::SetNextWindowBgAlpha(0.01);
ImGui::Begin("Main", &open, ImGuiWindowFlags_NoDecoration);
@ -1284,11 +1284,21 @@ static void compute_swapchain_display(struct swapchain_data *data)
ImGui::Text("Logging...");
ImGui::Text("Elapsed: %isec", int((elapsedLog) / 1000000));
ImGui::End();
}
ImGui::PopStyleVar(2);
ImGui::EndFrame();
ImGui::Render();
}
if (instance_data->params.enabled[OVERLAY_PARAM_ENABLED_crosshair]){
ImGui::SetNextWindowBgAlpha(0.0);
ImGui::SetNextWindowSize(ImVec2(data->width, data->height), ImGuiCond_Always);
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
ImGui::Begin("Logging", &open, ImGuiWindowFlags_NoDecoration);
ImVec2 horiz = ImVec2(data->width / 2 - (instance_data->params.crosshair_size / 2), data->height / 2);
ImVec2 vert = ImVec2(data->width / 2, data->height / 2 - (instance_data->params.crosshair_size / 2));
ImGui::GetWindowDrawList()->AddLine(horiz, ImVec2(horiz.x + instance_data->params.crosshair_size, horiz.y + 0), IM_COL32(0, 0, 0, 255), 2.0f);
ImGui::GetWindowDrawList()->AddLine(vert, ImVec2(vert.x + 0, vert.y + instance_data->params.crosshair_size), IM_COL32(0, 0, 0, 255), 2.0f);
ImGui::End();
}
ImGui::PopStyleVar(2);
ImGui::EndFrame();
ImGui::Render();
}
static uint32_t vk_memory_type(struct device_data *data,

@ -79,6 +79,12 @@ parse_fps_sampling_period(const char *str)
return strtol(str, NULL, 0) * 1000;
}
static uint32_t
parse_crosshair_size(const char *str)
{
return strtol(str, NULL, 0);
}
static bool
parse_no_display(const char *str)
{
@ -183,6 +189,7 @@ parse_overlay_env(struct overlay_params *params,
params->width = 280;
params->height = 140;
params->control = -1;
params->crosshair_size = 30;
if (!env)
return;

@ -45,6 +45,7 @@ extern "C" {
OVERLAY_PARAM_BOOL(gpu_stats) \
OVERLAY_PARAM_BOOL(ram) \
OVERLAY_PARAM_BOOL(vram) \
OVERLAY_PARAM_BOOL(crosshair) \
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \
OVERLAY_PARAM_CUSTOM(output_file) \
OVERLAY_PARAM_CUSTOM(position) \
@ -53,6 +54,7 @@ extern "C" {
OVERLAY_PARAM_CUSTOM(no_display) \
OVERLAY_PARAM_CUSTOM(control) \
OVERLAY_PARAM_CUSTOM(font_size) \
OVERLAY_PARAM_CUSTOM(crosshair_size) \
OVERLAY_PARAM_CUSTOM(help)
enum overlay_param_position {
@ -77,6 +79,7 @@ struct overlay_params {
FILE *output_file;
int control;
uint32_t fps_sampling_period; /* us */
uint32_t crosshair_size;
bool help;
bool no_display;
unsigned width;

Loading…
Cancel
Save