Merge branch 'crosshair'

This commit is contained in:
FlightlessMango 2020-02-10 17:08:15 +01:00
commit a8e4ac84f9
3 changed files with 26 additions and 6 deletions

View File

@ -1126,7 +1126,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);
@ -1275,11 +1275,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,

View File

@ -105,6 +105,12 @@ parse_vsync(const char *str)
return strtol(str, NULL, 0);
}
static uint32_t
parse_crosshair_size(const char *str)
{
return strtol(str, NULL, 0);
}
static bool
parse_no_display(const char *str)
{
@ -214,6 +220,7 @@ parse_overlay_env(struct overlay_params *params,
params->toggle_logging = 65471;
params->fps_limit = 0;
params->vsync = -1;
params->crosshair_size = 30;
if (!env)
return;

View File

@ -47,6 +47,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) \
@ -59,6 +60,7 @@ extern "C" {
OVERLAY_PARAM_CUSTOM(font_size) \
OVERLAY_PARAM_CUSTOM(toggle_hud) \
OVERLAY_PARAM_CUSTOM(toggle_logging) \
OVERLAY_PARAM_CUSTOM(crosshair_size) \
OVERLAY_PARAM_CUSTOM(help)
enum overlay_param_position {
@ -84,6 +86,7 @@ struct overlay_params {
int control;
uint32_t fps_sampling_period; /* us */
uint32_t fps_limit;
uint32_t crosshair_size;
bool help;
bool no_display;
unsigned width;