Remove Nz::String and Nz::StringStream
This commit is contained in:
@@ -8,12 +8,12 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
String Keyboard::GetKeyName(Scancode scancode)
|
||||
std::string Keyboard::GetKeyName(Scancode scancode)
|
||||
{
|
||||
return EventImpl::GetKeyName(scancode);
|
||||
}
|
||||
|
||||
String Keyboard::GetKeyName(VKey key)
|
||||
std::string Keyboard::GetKeyName(VKey key)
|
||||
{
|
||||
return EventImpl::GetKeyName(key);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This file is part of the "Nazara Engine - Platform module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Platform/SDL2/InputImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Platform/Debug.hpp>
|
||||
#include <Nazara/Platform/SDL2/InputImpl.hpp>
|
||||
#include <Nazara/Platform/SDL2/SDLHelper.hpp>
|
||||
#include <Nazara/Platform/SDL2/WindowImpl.hpp>
|
||||
#include <Nazara/Platform/Window.hpp>
|
||||
@@ -14,26 +14,30 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
String EventImpl::GetKeyName(Keyboard::Scancode key)
|
||||
std::string EventImpl::GetKeyName(Keyboard::Scancode key)
|
||||
{
|
||||
SDL_Scancode scancode = SDLHelper::ToSDL(key);
|
||||
|
||||
String name;
|
||||
std::string name;
|
||||
if (scancode != SDL_SCANCODE_UNKNOWN)
|
||||
name = SDL_GetScancodeName(scancode);
|
||||
else
|
||||
name = "Unknown";
|
||||
|
||||
return !name.IsEmpty() ? name : String::Unicode("Unknown");
|
||||
return name;
|
||||
}
|
||||
|
||||
String EventImpl::GetKeyName(Keyboard::VKey key)
|
||||
std::string EventImpl::GetKeyName(Keyboard::VKey key)
|
||||
{
|
||||
SDL_Keycode vkey = SDLHelper::ToSDL(key);
|
||||
|
||||
String name;
|
||||
std::string name;
|
||||
if (vkey != SDLK_UNKNOWN)
|
||||
name = SDL_GetKeyName(vkey);
|
||||
else
|
||||
name = "Unknown";
|
||||
|
||||
return !name.IsEmpty() ? name : String::Unicode("Unknown");
|
||||
return name;
|
||||
}
|
||||
|
||||
Vector2i EventImpl::GetMousePosition()
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
#ifndef NAZARA_INPUTIMPL_HPP
|
||||
#define NAZARA_INPUTIMPL_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Platform/Keyboard.hpp>
|
||||
#include <Nazara/Platform/Mouse.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class EventImpl
|
||||
{
|
||||
public:
|
||||
static String GetKeyName(Keyboard::Scancode scancode);
|
||||
static String GetKeyName(Keyboard::VKey key);
|
||||
static std::string GetKeyName(Keyboard::Scancode scancode);
|
||||
static std::string GetKeyName(Keyboard::VKey key);
|
||||
static Vector2i GetMousePosition();
|
||||
static Vector2i GetMousePosition(const Window& relativeTo);
|
||||
static bool IsKeyPressed(Keyboard::Scancode key);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Platform module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Platform/SDL2/WindowImpl.hpp>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
@@ -12,7 +13,6 @@
|
||||
#include <Nazara/Platform/SDL2/CursorImpl.hpp>
|
||||
#include <Nazara/Platform/SDL2/IconImpl.hpp>
|
||||
#include <Nazara/Platform/SDL2/SDLHelper.hpp>
|
||||
#include <Nazara/Platform/SDL2/WindowImpl.hpp>
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_syswm.h>
|
||||
@@ -60,7 +60,7 @@ namespace Nz
|
||||
m_cursor = SDL_GetDefaultCursor();
|
||||
}
|
||||
|
||||
bool WindowImpl::Create(const VideoMode& mode, const String& title, WindowStyleFlags style)
|
||||
bool WindowImpl::Create(const VideoMode& mode, const std::string& title, WindowStyleFlags style)
|
||||
{
|
||||
bool async = (style & WindowStyle_Threaded) != 0;
|
||||
if (async)
|
||||
@@ -108,7 +108,7 @@ namespace Nz
|
||||
m_sizemove = false;
|
||||
m_style = style;
|
||||
|
||||
m_handle = SDL_CreateWindow(title.GetConstBuffer(), x, y, width, height, winStyle);
|
||||
m_handle = SDL_CreateWindow(title.c_str(), x, y, width, height, winStyle);
|
||||
|
||||
if (!m_handle)
|
||||
{
|
||||
@@ -240,9 +240,9 @@ namespace Nz
|
||||
return handle;
|
||||
}
|
||||
|
||||
String WindowImpl::GetTitle() const
|
||||
std::string WindowImpl::GetTitle() const
|
||||
{
|
||||
return String::Unicode(SDL_GetWindowTitle(m_handle));
|
||||
return SDL_GetWindowTitle(m_handle);
|
||||
}
|
||||
|
||||
bool WindowImpl::HasFocus() const
|
||||
@@ -491,7 +491,7 @@ namespace Nz
|
||||
evt.type = WindowEventType_TextEntered;
|
||||
evt.text.repeated = false;
|
||||
|
||||
for (decltype(evt.text.character) codepoint : String::Unicode(event->text.text).Simplify().GetUtf32String())
|
||||
for (decltype(evt.text.character) codepoint : ToUtf32String(event->text.text))
|
||||
{
|
||||
evt.text.character = codepoint;
|
||||
|
||||
@@ -589,9 +589,9 @@ namespace Nz
|
||||
NazaraDebug("Stay on top isn't supported by SDL2 backend for now");
|
||||
}
|
||||
|
||||
void WindowImpl::SetTitle(const String& title)
|
||||
void WindowImpl::SetTitle(const std::string& title)
|
||||
{
|
||||
SDL_SetWindowTitle(m_handle, title.GetConstBuffer());
|
||||
SDL_SetWindowTitle(m_handle, title.c_str());
|
||||
}
|
||||
|
||||
void WindowImpl::SetVisible(bool visible)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#ifndef NAZARA_WINDOWIMPL_HPP
|
||||
#define NAZARA_WINDOWIMPL_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Platform/Config.hpp>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include <SDL2/SDL_events.h>
|
||||
#include <SDL2/SDL_keyboard.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
#include <string>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -34,7 +34,7 @@ namespace Nz
|
||||
WindowImpl(WindowImpl&&) = delete; ///TODO?
|
||||
~WindowImpl() = default;
|
||||
|
||||
bool Create(const VideoMode& mode, const String& title, WindowStyleFlags style);
|
||||
bool Create(const VideoMode& mode, const std::string& title, WindowStyleFlags style);
|
||||
bool Create(void* handle);
|
||||
|
||||
void Destroy();
|
||||
@@ -47,7 +47,7 @@ namespace Nz
|
||||
Vector2ui GetSize() const;
|
||||
WindowStyleFlags GetStyle() const;
|
||||
WindowHandle GetSystemHandle() const;
|
||||
String GetTitle() const;
|
||||
std::string GetTitle() const;
|
||||
|
||||
bool HasFocus() const;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Nz
|
||||
void SetPosition(int x, int y);
|
||||
void SetSize(unsigned int width, unsigned int height);
|
||||
void SetStayOnTop(bool stayOnTop);
|
||||
void SetTitle(const String& title);
|
||||
void SetTitle(const std::string& title);
|
||||
void SetVisible(bool visible);
|
||||
|
||||
WindowImpl& operator=(const WindowImpl&) = delete;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Platform/Cursor.hpp>
|
||||
#include <Nazara/Platform/Icon.hpp>
|
||||
#include <Nazara/Platform/SDL2/WindowImpl.hpp>
|
||||
#include <Nazara/Platform/SDL2/WindowImpl.hpp>
|
||||
#include <Nazara/Platform/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -50,7 +50,7 @@ namespace Nz
|
||||
Destroy();
|
||||
}
|
||||
|
||||
bool Window::Create(VideoMode mode, const String& title, WindowStyleFlags style)
|
||||
bool Window::Create(VideoMode mode, const std::string& title, WindowStyleFlags style)
|
||||
{
|
||||
// If the window is already open, we keep its position
|
||||
bool opened = IsOpen();
|
||||
@@ -65,7 +65,7 @@ namespace Nz
|
||||
{
|
||||
if (fullscreenWindow)
|
||||
{
|
||||
NazaraError("Window " + String::Pointer(fullscreenWindow) + " already in fullscreen mode");
|
||||
NazaraError("Window " + PointerToString(fullscreenWindow) + " already in fullscreen mode");
|
||||
style &= ~WindowStyle_Fullscreen;
|
||||
}
|
||||
else
|
||||
@@ -245,13 +245,13 @@ namespace Nz
|
||||
return m_impl->GetSystemHandle();
|
||||
}
|
||||
|
||||
String Window::GetTitle() const
|
||||
std::string Window::GetTitle() const
|
||||
{
|
||||
#if NAZARA_PLATFORM_SAFE
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Window not created");
|
||||
return String();
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -508,7 +508,7 @@ namespace Nz
|
||||
m_impl->SetStayOnTop(stayOnTop);
|
||||
}
|
||||
|
||||
void Window::SetTitle(const String& title)
|
||||
void Window::SetTitle(const std::string& title)
|
||||
{
|
||||
#if NAZARA_PLATFORM_SAFE
|
||||
if (!m_impl)
|
||||
|
||||
Reference in New Issue
Block a user