mirror of
https://github.com/aap/librw.git
synced 2026-08-30 11:18:26 +01:00
skeleton: tracked input state, analog pad api, camera manipulator, file paths
EventHandler now keeps keys/mouse/pad state so apps don't have to; sk::Camera is an orbit/dolly/pan manipulator over an rw::Camera; GetFilePath mangles paths for cdrom0:/host:/host0: on ps2. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+55
-6
@@ -102,20 +102,69 @@ struct Args
|
||||
};
|
||||
extern Args args;
|
||||
|
||||
// Pad buttons, same bit order as the PS2 pad
|
||||
enum PadButton
|
||||
{
|
||||
PADL2 = 0x0001,
|
||||
PADR2 = 0x0002,
|
||||
PADL1 = 0x0004,
|
||||
PADR1 = 0x0008,
|
||||
PADTRIANGLE = 0x0010,
|
||||
PADCIRCLE = 0x0020,
|
||||
PADCROSS = 0x0040,
|
||||
PADSQUARE = 0x0080,
|
||||
PADSELECT = 0x0100,
|
||||
PADL3 = 0x0200,
|
||||
PADR3 = 0x0400,
|
||||
PADSTART = 0x0800,
|
||||
PADUP = 0x1000,
|
||||
PADRIGHT = 0x2000,
|
||||
PADDOWN = 0x4000,
|
||||
PADLEFT = 0x8000,
|
||||
};
|
||||
|
||||
struct PadState
|
||||
{
|
||||
// -1..1, down/right positive, deadzone already applied
|
||||
float leftx, lefty;
|
||||
float rightx, righty;
|
||||
uint32 buttons;
|
||||
bool32 connected;
|
||||
};
|
||||
|
||||
// Input state, tracked by EventHandler so apps don't have to.
|
||||
extern bool32 keys[KEY_NUMKEYS];
|
||||
extern MouseState mouse; // live
|
||||
extern MouseState prevmouse; // as of the previous frame
|
||||
extern PadState pad;
|
||||
|
||||
// File paths.
|
||||
// On PS2 a CDROM build goes through cdrom0:, otherwise paths are
|
||||
// prefixed with hostPrefix ("host:" for pcsx2, "host0:" for the SCE
|
||||
// TOOL) and relative paths get a "./" so the host fs resolves them.
|
||||
// On PC the path is passed through unchanged.
|
||||
#define SK_MAXPATH 256
|
||||
char *GetFilePath(char *dst, const char *path);
|
||||
#ifdef RW_PS2
|
||||
extern const char *hostPrefix;
|
||||
#endif
|
||||
|
||||
bool InitRW(void);
|
||||
void TerminateRW(void);
|
||||
Camera *CameraCreate(int32 width, int32 height, bool32 z);
|
||||
rw::Camera *CameraCreate(int32 width, int32 height, bool32 z);
|
||||
void CameraDestroy(rw::Camera *cam);
|
||||
void CameraSize(Camera *cam, Rect *r, float viewWindow = 0.0f, float aspectRatio = 0.0f);
|
||||
void CameraMove(Camera *cam, V3d *delta);
|
||||
void CameraPan(Camera *cam, V3d *pos, float angle);
|
||||
void CameraTilt(Camera *cam, V3d *pos, float angle);
|
||||
void CameraRotate(Camera *cam, V3d *pos, float angle);
|
||||
void CameraSize(rw::Camera *cam, Rect *r, float viewWindow = 0.0f, float aspectRatio = 0.0f);
|
||||
void CameraMove(rw::Camera *cam, V3d *delta);
|
||||
void CameraPan(rw::Camera *cam, V3d *pos, float angle);
|
||||
void CameraTilt(rw::Camera *cam, V3d *pos, float angle);
|
||||
void CameraRotate(rw::Camera *cam, V3d *pos, float angle);
|
||||
void SetMousePosition(int x, int y);
|
||||
EventStatus EventHandler(Event e, void *param);
|
||||
|
||||
}
|
||||
|
||||
#include "camera.h"
|
||||
|
||||
sk::EventStatus AppEventHandler(sk::Event e, void *param);
|
||||
|
||||
#ifndef RW_PS2
|
||||
|
||||
Reference in New Issue
Block a user