Add hydra touch support
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
#include <emulator.hpp>
|
#include <emulator.hpp>
|
||||||
#include <hydra/core.hxx>
|
#include <hydra/core.hxx>
|
||||||
#include <renderer_gl/renderer_gl.hpp>
|
#include <renderer_gl/renderer_gl.hpp>
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
class HC_GLOBAL HydraCore final : public hydra::IBase, public hydra::IOpenGlRendered, public hydra::IFrontendDriven, public hydra::IInput {
|
class HC_GLOBAL HydraCore final : public hydra::IBase, public hydra::IOpenGlRendered, public hydra::IFrontendDriven, public hydra::IInput {
|
||||||
@@ -72,6 +71,20 @@ void HydraCore::runFrame() {
|
|||||||
int y = !!checkButtonCallback(0, hydra::ButtonType::Analog1Up) - !!checkButtonCallback(0, hydra::ButtonType::Analog1Down);
|
int y = !!checkButtonCallback(0, hydra::ButtonType::Analog1Up) - !!checkButtonCallback(0, hydra::ButtonType::Analog1Down);
|
||||||
hid.setCirclepadX(x * 0x9C);
|
hid.setCirclepadX(x * 0x9C);
|
||||||
hid.setCirclepadY(y * 0x9C);
|
hid.setCirclepadY(y * 0x9C);
|
||||||
|
|
||||||
|
u32 touch = checkButtonCallback(0, hydra::ButtonType::Touch);
|
||||||
|
if (touch != hydra::TOUCH_RELEASED) {
|
||||||
|
u16 x = touch >> 16;
|
||||||
|
u16 y = touch;
|
||||||
|
if (y >= 240 && y <= 480 && x >= 40 && x < 40 + 320) {
|
||||||
|
hid.setTouchScreenPress(x - 40, y - 240);
|
||||||
|
} else {
|
||||||
|
hid.releaseTouchScreen();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hid.releaseTouchScreen();
|
||||||
|
}
|
||||||
|
|
||||||
hid.updateInputs(emulator->getTicks());
|
hid.updateInputs(emulator->getTicks());
|
||||||
|
|
||||||
emulator->runFrame();
|
emulator->runFrame();
|
||||||
|
|||||||
2
third_party/hydra_core
vendored
2
third_party/hydra_core
vendored
Submodule third_party/hydra_core updated: 5b7b38be05...e4cc6b0fc2
Reference in New Issue
Block a user