commit d15cb702fbb3838f5e034636e7204983040a0bbd
Author: DPS2004 <dpsophinos@gmail.com>
AuthorDate: Mon Apr 11 11:37:32 2022 -0400
Commit: DPS2004 <dpsophinos@gmail.com>
CommitDate: Mon Apr 11 11:37:32 2022 -0400
match linux host to windows host
---
.gitignore | 2 ++
Makefile | 2 +-
platform/SDL2Desktop/source/SDL2Host.cpp | 36 +++++++++++++++++++++++++++++++-
platform/windows/source/WindowsHost.cpp | 10 +--------
4 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
index 2727de4..adc1800 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@
*.rpx
+*.exe
+
*.o
bin/
diff --git a/Makefile b/Makefile
index 19d2add..cc69ec4 100644
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ clean-miyoomini:
@$(MAKE) -C platform/miyoomini clean
clean-windows:
- @$(MAKE) -C platform/miyoomini clean
+ @$(MAKE) -C platform/windows clean
3ds:
@$(MAKE) -C platform/3ds
diff --git a/platform/SDL2Desktop/source/SDL2Host.cpp b/platform/SDL2Desktop/source/SDL2Host.cpp
index 9a64fab..2f4ff48 100644
--- a/platform/SDL2Desktop/source/SDL2Host.cpp
+++ b/platform/SDL2Desktop/source/SDL2Host.cpp
@@ -17,6 +17,8 @@ using namespace std;
#include "../../../source/filehelpers.h"
#include "../../../source/logger.h"
+#include "../../../source/emojiconversion.h"
+
// sdl
#include <SDL2/SDL.h>
@@ -28,6 +30,8 @@ using namespace std;
#define RENDERER_FLAGS SDL_RENDERER_ACCELERATED
#define PIXEL_FORMAT SDL_PIXELFORMAT_ARGB8888
+#define KB_ENABLED true
+
SDL_Event event;
@@ -52,6 +56,10 @@ Host::Host()
if (res == 0 && stat(cartdatadir.c_str(), &st) == -1) {
res = mkdir(cartdatadir.c_str(), 0777);
}
+
+ #if KB_ENABLED
+ SDL_StartTextInput();
+ #endif
std::string home = getenv("HOME");
@@ -77,7 +85,31 @@ InputState_t Host::scanInput(){
while (SDL_PollEvent(&event)) {
switch (event.type) {
+
+ #if KB_ENABLED
+ case SDL_TEXTINPUT:
+ //Logger_Write( charset::upper_to_emoji(event.text.text).c_str() );
+ //Logger_Write("\n");
+ currKBKey = charset::upper_to_emoji(event.text.text);
+ currKBDown = true;
+
+ break;
+ #endif
+
+
case SDL_KEYDOWN:
+
+ #if KB_ENABLED
+ switch (event.key.keysym.scancode)
+ {
+ case SDL_SCANCODE_BACKSPACE: currKBDown = true; currKBKey = "\b"; break;
+ case SDL_SCANCODE_RETURN: currKBDown = true; currKBKey = "\r"; break;
+ case SDL_SCANCODE_ESCAPE: currKBDown = true; currKBKey = "\27"; break;
+ case SDL_SCANCODE_TAB: currKBDown = true; currKBKey = "\t"; break;
+ default : break;
+ }
+ #endif
+
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:currKDown |= P8_KEY_PAUSE; break;
@@ -147,7 +179,9 @@ InputState_t Host::scanInput(){
currKHeld,
(int16_t)mouseX,
(int16_t)mouseY,
- picoMouseState
+ picoMouseState,
+ currKBDown,
+ currKBKey
};
}
diff --git a/platform/windows/source/WindowsHost.cpp b/platform/windows/source/WindowsHost.cpp
index 4bd989b..fd8b18e 100644
--- a/platform/windows/source/WindowsHost.cpp
+++ b/platform/windows/source/WindowsHost.cpp
@@ -32,10 +32,6 @@ using namespace std;
#define KB_ENABLED true
-
-
-
-
SDL_Event event;
string _windowsAppData = SDL_GetPrefPath("FAKE-08", "FAKE-08");
@@ -72,7 +68,7 @@ Host::Host()
std::string home = _windowsAppData; // C:\Users\(username)\AppData\Roaming\FAKE-08\FAKE-08\p8carts
std::string fullCartDir = home + "/p8carts";
- //fprintf( stderr, "hello" );
+
setPlatformParams(
WINDOW_SIZE_X,
WINDOW_SIZE_Y,
@@ -186,10 +182,6 @@ InputState_t Host::scanInput(){
if(keystate[SDL_SCANCODE_C]){
currKHeld |= P8_KEY_X;
}
-
- //keyboard stuff
-
-
return InputState_t {
currKDown,