mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
N64: Untested mouse support
This commit is contained in:
parent
3e827dba76
commit
561010d897
@ -14,6 +14,7 @@
|
|||||||
#include <libdragon.h>
|
#include <libdragon.h>
|
||||||
|
|
||||||
static cc_bool launcherMode;
|
static cc_bool launcherMode;
|
||||||
|
#include "VirtualCursor.h"
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct cc_window WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
@ -76,6 +77,22 @@ void Window_EnableRawMouse(void) { Input.RawMode = true; }
|
|||||||
void Window_DisableRawMouse(void) { Input.RawMode = false; }
|
void Window_DisableRawMouse(void) { Input.RawMode = false; }
|
||||||
void Window_UpdateRawMouse(void) { }
|
void Window_UpdateRawMouse(void) { }
|
||||||
|
|
||||||
|
static void ProcessMouse(joypad_inputs_t* inputs, float delta) {
|
||||||
|
Input_SetNonRepeatable(CCMOUSE_L, inputs->btn.a);
|
||||||
|
Input_SetNonRepeatable(CCMOUSE_R, inputs->btn.b);
|
||||||
|
|
||||||
|
// TODO check stick_x/y is right
|
||||||
|
if (!vc_hooked) {
|
||||||
|
Pointer_SetPosition(0, Window_Main.Width / 2, Window_Main.Height / 2);
|
||||||
|
}
|
||||||
|
VirtualCursor_SetPosition(Pointers[0].x + inputs->stick_x, Pointers[0].y + inputs->stick_y);
|
||||||
|
|
||||||
|
if (!Input.RawMode) return;
|
||||||
|
float scale = (delta * 60.0) / 2.0f;
|
||||||
|
Event_RaiseRawMove(&PointerEvents.RawMoved,
|
||||||
|
inputs->stick_x * scale, inputs->stick_y * scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Gamepads----------------------------------------------------------*
|
*-------------------------------------------------------Gamepads----------------------------------------------------------*
|
||||||
@ -143,9 +160,13 @@ void Gamepads_Process(float delta) {
|
|||||||
for (int i = 0; i < INPUT_MAX_GAMEPADS; i++)
|
for (int i = 0; i < INPUT_MAX_GAMEPADS; i++)
|
||||||
{
|
{
|
||||||
if (!joypad_is_connected(i)) continue;
|
if (!joypad_is_connected(i)) continue;
|
||||||
int port = Gamepad_Connect(0x64 + i, default_n64);
|
|
||||||
|
|
||||||
joypad_inputs_t inputs = joypad_get_inputs(i);
|
joypad_inputs_t inputs = joypad_get_inputs(i);
|
||||||
|
|
||||||
|
if (joypad_get_style(i) == JOYPAD_STYLE_MOUSE) {
|
||||||
|
ProcessMouse(&inputs, delta); continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int port = Gamepad_Connect(0x64 + i, default_n64);
|
||||||
HandleButtons(port, inputs.btn);
|
HandleButtons(port, inputs.btn);
|
||||||
ProcessAnalogInput(port, &inputs, delta);
|
ProcessAnalogInput(port, &inputs, delta);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user