mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Wii: For classic controller, allow using left joystick for movement too
This commit is contained in:
parent
834699a4f8
commit
b996767ff6
254
src/Core.h
254
src/Core.h
@ -122,148 +122,148 @@ typedef cc_uint8 cc_bool;
|
||||
/*#define CC_BUILD_GL11*/
|
||||
#ifndef CC_BUILD_MANUAL
|
||||
#if defined _WIN32
|
||||
#define CC_BUILD_WIN
|
||||
#define CC_BUILD_D3D9
|
||||
#define CC_BUILD_WINGUI
|
||||
#define CC_BUILD_WININET
|
||||
#define CC_BUILD_WINMM
|
||||
#define CC_BUILD_WIN
|
||||
#define CC_BUILD_D3D9
|
||||
#define CC_BUILD_WINGUI
|
||||
#define CC_BUILD_WININET
|
||||
#define CC_BUILD_WINMM
|
||||
#elif defined __ANDROID__
|
||||
#define CC_BUILD_ANDROID
|
||||
#define CC_BUILD_MOBILE
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_EGL
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_OPENSLES
|
||||
#define CC_BUILD_ANDROID
|
||||
#define CC_BUILD_MOBILE
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_EGL
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_OPENSLES
|
||||
#elif defined __serenity__
|
||||
#define CC_BUILD_SERENITY
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_SDL
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_SERENITY
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_SDL
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#elif defined __linux__
|
||||
#define CC_BUILD_LINUX
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#if defined CC_BUILD_RPI
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_EGL
|
||||
#endif
|
||||
#define CC_BUILD_LINUX
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#if defined CC_BUILD_RPI
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_EGL
|
||||
#endif
|
||||
#elif defined __APPLE__
|
||||
#define CC_BUILD_DARWIN
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#if defined __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
|
||||
#define CC_BUILD_MOBILE
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_IOS
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_CFNETWORK
|
||||
#elif defined __x86_64__ || defined __arm64__
|
||||
#define CC_BUILD_COCOA
|
||||
#define CC_BUILD_MACOS
|
||||
#define CC_BUILD_CURL
|
||||
#else
|
||||
#define CC_BUILD_CARBON
|
||||
#define CC_BUILD_MACOS
|
||||
#define CC_BUILD_CURL
|
||||
#endif
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_DARWIN
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#if defined __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
|
||||
#define CC_BUILD_MOBILE
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_IOS
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_CFNETWORK
|
||||
#elif defined __x86_64__ || defined __arm64__
|
||||
#define CC_BUILD_COCOA
|
||||
#define CC_BUILD_MACOS
|
||||
#define CC_BUILD_CURL
|
||||
#else
|
||||
#define CC_BUILD_CARBON
|
||||
#define CC_BUILD_MACOS
|
||||
#define CC_BUILD_CURL
|
||||
#endif
|
||||
#define CC_BUILD_OPENAL
|
||||
#elif defined __sun__
|
||||
#define CC_BUILD_SOLARIS
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_SOLARIS
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#elif defined __FreeBSD__ || defined __DragonFly__
|
||||
#define CC_BUILD_FREEBSD
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_FREEBSD
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#elif defined __OpenBSD__
|
||||
#define CC_BUILD_OPENBSD
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_OPENBSD
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#elif defined __NetBSD__
|
||||
#define CC_BUILD_NETBSD
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_NETBSD
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#elif defined __HAIKU__
|
||||
#define CC_BUILD_HAIKU
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BACKTRACE_BUILTIN
|
||||
#define CC_BUILD_HAIKU
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BACKTRACE_BUILTIN
|
||||
#elif defined __BEOS__
|
||||
#define CC_BUILD_BEOS
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_GL11
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BACKTRACE_BUILTIN
|
||||
#define CC_BUILD_BEOS
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_GL11
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BACKTRACE_BUILTIN
|
||||
#elif defined __sgi
|
||||
#define CC_BUILD_IRIX
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BIG_ENDIAN
|
||||
#define CC_BUILD_IRIX
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_X11
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BIG_ENDIAN
|
||||
#elif defined __EMSCRIPTEN__
|
||||
#define CC_BUILD_WEB
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_WEBAUDIO
|
||||
#define CC_BUILD_NOMUSIC
|
||||
#define CC_BUILD_MINFILES
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#define CC_BUILD_WEB
|
||||
#define CC_BUILD_GL
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_WEBAUDIO
|
||||
#define CC_BUILD_NOMUSIC
|
||||
#define CC_BUILD_MINFILES
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#elif defined __psp__
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_PSP
|
||||
#define CC_BUILD_LOWMEM
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_PSP
|
||||
#define CC_BUILD_LOWMEM
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#elif defined __3DS__
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_3DS
|
||||
#define CC_BUILD_LOWMEM
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_3DS
|
||||
#define CC_BUILD_LOWMEM
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#elif defined GEKKO
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_GCWII
|
||||
#define CC_BUILD_LOWMEM
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_GCWII
|
||||
#define CC_BUILD_LOWMEM
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -235,15 +235,28 @@ static void ProcessNunchuck_Game(int mods, double delta) {
|
||||
Input_SetNonRepeatable(CCPAD_DOWN, nunchuckDown);
|
||||
}
|
||||
|
||||
static void ProcessClassic_Joystick(struct joystick_t* js) {
|
||||
static void ProcessClassic_LeftJoystick(struct joystick_t* js) {
|
||||
// TODO: need to account for min/max??
|
||||
int dx = js->pos.x - js->center.x;
|
||||
int dy = js->pos.y - js->center.y;
|
||||
|
||||
if (Math_AbsI(dx) <= 4) dx = 0;
|
||||
if (Math_AbsI(dy) <= 4) dy = 0;
|
||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||
|
||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx / 8.0f, dy / 8.0f);
|
||||
if (dx == 0 && dy == 0) return;
|
||||
Input.JoystickMovement = true;
|
||||
Input.JoystickAngle = (js->ang - 90) * MATH_DEG2RAD;
|
||||
}
|
||||
|
||||
static void ProcessClassic_RightJoystick(struct joystick_t* js) {
|
||||
// TODO: need to account for min/max??
|
||||
int dx = js->pos.x - js->center.x;
|
||||
int dy = js->pos.y - js->center.y;
|
||||
|
||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||
|
||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx / 8.0f, -dy / 8.0f);
|
||||
}
|
||||
|
||||
static void ProcessClassic_Game(void) {
|
||||
@ -268,8 +281,8 @@ static void ProcessClassic_Game(void) {
|
||||
Input_SetNonRepeatable(CCPAD_DOWN, mods & CLASSIC_CTRL_BUTTON_DOWN);
|
||||
|
||||
if (Input.RawMode) {
|
||||
ProcessClassic_Joystick(&ctrls.ljs);
|
||||
ProcessClassic_Joystick(&ctrls.rjs);
|
||||
ProcessClassic_LeftJoystick(&ctrls.ljs);
|
||||
ProcessClassic_RightJoystick(&ctrls.rjs);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user