Review some comments
This commit is contained in:
parent
b0dcdf688f
commit
7bc2e922c9
36
src/core.c
36
src/core.c
@ -777,7 +777,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
// Detect fullscreen change events
|
||||
// Check fullscreen change events
|
||||
//emscripten_set_fullscreenchange_callback("#canvas", NULL, 1, EmscriptenFullscreenChangeCallback);
|
||||
//emscripten_set_resize_callback("#canvas", NULL, 1, EmscriptenResizeCallback);
|
||||
|
||||
@ -3098,7 +3098,7 @@ void OpenURL(const char *url)
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Input (Keyboard, Mouse, Gamepad) Functions
|
||||
//----------------------------------------------------------------------------------
|
||||
// Detect if a key has been pressed once
|
||||
// Check if a key has been pressed once
|
||||
bool IsKeyPressed(int key)
|
||||
{
|
||||
bool pressed = false;
|
||||
@ -3109,14 +3109,14 @@ bool IsKeyPressed(int key)
|
||||
return pressed;
|
||||
}
|
||||
|
||||
// Detect if a key is being pressed (key held down)
|
||||
// Check if a key is being pressed (key held down)
|
||||
bool IsKeyDown(int key)
|
||||
{
|
||||
if (CORE.Input.Keyboard.currentKeyState[key] == 1) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
// Detect if a key has been released once
|
||||
// Check if a key has been released once
|
||||
bool IsKeyReleased(int key)
|
||||
{
|
||||
bool released = false;
|
||||
@ -3127,7 +3127,7 @@ bool IsKeyReleased(int key)
|
||||
return released;
|
||||
}
|
||||
|
||||
// Detect if a key is NOT being pressed (key not held down)
|
||||
// Check if a key is NOT being pressed (key not held down)
|
||||
bool IsKeyUp(int key)
|
||||
{
|
||||
if (CORE.Input.Keyboard.currentKeyState[key] == 0) return true;
|
||||
@ -3189,7 +3189,7 @@ void SetExitKey(int key)
|
||||
|
||||
// NOTE: Gamepad support not implemented in emscripten GLFW3 (PLATFORM_WEB)
|
||||
|
||||
// Detect if a gamepad is available
|
||||
// Check if a gamepad is available
|
||||
bool IsGamepadAvailable(int gamepad)
|
||||
{
|
||||
bool result = false;
|
||||
@ -3211,7 +3211,7 @@ bool IsGamepadName(int gamepad, const char *name)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Return gamepad internal name id
|
||||
// Get gamepad internal name id
|
||||
const char *GetGamepadName(int gamepad)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
@ -3225,7 +3225,7 @@ const char *GetGamepadName(int gamepad)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Return gamepad axis count
|
||||
// Get gamepad axis count
|
||||
int GetGamepadAxisCount(int gamepad)
|
||||
{
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
@ -3237,7 +3237,7 @@ int GetGamepadAxisCount(int gamepad)
|
||||
return CORE.Input.Gamepad.axisCount;
|
||||
}
|
||||
|
||||
// Return axis movement vector for a gamepad
|
||||
// Get axis movement vector for a gamepad
|
||||
float GetGamepadAxisMovement(int gamepad, int axis)
|
||||
{
|
||||
float value = 0;
|
||||
@ -3248,7 +3248,7 @@ float GetGamepadAxisMovement(int gamepad, int axis)
|
||||
return value;
|
||||
}
|
||||
|
||||
// Detect if a gamepad button has been pressed once
|
||||
// Check if a gamepad button has been pressed once
|
||||
bool IsGamepadButtonPressed(int gamepad, int button)
|
||||
{
|
||||
bool pressed = false;
|
||||
@ -3260,7 +3260,7 @@ bool IsGamepadButtonPressed(int gamepad, int button)
|
||||
return pressed;
|
||||
}
|
||||
|
||||
// Detect if a gamepad button is being pressed
|
||||
// Check if a gamepad button is being pressed
|
||||
bool IsGamepadButtonDown(int gamepad, int button)
|
||||
{
|
||||
bool result = false;
|
||||
@ -3271,7 +3271,7 @@ bool IsGamepadButtonDown(int gamepad, int button)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Detect if a gamepad button has NOT been pressed once
|
||||
// Check if a gamepad button has NOT been pressed once
|
||||
bool IsGamepadButtonReleased(int gamepad, int button)
|
||||
{
|
||||
bool released = false;
|
||||
@ -3283,7 +3283,7 @@ bool IsGamepadButtonReleased(int gamepad, int button)
|
||||
return released;
|
||||
}
|
||||
|
||||
// Detect if a gamepad button is NOT being pressed
|
||||
// Check if a gamepad button is NOT being pressed
|
||||
bool IsGamepadButtonUp(int gamepad, int button)
|
||||
{
|
||||
bool result = false;
|
||||
@ -3312,7 +3312,7 @@ int SetGamepadMappings(const char *mappings)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Detect if a mouse button has been pressed once
|
||||
// Check if a mouse button has been pressed once
|
||||
bool IsMouseButtonPressed(int button)
|
||||
{
|
||||
bool pressed = false;
|
||||
@ -3325,7 +3325,7 @@ bool IsMouseButtonPressed(int button)
|
||||
return pressed;
|
||||
}
|
||||
|
||||
// Detect if a mouse button is being pressed
|
||||
// Check if a mouse button is being pressed
|
||||
bool IsMouseButtonDown(int button)
|
||||
{
|
||||
bool down = false;
|
||||
@ -3338,7 +3338,7 @@ bool IsMouseButtonDown(int button)
|
||||
return down;
|
||||
}
|
||||
|
||||
// Detect if a mouse button has been released once
|
||||
// Check if a mouse button has been released once
|
||||
bool IsMouseButtonReleased(int button)
|
||||
{
|
||||
bool released = false;
|
||||
@ -3351,7 +3351,7 @@ bool IsMouseButtonReleased(int button)
|
||||
return released;
|
||||
}
|
||||
|
||||
// Detect if a mouse button is NOT being pressed
|
||||
// Check if a mouse button is NOT being pressed
|
||||
bool IsMouseButtonUp(int button)
|
||||
{
|
||||
return !IsMouseButtonDown(button);
|
||||
@ -5569,7 +5569,7 @@ static void ProcessKeyboard(void)
|
||||
// Up -> 1b 5b 41 / Left -> 1b 5b 44 / Right -> 1b 5b 43 / Down -> 1b 5b 42
|
||||
if (keysBuffer[i] == 0x1b)
|
||||
{
|
||||
// Detect ESC to stop program
|
||||
// Check if ESCAPE key has been pressed to stop program
|
||||
if (bufferByteCount == 1) CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey] = 1;
|
||||
else
|
||||
{
|
||||
|
@ -2919,7 +2919,7 @@ void DrawBoundingBox(BoundingBox box, Color color)
|
||||
DrawCubeWires(center, size.x, size.y, size.z, color);
|
||||
}
|
||||
|
||||
// Detect collision between two spheres
|
||||
// Check collision between two spheres
|
||||
bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2)
|
||||
{
|
||||
bool collision = false;
|
||||
@ -2942,7 +2942,7 @@ bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, floa
|
||||
return collision;
|
||||
}
|
||||
|
||||
// Detect collision between two boxes
|
||||
// Check collision between two boxes
|
||||
// NOTE: Boxes are defined by two points minimum and maximum
|
||||
bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2)
|
||||
{
|
||||
@ -2958,7 +2958,7 @@ bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2)
|
||||
return collision;
|
||||
}
|
||||
|
||||
// Detect collision between box and sphere
|
||||
// Check collision between box and sphere
|
||||
bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius)
|
||||
{
|
||||
bool collision = false;
|
||||
|
38
src/raylib.h
38
src/raylib.h
@ -1075,32 +1075,32 @@ RLAPI void OpenURL(const char *url); // Open URL wi
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
// Input-related functions: keyboard
|
||||
RLAPI bool IsKeyPressed(int key); // Detect if a key has been pressed once
|
||||
RLAPI bool IsKeyDown(int key); // Detect if a key is being pressed
|
||||
RLAPI bool IsKeyReleased(int key); // Detect if a key has been released once
|
||||
RLAPI bool IsKeyUp(int key); // Detect if a key is NOT being pressed
|
||||
RLAPI bool IsKeyPressed(int key); // Check if a key has been pressed once
|
||||
RLAPI bool IsKeyDown(int key); // Check if a key is being pressed
|
||||
RLAPI bool IsKeyReleased(int key); // Check if a key has been released once
|
||||
RLAPI bool IsKeyUp(int key); // Check if a key is NOT being pressed
|
||||
RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
||||
RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued
|
||||
RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued
|
||||
|
||||
// Input-related functions: gamepads
|
||||
RLAPI bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
|
||||
RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available
|
||||
RLAPI bool IsGamepadName(int gamepad, const char *name); // Check gamepad name (if available)
|
||||
RLAPI const char *GetGamepadName(int gamepad); // Return gamepad internal name id
|
||||
RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button has been pressed once
|
||||
RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Detect if a gamepad button is being pressed
|
||||
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad button has been released once
|
||||
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad button is NOT being pressed
|
||||
RLAPI const char *GetGamepadName(int gamepad); // Get gamepad internal name id
|
||||
RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once
|
||||
RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed
|
||||
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once
|
||||
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed
|
||||
RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
|
||||
RLAPI int GetGamepadAxisCount(int gamepad); // Return gamepad axis count for a gamepad
|
||||
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Return axis movement value for a gamepad axis
|
||||
RLAPI int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad
|
||||
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis
|
||||
RLAPI int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
|
||||
|
||||
// Input-related functions: mouse
|
||||
RLAPI bool IsMouseButtonPressed(int button); // Detect if a mouse button has been pressed once
|
||||
RLAPI bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
|
||||
RLAPI bool IsMouseButtonReleased(int button); // Detect if a mouse button has been released once
|
||||
RLAPI bool IsMouseButtonUp(int button); // Detect if a mouse button is NOT being pressed
|
||||
RLAPI bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once
|
||||
RLAPI bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed
|
||||
RLAPI bool IsMouseButtonReleased(int button); // Check if a mouse button has been released once
|
||||
RLAPI bool IsMouseButtonUp(int button); // Check if a mouse button is NOT being pressed
|
||||
RLAPI int GetMouseX(void); // Get mouse position X
|
||||
RLAPI int GetMouseY(void); // Get mouse position Y
|
||||
RLAPI Vector2 GetMousePosition(void); // Get mouse position XY
|
||||
@ -1449,9 +1449,9 @@ RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source,
|
||||
RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
|
||||
|
||||
// Collision detection functions
|
||||
RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Detect collision between two spheres
|
||||
RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Detect collision between two bounding boxes
|
||||
RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Detect collision between box and sphere
|
||||
RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres
|
||||
RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Check collision between two bounding boxes
|
||||
RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Check collision between box and sphere
|
||||
RLAPI RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); // Get collision info between ray and sphere
|
||||
RLAPI RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); // Get collision info between ray and box
|
||||
RLAPI RayCollision GetRayCollisionModel(Ray ray, Model model); // Get collision info between ray and model
|
||||
|
@ -42,11 +42,11 @@
|
||||
#ifndef RAYMATH_H
|
||||
#define RAYMATH_H
|
||||
|
||||
//#define RAYMATH_STANDALONE // NOTE: To use raymath as standalone lib, just uncomment this line
|
||||
//#define RAYMATH_HEADER_ONLY // NOTE: To compile functions as static inline, uncomment this line
|
||||
//#define RAYMATH_STANDALONE // NOTE: To use raymath as standalone lib, just uncomment this line
|
||||
//#define RAYMATH_HEADER_ONLY // NOTE: To compile functions as static inline, uncomment this line
|
||||
|
||||
#ifndef RAYMATH_STANDALONE
|
||||
#include "raylib.h" // Required for structs: Vector3, Matrix
|
||||
#include "raylib.h" // Required for structs: Vector3, Matrix
|
||||
#endif
|
||||
|
||||
#if defined(RAYMATH_IMPLEMENTATION) && defined(RAYMATH_HEADER_ONLY)
|
||||
@ -55,17 +55,17 @@
|
||||
|
||||
#if defined(RAYMATH_IMPLEMENTATION)
|
||||
#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
|
||||
#define RMDEF __declspec(dllexport) extern inline // We are building raylib as a Win32 shared library (.dll).
|
||||
#define RMDEF __declspec(dllexport) extern inline // We are building raylib as a Win32 shared library (.dll).
|
||||
#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
|
||||
#define RMDEF __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
|
||||
#define RMDEF __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
|
||||
#else
|
||||
#define RMDEF extern inline // Provide external definition
|
||||
#endif
|
||||
#elif defined(RAYMATH_HEADER_ONLY)
|
||||
#define RMDEF static inline // Functions may be inlined, no external out-of-line definition
|
||||
#define RMDEF static inline // Functions may be inlined, no external out-of-line definition
|
||||
#else
|
||||
#if defined(__TINYC__)
|
||||
#define RMDEF static inline // plain inline not supported by tinycc (See issue #435)
|
||||
#define RMDEF static inline // WARNING: Plain inline not supported by tinycc (See issue #435)
|
||||
#else
|
||||
#define RMDEF inline // Functions may be inlined or external definition used
|
||||
#endif
|
||||
@ -86,12 +86,12 @@
|
||||
#define RAD2DEG (180.0f/PI)
|
||||
#endif
|
||||
|
||||
// Return float vector for Matrix
|
||||
// Get float vector for Matrix
|
||||
#ifndef MatrixToFloat
|
||||
#define MatrixToFloat(mat) (MatrixToFloatV(mat).v)
|
||||
#endif
|
||||
|
||||
// Return float vector for Vector3
|
||||
// Get float vector for Vector3
|
||||
#ifndef Vector3ToFloat
|
||||
#define Vector3ToFloat(vec) (Vector3ToFloatV(vec).v)
|
||||
#endif
|
||||
@ -559,7 +559,7 @@ RMDEF Vector3 Vector3Reflect(Vector3 v, Vector3 normal)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Return min value for each pair of components
|
||||
// Get min value for each pair of components
|
||||
RMDEF Vector3 Vector3Min(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
Vector3 result = { 0 };
|
||||
@ -571,7 +571,7 @@ RMDEF Vector3 Vector3Min(Vector3 v1, Vector3 v2)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Return max value for each pair of components
|
||||
// Get max value for each pair of components
|
||||
RMDEF Vector3 Vector3Max(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
Vector3 result = { 0 };
|
||||
@ -1487,7 +1487,7 @@ RMDEF Quaternion QuaternionFromEuler(float pitch, float yaw, float roll)
|
||||
return q;
|
||||
}
|
||||
|
||||
// Return the Euler angles equivalent to quaternion (roll, pitch, yaw)
|
||||
// Get the Euler angles equivalent to quaternion (roll, pitch, yaw)
|
||||
// NOTE: Angles are returned in a Vector3 struct in degrees
|
||||
RMDEF Vector3 QuaternionToEuler(Quaternion q)
|
||||
{
|
||||
|
@ -3468,7 +3468,7 @@ void rlSetShader(Shader shader)
|
||||
|
||||
// Matrix state management
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// Return internal modelview matrix
|
||||
// Get internal modelview matrix
|
||||
Matrix rlGetMatrixModelview(void)
|
||||
{
|
||||
Matrix matrix = MatrixIdentity();
|
||||
@ -3497,7 +3497,7 @@ Matrix rlGetMatrixModelview(void)
|
||||
return matrix;
|
||||
}
|
||||
|
||||
// Return internal projection matrix
|
||||
// Get internal projection matrix
|
||||
Matrix rlGetMatrixProjection(void)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_11)
|
||||
|
@ -2646,7 +2646,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color
|
||||
// [x] Optimize ColorAlphaBlend() for faster operations (maybe avoiding divs?)
|
||||
// [x] Consider fast path: no alpha blending required cases (src has no alpha)
|
||||
// [x] Consider fast path: same src/dst format with no alpha -> direct line copy
|
||||
// [-] GetPixelColor(): Return Vector4 instead of Color, easier for ColorAlphaBlend()
|
||||
// [-] GetPixelColor(): Get Vector4 instead of Color, easier for ColorAlphaBlend()
|
||||
|
||||
Color colSrc, colDst, blend;
|
||||
bool blendRequired = true;
|
||||
|
@ -393,7 +393,7 @@ FILE *android_fopen(const char *fileName, const char *mode)
|
||||
|
||||
if (asset != NULL)
|
||||
{
|
||||
// Return pointer to file in the assets
|
||||
// Get pointer to file in the assets
|
||||
return funopen(asset, android_read, android_write, android_seek, android_close);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user