Developer knowledge network · moderated exchange

Супольнасць UnreliableCode

Супольнасць распрацоўшчыкаў даследаванняў, зваротнага праектавання і кадавання

Knowledge indexжыць
4Categories
919Threads
2.8KПаведамленні
Release

Dynamic Weapon Crosshair HUD with Real-Time Bullet Spread Circle in ImGui [v2.4 Technical Discussion]

imgui_artisan
UI Designer
MEMBER
прадстаўнік: 202
Дата далучэння: Apr 2019
Паведамленні: 54
Дзякуй: 28
3 тыдняў таму · Aug 2, 2026 5:59 AM
#1

A responsive dynamic crosshair widget for GTA V:

CPP
void DrawDynamicCrosshair(Vector2 screenCenter, float spreadRadius, ImU32 color) {
    ImDrawList* dl = ImGui::GetBackgroundDrawList();
    float gap = max(4.0f, spreadRadius * 20.0f); // Expands as spread increases
    float len = 8.0f;
    
    // Top, Bottom, Left, Right crosshair lines
    dl->AddLine(ImVec2(screenCenter.x, screenCenter.y - gap), ImVec2(screenCenter.x, screenCenter.y - gap - len), color, 2.0f);
    dl->AddLine(ImVec2(screenCenter.x, screenCenter.y + gap), ImVec2(screenCenter.x, screenCenter.y + gap + len), color, 2.0f);
    dl->AddLine(ImVec2(screenCenter.x - gap, screenCenter.y), ImVec2(screenCenter.x - gap - len, screenCenter.y), color, 2.0f);
    dl->AddLine(ImVec2(screenCenter.x + gap, screenCenter.y), ImVec2(screenCenter.x + gap + len, screenCenter.y), color, 2.0f);
}
fivem_native_coder
Lua Scripter
MEMBER
прадстаўнік: 64
Дата далучэння: Jun 2019
Паведамленні: 20
Дзякуй: 48
3 тыдняў таму · Aug 2, 2026 11:29 AM
#2

The crosshair dynamically expands when running or firing and snaps tight when standing still. Beautiful HUD design.

matrix_math_guy
Math Specialist
MEMBER
прадстаўнік: 105
Дата далучэння: Aug 2018
Паведамленні: 52
Дзякуй: 41
3 тыдняў таму · Aug 2, 2026 5:09 PM
#3

Clean ImGui rendering.