Jump to content

OutLineColor Extension for TextLine


Recommended Posts

  • Honorable Member

M2 Download Center

This is the hidden content, please
  ( Internal )

Hello everyone.

I've got this request long time ago to extend the OutLine coloring feature for the TextLines to make beautiful texts via Python.
As you might know there is the ConquerorLevel text which also uses this feature just binary sided.
With this small code you will be able to recolor the OutLine of the textlines from python scripts.

Demo:

Spoiler

Images:

Spoiler

VI5ynXE.png  KcDVAdN.png   jeisAt5.png

Video:

Spoiler

 

 

 

Guide:

Spoiler

1.) EterPythonLib/PythonWindowManagerModule.cpp >> Declare the following function and add to the method list:

PyObject * wndTextSetOutLineColor(PyObject * poSelf, PyObject * poArgs)
{
	UI::CWindow * pWindow;
	if (!PyTuple_GetWindow(poArgs, 0, &pWindow))
		return Py_BuildException();

	if (2 == PyTuple_Size(poArgs))
	{
		DWORD dwColor;
		// <!> PyTuple_GetUnsignedLong might cause some problems, change it if you need <!>
		if (!PyTuple_GetUnsignedLong(poArgs, 1, &dwColor))
			return Py_BuildException();
		((UI::CTextLine*)pWindow)->SetOutLineColor(dwColor);
	}
	else if (5 == PyTuple_Size(poArgs))
	{
		float fr;
		if (!PyTuple_GetFloat(poArgs, 1, &fr))
			return Py_BuildException();
		float fg;
		if (!PyTuple_GetFloat(poArgs, 2, &fg))
			return Py_BuildException();
		float fb;
		if (!PyTuple_GetFloat(poArgs, 3, &fb))
			return Py_BuildException();
		float fa;
		if (!PyTuple_GetFloat(poArgs, 4, &fa))
			return Py_BuildException();

		((UI::CTextLine*)pWindow)->SetOutLineColor(fr, fg, fb, fa);
	}
	else
	{
		return Py_BuildException();
	}

	return Py_BuildNone();
}

//// 

		{ "SetOutLineColor",			wndTextSetOutLineColor,				METH_VARARGS },

2.) EterPythonLib/PythonWindow.h >> Add the following lines into the CTextLine class as 'public' (recommended below of the SetFontColor):

			void SetOutLineColor(DWORD dwColor);
			void SetOutLineColor(float fR, float fG, float fB, float fA);

3.) EterPythonLib/PythonWindow.cpp >> Declare the new functions (recommended below of the CTextLine::SetFontColor):

	void CTextLine::SetOutLineColor(DWORD dwColor)
	{
		m_TextInstance.SetOutLineColor(dwColor);
	}
	void CTextLine::SetOutLineColor(float fR, float fG, float fB, float fA)
	{
		m_TextInstance.SetOutLineColor(fR, fG, fB, fA);
	}

4.) root/ui.py >> Add these functions into the TextLine class (recommended below of the SetPackedFontColor):

	def SetOutLineColor(self, red, green, blue, alpha):
		wndMgr.SetOutLineColor(self.hWnd, red, green, blue, alpha)

	def SetPackedOutLineColor(self, color):
		wndMgr.SetOutLineColor(self.hWnd, color)

 

 

Test Script:

Spoiler

 

Any problem --> Comment below 👇
Greetz

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 37
  • Confused 1
  • Lmao 1
  • Good 11
  • Love 5
  • Love 37
Link to comment
Share on other sites

  • 1 year later...

Announcements



×
×
  • 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.