~ WIP input IME

This commit is contained in:
REMqb
2019-12-19 19:59:43 +01:00
parent 350a1cf09f
commit ef791e2f3c
18 changed files with 207 additions and 23 deletions

View File

@@ -51,9 +51,10 @@ namespace Nz
WindowEventType_Moved,
WindowEventType_Quit,
WindowEventType_Resized,
WindowEventType_TextEdited,
WindowEventType_TextEntered,
WindowEventType_Max = WindowEventType_TextEntered
WindowEventType_Max = WindowEventType_TextEntered
};
enum WindowStyle

View File

@@ -9,6 +9,8 @@
#ifndef NAZARA_EVENT_HPP
#define NAZARA_EVENT_HPP
#include <array>
#include <Nazara/Platform/Enums.hpp>
#include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Platform/Mouse.hpp>
@@ -80,7 +82,15 @@ namespace Nz
{
bool repeated;
char32_t character;
};
};
// Used by:
// -WindowEventType_TextEdited
struct EditEvent
{
int length;
std::array<char, 32> text;
};
WindowEventType type;
@@ -115,6 +125,10 @@ namespace Nz
// Used by:
// -WindowEventType_TextEntered
TextEvent text;
// Used by:
// -WindowEventType_TextEntered
EditEvent edit;
};
};
}

View File

@@ -48,7 +48,8 @@ namespace Nz
NazaraSignal(OnMoved, const EventHandler* /*eventHandler*/, const WindowEvent::PositionEvent& /*event*/);
NazaraSignal(OnQuit, const EventHandler* /*eventHandler*/);
NazaraSignal(OnResized, const EventHandler* /*eventHandler*/, const WindowEvent::SizeEvent& /*event*/);
NazaraSignal(OnTextEntered, const EventHandler* /*eventHandler*/, const WindowEvent::TextEvent& /*event*/);
NazaraSignal(OnTextEntered, const EventHandler* /*eventHandler*/, const WindowEvent::TextEvent& /*event*/);
NazaraSignal(OnTextEdited, const EventHandler* /*eventHandler*/, const WindowEvent::EditEvent& /*event*/);
};
}

View File

@@ -78,6 +78,10 @@ namespace Nz
case WindowEventType_TextEntered:
OnTextEntered(this, event.text);
break;
case WindowEventType_TextEdited:
OnTextEdited(this, event.edit);
break;
}
}
}

View File

@@ -323,6 +323,8 @@ namespace Nz
static String GetKeyName(VKey key);
static bool IsKeyPressed(Scancode scancode);
static bool IsKeyPressed(VKey key);
static void StartTextInput();
static void StopTextInput();
static Scancode ToScanCode(VKey key);
static VKey ToVirtualKey(Scancode key);
};