From 544d6d8591eb6a1f9a0c6649ffced5962147c060 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Sun, 6 Jan 2019 02:19:54 +0500 Subject: [PATCH] xrUICore/Static/UIStatic.h: returned some deleted script export Now you can launch Clear Sky (only main menu for now) --- src/xrUICore/Static/UIStatic.h | 29 ++++++++++++++++++ src/xrUICore/Static/UIStatic_script.cpp | 40 ++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/src/xrUICore/Static/UIStatic.h b/src/xrUICore/Static/UIStatic.h index 64139afcf95..e4e5108fa5f 100644 --- a/src/xrUICore/Static/UIStatic.h +++ b/src/xrUICore/Static/UIStatic.h @@ -39,6 +39,34 @@ class XRUICORE_API CUIStatic : public CUIWindow, public ITextureOwner, public CU virtual void Update(); virtual void OnFocusLost(); + virtual pcstr GetText() { return TextItemControl()->GetText(); } + virtual void SetText(pcstr txt) { TextItemControl()->SetText(txt); } + virtual void SetTextST(pcstr txt) { TextItemControl()->SetTextST(txt); } + + void SetTextColor_script(int a, int r, int g, int b) + { + TextItemControl()->SetTextColor(color_argb(a, r, g, b)); + } + + u32 GetTextAlign_script() + { + return static_cast(TextItemControl()->GetTextAlignment()); + } + + void SetTextAlign_script(u32 align) + { + TextItemControl()->SetTextAlignment((CGameFont::EAligment)align); + TextItemControl()->GetFont()->SetAligment((CGameFont::EAligment)align); + } + + virtual void SetTextX(float text_x) { TextItemControl()->m_TextOffset.x = text_x; } + virtual void SetTextY(float text_y) { TextItemControl()->m_TextOffset.y = text_y; } + virtual float GetTextX() { return TextItemControl()->m_TextOffset.x; } + virtual float GetTextY() { return TextItemControl()->m_TextOffset.y; } + + virtual void SetColor(u32 color) { m_UIStaticItem.SetColor(color); } + virtual u32 GetColor() const { return m_UIStaticItem.GetColor(); } + virtual void CreateShader(LPCSTR tex, LPCSTR sh = "hud" DELIMITER "default"); ui_shader& GetShader() { return m_UIStaticItem.GetShader(); }; virtual void SetTextureColor(u32 color) { m_UIStaticItem.SetTextureColor(color); } @@ -73,6 +101,7 @@ class XRUICORE_API CUIStatic : public CUIWindow, public ITextureOwner, public CU CUIStaticItem& GetUIStaticItem() { return m_UIStaticItem; } void SetStretchTexture(bool stretch_texture) { m_bStretchTexture = stretch_texture; } bool GetStretchTexture() { return m_bStretchTexture; } + void SetEllipsis(int pos, int indent) { TextItemControl()->SetEllipsis(pos != 0); } void SetHeading(float f) { m_fHeading = f; }; float GetHeading() { return m_fHeading; } bool Heading() { return m_bHeading; } diff --git a/src/xrUICore/Static/UIStatic_script.cpp b/src/xrUICore/Static/UIStatic_script.cpp index 15f1257b9f9..5c8b1e807bc 100644 --- a/src/xrUICore/Static/UIStatic_script.cpp +++ b/src/xrUICore/Static/UIStatic_script.cpp @@ -25,12 +25,50 @@ SCRIPT_EXPORT(CUIStatic, (CUIWindow), [ class_("CUIStatic") .def(constructor<>()) + .def("TextControl", &CUIStatic::TextItemControl) + + .def("SetText", (void (CUIStatic::*)(LPCSTR)) (&CUIStatic::SetText)) + .def("SetTextST", (void (CUIStatic::*)(LPCSTR)) (&CUIStatic::SetTextST)) + + .def("GetText", &CUIStatic::GetText) + + .def("SetTextX", &CUIStatic::SetTextX) + .def("SetTextY", &CUIStatic::SetTextY) + .def("GetTextX", &CUIStatic::GetTextX) + .def("GetTextY", &CUIStatic::GetTextY) + + .def("SetColor", &CUIStatic::SetColor) + .def("GetColor", &CUIStatic::GetColor) + + .def("SetTextColor", &CUIStatic::SetTextColor_script) + .def("InitTexture", &CUIStatic::InitTexture) .def("InitTextureEx", &CUIStatic::InitTextureEx) + + .def("SetTextureOffset", &CUIStatic::SetTextureOffset) + .def("SetTextureRect", &CUIStatic::SetTextureRect_script) - .def("SetStretchTexture", &CUIStatic::SetStretchTexture) .def("GetTextureRect", &CUIStatic::GetTextureRect_script) + + .def("SetOriginalRect", &CUIStatic::SetTextureRect_script) + .def("GetOriginalRect", &CUIStatic::GetTextureRect_script) + + .def("SetStretchTexture", &CUIStatic::SetStretchTexture) + .def("GetStretchTexture", &CUIStatic::GetStretchTexture) + + .def("SetTextAlign", &CUIStatic::SetTextAlign_script) + .def("GetTextAlign", &CUIStatic::GetTextAlign_script) + + .def("SetHeading", &CUIStatic::SetHeading) + .def("GetHeading", &CUIStatic::GetHeading) + + //.def("ClipperOn", &CUIStatic::ClipperOn) + //.def("ClipperOff", (void(CUIStatic::*)(void))&CUIStatic::ClipperOff) + + //.def("GetClipperState", &CUIStatic::GetClipperState) + + .def("SetElipsis", &CUIStatic::SetEllipsis) ]; });