Jump to content

Recommended Posts

  • Active+ Member

An intuitive interface optimization that dynamically scales item quantity numbers. Automatically zooms text size (x2) while holding the CTRL key for quick, crystal-clear visibility of item stacks, instantly reverting to normal when released. 
This version is a personal reinterpretation of the official system, it works differently from the official one, where enlarged pictures are used, instead of scaling existing pictures, which I did in this system. In the system I made, there is only the scaling part directly on CTRL in the game source, if you want in the config this can be done quite easily. 🙂

Happy Easter! 🙂 

spacer.png
 

INSTALLATION

 

UserInterface/Locale_inc.h

Add:

#define ENABLE_SLOT_TEXT_SIZE


EterPythonLib/PythonWindow.h

Search:

			DWORD m_dwWidthSummary;

Add below:

#ifdef ENABLE_SLOT_TEXT_SIZE
			bool m_bIsZoomed;
#endif



EterPythonLib/PythonWindow.cpp

Search:

	CNumberLine::CNumberLine(PyObject * ppyObject) : CWindow(ppyObject)
	{
		m_strPath = "d:/ymir work/ui/game/taskbar/";
		m_iHorizontalAlign = HORIZONTAL_ALIGN_LEFT;
		m_dwWidthSummary = 0;

Add below:

#ifdef ENABLE_SLOT_TEXT_SIZE
		m_bIsZoomed = false;
#endif

 Search:

	CNumberLine::CNumberLine(CWindow * pParent) : CWindow(NULL)
	{
		m_strPath = "d:/ymir work/ui/game/taskbar/";
		m_iHorizontalAlign = HORIZONTAL_ALIGN_LEFT;
		m_dwWidthSummary = 0;

		m_pParent = pParent;

Add below:

#ifdef ENABLE_SLOT_TEXT_SIZE
		m_bIsZoomed = false;
#endif

 Search:

			CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(strImageFileName.c_str());

			CGraphicImageInstance * pInstance = CGraphicImageInstance::New();
			pInstance->SetImagePointer(pImage);
			m_ImageInstanceVector.push_back(pInstance);

			m_dwWidthSummary += pInstance->GetWidth();

Replace with:

#ifdef ENABLE_SLOT_TEXT_SIZE
			CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(strImageFileName.c_str());

			CGraphicExpandedImageInstance * pInstance = CGraphicExpandedImageInstance::New();
			pInstance->SetImagePointer(pImage);

			pInstance->SetScale(m_bIsZoomed ? 2.0f : 1.0f, m_bIsZoomed ? 2.0f : 1.0f); 

			m_ImageInstanceVector.push_back(pInstance);
			m_dwWidthSummary += pImage->GetWidth(); 
#else
			CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(strImageFileName.c_str());

			CGraphicImageInstance * pInstance = CGraphicImageInstance::New();
			pInstance->SetImagePointer(pImage);
			m_ImageInstanceVector.push_back(pInstance);

			m_dwWidthSummary += pInstance->GetWidth();
#endif

 Search:

	void CNumberLine::OnRender()
	{
		for (DWORD i = 0; i < m_ImageInstanceVector.size(); ++i)
		{
			m_ImageInstanceVector[i]->Render();
		}
	}

Replace with:

	void CNumberLine::OnRender()
	{
#ifdef ENABLE_SLOT_TEXT_SIZE
		bool bIsCtrlPressed = (GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0;

		if (m_bIsZoomed != bIsCtrlPressed)
		{
			m_bIsZoomed = bIsCtrlPressed;

			for (DWORD i = 0; i < m_ImageInstanceVector.size(); ++i)
			{
				CGraphicExpandedImageInstance* pInstance = (CGraphicExpandedImageInstance*)m_ImageInstanceVector[i];
				pInstance->SetScale(m_bIsZoomed ? 2.0f : 1.0f, m_bIsZoomed ? 2.0f : 1.0f);
			}
			
			OnChangePosition(); 
		}
#endif
		for (DWORD i = 0; i < m_ImageInstanceVector.size(); ++i)
		{
			m_ImageInstanceVector[i]->Render();
		}
	}

 Search:

	void CNumberLine::OnChangePosition()
	{
		int ix = m_x;
		int iy = m_y;

		if (m_pParent)
		{
			ix = m_rect.left;
			iy = m_rect.top;
		}

		switch (m_iHorizontalAlign)
		{
			case HORIZONTAL_ALIGN_LEFT:
				break;
			case HORIZONTAL_ALIGN_CENTER:
				ix -= int(m_dwWidthSummary) / 2;
				break;
			case HORIZONTAL_ALIGN_RIGHT:
				ix -= int(m_dwWidthSummary);
				break;
		}

		for (DWORD i = 0; i < m_ImageInstanceVector.size(); ++i)
		{
			m_ImageInstanceVector[i]->SetPosition(ix, iy);
			ix += m_ImageInstanceVector[i]->GetWidth();
		}

	}

Replace with:

	void CNumberLine::OnChangePosition()
	{
		int ix = m_x;
		int iy = m_y;

		if (m_pParent)
		{
			ix = m_rect.left;
			iy = m_rect.top;
		}

#ifdef ENABLE_SLOT_TEXT_SIZE
		int iCurrentWidthSummary = m_dwWidthSummary * (m_bIsZoomed ? 2 : 1);
#endif

		switch (m_iHorizontalAlign)
		{
			case HORIZONTAL_ALIGN_LEFT:
				break;
			case HORIZONTAL_ALIGN_CENTER:
#ifdef ENABLE_SLOT_TEXT_SIZE
				ix -= int(iCurrentWidthSummary) / 2;
#else
				ix -= int(m_dwWidthSummary) / 2;
#endif
				break;
			case HORIZONTAL_ALIGN_RIGHT:
#ifdef ENABLE_SLOT_TEXT_SIZE
				ix -= int(iCurrentWidthSummary);
#else
				ix -= int(m_dwWidthSummary);
#endif
				break;
		}

#ifdef ENABLE_SLOT_TEXT_SIZE
		if (m_bIsZoomed)
		{
			iy -= 4; 
			ix += 4; 
		}

		for (DWORD i = 0; i < m_ImageInstanceVector.size(); ++i)
		{
			m_ImageInstanceVector[i]->SetPosition(ix, iy);
			ix += (m_ImageInstanceVector[i]->GetWidth() * (m_bIsZoomed ? 2 : 1));
		}
#else
		for (DWORD i = 0; i < m_ImageInstanceVector.size(); ++i)
		{
			m_ImageInstanceVector[i]->SetPosition(ix, iy);
			ix += m_ImageInstanceVector[i]->GetWidth();
		}
#endif

	}

 

  • Metin2 Dev 2
Link to comment
https://metin2.dev/topic/34456-c-slot-text-size/
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.