Added camera and gestures modules functions
This commit is contained in:
parent
c0d8ae7f4d
commit
6e4cfa5ecf
1 changed files with 53 additions and 20 deletions
67
src/raylib.h
67
src/raylib.h
|
@ -36,7 +36,7 @@
|
||||||
* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
* BSD-like license that allows static linking with closed source software:
|
* BSD-like license that allows static linking with closed source software:
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2013 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
* will the authors be held liable for any damages arising from the use of this software.
|
* will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
@ -176,7 +176,6 @@
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Types and Structures Definition
|
// Types and Structures Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
// Boolean type
|
// Boolean type
|
||||||
typedef enum { false, true } bool;
|
typedef enum { false, true } bool;
|
||||||
|
@ -370,6 +369,9 @@ typedef enum {
|
||||||
GESTURE_PINCH_OUT = 1024
|
GESTURE_PINCH_OUT = 1024
|
||||||
} Gestures;
|
} Gestures;
|
||||||
|
|
||||||
|
// Camera system modes
|
||||||
|
typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" { // Prevents name mangling of functions
|
extern "C" { // Prevents name mangling of functions
|
||||||
#endif
|
#endif
|
||||||
|
@ -383,13 +385,14 @@ extern "C" { // Prevents name mangling of functions
|
||||||
// Window and Graphics Device Functions (Module: core)
|
// Window and Graphics Device Functions (Module: core)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
void InitWindow(int width, int height, struct android_app *state); // Init Android activity
|
void InitWindow(int width, int height, struct android_app *state); // Init Android Activity and OpenGL Graphics
|
||||||
#elif defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
#elif defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
||||||
void InitWindow(int width, int height, const char *title); // Initialize Window and OpenGL Graphics
|
void InitWindow(int width, int height, const char *title); // Initialize Window and OpenGL Graphics
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CloseWindow(void); // Close Window and Terminate Context
|
void CloseWindow(void); // Close Window and Terminate Context
|
||||||
bool WindowShouldClose(void); // Detect if KEY_ESCAPE pressed or Close icon pressed
|
bool WindowShouldClose(void); // Detect if KEY_ESCAPE pressed or Close icon pressed
|
||||||
|
bool IsWindowMinimized(void); // Detect if window has been minimized (or lost focus)
|
||||||
void ToggleFullscreen(void); // Fullscreen toggle (only PLATFORM_DESKTOP)
|
void ToggleFullscreen(void); // Fullscreen toggle (only PLATFORM_DESKTOP)
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
||||||
void SetCustomCursor(const char *cursorImage); // Set a custom cursor icon/image
|
void SetCustomCursor(const char *cursorImage); // Set a custom cursor icon/image
|
||||||
|
@ -418,6 +421,10 @@ Color Fade(Color color, float alpha); // Color fade-in or
|
||||||
void SetConfigFlags(char flags); // Enable some window configurations
|
void SetConfigFlags(char flags); // Enable some window configurations
|
||||||
void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
|
void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
|
||||||
|
|
||||||
|
bool IsFileDropped(void); // Check if a file have been dropped into window
|
||||||
|
char **GetDroppedFiles(int *count); // Retrieve dropped files into window
|
||||||
|
void ClearDroppedFiles(void); // Clear dropped files paths buffer
|
||||||
|
|
||||||
Ray GetMouseRay(Vector2 mousePosition, Camera camera); // TODO: Gives the ray trace from mouse position
|
Ray GetMouseRay(Vector2 mousePosition, Camera camera); // TODO: Gives the ray trace from mouse position
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
@ -476,22 +483,47 @@ bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad b
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
|
||||||
int GetTouchX(void); // Returns touch position X
|
//------------------------------------------------------------------------------------
|
||||||
int GetTouchY(void); // Returns touch position Y
|
// Gestures and Touch Handling Functions (Module: gestures)
|
||||||
Vector2 GetTouchPosition(void); // Returns touch position XY
|
//------------------------------------------------------------------------------------
|
||||||
|
int GetTouchX(void); // Returns touch position X (relative to screen size)
|
||||||
|
int GetTouchY(void); // Returns touch position Y (relative to screen size)
|
||||||
|
Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size)
|
||||||
|
|
||||||
// Gestures System (module: gestures)
|
#if defined(PLATFORM_WEB)
|
||||||
bool IsGestureDetected(void);
|
void InitGesturesSystem(void); // Init gestures system (web)
|
||||||
int GetGestureType(void);
|
#elif defined(PLATFORM_ANDROID)
|
||||||
void SetGesturesEnabled(unsigned int gestureFlags);
|
void InitGesturesSystem(struct android_app *app); // Init gestures system (android)
|
||||||
|
|
||||||
float GetGestureDragIntensity(void);
|
|
||||||
float GetGestureDragAngle(void);
|
|
||||||
Vector2 GetGestureDragVector(void);
|
|
||||||
int GetGestureHoldDuration(void); // Hold time in frames
|
|
||||||
float GetGesturePinchDelta(void);
|
|
||||||
float GetGesturePinchAngle(void);
|
|
||||||
#endif
|
#endif
|
||||||
|
void UpdateGestures(void); // Update gestures detected (must be called every frame)
|
||||||
|
bool IsGestureDetected(void); // Check if a gesture have been detected
|
||||||
|
int GetGestureType(void); // Get latest detected gesture
|
||||||
|
void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags
|
||||||
|
|
||||||
|
float GetGestureDragIntensity(void); // Get gesture drag intensity
|
||||||
|
float GetGestureDragAngle(void); // Get gesture drag angle
|
||||||
|
Vector2 GetGestureDragVector(void); // Get gesture drag vector
|
||||||
|
int GetGestureHoldDuration(void); // Get gesture hold time in frames
|
||||||
|
float GetGesturePinchDelta(void); // Get gesture pinch delta
|
||||||
|
float GetGesturePinchAngle(void); // Get gesture pinch angle
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Camera System Functions (Module: camera)
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
void SetCameraMode(int mode); // Set camera mode (multiple camera modes available)
|
||||||
|
Camera UpdateCamera(Vector3 *playerPosition); // Update camera and player position (1st person and 3rd person cameras)
|
||||||
|
|
||||||
|
void SetCameraMoveControls(int frontKey, int backKey,
|
||||||
|
int leftKey, int rightKey,
|
||||||
|
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
|
||||||
|
|
||||||
|
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 SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
|
||||||
|
|
||||||
|
void SetCameraMouseSensitivity(float sensitivity); // Set camera mouse sensitivity (1st person and 3rd person cameras)
|
||||||
|
void SetCameraTarget(Vector3 target); // Set internal camera target
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Basic Shapes Drawing Functions (Module: shapes)
|
// Basic Shapes Drawing Functions (Module: shapes)
|
||||||
|
@ -625,6 +657,7 @@ void SetSoundVolume(Sound sound, float volume); // Set volume fo
|
||||||
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||||
|
|
||||||
void PlayMusicStream(char *fileName); // Start music playing (open stream)
|
void PlayMusicStream(char *fileName); // Start music playing (open stream)
|
||||||
|
void UpdateMusicStream(void); // Updates buffers for music streaming
|
||||||
void StopMusicStream(void); // Stop music playing (close stream)
|
void StopMusicStream(void); // Stop music playing (close stream)
|
||||||
void PauseMusicStream(void); // Pause music playing
|
void PauseMusicStream(void); // Pause music playing
|
||||||
void ResumeMusicStream(void); // Resume playing paused music
|
void ResumeMusicStream(void); // Resume playing paused music
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue