mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 17:12:25 -05:00
PSP: Implement rudimentary controls
This commit is contained in:
parent
1855213e6d
commit
5c973cda53
2 changed files with 42 additions and 3 deletions
|
@ -108,7 +108,7 @@ endif
|
|||
|
||||
ifeq ($(PLAT),psp)
|
||||
CC=psp-gcc
|
||||
LIBS=-lm -lpspgum -lpspgu -lpspge -lpspdisplay
|
||||
LIBS=-lm -lpspgum -lpspgu -lpspge -lpspdisplay -lpspctrl
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
#include "Funcs.h"
|
||||
#include "Bitmap.h"
|
||||
#include "Errors.h"
|
||||
#include "ExtMath.h"
|
||||
#include <pspdisplay.h>
|
||||
#include <pspge.h>
|
||||
#include <pspctrl.h>
|
||||
|
||||
#define BUFFER_WIDTH 512
|
||||
#define SCREEN_WIDTH 480
|
||||
|
@ -22,7 +24,10 @@ void Window_Init(void) {
|
|||
|
||||
WindowInfo.Width = SCREEN_WIDTH;
|
||||
WindowInfo.Height = SCREEN_HEIGHT;
|
||||
//WindowInfo.Focused = true;
|
||||
WindowInfo.Focused = true;
|
||||
|
||||
sceCtrlSetSamplingCycle(0);
|
||||
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
|
||||
}
|
||||
|
||||
static void DoCreateWindow(int _3d) {
|
||||
|
@ -48,7 +53,41 @@ void Window_Close(void) {
|
|||
}
|
||||
|
||||
void Window_ProcessEvents(void) {
|
||||
SceCtrlData pad;
|
||||
/* TODO implement */
|
||||
sceCtrlReadBufferPositive(&pad, 1);
|
||||
int mods = pad.Buttons;
|
||||
|
||||
int dx = pad.Lx - 127;
|
||||
int dy = pad.Ly - 127;
|
||||
if (Input_RawMode && (Math_AbsF(dx) > 1 || Math_AbsF(dy) > 1)) {
|
||||
//Platform_Log2("RAW: %i, %i", &dx, &dy);
|
||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx / 32.0f, dy / 32.0f);
|
||||
}
|
||||
|
||||
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_PLACE_BLOCK], mods & PSP_CTRL_LTRIGGER);
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_DELETE_BLOCK], mods & PSP_CTRL_RTRIGGER);
|
||||
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_JUMP], mods & PSP_CTRL_TRIANGLE);
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_CHAT], mods & PSP_CTRL_CIRCLE);
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_INVENTORY], mods & PSP_CTRL_CROSS);
|
||||
// PSP_CTRL_SQUARE
|
||||
|
||||
Input_SetNonRepeatable(IPT_ENTER, mods & PSP_CTRL_START);
|
||||
Input_SetNonRepeatable(IPT_ESCAPE, mods & PSP_CTRL_SELECT);
|
||||
// fake tab with down for Launcher
|
||||
Input_SetNonRepeatable(IPT_TAB, mods & PSP_CTRL_DOWN);
|
||||
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_LEFT], mods & PSP_CTRL_LEFT);
|
||||
Input_SetNonRepeatable(IPT_LEFT, mods & PSP_CTRL_LEFT);
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_RIGHT], mods & PSP_CTRL_RIGHT);
|
||||
Input_SetNonRepeatable(IPT_RIGHT, mods & PSP_CTRL_RIGHT);
|
||||
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_FORWARD], mods & PSP_CTRL_UP);
|
||||
Input_SetNonRepeatable(IPT_UP, mods & PSP_CTRL_UP);
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_BACK], mods & PSP_CTRL_DOWN);
|
||||
Input_SetNonRepeatable(IPT_DOWN, mods & PSP_CTRL_DOWN);
|
||||
}
|
||||
|
||||
static void Cursor_GetRawPos(int* x, int* y) {
|
||||
|
@ -131,4 +170,4 @@ void Window_DisableRawMouse(void) {
|
|||
RegrabMouse();
|
||||
Input_RawMode = false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue