[ion/3ds] Cleaning, non-debug keyboard, can exit now.

This commit is contained in:
M4x1m3
2020-04-20 10:49:44 +02:00
parent 18ad90e2d3
commit 1919933f8d
4 changed files with 4690 additions and 4688 deletions

View File

@@ -4,7 +4,7 @@
#include <ion/display.h>
#include <string.h>
#include "keyboard_debug.h"
#include "keyboard.h"
namespace Ion {
namespace Simulator {
@@ -37,7 +37,7 @@ void draw() {
}
u8* fb = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
memcpy(fb, keyboard_debug_bgr, keyboard_debug_bgr_len);
memcpy(fb, keyboard_bgr, keyboard_bgr_len);
gfxFlushBuffers();
gfxSwapBuffers();

View File

@@ -5,6 +5,8 @@
#include <ion/events.h>
#include <string.h>
#include <3ds.h>
namespace Ion {
namespace Events {
@@ -13,6 +15,11 @@ namespace Events {
Event getPlatformEvent() {
Event result = None;
if (!aptMainLoop()) {
result = Termination;
}
return result;
}

View File

@@ -20,23 +20,24 @@ namespace Keyboard {
bool m_heldLastFrame = false;
State scan() {
hidScanInput();
State state;
touchPosition touch;
hidTouchRead(&touch);
if (touch.px == 0 && touch.py == 0) {
if (m_heldLastFrame) {
m_heldLastFrame = false;
}
} else {
if (!m_heldLastFrame) {
m_heldLastFrame = true;
Simulator::Main::refresh();
hidScanInput();
touchPosition touch;
hidTouchRead(&touch);
State state;
if (touch.px == 0 && touch.py == 0) {
if (m_heldLastFrame) {
m_heldLastFrame = false;
}
} else {
if (!m_heldLastFrame) {
m_heldLastFrame = true;
DETECT_KEY(271, 13 , 31, 31, Key::OK)
DETECT_KEY(271, 46 , 31, 31, Key::Back)
DETECT_KEY(227, 16 , 37, 25, Key::Home)
@@ -98,47 +99,41 @@ State scan() {
DETECT_KEY(245, 212, 34, 23, Key::Toolbox)
DETECT_KEY(285, 212, 34, 23, Key::Backspace)
// printf("\x1b[2;0H%03d; %03d", touch.px, touch.py);
// Handle touchscreen here.
}
}
u32 kDown = hidKeysDown();
if (kDown & KEY_DUP) {
state.setKey(Key::Up);
}
if (kDown & KEY_DDOWN) {
state.setKey(Key::Down);
}
if (kDown & KEY_DLEFT) {
state.setKey(Key::Left);
}
if (kDown & KEY_DRIGHT) {
state.setKey(Key::Right);
}
if (kDown & KEY_A) {
state.setKey(Key::OK);
}
if (kDown & KEY_B) {
state.setKey(Key::Back);
}
if (kDown & KEY_Y) {
state.setKey(Key::Shift);
}
if (kDown & KEY_X) {
state.setKey(Key::Alpha);
}
if (kDown & KEY_START) {
state.setKey(Key::Home);
}
if (kDown & KEY_SELECT) {
state.setKey(Key::OnOff);
}
Simulator::Main::refresh();
}
}
u32 kDown = hidKeysDown();
if (kDown & KEY_DUP) {
state.setKey(Key::Up);
}
if (kDown & KEY_DDOWN) {
state.setKey(Key::Down);
}
if (kDown & KEY_DLEFT) {
state.setKey(Key::Left);
}
if (kDown & KEY_DRIGHT) {
state.setKey(Key::Right);
}
if (kDown & KEY_A) {
state.setKey(Key::OK);
}
if (kDown & KEY_B) {
state.setKey(Key::Back);
}
if (kDown & KEY_Y) {
state.setKey(Key::Shift);
}
if (kDown & KEY_X) {
state.setKey(Key::Alpha);
}
if (kDown & KEY_START) {
state.setKey(Key::Home);
}
if (kDown & KEY_SELECT) {
state.setKey(Key::OnOff);
}
return state;
}