Merge branch 'master' into opengl3

This commit is contained in:
numzero 2023-03-03 21:52:25 +03:00
commit ceb53be9e3
4 changed files with 23 additions and 49 deletions

@ -963,11 +963,11 @@ public:
#endif #endif
if (sizeof(wchar_t) == 4) if (sizeof(wchar_t) == 4)
append(reinterpret_cast<const uchar32_t* const>(c)); append(reinterpret_cast<const uchar32_t*>(c));
else if (sizeof(wchar_t) == 2) else if (sizeof(wchar_t) == 2)
append(reinterpret_cast<const uchar16_t* const>(c)); append(reinterpret_cast<const uchar16_t*>(c));
else if (sizeof(wchar_t) == 1) else if (sizeof(wchar_t) == 1)
append(reinterpret_cast<const uchar8_t* const>(c)); append(reinterpret_cast<const uchar8_t*>(c));
} }
@ -982,11 +982,11 @@ public:
#endif #endif
if (sizeof(wchar_t) == 4) if (sizeof(wchar_t) == 4)
append(reinterpret_cast<const uchar32_t* const>(c), length); append(reinterpret_cast<const uchar32_t*>(c), length);
else if (sizeof(wchar_t) == 2) else if (sizeof(wchar_t) == 2)
append(reinterpret_cast<const uchar16_t* const>(c), length); append(reinterpret_cast<const uchar16_t*>(c), length);
else if (sizeof(wchar_t) == 1) else if (sizeof(wchar_t) == 1)
append(reinterpret_cast<const uchar8_t* const>(c), length); append(reinterpret_cast<const uchar8_t*>(c), length);
} }
@ -1116,11 +1116,11 @@ public:
ustring16& operator=(const wchar_t* const c) ustring16& operator=(const wchar_t* const c)
{ {
if (sizeof(wchar_t) == 4) if (sizeof(wchar_t) == 4)
*this = reinterpret_cast<const uchar32_t* const>(c); *this = reinterpret_cast<const uchar32_t*>(c);
else if (sizeof(wchar_t) == 2) else if (sizeof(wchar_t) == 2)
*this = reinterpret_cast<const uchar16_t* const>(c); *this = reinterpret_cast<const uchar16_t*>(c);
else if (sizeof(wchar_t) == 1) else if (sizeof(wchar_t) == 1)
*this = reinterpret_cast<const uchar8_t* const>(c); *this = reinterpret_cast<const uchar8_t*>(c);
return *this; return *this;
} }
@ -3049,14 +3049,14 @@ public:
//! Gets the encoding of the Unicode string this class contains. //! Gets the encoding of the Unicode string this class contains.
//! \return An enum describing the current encoding of this string. //! \return An enum describing the current encoding of this string.
const unicode::EUTF_ENCODE getEncoding() const unicode::EUTF_ENCODE getEncoding() const
{ {
return encoding; return encoding;
} }
//! Gets the endianness of the Unicode string this class contains. //! Gets the endianness of the Unicode string this class contains.
//! \return An enum describing the endianness of this string. //! \return An enum describing the endianness of this string.
const unicode::EUTF_ENDIAN getEndianness() const unicode::EUTF_ENDIAN getEndianness() const
{ {
if (encoding == unicode::EUTFE_UTF16_LE || if (encoding == unicode::EUTFE_UTF16_LE ||
encoding == unicode::EUTFE_UTF32_LE) encoding == unicode::EUTFE_UTF32_LE)
@ -3612,33 +3612,5 @@ inline std::wostream& operator<<(std::wostream& out, const ustring16& in)
return out; return out;
} }
namespace unicode
{
//! Hashing algorithm for hashing a ustring. Used for things like unordered_maps.
//! Algorithm taken from std::hash<std::string>.
class hash : public std::unary_function<core::ustring, size_t>
{
public:
size_t operator()(const core::ustring& s) const
{
size_t ret = 2166136261U;
size_t index = 0;
size_t stride = 1 + s.size_raw() / 10;
core::ustring::const_iterator i = s.begin();
while (i != s.end())
{
// TODO: Don't force u32 on an x64 OS. Make it agnostic.
ret = 16777619U * ret ^ (size_t)s[(u32)index];
index += stride;
i += stride;
}
return (ret);
}
};
} // end namespace unicode
} // end namespace core } // end namespace core
} // end namespace irr } // end namespace irr

@ -413,6 +413,9 @@ namespace irr
bool HasNetWM; bool HasNetWM;
// text is utf-8 // text is utf-8
mutable core::stringc Clipboard; mutable core::stringc Clipboard;
#endif
#if defined(_IRR_LINUX_X11_XINPUT2_)
int currentTouchedCount;
#endif #endif
u32 Width, Height; u32 Width, Height;
bool WindowHasFocus; bool WindowHasFocus;
@ -453,10 +456,6 @@ namespace irr
}; };
core::array<JoystickInfo> ActiveJoysticks; core::array<JoystickInfo> ActiveJoysticks;
#endif #endif
#if defined(_IRR_LINUX_X11_XINPUT2_)
int currentTouchedCount;
#endif
}; };

@ -345,13 +345,16 @@ void CIrrDeviceSDL::logAttributes()
bool CIrrDeviceSDL::createWindow() bool CIrrDeviceSDL::createWindow()
{ {
if (CreationParams.Fullscreen) { if (CreationParams.Fullscreen) {
#ifdef _IRR_EMSCRIPTEN_PLATFORM_
SDL_Flags |= SDL_WINDOW_FULLSCREEN; SDL_Flags |= SDL_WINDOW_FULLSCREEN;
} else { #else
if (Resizable) SDL_Flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
SDL_Flags |= SDL_WINDOW_RESIZABLE; #endif
if (CreationParams.WindowMaximized)
SDL_Flags |= SDL_WINDOW_MAXIMIZED;
} }
if (Resizable)
SDL_Flags |= SDL_WINDOW_RESIZABLE;
if (CreationParams.WindowMaximized)
SDL_Flags |= SDL_WINDOW_MAXIMIZED;
SDL_Flags |= SDL_WINDOW_OPENGL; SDL_Flags |= SDL_WINDOW_OPENGL;
#ifdef _IRR_EMSCRIPTEN_PLATFORM_ #ifdef _IRR_EMSCRIPTEN_PLATFORM_

@ -12,7 +12,7 @@ namespace io
CWriteFile::CWriteFile(const io::path& fileName, bool append) CWriteFile::CWriteFile(const io::path& fileName, bool append)
: FileSize(0), Filename(fileName) : Filename(fileName), FileSize(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CWriteFile"); setDebugName("CWriteFile");