* render camera crosshair sharply independently of viewport size, with shadow

This commit is contained in:
Garux
2025-09-19 03:58:33 +05:00
parent 16a04110b3
commit 413eb84b6c
2 changed files with 19 additions and 10 deletions
+1
View File
@@ -1143,6 +1143,7 @@ misc...
* Layers Browser: New Layer, Show All Layers, Hide All Layers buttons
* new icons by Julius, high dpi scaling support
* improved GUI themes, new unmodified Fusion theme, external .qss file
* render camera crosshair sharply independently of viewport size, with shadow
+18 -10
View File
@@ -2084,16 +2084,24 @@ void CamWnd::Cam_Draw(){
// draw the crosshair
if ( m_bFreeMove ) {
gl().glBegin( GL_LINES );
gl().glVertex2f( (float)m_Camera.width / 2.f, (float)m_Camera.height / 2.f + 6 );
gl().glVertex2f( (float)m_Camera.width / 2.f, (float)m_Camera.height / 2.f + 2 );
gl().glVertex2f( (float)m_Camera.width / 2.f, (float)m_Camera.height / 2.f - 6 );
gl().glVertex2f( (float)m_Camera.width / 2.f, (float)m_Camera.height / 2.f - 2 );
gl().glVertex2f( (float)m_Camera.width / 2.f + 6, (float)m_Camera.height / 2.f );
gl().glVertex2f( (float)m_Camera.width / 2.f + 2, (float)m_Camera.height / 2.f );
gl().glVertex2f( (float)m_Camera.width / 2.f - 6, (float)m_Camera.height / 2.f );
gl().glVertex2f( (float)m_Camera.width / 2.f - 2, (float)m_Camera.height / 2.f );
gl().glEnd();
// .5 coords for exact pixel rendering
const Vector2 cent( ( m_Camera.width + 1 ) / 2 + .5f, ( m_Camera.height + 1 ) / 2 + .5f );
constexpr float a = 6.5, b = 2.5;
for( float f : { 0.f, 1.f } )
{
gl().glColor3f( f, f, f );
const Vector2 verts[]{
cent + Vector2( 0, a ) - Vector2( f, f ),
cent + Vector2( 0, b ) - Vector2( f, f ),
cent + Vector2( 0, -a ) - Vector2( f, f ),
cent + Vector2( 0, -b ) - Vector2( f, f ),
cent + Vector2( a, 0 ) - Vector2( f, f ),
cent + Vector2( b, 0 ) - Vector2( f, f ),
cent + Vector2( -a, 0 ) - Vector2( f, f ),
cent + Vector2( -b, 0 ) - Vector2( f, f ) };
gl().glVertexPointer( 2, GL_FLOAT, sizeof( *verts ), verts->data() );
gl().glDrawArrays( GL_LINES, 0, std::size( verts ) );
}
}
if ( g_camwindow_globals.m_showStats ) {