arset=UTF-8 Last-Modified: Mon, 30 Nov 2026 18:13:30 GMT Expires: Thu, 27 Nov 2036 18:13:30 GMT advtrains.git - Advtrains mod for minetest.
aboutsummaryrefslogtreecommitdiff
BranchCommit messageAuthorAge
atcjitAdd scheduling commandsywang5 years
docFix signal directionY. Wang4 years
l10nRemove line numbers from translation filesupdate-translations.sh24 months
luaatcdebugAdd commands for dangerous mode.Gabriel Pérez-Cerezo5 years
masterUpdate the train copy/paste tool to include more wagon data.Marnack5 months
profilerMore profiling instructionsorwell967 years
timetableMore translations and fixesorwell15 months
tracyMore tracy wrappers for path/LZB-related functionsY. Wang2 years
trainhudoxipngY. Wang2 years
trainhud-unifontAdd workarounds to not break MT 5.3.0 compatY. Wang5 years
 
TagDownloadAuthorAge
release-2.9.0commit 1f36bea5f8...orwell8 months
release-2.8.3commit d6469df4c7...orwell14 months
release-2.8.2commit 0301f28315...orwell14 months
release-2.8.1commit f7d757b9a5...orwell14 months
release-2.8.0commit 558f1c4c1c...orwell14 months
release-2.7.1commit 382f4204e0...orwell15 months
release-2.7.0commit f06cbfee26...maxchen3215 months
release-2.6.0commit adc01a0bba...orwell19 months
release-2.5.0commit c974e70fde...orwell20 months
release-2.4.7commit 3d2d19f6f7...Maverick27972 years
release-2.4.6commit 882108e8bf...1F616EMO2 years
release-2.4.5commit 46fbf89acf...gpcf2 years
release-2.4.4commit 4cfd07e992...orwell2 years
release-2.4.3commit 2884ed3e27...orwell963 years
release-2.4.2commit cad4809b99...Maverick27974 years
release-1.xcommit 44000dd796...orwell965 years
release-2.4.1commit f27640ee27...ywang5 years
release-2.4.0commit 358bff47b2...orwell965 years
release-2.3.1commit e506086011...orwell966 years
release-2.3.0commit 5aa700c3ab...orwell966 years// Copyright (C) 2002-2012 Nikolaus Gebhardt // Copyright (C) 2016 Nathanaël Courant // Modified this class to work with EnrichedStrings too // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __C_GUI_STATIC_TEXT_H_INCLUDED__ #define __C_GUI_STATIC_TEXT_H_INCLUDED__ #include "IrrCompileConfig.h" #ifdef _IRR_COMPILE_WITH_GUI_ #include "IGUIStaticText.h" #include "irrArray.h" #include "log.h" #include <vector> #include "util/enriched_string.h" #include "config.h" #include <IGUIEnvironment.h> #if USE_FREETYPE namespace irr { namespace gui { const EGUI_ELEMENT_TYPE EGUIET_ENRICHED_STATIC_TEXT = (EGUI_ELEMENT_TYPE)(0x1000); class StaticText : public IGUIStaticText { public: //! constructor StaticText(const EnrichedString &text, bool border, IGUIEnvironment* environment, IGUIElement* parent, s32 id, const core::rect<s32>& rectangle, bool background = false); //! destructor virtual ~StaticText(); //! draws the element and its children virtual void draw(); //! Sets another skin independent font. virtual void setOverrideFont(IGUIFont* font=0); //! Gets the override font (if any) virtual IGUIFont* getOverrideFont() const; //! Get the font which is used right now for drawing virtual IGUIFont* getActiveFont() const; //! Sets another color for the text. virtual void setOverrideColor(video::SColor color); //! Sets another color for the background. virtual void setBackgroundColor(video::SColor color); //! Sets whether to draw the background virtual void setDrawBackground(bool draw); //! Gets the background color virtual video::SColor getBackgroundColor() const; //! Checks if background drawing is enabled virtual bool isDrawBackgroundEnabled() const; //! Sets whether to draw the border virtual void setDrawBorder(bool draw); //! Checks if border drawing is enabled virtual bool isDrawBorderEnabled() const; //! Sets alignment mode for text virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical); //! Gets the override color #if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 7 virtual const video::SColor& getOverrideColor() const; #else virtual video::SColor getOverrideColor() const; #endif //! Sets if the static text should use the overide color or the //! color in the gui skin. virtual void enableOverrideColor(bool enable); //! Checks if an override color is enabled virtual bool isOverrideColorEnabled() const; //! Set whether the text in this label should be clipped if it goes outside bounds virtual void setTextRestrainedInside(bool restrainedInside); //! Checks if the text in this label should be clipped if it goes outside bounds virtual bool isTextRestrainedInside() const; //! Enables or disables word wrap for using the static text as //! multiline text control. virtual void setWordWrap(bool enable); //! Checks if word wrap is enabled virtual bool isWordWrapEnabled() const; //! Sets the new caption of this element. virtual void setText(const wchar_t* text); //! Returns the height of the text in pixels when it is drawn. virtual s32 getTextHeight() const; //! Returns the width of the current text, in the current font virtual s32 getTextWidth() const; //! Updates the absolute position, splits text if word wrap is enabled virtual void updateAbsolutePosition(); //! Set whether the string should be interpreted as right-to-left (RTL) text /** \note This component does not implement the Unicode bidi standard, the text of the component should be already RTL if you call this. The main difference when RTL is enabled is that the linebreaks for multiline elements are performed starting from the end. */ virtual void setRightToLeft(bool rtl); //! Checks if the text should be interpreted as right-to-left text virtual bool isRightToLeft() const; //! Writes attributes of the element. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const; //! Reads attributes of the element virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); virtual bool hasType(EGUI_ELEMENT_TYPE t) const { return (t == EGUIET_ENRICHED_STATIC_TEXT) || (t == EGUIET_STATIC_TEXT); }; virtual bool hasType(EGUI_ELEMENT_TYPE t) { return (t == EGUIET_ENRICHED_STATIC_TEXT) || (t == EGUIET_STATIC_TEXT); }; void setText(const EnrichedString &text); private: //! Breaks the single text line. void breakText(); EGUI_ALIGNMENT HAlign, VAlign; bool Border; bool OverrideColorEnabled; bool OverrideBGColorEnabled; bool WordWrap; bool Background; bool RestrainTextInside; bool RightToLeft; video::SColor OverrideColor, BGColor; gui::IGUIFont* OverrideFont; gui::IGUIFont* LastBreakFont; // stored because: if skin changes, line break must be recalculated. EnrichedString cText; core::array< EnrichedString > BrokenText; }; } // end namespace gui } // end namespace irr inline irr::gui::IGUIStaticText *addStaticText( irr::gui::IGUIEnvironment *guienv, const EnrichedString &text, const core::rect< s32 > &rectangle, bool border = false, bool wordWrap = true, irr::gui::IGUIElement *parent = NULL, s32 id = -1, bool fillBackground = false) { if (parent == NULL) { // parent is NULL, so we must find one, or we need not to drop // result, but then there will be a memory leak. // // What Irrlicht does is to use guienv as a parent, but the problem // is that guienv is here only an IGUIEnvironment, while it is a // CGUIEnvironment in Irrlicht, which inherits from both IGUIElement // and IGUIEnvironment. // // A solution would be to dynamic_cast guienv to a // IGUIElement*, but Irrlicht is shipped without rtti support // in some distributions, causing the dymanic_cast to segfault. // // Thus, to find the parent, we create a dummy StaticText and ask // for its parent, and then remove it. irr::gui::IGUIStaticText *dummy_text = guienv->addStaticText(L"", rectangle, border, wordWrap, parent, id, fillBackground); parent = dummy_text->getParent(); dummy_text->remove(); } irr::gui::IGUIStaticText *result = new irr::gui::StaticText( text, border, guienv, parent, id, rectangle, fillBackground); result->setWordWrap(wordWrap); result->drop(); return result; } inline void setStaticText(irr::gui::IGUIStaticText *static_text, const EnrichedString &text) { // dynamic_cast not possible due to some distributions shipped // without rtti support in irrlicht if (static_text->hasType(irr::gui::EGUIET_ENRICHED_STATIC_TEXT)) { irr::gui::StaticText* stext = static_cast<irr::gui::StaticText*>(static_text); stext->setText(text); } else { static_text->setText(text.c_str()); } } #else // USE_FREETYPE inline irr::gui::IGUIStaticText *addStaticText( irr::gui::IGUIEnvironment *guienv, const EnrichedString &text, const core::rect< s32 > &rectangle, bool border = false, bool wordWrap = true, irr::gui::IGUIElement *parent = NULL, s32 id = -1, bool fillBackground = false) { return guienv->addStaticText(text.c_str(), rectangle, border, wordWrap, parent, id, fillBackground); } inline void setStaticText(irr::gui::IGUIStaticText *static_text, const EnrichedString &text) { static_text->setText(text.c_str()); } #endif inline irr::gui::IGUIStaticText *addStaticText( irr::gui::IGUIEnvironment *guienv, const wchar_t *text, const core::rect< s32 > &rectangle, bool border = false, bool wordWrap = true, irr::gui::IGUIElement *parent = NULL, s32 id = -1, bool fillBackground = false) { return addStaticText(guienv, EnrichedString(text), rectangle, border, wordWrap, parent, id, fillBackground); } inline void setStaticText(irr::gui::IGUIStaticText *static_text, const wchar_t *text) { setStaticText(static_text, EnrichedString(text)); } #endif // _IRR_COMPILE_WITH_GUI_ #endif // C_GUI_STATIC_TEXT_H_INCLUDED