4K High Resolution UI Upscale Source 

Newbie Spellweaver
Joined
Dec 22, 2023
Messages
17
Reaction score
47
If you are using a high-resolution monitor, you may find the RAN UI to be too small. Apply the method below which detects the monitor scaling to upscale the UI size.

before (using DPI property) -> after (applying UI upscaling)
Result2 - 4K High Resolution UI Upscale - RaGEZONE Forums


UIMan.h
C++:
    CUIControl * m_pFocusControl;        // MEMO : 포커스 컨트롤의 컨트롤 포인터

    /* UI Scaling fix | moon | 8 Oct 2025 */
    static float m_fMonitorScaling;
    static bool m_bInit;
public:
    static float GetMonitorScaling();

UIMan.cpp
C++:
/* UI Scaling fix | moon | 8 Oct 2025 */
auto CUIMan::m_fMonitorScaling(1.0f);
auto CUIMan::m_bInit(false);
float CUIMan::GetMonitorScaling()
{
    if (!m_bInit)
    {
        m_bInit = true;
        auto hDc = GetDC(NULL);
        auto nDpi = GetDeviceCaps(hDc, LOGPIXELSY);
        m_fMonitorScaling = static_cast<float>(nDpi) / 96.0f;
        ReleaseDC(NULL, hDc);
    }

    return m_fMonitorScaling;
}


InterfaceCfgXml.cpp
C++:
#include "UIMan.h"

// ...
                {
                    _tcscpy(szValue,WindowPosElem->Attribute("X"));
                    if( !IsValidData( szValue, "CONTROL/WINDOW_POS/X", nCount, szId ) ){
                        SAFE_DELETE( pInterfaceCfg );
                        ControlElem = ControlElem->NextSiblingElement("CONTROL");
                        nCount++;
                        continue;
                    }
                    /* UI Scaling fix | moon | 8 Oct 2025 */
                    pInterfaceCfg->rcControlPos.left = (float)_tstof( szValue ) * CUIMan::GetMonitorScaling();
                }

                {
                    _tcscpy(szValue,WindowPosElem->Attribute("Y"));
                    if( !IsValidData( szValue, "CONTROL/WINDOW_POS/Y", nCount, szId ) ){
                        SAFE_DELETE( pInterfaceCfg );
                        ControlElem = ControlElem->NextSiblingElement("CONTROL");
                        nCount++;
                        continue;
                    }

                    /* UI Scaling fix | moon | 8 Oct 2025 */
                    pInterfaceCfg->rcControlPos.top = (float)_tstof( szValue ) * CUIMan::GetMonitorScaling();
                }

                {
                    _tcscpy(szValue,WindowPosElem->Attribute("W"));
                    if( !IsValidData( szValue, "CONTROL/WINDOW_POS/W", nCount, szId ) ){
                        SAFE_DELETE( pInterfaceCfg );
                        ControlElem = ControlElem->NextSiblingElement("CONTROL");
                        nCount++;
                        continue;
                    }
                    /* UI Scaling fix | moon | 8 Oct 2025 */
                    pInterfaceCfg->rcControlPos.sizeX = (float)_tstof( szValue ) * CUIMan::GetMonitorScaling();
                }

                {
                    _tcscpy(szValue,WindowPosElem->Attribute("H"));
                    if( !IsValidData( szValue, "CONTROL/WINDOW_POS/H", nCount, szId ) ){
                        SAFE_DELETE( pInterfaceCfg );
                        ControlElem = ControlElem->NextSiblingElement("CONTROL");
                        nCount++;
                        continue;
                    }
                    /* UI Scaling fix | moon | 8 Oct 2025 */
                    pInterfaceCfg->rcControlPos.sizeY = (float)_tstof( szValue ) * CUIMan::GetMonitorScaling();
                }
 
Last edited:
bug expliot some player the button icon tigger not correctly position
 
Back