Skip to content

Commit

Permalink
Added UTF8 Support for window title (EncoDesktop, EncoShared)
Browse files Browse the repository at this point in the history
  • Loading branch information
shirookad committed Nov 23, 2014
1 parent 65a8abb commit b379816
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions EncoDesktop/DesktopView.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
#include "stdafx.h"

#include <EncoShared\EncoShared.h>
#include <codecvt>

namespace enco {
class DesktopView : public IView {
public:
inline DesktopView(const std::string &title, const glm::u32vec2 &size = glm::u32vec2(320, 240)) : m_window(nullptr) { m_name = title; m_size = size; }
inline DesktopView(const std::string &title, u32 width, u32 height) : DesktopView(title, glm::u32vec2(width, height)) { }
inline DesktopView(const std::wstring &title, const glm::u32vec2 &size = glm::u32vec2(320, 240)) : DesktopView(g_utf8conv.to_bytes(title), size) { }
inline DesktopView(const std::wstring &title, u32 width, u32 height) : DesktopView(g_utf8conv.to_bytes(title), glm::u32vec2(width, height)) { }

ENCODESKTOPAPI virtual void create(IRenderer *renderer);
ENCODESKTOPAPI virtual void destroy();
Expand Down
7 changes: 1 addition & 6 deletions EncoShared/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// stdafx.cpp : Quelldatei, die nur die Standard-Includes einbindet.
// EncoShared.pch ist der vorkompilierte Header.
// stdafx.obj enthält die vorkompilierten Typinformationen.

#include "stdafx.h"

// TODO: Auf zusätzliche Header verweisen, die in STDAFX.H
// und nicht in dieser Datei erforderlich sind.
ENCOSHAREDAPI std::wstring_convert<std::codecvt_utf8<wchar_t>> enco::g_utf8conv;
4 changes: 4 additions & 0 deletions EncoShared/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# define ENCOSHAREDAPI
#endif

#include <codecvt>

namespace enco {
typedef char int8, i8;
typedef short int16, i16;
Expand All @@ -30,4 +32,6 @@ namespace enco {

typedef float f32, float32;
typedef double f64, float64;

ENCOSHAREDAPI extern std::wstring_convert<std::codecvt_utf8<wchar_t>> g_utf8conv;
}

0 comments on commit b379816

Please sign in to comment.