瀏覽代碼

Camera funcs, review params names

Just for a better consistency
pull/1467/head
Ray 4 年之前
父節點
當前提交
d82113ec34
共有 2 個檔案被更改,包括 22 行新增22 行删除
  1. +18
    -18
      src/camera.h
  2. +4
    -4
      src/raylib.h

+ 18
- 18
src/camera.h 查看文件

@ -110,12 +110,12 @@ extern "C" { // Prevents name mangling of functions
void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available) void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available)
void UpdateCamera(Camera *camera); // Update camera position for selected mode void UpdateCamera(Camera *camera); // Update camera position for selected mode
void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
void SetCameraPanControl(int keyPan); // Set camera pan key to combine with mouse movement (free camera)
void SetCameraAltControl(int keyAlt); // Set camera alt key to combine with mouse movement (free camera)
void SetCameraSmoothZoomControl(int szoomKey); // Set camera smooth zoom key to combine with mouse (free camera) void SetCameraSmoothZoomControl(int szoomKey); // Set camera smooth zoom key to combine with mouse (free camera)
void SetCameraMoveControls(int frontKey, int backKey,
int rightKey, int leftKey,
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
void SetCameraMoveControls(int keyFront, int keyBack,
int keyRight, int keyLeft,
int keyUp, int keyDown); // Set camera move controls (1st person and 3rd person cameras)
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -289,8 +289,8 @@ void UpdateCamera(Camera *camera)
// Keys input detection // Keys input detection
// TODO: Input detection is raylib-dependant, it could be moved outside the module // TODO: Input detection is raylib-dependant, it could be moved outside the module
bool panKey = IsMouseButtonDown(CAMERA.panControl);
bool altKey = IsKeyDown(CAMERA.altControl);
bool keyPan = IsMouseButtonDown(CAMERA.panControl);
bool keyAlt = IsKeyDown(CAMERA.altControl);
bool szoomKey = IsKeyDown(CAMERA.smoothZoomControl); bool szoomKey = IsKeyDown(CAMERA.smoothZoomControl);
bool direction[6] = { IsKeyDown(CAMERA.moveControl[MOVE_FRONT]), bool direction[6] = { IsKeyDown(CAMERA.moveControl[MOVE_FRONT]),
IsKeyDown(CAMERA.moveControl[MOVE_BACK]), IsKeyDown(CAMERA.moveControl[MOVE_BACK]),
@ -362,9 +362,9 @@ void UpdateCamera(Camera *camera)
} }
// Input keys checks // Input keys checks
if (panKey)
if (keyPan)
{ {
if (altKey) // Alternative key behaviour
if (keyAlt) // Alternative key behaviour
{ {
if (szoomKey) if (szoomKey)
{ {
@ -500,23 +500,23 @@ void UpdateCamera(Camera *camera)
} }
// Set camera pan key to combine with mouse movement (free camera) // Set camera pan key to combine with mouse movement (free camera)
void SetCameraPanControl(int panKey) { CAMERA.panControl = panKey; }
void SetCameraPanControl(int keyPan) { CAMERA.panControl = keyPan; }
// Set camera alt key to combine with mouse movement (free camera) // Set camera alt key to combine with mouse movement (free camera)
void SetCameraAltControl(int altKey) { CAMERA.altControl = altKey; }
void SetCameraAltControl(int keyAlt) { CAMERA.altControl = keyAlt; }
// Set camera smooth zoom key to combine with mouse (free camera) // Set camera smooth zoom key to combine with mouse (free camera)
void SetCameraSmoothZoomControl(int szoomKey) { CAMERA.smoothZoomControl = szoomKey; } void SetCameraSmoothZoomControl(int szoomKey) { CAMERA.smoothZoomControl = szoomKey; }
// Set camera move controls (1st person and 3rd person cameras) // Set camera move controls (1st person and 3rd person cameras)
void SetCameraMoveControls(int frontKey, int backKey, int rightKey, int leftKey, int upKey, int downKey)
void SetCameraMoveControls(int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown)
{ {
CAMERA.moveControl[MOVE_FRONT] = frontKey;
CAMERA.moveControl[MOVE_BACK] = backKey;
CAMERA.moveControl[MOVE_RIGHT] = rightKey;
CAMERA.moveControl[MOVE_LEFT] = leftKey;
CAMERA.moveControl[MOVE_UP] = upKey;
CAMERA.moveControl[MOVE_DOWN] = downKey;
CAMERA.moveControl[MOVE_FRONT] = keyFront;
CAMERA.moveControl[MOVE_BACK] = keyBack;
CAMERA.moveControl[MOVE_RIGHT] = keyRight;
CAMERA.moveControl[MOVE_LEFT] = keyLeft;
CAMERA.moveControl[MOVE_UP] = keyUp;
CAMERA.moveControl[MOVE_DOWN] = keyDown;
} }
#endif // CAMERA_IMPLEMENTATION #endif // CAMERA_IMPLEMENTATION

+ 4
- 4
src/raylib.h 查看文件

@ -1074,10 +1074,10 @@ RLAPI float GetGesturePinchAngle(void); // Get gesture pin
RLAPI void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available) RLAPI void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available)
RLAPI void UpdateCamera(Camera *camera); // Update camera position for selected mode RLAPI void UpdateCamera(Camera *camera); // Update camera position for selected mode
RLAPI void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
RLAPI void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
RLAPI void SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
RLAPI void SetCameraMoveControls(int frontKey, int backKey, int rightKey, int leftKey, int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
RLAPI void SetCameraPanControl(int keyPan); // Set camera pan key to combine with mouse movement (free camera)
RLAPI void SetCameraAltControl(int keyAlt); // Set camera alt key to combine with mouse movement (free camera)
RLAPI void SetCameraSmoothZoomControl(int keySmoothZoom); // Set camera smooth zoom key to combine with mouse (free camera)
RLAPI void SetCameraMoveControls(int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown); // Set camera move controls (1st person and 3rd person cameras)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Basic Shapes Drawing Functions (Module: shapes) // Basic Shapes Drawing Functions (Module: shapes)

Loading…
取消
儲存