-
Автор темы
- #1
My custom hud is fine with clamping to the left side but when im changing my resolution my watermark can't clamp to the right side? and i cant really see what the big difference in my 2 code is?
My HUD Code:
[CODE = cpp] ImGuiIO & io = ImGui :: GetIO ();
ImGuiStyle & style = ImGui :: GetStyle ();
int width = io.DisplaySize.x;
int side_pos = 5;
int up_down_pos = 5;
ImGui :: SetNextWindowPos (ImVec2 (side_pos, up_down_pos));
ImGui :: SetNextWindowSize (ImVec2 (200, 20));
ImGui :: Begin ("Hud", nullptr, pWatermark);
{
ImVec2 p = ImGui :: GetCursorScreenPos ();
ImGui :: SetCursorPosY (ImGui :: GetWindowHeight () / 2 - py / 2);
if (! localPlayer ||! localPlayer-> isAlive ())
return;
const auto health = localPlayer-> health ();
const auto armor = localPlayer-> armor ();
ImGui :: Text ("HP:% 02d", health);
SSameline ();
ImGui :: Text ("Armor:% 02d", armor);
} ImGui :: End (); [/ CODE]
Watermark:
[CODE = cpp] ImGuiIO & io = ImGui :: GetIO ();
ImGuiStyle & style = ImGui :: GetStyle ();
int width = io.DisplaySize.x;
int side_pos = 1330;
int up_down_pos = 5;
ImGui :: SetNextWindowPos (ImVec2 (side_pos, up_down_pos));
ImGui :: SetNextWindowSize (ImVec2 (255, 20));
ImGui :: Begin ("pMark", nullptr, pWatermark);
{
ImVec2 p = ImGui :: GetCursorScreenPos ();
ImGui :: SetCursorPosY (ImGui :: GetWindowHeight () / 2 - py / 2);
} ImGui :: End (); [/ CODE]
My HUD Code:
[CODE = cpp] ImGuiIO & io = ImGui :: GetIO ();
ImGuiStyle & style = ImGui :: GetStyle ();
int width = io.DisplaySize.x;
int side_pos = 5;
int up_down_pos = 5;
ImGui :: SetNextWindowPos (ImVec2 (side_pos, up_down_pos));
ImGui :: SetNextWindowSize (ImVec2 (200, 20));
ImGui :: Begin ("Hud", nullptr, pWatermark);
{
ImVec2 p = ImGui :: GetCursorScreenPos ();
ImGui :: SetCursorPosY (ImGui :: GetWindowHeight () / 2 - py / 2);
if (! localPlayer ||! localPlayer-> isAlive ())
return;
const auto health = localPlayer-> health ();
const auto armor = localPlayer-> armor ();
ImGui :: Text ("HP:% 02d", health);
SSameline ();
ImGui :: Text ("Armor:% 02d", armor);
} ImGui :: End (); [/ CODE]
Watermark:
[CODE = cpp] ImGuiIO & io = ImGui :: GetIO ();
ImGuiStyle & style = ImGui :: GetStyle ();
int width = io.DisplaySize.x;
int side_pos = 1330;
int up_down_pos = 5;
ImGui :: SetNextWindowPos (ImVec2 (side_pos, up_down_pos));
ImGui :: SetNextWindowSize (ImVec2 (255, 20));
ImGui :: Begin ("pMark", nullptr, pWatermark);
{
ImVec2 p = ImGui :: GetCursorScreenPos ();
ImGui :: SetCursorPosY (ImGui :: GetWindowHeight () / 2 - py / 2);
} ImGui :: End (); [/ CODE]