Developer knowledge network · moderated exchange

UnreliableCode Topluluğu

Geliştirici Araştırması, Tersine Mühendislik ve Kodlama Topluluğu

Knowledge indexCanlı
4Categories
919Threads
2.8KGönderiler
Release

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

imgui_artisan
UI Designer
MEMBER
Temsilci: 202
Katılım Tarihi: Apr 2019
Gönderiler: 54
Teşekkürler: 28
3 hafta önce · 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
Temsilci: 64
Katılım Tarihi: Jun 2019
Gönderiler: 20
Teşekkürler: 48
3 hafta önce · 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
Temsilci: 105
Katılım Tarihi: Aug 2018
Gönderiler: 52
Teşekkürler: 41
3 hafta önce · Aug 2, 2026 5:09 PM
#3

Clean ImGui rendering.