Jump to content

Recommended Posts

  • Active+ Member

i was just coding some system and i was lazy to add all the images so i just used emojis

turns out they don't clip mask so here we go..

 

Spoiler

GrpTextInstance.cpp

at the very end of :
void CGraphicTextInstance::Render(RECT * pClipRect)
{

	[...]
	
	Find this :
	
#ifdef ENABLE_EMOJI_SYSTEM
    if (!m_emojiVector.empty())
    {
        for (auto& rEmo : m_emojiVector)
        {
            if (rEmo.pInstance)
            {
                float emoX = fStanX + rEmo.x;
                float emoY = (fStanY + 7.0f) - (rEmo.pInstance->GetHeight() / 2);
                
                rEmo.pInstance->SetPosition(emoX, emoY);
                rEmo.pInstance->Render();
            }
        }
    }
#endif


	And just change it to:
#ifdef ENABLE_EMOJI_SYSTEM
    if (!m_emojiVector.empty())
    {
        for (auto& rEmo : m_emojiVector)
        {
            if (rEmo.pInstance)
            {
                float emoX = fStanX + rEmo.x;
                float emoY = (fStanY + 7.0f) - (rEmo.pInstance->GetHeight() / 2);
                
                rEmo.pInstance->SetPosition(emoX, emoY);

#if defined(ENABLE_CLIP_MASK)
                if (pClipRect)
                {
                    RECT emojiClipRect;
                    
                    float emoWidth = rEmo.pInstance->GetWidth();
                    float emoHeight = rEmo.pInstance->GetHeight();
                    
                    emojiClipRect = *pClipRect;
                    
                    emojiClipRect.left = max(pClipRect->left, static_cast<LONG>(emoX));
                    emojiClipRect.top = max(pClipRect->top, static_cast<LONG>(emoY));
                    emojiClipRect.right = min(pClipRect->right, static_cast<LONG>(emoX + emoWidth));
                    emojiClipRect.bottom = min(pClipRect->bottom, static_cast<LONG>(emoY + emoHeight));
                    
                    if (emojiClipRect.right > emojiClipRect.left && 
                        emojiClipRect.bottom > emojiClipRect.top)
                    {
                        rEmo.pInstance->Render(&emojiClipRect);
                    }
                }
                else
#endif
                {
                    rEmo.pInstance->Render();
                }
            }
        }
    }
#endif

 

 

 

also don't forget to match the defines to the ones you have !!

 

Ciao

Edited by CONTROL
  • Metin2 Dev 1
  • Good 1
  • Love 1

I don’t know — I think.

 

Discord

 

Link to comment
https://metin2.dev/topic/33507-clip_mask-for-emoji/
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.