visibility checks + group and person icon

This commit is contained in:
2024-06-19 16:10:03 +02:00
parent 5544adf345
commit 7c227457cd
6 changed files with 332 additions and 32 deletions

View File

@ -0,0 +1,139 @@
#include "./group.hpp"
#include <array>
static void drawIconGroupLines(
const ImVec2 p0,
const ImVec2 p1_o,
const ImU32 col,
const float thickness
) {
#define PLINE(x0, y0, x1, y1) \
ImGui::GetWindowDrawList()->AddLine( \
{p0.x + p1_o.x*(x0), p0.y + p1_o.y*(y0)}, \
{p0.x + p1_o.x*(x1), p0.y + p1_o.y*(y1)}, \
col, \
thickness \
);
// person front
// x y
PLINE(
0.1f, 0.9f,
0.6f, 0.9f
)
PLINE(
0.6f, 0.9f,
0.6f, 0.7f
)
PLINE(
0.6f, 0.7f,
0.5f, 0.6f
)
PLINE(
0.5f, 0.6f,
0.4f, 0.6f
)
PLINE(
0.4f, 0.6f,
0.5f, 0.5f
)
PLINE(
0.5f, 0.5f,
0.5f, 0.4f
)
PLINE(
0.5f, 0.4f,
0.4f, 0.3f
)
PLINE(
0.4f, 0.3f,
0.3f, 0.3f
)
PLINE(
0.3f, 0.3f,
0.2f, 0.4f
)
PLINE(
0.2f, 0.4f,
0.2f, 0.5f
)
PLINE(
0.2f, 0.5f,
0.3f, 0.6f
)
PLINE(
0.3f, 0.6f,
0.2f, 0.6f
)
PLINE(
0.2f, 0.6f,
0.1f, 0.7f
)
PLINE(
0.1f, 0.7f,
0.1f, 0.9f
)
// person back
// x y
PLINE(
0.7f, 0.7f,
0.9f, 0.7f
)
PLINE(
0.9f, 0.7f,
0.9f, 0.5f
)
PLINE(
0.9f, 0.5f,
0.8f, 0.4f
)
PLINE(
0.8f, 0.4f,
0.7f, 0.4f
)
PLINE(
0.7f, 0.4f,
0.8f, 0.3f
)
PLINE(
0.8f, 0.3f,
0.8f, 0.2f
)
PLINE(
0.8f, 0.2f,
0.7f, 0.1f
)
PLINE(
0.7f, 0.1f,
0.6f, 0.1f
)
PLINE(
0.6f, 0.1f,
0.5f, 0.2f
)
PLINE(
0.5f, 0.2f,
0.5f, 0.3f
)
PLINE(
0.5f, 0.3f,
0.6f, 0.4f
)
#undef PLINE
}
void drawIconGroup(
const ImVec2 p0,
const ImVec2 p1_o,
const ImU32 col_main
) {
// dark background
// the circle looks bad in light mode
//ImGui::GetWindowDrawList()->AddCircleFilled({p0.x + p1_o.x*0.5f, p0.y + p1_o.y*0.5f}, p1_o.x*0.5f, col_back);
//drawIconGroupLines(p0, p1_o, col_back, 3.5f);
drawIconGroupLines(p0, p1_o, col_main, 1.0f);
}

View File

@ -0,0 +1,10 @@
#pragma once
#include <imgui/imgui.h>
void drawIconGroup(
const ImVec2 p0,
const ImVec2 p1_o,
const ImU32 col_main
);

View File

@ -0,0 +1,101 @@
#include "./person.hpp"
#include <array>
static void drawIconPersonLines(
const ImVec2 p0,
const ImVec2 p1_o,
const ImU32 col,
const float thickness
) {
#define PLINE(x0, y0, x1, y1) \
ImGui::GetWindowDrawList()->AddLine( \
{p0.x + p1_o.x*(x0), p0.y + p1_o.y*(y0)}, \
{p0.x + p1_o.x*(x1), p0.y + p1_o.y*(y1)}, \
col, \
thickness \
);
//// quad
//// (1,2) -> (1,8)
//PLINE(0.1f, 0.2f, 0.1f, 0.8f)
//// (1,8) -> (9,8)
//PLINE(0.1f, 0.8f, 0.9f, 0.8f)
//// (9,8) -> (9,2)
//PLINE(0.9f, 0.8f, 0.9f, 0.2f)
//// (9,2) -> (1,2)
//PLINE(0.9f, 0.2f, 0.1f, 0.2f)
// x y
PLINE(
0.2f, 0.8f,
0.8f, 0.8f
)
PLINE(
0.8f, 0.8f,
0.8f, 0.6f
)
PLINE(
0.8f, 0.6f,
0.7f, 0.5f
)
PLINE(
0.7f, 0.5f,
0.6f, 0.5f
)
PLINE(
0.6f, 0.5f,
0.7f, 0.4f
)
PLINE(
0.7f, 0.4f,
0.7f, 0.2f
)
PLINE(
0.7f, 0.2f,
0.6f, 0.1f
)
PLINE(
0.6f, 0.1f,
0.4f, 0.1f
)
PLINE(
0.4f, 0.1f,
0.3f, 0.2f
)
PLINE(
0.3f, 0.2f,
0.3f, 0.4f
)
PLINE(
0.3f, 0.4f,
0.4f, 0.5f
)
PLINE(
0.4f, 0.5f,
0.3f, 0.5f
)
PLINE(
0.3f, 0.5f,
0.2f, 0.6f
)
PLINE(
0.2f, 0.6f,
0.2f, 0.8f
)
#undef PLINE
}
void drawIconPerson(
const ImVec2 p0,
const ImVec2 p1_o,
const ImU32 col_main
) {
// dark background
// the circle looks bad in light mode
//ImGui::GetWindowDrawList()->AddCircleFilled({p0.x + p1_o.x*0.5f, p0.y + p1_o.y*0.5f}, p1_o.x*0.5f, col_back);
//drawIconPersonLines(p0, p1_o, col_back, 3.5f);
drawIconPersonLines(p0, p1_o, col_main, 1.0f);
}

View File

@ -0,0 +1,10 @@
#pragma once
#include <imgui/imgui.h>
void drawIconPerson(
const ImVec2 p0,
const ImVec2 p1_o,
const ImU32 col_main
);