1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-30 19:22:14 +00:00

Remove irr namespace (#16309)

This commit is contained in:
Lars Müller 2025-07-09 10:35:52 +02:00 committed by GitHub
parent 7e22c72492
commit 61551cfc3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
381 changed files with 680 additions and 1632 deletions

View file

@ -236,25 +236,25 @@ public:
return def;
}
irr::core::rect<s32> getRect(Property prop, irr::core::rect<s32> def) const
core::rect<s32> getRect(Property prop, core::rect<s32> def) const
{
const auto &val = properties[prop];
if (val.empty())
return def;
irr::core::rect<s32> rect;
core::rect<s32> rect;
if (!parseRect(val, &rect))
return def;
return rect;
}
irr::core::rect<s32> getRect(Property prop) const
core::rect<s32> getRect(Property prop) const
{
const auto &val = properties[prop];
FATAL_ERROR_IF(val.empty(), "Unexpected missing property");
irr::core::rect<s32> rect;
core::rect<s32> rect;
parseRect(val, &rect);
return rect;
}
@ -416,25 +416,25 @@ private:
return true;
}
bool parseRect(const std::string &value, irr::core::rect<s32> *parsed_rect) const
bool parseRect(const std::string &value, core::rect<s32> *parsed_rect) const
{
irr::core::rect<s32> rect;
core::rect<s32> rect;
std::vector<std::string> v_rect = split(value, ',');
if (v_rect.size() == 1) {
s32 x = stoi(v_rect[0]);
rect.UpperLeftCorner = irr::core::vector2di(x, x);
rect.LowerRightCorner = irr::core::vector2di(-x, -x);
rect.UpperLeftCorner = core::vector2di(x, x);
rect.LowerRightCorner = core::vector2di(-x, -x);
} else if (v_rect.size() == 2) {
s32 x = stoi(v_rect[0]);
s32 y = stoi(v_rect[1]);
rect.UpperLeftCorner = irr::core::vector2di(x, y);
rect.LowerRightCorner = irr::core::vector2di(-x, -y);
rect.UpperLeftCorner = core::vector2di(x, y);
rect.LowerRightCorner = core::vector2di(-x, -y);
// `-x` is interpreted as `w - x`
} else if (v_rect.size() == 4) {
rect.UpperLeftCorner = irr::core::vector2di(
rect.UpperLeftCorner = core::vector2di(
stoi(v_rect[0]), stoi(v_rect[1]));
rect.LowerRightCorner = irr::core::vector2di(
rect.LowerRightCorner = core::vector2di(
stoi(v_rect[2]), stoi(v_rect[3]));
} else {
warningstream << "Invalid rectangle string format: \"" << value

View file

@ -4,7 +4,6 @@
#include <IGUIElement.h>
#include <IGUIEnvironment.h>
using namespace irr;
class ISimpleTextureSource;

View file

@ -21,7 +21,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <IGUIEnvironment.h>
#include "irr_v2d.h"
using namespace irr;
class ISimpleTextureSource;

View file

@ -8,7 +8,6 @@
#include <IGUIElement.h>
#include <IGUIEnvironment.h>
using namespace irr;
class GUIBox : public gui::IGUIElement
{

View file

@ -15,7 +15,7 @@
#include "StyleSpec.h"
#include "util/numeric.h"
using namespace irr;
using namespace gui;
// Multiply with a color to get the default corresponding hovered color
@ -744,8 +744,8 @@ void GUIButton::setFromStyle(const StyleSpec& style)
IGUISkin *skin = Environment->getSkin();
core::vector2d<s32> defaultPressOffset(
skin->getSize(irr::gui::EGDS_BUTTON_PRESSED_IMAGE_OFFSET_X),
skin->getSize(irr::gui::EGDS_BUTTON_PRESSED_IMAGE_OFFSET_Y));
skin->getSize(gui::EGDS_BUTTON_PRESSED_IMAGE_OFFSET_X),
skin->getSize(gui::EGDS_BUTTON_PRESSED_IMAGE_OFFSET_Y));
ContentOffset = style.getVector2i(StyleSpec::CONTENT_OFFSET, isPressed()
? defaultPressOffset
: core::vector2d<s32>(0));

View file

@ -12,7 +12,6 @@
#include "SColor.h"
#include "StyleSpec.h"
using namespace irr;
class ISimpleTextureSource;

View file

@ -11,7 +11,7 @@
#include "IVideoDriver.h"
#include "StyleSpec.h"
using namespace irr;
using namespace gui;
GUIButtonImage::GUIButtonImage(gui::IGUIEnvironment *environment,

View file

@ -9,7 +9,6 @@
#include "guiAnimatedImage.h"
#include "irr_ptr.h"
using namespace irr;
class GUIButtonImage : public GUIButton
{

View file

@ -9,7 +9,7 @@
#include "IGUIEnvironment.h"
#include "itemdef.h"
using namespace irr;
using namespace gui;
GUIButtonItemImage::GUIButtonItemImage(gui::IGUIEnvironment *environment,

View file

@ -7,7 +7,6 @@
#include "guiButton.h"
#include "IGUIButton.h"
using namespace irr;
class Client;
class GUIItemImage;

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include "guiButtonKey.h"
using namespace irr::gui;
using namespace gui;
GUIButtonKey *GUIButtonKey::addButton(IGUIEnvironment *environment,
const core::rect<s32> &rectangle, ISimpleTextureSource *tsrc,

View file

@ -8,7 +8,6 @@
#include "util/string.h"
#include "gettext.h"
using namespace irr;
class GUIButtonKey : public GUIButton
{

View file

@ -24,7 +24,7 @@ inline u32 clamp_u8(s32 value)
return (u32) MYMIN(MYMAX(value, 0), 255);
}
inline bool isInCtrlKeys(const irr::EKEY_CODE& kc)
inline bool isInCtrlKeys(const EKEY_CODE& kc)
{
return kc == KEY_LCONTROL || kc == KEY_RCONTROL || kc == KEY_CONTROL;
}
@ -332,7 +332,7 @@ void GUIChatConsole::drawText()
core::rect<s32> destrect(
x, y, x + m_fontsize.X * fragment.text.size(), y + m_fontsize.Y);
if (m_font->getType() == irr::gui::EGFT_CUSTOM) {
if (m_font->getType() == gui::EGFT_CUSTOM) {
// Draw colored text if possible
auto *tmp = static_cast<gui::CGUITTFont*>(m_font.get());
tmp->draw(

View file

@ -707,7 +707,7 @@ void GUIEditBox::inputString(const core::stringw &str)
bool GUIEditBox::processMouse(const SEvent &event)
{
switch (event.MouseInput.Event) {
case irr::EMIE_LMOUSE_LEFT_UP:
case EMIE_LMOUSE_LEFT_UP:
if (Environment->hasFocus(this)) {
m_cursor_pos = getCursorPos(
event.MouseInput.X, event.MouseInput.Y);
@ -719,7 +719,7 @@ bool GUIEditBox::processMouse(const SEvent &event)
return true;
}
break;
case irr::EMIE_MOUSE_MOVED: {
case EMIE_MOUSE_MOVED: {
if (m_mouse_marking) {
m_cursor_pos = getCursorPos(
event.MouseInput.X, event.MouseInput.Y);

View file

@ -10,8 +10,8 @@
#include "guiScrollBar.h"
#include <vector>
using namespace irr;
using namespace irr::gui;
using namespace gui;
class GUIEditBox : public IGUIEditBox
{

View file

@ -503,7 +503,7 @@ void GUIEditBoxWithScrollBar::calculateScrollPos()
return;
// get cursor area
irr::u32 cursor_width = font->getDimension(L"_").Width;
u32 cursor_width = font->getDimension(L"_").Width;
core::stringw *txt_line = has_broken_text ? &m_broken_text[curs_line] : &Text;
s32 cpos = has_broken_text ? m_cursor_pos - m_broken_text_positions[curs_line] : m_cursor_pos; // column
s32 cstart = font->getDimension(txt_line->subString(0, cpos).c_str()).Width; // pixels from text-start
@ -534,9 +534,9 @@ void GUIEditBoxWithScrollBar::calculateScrollPos()
// calculate vertical scrolling
if (has_broken_text) {
irr::u32 line_height = font->getDimension(L"A").Height + font->getKerning(L'A').Y;
u32 line_height = font->getDimension(L"A").Height + font->getKerning(L'A').Y;
// only up to 1 line fits?
if (line_height >= (irr::u32)m_frame_rect.getHeight()) {
if (line_height >= (u32)m_frame_rect.getHeight()) {
m_vscroll_pos = 0;
setTextRect(curs_line);
s32 unscrolledPos = m_current_text_rect.UpperLeftCorner.Y;
@ -627,7 +627,7 @@ void GUIEditBoxWithScrollBar::createVScrollBar()
m_scrollbar_width = skin ? skin->getSize(gui::EGDS_SCROLLBAR_SIZE) : 16;
irr::core::rect<s32> scrollbarrect = m_frame_rect;
core::rect<s32> scrollbarrect = m_frame_rect;
scrollbarrect.UpperLeftCorner.X += m_frame_rect.getWidth() - m_scrollbar_width;
m_vscrollbar = new GUIScrollBar(Environment, getParent(), -1,
scrollbarrect, false, true, m_tsrc);
@ -650,5 +650,5 @@ bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled() const { return false; }
bool GUIEditBoxWithScrollBar::isDrawBorderEnabled() const { return false; }
void GUIEditBoxWithScrollBar::setCursorChar(const wchar_t cursorChar) { }
wchar_t GUIEditBoxWithScrollBar::getCursorChar() const { return '|'; }
void GUIEditBoxWithScrollBar::setCursorBlinkTime(irr::u32 timeMs) { }
irr::u32 GUIEditBoxWithScrollBar::getCursorBlinkTime() const { return 500; }
void GUIEditBoxWithScrollBar::setCursorBlinkTime(u32 timeMs) { }
u32 GUIEditBoxWithScrollBar::getCursorBlinkTime() const { return 500; }

View file

@ -37,8 +37,8 @@ public:
virtual bool isDrawBorderEnabled() const;
virtual void setCursorChar(const wchar_t cursorChar);
virtual wchar_t getCursorChar() const;
virtual void setCursorBlinkTime(irr::u32 timeMs);
virtual irr::u32 getCursorBlinkTime() const;
virtual void setCursorBlinkTime(u32 timeMs);
virtual u32 getCursorBlinkTime() const;
protected:
//! Breaks the single text line.

View file

@ -317,7 +317,7 @@ void GUIEngine::run()
fog_end, fog_density, fog_pixelfog, fog_rangefog);
}
const irr::core::dimension2d<u32> initial_screen_size(
const core::dimension2d<u32> initial_screen_size(
g_settings->getU16("screen_w"),
g_settings->getU16("screen_h")
);

View file

@ -254,7 +254,7 @@ private:
void setTopleftText(const std::string &text);
/** pointer to gui element shown at topleft corner */
irr::gui::IGUIStaticText *m_irr_toplefttext = nullptr;
gui::IGUIStaticText *m_irr_toplefttext = nullptr;
/** and text that is in it */
EnrichedString m_toplefttext;

View file

@ -1505,7 +1505,7 @@ void GUIFormSpecMenu::parsePwdField(parserData* data, const std::string &element
e->setOverrideColor(style.getColor(StyleSpec::TEXTCOLOR, video::SColor(0xFFFFFFFF)));
e->setOverrideFont(style.getFont());
irr::SEvent evt;
SEvent evt;
evt.EventType = EET_KEY_INPUT_EVENT;
evt.KeyInput.Key = KEY_END;
evt.KeyInput.Char = 0;
@ -1560,7 +1560,7 @@ void GUIFormSpecMenu::createTextField(parserData *data, FieldSpec &spec,
e->setWordWrap(true);
e->setTextAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_UPPERLEFT);
} else {
irr::SEvent evt;
SEvent evt;
evt.EventType = EET_KEY_INPUT_EVENT;
evt.KeyInput.Key = KEY_END;
evt.KeyInput.Char = 0;
@ -2137,8 +2137,8 @@ void GUIFormSpecMenu::parseTabHeader(parserData* data, const std::string &elemen
gui::IGUITabControl *e = Environment->addTabControl(rect,
data->current_parent, show_background, show_border, spec.fid);
e->setAlignment(irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_UPPERLEFT,
irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_LOWERRIGHT);
e->setAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_UPPERLEFT,
gui::EGUIA_UPPERLEFT, gui::EGUIA_LOWERRIGHT);
e->setTabHeight(geom.Y);
auto style = getDefaultStyleForElement("tabheader", name);
@ -3400,7 +3400,7 @@ void GUIFormSpecMenu::getAndroidUIInput()
return;
auto element_type = element->getType();
if (dialog_type == porting::TEXT_INPUT && element_type == irr::gui::EGUIET_EDIT_BOX) {
if (dialog_type == porting::TEXT_INPUT && element_type == gui::EGUIET_EDIT_BOX) {
gui::IGUIEditBox *editbox = (gui::IGUIEditBox *)element;
std::string text = porting::getInputDialogMessage();
editbox->setText(utf8_to_wide(text).c_str());
@ -3419,7 +3419,7 @@ void GUIFormSpecMenu::getAndroidUIInput()
editbox->getParent()->OnEvent(enter);
}
} else if (dialog_type == porting::SELECTION_INPUT &&
element_type == irr::gui::EGUIET_COMBO_BOX) {
element_type == gui::EGUIET_COMBO_BOX) {
auto dropdown = (gui::IGUIComboBox *) element;
int selected = porting::getInputDialogSelection();
dropdown->setAndSendSelected(selected);
@ -3631,7 +3631,7 @@ void GUIFormSpecMenu::drawMenu()
void GUIFormSpecMenu::showTooltip(const std::wstring &text,
const irr::video::SColor &color, const irr::video::SColor &bgcolor)
const video::SColor &color, const video::SColor &bgcolor)
{
EnrichedString ntext(text);
ntext.setDefaultColor(color);
@ -4024,7 +4024,7 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event)
}
}
if (event.EventType == irr::EET_JOYSTICK_INPUT_EVENT) {
if (event.EventType == EET_JOYSTICK_INPUT_EVENT) {
if (event.JoystickEvent.Joystick != m_joystick->getJoystickId())
return false;

View file

@ -136,8 +136,8 @@ class GUIFormSpecMenu : public GUIModalMenu
struct TooltipSpec
{
TooltipSpec() = default;
TooltipSpec(const std::wstring &a_tooltip, irr::video::SColor a_bgcolor,
irr::video::SColor a_color):
TooltipSpec(const std::wstring &a_tooltip, video::SColor a_bgcolor,
video::SColor a_color):
tooltip(translate_string(a_tooltip)),
bgcolor(a_bgcolor),
color(a_color)
@ -145,8 +145,8 @@ class GUIFormSpecMenu : public GUIModalMenu
}
std::wstring tooltip;
irr::video::SColor bgcolor;
irr::video::SColor color;
video::SColor bgcolor;
video::SColor color;
};
public:
@ -493,8 +493,8 @@ private:
void tryClose();
void trySubmitClose();
void showTooltip(const std::wstring &text, const irr::video::SColor &color,
const irr::video::SColor &bgcolor);
void showTooltip(const std::wstring &text, const video::SColor &color,
const video::SColor &bgcolor);
/**
* In formspec version < 2 the elements were not ordered properly. Some element

View file

@ -17,11 +17,11 @@
#include "mainmenumanager.h"
#include "porting.h"
using namespace irr::gui;
using namespace gui;
static bool check_color(const std::string &str)
{
irr::video::SColor color;
video::SColor color;
return parseColorString(str, color, false);
}
@ -359,7 +359,7 @@ void ParsedText::globalTag(const AttrsList &attrs)
else if (attr.second == "middle")
valign = ParsedText::VALIGN_MIDDLE;
} else if (attr.first == "background") {
irr::video::SColor color;
video::SColor color;
if (attr.second == "none") {
background_type = BACKGROUND_NONE;
} else if (parseColorString(attr.second, color, false)) {
@ -630,7 +630,7 @@ TextDrawer::TextDrawer(const wchar_t *text, Client *client,
if (e.font) {
e.dim.Width = e.font->getDimension(e.text.c_str()).Width;
e.dim.Height = e.font->getDimension(L"Yy").Height;
if (e.font->getType() == irr::gui::EGFT_CUSTOM) {
if (e.font->getType() == gui::EGFT_CUSTOM) {
CGUITTFont *tmp = static_cast<CGUITTFont*>(e.font);
e.baseline = e.dim.Height - 1 - tmp->getAscender() / 64;
}
@ -932,7 +932,7 @@ void TextDrawer::place(const core::rect<s32> &dest_rect)
void TextDrawer::draw(const core::rect<s32> &clip_rect,
const core::position2d<s32> &dest_offset)
{
irr::video::IVideoDriver *driver = m_guienv->getVideoDriver();
video::IVideoDriver *driver = m_guienv->getVideoDriver();
core::position2d<s32> offset = dest_offset;
offset.Y += m_voffset;
@ -948,7 +948,7 @@ void TextDrawer::draw(const core::rect<s32> &clip_rect,
switch (el.type) {
case ParsedText::ELEMENT_SEPARATOR:
case ParsedText::ELEMENT_TEXT: {
irr::video::SColor color = el.color;
video::SColor color = el.color;
for (auto tag : el.tags)
if (&(*tag) == m_hovertag)
@ -981,7 +981,7 @@ void TextDrawer::draw(const core::rect<s32> &clip_rect,
if (texture != 0)
m_guienv->getVideoDriver()->draw2DImage(
texture, rect,
irr::core::rect<s32>(
core::rect<s32>(
core::position2d<s32>(0, 0),
texture->getOriginalSize()),
&clip_rect, 0, true);
@ -1021,7 +1021,7 @@ GUIHyperText::GUIHyperText(const wchar_t *text, IGUIEnvironment *environment,
m_scrollbar_width = skin ? skin->getSize(gui::EGDS_SCROLLBAR_SIZE) : 16;
core::rect<s32> rect = irr::core::rect<s32>(
core::rect<s32> rect = core::rect<s32>(
RelativeRect.getWidth() - m_scrollbar_width, 0,
RelativeRect.getWidth(), RelativeRect.getHeight());

View file

@ -12,7 +12,6 @@
#include <IGUIEnvironment.h>
#include "irr_v3d.h"
using namespace irr;
class ISimpleTextureSource;
class Client;
@ -86,8 +85,8 @@ public:
gui::IGUIFont *font;
irr::video::SColor color;
irr::video::SColor hovercolor;
video::SColor color;
video::SColor hovercolor;
bool underline;
s32 baseline = 0;
@ -117,7 +116,7 @@ public:
s32 margin = 3;
ValignType valign = VALIGN_TOP;
BackgroundType background_type = BACKGROUND_NONE;
irr::video::SColor background_color;
video::SColor background_color;
Tag m_root_tag;

View file

@ -9,7 +9,6 @@
#include <IGUIEnvironment.h>
#include "irr_v2d.h"
using namespace irr;
class GUIFormSpecMenu;

View file

@ -7,7 +7,6 @@
#include <IGUIElement.h>
#include <IGUIEnvironment.h>
using namespace irr;
class Client;

View file

@ -274,7 +274,7 @@ void GUIPasswordChange::getAndroidUIInput()
e = getElementFromId(ID_newPassword2);
m_jni_field_name.clear();
if (!e || e->getType() != irr::gui::EGUIET_EDIT_BOX)
if (!e || e->getType() != gui::EGUIET_EDIT_BOX)
return;
std::string text = porting::getInputDialogMessage();

View file

@ -74,7 +74,7 @@ void GUIFileSelectMenu::acceptInput()
bool GUIFileSelectMenu::OnEvent(const SEvent &event)
{
if (event.EventType == irr::EET_GUI_EVENT) {
if (event.EventType == EET_GUI_EVENT) {
switch (event.GUIEvent.EventType) {
case gui::EGET_ELEMENT_CLOSED:
case gui::EGET_FILE_CHOOSE_DIALOG_CANCELLED:

View file

@ -10,7 +10,6 @@
#include <IGUIElement.h>
#include <IGUIEnvironment.h>
using namespace irr;
class GUIScene : public gui::IGUIElement
{

View file

@ -18,7 +18,7 @@ the arrow buttons where there is insufficient space.
class ISimpleTextureSource;
using namespace irr;
using namespace gui;
class GUIScrollBar : public IGUIElement

View file

@ -13,7 +13,7 @@
#include "IGUIEnvironment.h"
namespace irr::gui {
namespace gui {
class IGUIStaticText;
}

View file

@ -251,7 +251,7 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
gui::IGUIElement *hovered =
Environment->getRootGUIElement()->getElementFromPoint(
core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y));
if ((hovered) && (hovered->getType() == irr::gui::EGUIET_EDIT_BOX)) {
if ((hovered) && (hovered->getType() == gui::EGUIET_EDIT_BOX)) {
bool retval = hovered->OnEvent(event);
if (retval)
Environment->setFocus(hovered);

View file

@ -10,7 +10,7 @@
#include <IGUIFont.h>
#include "profiler.h"
namespace irr::video {
namespace video {
class IVideoDriver;
}

View file

@ -18,24 +18,22 @@
#include "util/basic_macros.h"
#include "client/keycode.h"
namespace irr
class IrrlichtDevice;
namespace gui
{
class IrrlichtDevice;
namespace gui
{
class IGUIEnvironment;
class IGUIImage;
class IGUIStaticText;
}
namespace video
{
class IVideoDriver;
}
class IGUIEnvironment;
class IGUIImage;
class IGUIStaticText;
}
namespace video
{
class IVideoDriver;
}
class ISimpleTextureSource;
using namespace irr::core;
using namespace irr::gui;
using namespace core;
using namespace gui;
enum class TapState

View file

@ -11,7 +11,7 @@
#include <unordered_map>
class ISimpleTextureSource;
namespace irr::gui
namespace gui
{
class IGUIButton;
class IGUIImage;

View file

@ -12,11 +12,11 @@
#include <unordered_map>
class ISimpleTextureSource;
namespace irr::gui
namespace gui
{
class IGUIStaticText;
}
namespace irr::video
namespace video
{
class ITexture;
}