port: added rumble scale and support for 2 extra buttons

also fixed some warnings
This commit is contained in:
fgsfds committed 2023-08-18 12:26:55 +02:00
1 parent e1f6e167fb
commit b906f77b37
9 files changed
+95 -46

No files matched your search

+14 -13
View File
@@ -6,7 +6,6 @@
#define INPUT_MAX_CONTROLLERS MAXCONTROLLERS
#define INPUT_MAX_CONTROLLER_BUTTONS 32
#define INPUT_RUMBLE_STRENGTH 0.333f
#define CONT_STICK_XNEG 0x10000
#define CONT_STICK_XPOS 0x20000
@@ -50,8 +49,8 @@ enum contkey {
CK_C_U,
CK_RTRIG,
CK_LTRIG,
CK_EXTRA0, // gap in CONT_
CK_EXTRA1, // gap in CONT_
CK_X, // gap in CONT_
CK_Y, // gap in CONT_
CK_DPAD_R,
CK_DPAD_L,
CK_DPAD_D,
@@ -85,11 +84,14 @@ s32 inputControllerMask(void);
// vk is a value from the virtkey enum above
s32 inputKeyPressed(u32 vk);
// bind virtkey vk to n64 pad #idx's button/axis nbtn as represented by its contkey value
// if bind is -1, picks a bind slot automatically
void inputKeyBind(s32 idx, u32 cbtn, s32 bind, u32 vk);
// idx is controller index, contbtn is one of the CONT_ constants
s32 inputButtonPressed(s32 idx, u16 contbtn);
// 0 strength turns it off
// bind virtkey vk to n64 pad #idx's button/axis ck as represented by its contkey value
// if bind is -1, picks a bind slot automatically
void inputKeyBind(s32 idx, u32 ck, s32 bind, u32 vk);
// strength is 0 .. 1; 0 strength turns it off
void inputRumble(s32 idx, f32 strength, f32 time);
// locks the mouse cursor in the window and makes it invisible if argument is true
@@ -98,15 +100,14 @@ void inputLockMouse(s32 lock);
// returns the current state of the above
s32 inputMouseIsLocked(void);
// returns mouse position in window
// returns mouse position in native viewport coordinates (ie, 320x240 most of the time)
void inputMouseGetPosition(s32 *x, s32 *y);
// returns changes in mouse position since last frame
void inputMouseGetDelta(s32 *dx, s32 *dy);
// returns changes in mouse position since last frame, in normalized window coordinates scaled by sensitivity
void inputMouseGetNormalizedDelta(f32 *dx, f32 *dy);
// returns changes in mouse position since last frame, in window coordinates
void inputMouseGetRawDelta(s32 *dx, s32 *dy);
// returns changes in mouse position since last frame, scaled by sensitivity
void inputMouseGetScaledDelta(f32 *dx, f32 *dy);
// call this every frame
void inputUpdate(void);