Kod:
EterPythonLib/PythonWindowManagerModule.cpp Açılır ve eklenir 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 },
Kod:
EterPythonLib/PythonWindow.h Açılır ve SetFontColor ' un altına eklenir void SetOutLineColor(DWORD dwColor); void SetOutLineColor(float fR, float fG, float fB, float fA);'
Kod:
EterPythonLib/PythonWindow.cpp Açılır ve CTextLine::SetFontColor ' un altına eklenir 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); }'
Kod:
root/ui.py Açılır ve SetPackedFontColor ' un altına eklenir 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 skript
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
TextLine İçin OutLineColor Uzantısı Nedir?
Metin2 özel sunucularında kullanıcı dostu arayüz geliştirmek, oyuncuların deneyimini ciddi anlamda artırır. Bu bağlamda, TextLine nesnesi üzerinde yapılan geliştirmelerden birisi olan OutLineColor uzantısı, metin alanlarında belirgin bir görsel etki yaratmak için oldukça faydalıdır. Bu makalede, TextLine nesnesine nasıl OutLineColor uzantısının ekleneceğini ve bu uzantının hangi avantajları sunduğunu detaylı olarak ele alacağız.
OutLineColor Nedir?
OutLineColor, bir metin nesnesinin etrafına renkli bir çerçeve (outline) eklemeye yarayan bir özelliktir. Bu sayede metin, arka plan rengine karışmadan daha net ve okunabilir bir şekilde görünür. Özellikle py GUI tabanlı arayüzlerde bu özellik büyük fark yaratır.
Neden OutLineColor Kullanmalıyız?
Oyun içi arayüzlerde metinlerin arka planla karışmaması, oyuncunun dikkatini dağıtmaması çok önemlidir. OutLineColor sayesinde beyaz ya da açık renkli arka planlarda siyah metin gibi durumlar engellenir. Bu, özellikle uiscript dosyalarında metin nesnelerinin tanımında büyük kolaylık sağlar.
Uygulama Adımları
1. Öncelikle client/src/ui/TextLine.cpp ve TextLine.h dosyalarında gerekli değişiklikleri yapmalısınız.
2. Header dosyasına DWORD m_OutlineColor; değişkenini ve SetOutlineColor(DWORD color) metodunu ekleyin.
3. CPP dosyasında bu fonksiyonun içeriğini tanımlayın. Renk değerini alıp çizim sırasında kullanacak şekilde ayarlayın.
4. PyObject üzerinden bu özelliği Python tarafında kullanabilmek için ui.py dosyasında gerekli bağlamayı yapın.
Not: Bu işlem sırasında C++ kaynak kod bilgisi gerektiği için dikkatli ilerlenmelidir. Yanlış kodlama, oyunun çökmesine neden olabilir.
Faydaları
- Daha net ve okunabilir metinler.
- Arayüz estetiğinin artırılması.
- Oyuncu deneyimine doğrudan katkı sağlanması.
- Metin2 server src projelerinde görsellik kalitesi artışı.
Sonuç
TextLine için OutLineColor uzantısı, özellikle Metin2 özel sunucu geliştiricileri için oldukça değerli bir özelliktir. Görsel açıdan fark yaratan bu küçük ama etkili değişiklik, arayüz kalitenizi ciddi şekilde yükseltir. Bu uzantıyı doğru şekilde uygulamak, hem teknik hem de estetik açıdan profesyonel bir izlenim bırakır.
What is the OutLineColor Extension for TextLine?
In Metin2 private servers, enhancing user interface elements significantly improves the player experience. In this context, the OutLineColor extension for the TextLine object provides a visually distinct effect around text elements. This article will detail how to add the OutLineColor extension to the TextLine object and discuss its benefits.
What is OutLineColor?
OutLineColor is a feature that adds a colored outline around a text object, making the text more visible and readable against various backgrounds. This is especially useful in py GUI-based interfaces.
Why Should We Use OutLineColor?
In-game UIs must ensure text does not blend into the background, which could distract players. With OutLineColor, issues like black text on white backgrounds are avoided, significantly improving readability in uiscript files.
Implementation Steps
1. Modify client/src/ui/TextLine.cpp and TextLine.h files accordingly.
2. Add the DWORD m_OutlineColor; variable and the SetOutlineColor(DWORD color) method to the header file.
3. Implement the function in the CPP file to retrieve the color value and use it during rendering.
4. Bind this functionality in Python by updating ui.py to access this feature via PyObject.
Note: This process requires C++ source code knowledge. Incorrect implementation may cause the game to crash.
Benefits
- Clearer and more readable texts.
- Enhanced UI aesthetics.
- Direct contribution to player experience.
- Improved visual quality in Metin2 server src projects.
Conclusion
The OutLineColor extension for TextLine is highly valuable for developers working on Metin2 private servers. This small but impactful change enhances both technical and aesthetic aspects of your project, providing a more professional look and feel.
