mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-20 13:25:40 +00:00
REVIEWED: Webpage reference comments starting with REF:, more consistent with TODO: and NOTE: comments
This commit is contained in:
@@ -1162,8 +1162,8 @@ static GamepadButton AndroidTranslateGamepadButton(int button)
|
|||||||
static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
||||||
{
|
{
|
||||||
// If additional inputs are required check:
|
// If additional inputs are required check:
|
||||||
// Ref: https://developer.android.com/ndk/reference/group/input
|
// REF: https://developer.android.com/ndk/reference/group/input
|
||||||
// Ref: https://developer.android.com/training/game-controllers/controller-input
|
// REF: https://developer.android.com/training/game-controllers/controller-input
|
||||||
|
|
||||||
int type = AInputEvent_getType(event);
|
int type = AInputEvent_getType(event);
|
||||||
int source = AInputEvent_getSource(event);
|
int source = AInputEvent_getSource(event);
|
||||||
|
|||||||
@@ -1122,7 +1122,7 @@ double GetTime(void)
|
|||||||
// NOTE: This function is only safe to use if you control the URL given
|
// NOTE: This function is only safe to use if you control the URL given
|
||||||
// A user could craft a malicious string performing another action
|
// A user could craft a malicious string performing another action
|
||||||
// Only call this function yourself not with user input or make sure to check the string yourself
|
// Only call this function yourself not with user input or make sure to check the string yourself
|
||||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
// REF: https://github.com/raysan5/raylib/issues/686
|
||||||
void OpenURL(const char *url)
|
void OpenURL(const char *url)
|
||||||
{
|
{
|
||||||
// Security check to (partially) avoid malicious code
|
// Security check to (partially) avoid malicious code
|
||||||
@@ -1234,8 +1234,8 @@ void PollInputEvents(void)
|
|||||||
// Map touch position to mouse position for convenience
|
// Map touch position to mouse position for convenience
|
||||||
// WARNING: If the target desktop device supports touch screen, this behaviour should be reviewed!
|
// WARNING: If the target desktop device supports touch screen, this behaviour should be reviewed!
|
||||||
// TODO: GLFW does not support multi-touch input yet
|
// TODO: GLFW does not support multi-touch input yet
|
||||||
// Ref: https://www.codeproject.com/Articles/668404/Programming-for-Multi-Touch
|
// REF: https://www.codeproject.com/Articles/668404/Programming-for-Multi-Touch
|
||||||
// Ref: https://docs.microsoft.com/en-us/windows/win32/wintouch/getting-started-with-multi-touch-messages
|
// REF: https://docs.microsoft.com/en-us/windows/win32/wintouch/getting-started-with-multi-touch-messages
|
||||||
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
||||||
|
|
||||||
// Check if gamepads are ready
|
// Check if gamepads are ready
|
||||||
@@ -1347,7 +1347,7 @@ void PollInputEvents(void)
|
|||||||
// Function wrappers around RL_*alloc macros, used by glfwInitAllocator() inside of InitPlatform()
|
// Function wrappers around RL_*alloc macros, used by glfwInitAllocator() inside of InitPlatform()
|
||||||
// We need to provide these because GLFWallocator expects function pointers with specific signatures
|
// We need to provide these because GLFWallocator expects function pointers with specific signatures
|
||||||
// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch
|
// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch
|
||||||
// Ref: https://www.glfw.org/docs/latest/intro_guide.html#init_allocator
|
// REF: https://www.glfw.org/docs/latest/intro_guide.html#init_allocator
|
||||||
static void *AllocateWrapper(size_t size, void *user)
|
static void *AllocateWrapper(size_t size, void *user)
|
||||||
{
|
{
|
||||||
(void)user;
|
(void)user;
|
||||||
@@ -1945,8 +1945,8 @@ static void CharCallback(GLFWwindow *window, unsigned int codepoint)
|
|||||||
{
|
{
|
||||||
// NOTE: Registers any key down considering OS keyboard layout but
|
// NOTE: Registers any key down considering OS keyboard layout but
|
||||||
// does not detect action events, those should be managed by user...
|
// does not detect action events, those should be managed by user...
|
||||||
// Ref: https://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
// REF: https://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
||||||
// Ref: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
// REF: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
||||||
|
|
||||||
// Check if there is space available in the queue
|
// Check if there is space available in the queue
|
||||||
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
||||||
|
|||||||
@@ -1129,7 +1129,7 @@ Vector2 GetWindowScaleDPI(void)
|
|||||||
|
|
||||||
#ifndef USING_VERSION_SDL3
|
#ifndef USING_VERSION_SDL3
|
||||||
// NOTE: SDL_GetWindowDisplayScale was only added on SDL3
|
// NOTE: SDL_GetWindowDisplayScale was only added on SDL3
|
||||||
// Ref: https://wiki.libsdl.org/SDL3/SDL_GetWindowDisplayScale
|
// REF: https://wiki.libsdl.org/SDL3/SDL_GetWindowDisplayScale
|
||||||
// TODO: Implement the window scale factor calculation manually
|
// TODO: Implement the window scale factor calculation manually
|
||||||
TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform");
|
TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform");
|
||||||
#else
|
#else
|
||||||
@@ -1279,7 +1279,7 @@ double GetTime(void)
|
|||||||
// NOTE: This function is only safe to use if you control the URL given
|
// NOTE: This function is only safe to use if you control the URL given
|
||||||
// A user could craft a malicious string performing another action
|
// A user could craft a malicious string performing another action
|
||||||
// Only call this function yourself not with user input or make sure to check the string yourself
|
// Only call this function yourself not with user input or make sure to check the string yourself
|
||||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
// REF: https://github.com/raysan5/raylib/issues/686
|
||||||
void OpenURL(const char *url)
|
void OpenURL(const char *url)
|
||||||
{
|
{
|
||||||
// Security check to (partially) avoid malicious code
|
// Security check to (partially) avoid malicious code
|
||||||
|
|||||||
@@ -1239,7 +1239,7 @@ double GetTime(void)
|
|||||||
// NOTE: This function is only safe to use if you control the URL given
|
// NOTE: This function is only safe to use if you control the URL given
|
||||||
// A user could craft a malicious string performing another action
|
// A user could craft a malicious string performing another action
|
||||||
// Only call this function yourself not with user input or make sure to check the string yourself
|
// Only call this function yourself not with user input or make sure to check the string yourself
|
||||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
// REF: https://github.com/raysan5/raylib/issues/686
|
||||||
void OpenURL(const char *url)
|
void OpenURL(const char *url)
|
||||||
{
|
{
|
||||||
// Security check to (partially) avoid malicious code on target platform
|
// Security check to (partially) avoid malicious code on target platform
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ static const short linuxToRaylibMap[KEYMAP_SIZE] = {
|
|||||||
248, 0, 0, 0, 0, 0, 0, 0,
|
248, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
|
||||||
// Gamepads are mapped according to:
|
// Gamepads are mapped according to:
|
||||||
// Ref: https://www.kernel.org/doc/html/next/input/gamepad.html
|
// REF: https://www.kernel.org/doc/html/next/input/gamepad.html
|
||||||
// Those mappings are standardized, but that doesn't mean people follow
|
// Those mappings are standardized, but that doesn't mean people follow
|
||||||
// the standards, so this is more of an approximation
|
// the standards, so this is more of an approximation
|
||||||
[BTN_DPAD_UP] = GAMEPAD_BUTTON_LEFT_FACE_UP,
|
[BTN_DPAD_UP] = GAMEPAD_BUTTON_LEFT_FACE_UP,
|
||||||
@@ -1013,7 +1013,7 @@ double GetTime(void)
|
|||||||
// NOTE: This function is only safe to use if you control the URL given
|
// NOTE: This function is only safe to use if you control the URL given
|
||||||
// A user could craft a malicious string performing another action
|
// A user could craft a malicious string performing another action
|
||||||
// Only call this function yourself not with user input or make sure to check the string yourself
|
// Only call this function yourself not with user input or make sure to check the string yourself
|
||||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
// REF: https://github.com/raysan5/raylib/issues/686
|
||||||
void OpenURL(const char *url)
|
void OpenURL(const char *url)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "OpenURL() not implemented on target platform");
|
TRACELOG(LOG_WARNING, "OpenURL() not implemented on target platform");
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ double GetTime(void)
|
|||||||
// NOTE: This function is only safe to use if you control the URL given.
|
// NOTE: This function is only safe to use if you control the URL given.
|
||||||
// A user could craft a malicious string performing another action.
|
// A user could craft a malicious string performing another action.
|
||||||
// Only call this function yourself not with user input or make sure to check the string yourself.
|
// Only call this function yourself not with user input or make sure to check the string yourself.
|
||||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
// REF: https://github.com/raysan5/raylib/issues/686
|
||||||
void OpenURL(const char *url)
|
void OpenURL(const char *url)
|
||||||
{
|
{
|
||||||
// Security check to (partially) avoid malicious code on target platform
|
// Security check to (partially) avoid malicious code on target platform
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ static void MouseEnterCallback(GLFWwindow *window, int enter);
|
|||||||
|
|
||||||
// Emscripten window callback events
|
// Emscripten window callback events
|
||||||
static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const EmscriptenFullscreenChangeEvent *event, void *userData);
|
static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const EmscriptenFullscreenChangeEvent *event, void *userData);
|
||||||
// static EM_BOOL EmscriptenWindowResizedCallback(int eventType, const EmscriptenUiEvent *event, void *userData);
|
//static EM_BOOL EmscriptenWindowResizedCallback(int eventType, const EmscriptenUiEvent *event, void *userData);
|
||||||
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *event, void *userData);
|
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *event, void *userData);
|
||||||
static EM_BOOL EmscriptenFocusCallback(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData);
|
static EM_BOOL EmscriptenFocusCallback(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData);
|
||||||
static EM_BOOL EmscriptenVisibilityChangeCallback(int eventType, const EmscriptenVisibilityChangeEvent *visibilityChangeEvent, void *userData);
|
static EM_BOOL EmscriptenVisibilityChangeCallback(int eventType, const EmscriptenVisibilityChangeEvent *visibilityChangeEvent, void *userData);
|
||||||
@@ -165,7 +165,7 @@ EM_JS(void, SetCanvasIdJs, (char *out, int outSize), {
|
|||||||
bool WindowShouldClose(void)
|
bool WindowShouldClose(void)
|
||||||
{
|
{
|
||||||
// Emscripten Asyncify is required to run synchronous code in asynchronous JS
|
// Emscripten Asyncify is required to run synchronous code in asynchronous JS
|
||||||
// Ref: https://emscripten.org/docs/porting/asyncify.html
|
// REF: https://emscripten.org/docs/porting/asyncify.html
|
||||||
|
|
||||||
// WindowShouldClose() is not called on a web-ready raylib application if using emscripten_set_main_loop()
|
// WindowShouldClose() is not called on a web-ready raylib application if using emscripten_set_main_loop()
|
||||||
// and encapsulating one frame execution on a UpdateDrawFrame() function,
|
// and encapsulating one frame execution on a UpdateDrawFrame() function,
|
||||||
@@ -243,7 +243,7 @@ void ToggleFullscreen(void)
|
|||||||
|
|
||||||
// Option 2: Request fullscreen for the canvas element with strategy
|
// Option 2: Request fullscreen for the canvas element with strategy
|
||||||
// This option does not seem to work at all
|
// This option does not seem to work at all
|
||||||
// Ref: https://github.com/emscripten-core/emscripten/issues/5124
|
// REF: https://github.com/emscripten-core/emscripten/issues/5124
|
||||||
// EmscriptenFullscreenStrategy strategy = {
|
// EmscriptenFullscreenStrategy strategy = {
|
||||||
// .scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH, //EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT,
|
// .scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH, //EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT,
|
||||||
// .canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF,
|
// .canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF,
|
||||||
@@ -1520,8 +1520,8 @@ static void CharCallback(GLFWwindow *window, unsigned int key)
|
|||||||
|
|
||||||
// NOTE: Registers any key down considering OS keyboard layout but
|
// NOTE: Registers any key down considering OS keyboard layout but
|
||||||
// does not detect action events, those should be managed by user...
|
// does not detect action events, those should be managed by user...
|
||||||
// Ref: https://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
// REF: https://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
||||||
// Ref: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
// REF: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
||||||
|
|
||||||
// Check if there is space available in the queue
|
// Check if there is space available in the queue
|
||||||
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
||||||
|
|||||||
@@ -1660,8 +1660,8 @@ float GetFrameTime(void)
|
|||||||
// Wait for some time (stop program execution)
|
// Wait for some time (stop program execution)
|
||||||
// NOTE: Sleep() granularity could be around 10 ms, it means, Sleep() could
|
// NOTE: Sleep() granularity could be around 10 ms, it means, Sleep() could
|
||||||
// take longer than expected... for that reason we use the busy wait loop
|
// take longer than expected... for that reason we use the busy wait loop
|
||||||
// Ref: http://stackoverflow.com/questions/43057578/c-programming-win32-games-sleep-taking-longer-than-expected
|
// REF: http://stackoverflow.com/questions/43057578/c-programming-win32-games-sleep-taking-longer-than-expected
|
||||||
// Ref: http://www.geisswerks.com/ryan/FAQS/timing.html --> All about timing on Win32!
|
// REF: http://www.geisswerks.com/ryan/FAQS/timing.html --> All about timing on Win32!
|
||||||
void WaitTime(double seconds)
|
void WaitTime(double seconds)
|
||||||
{
|
{
|
||||||
if (seconds < 0) return; // Security check
|
if (seconds < 0) return; // Security check
|
||||||
|
|||||||
@@ -3914,7 +3914,7 @@ void rlUnloadFramebuffer(unsigned int id)
|
|||||||
|
|
||||||
// TODO: Review warning retrieving object name in WebGL
|
// TODO: Review warning retrieving object name in WebGL
|
||||||
// WARNING: WebGL: INVALID_ENUM: getFramebufferAttachmentParameter: invalid parameter name
|
// WARNING: WebGL: INVALID_ENUM: getFramebufferAttachmentParameter: invalid parameter name
|
||||||
// Ref: https://registry.khronos.org/webgl/specs/latest/1.0/
|
// REF: https://registry.khronos.org/webgl/specs/latest/1.0/
|
||||||
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depthId);
|
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depthId);
|
||||||
|
|
||||||
unsigned int depthIdU = (unsigned int)depthId;
|
unsigned int depthIdU = (unsigned int)depthId;
|
||||||
@@ -4485,7 +4485,7 @@ void rlSetUniformMatrices(int locIndex, const Matrix *matrices, int count)
|
|||||||
glUniformMatrix4fv(locIndex, count, true, (const float *)matrices);
|
glUniformMatrix4fv(locIndex, count, true, (const float *)matrices);
|
||||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// WARNING: WebGL does not support Matrix transpose ("true" parameter)
|
// WARNING: WebGL does not support Matrix transpose ("true" parameter)
|
||||||
// Ref: https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix
|
// REF: https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix
|
||||||
glUniformMatrix4fv(locIndex, count, false, (const float *)matrices);
|
glUniformMatrix4fv(locIndex, count, false, (const float *)matrices);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5998,8 +5998,8 @@ static Model LoadGLTF(const char *fileName)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Load animation data
|
// Load animation data
|
||||||
// Ref: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skins
|
// REF: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skins
|
||||||
// Ref: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skinned-mesh-attributes
|
// REF: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skinned-mesh-attributes
|
||||||
//
|
//
|
||||||
// LIMITATIONS:
|
// LIMITATIONS:
|
||||||
// - Only supports 1 armature per file, and skips loading it if there are multiple armatures
|
// - Only supports 1 armature per file, and skips loading it if there are multiple armatures
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ extern void LoadFontDefault(void)
|
|||||||
if (defaultFont.glyphs != NULL) return;
|
if (defaultFont.glyphs != NULL) return;
|
||||||
|
|
||||||
// NOTE: Using UTF-8 encoding table for Unicode U+0000..U+00FF Basic Latin + Latin-1 Supplement
|
// NOTE: Using UTF-8 encoding table for Unicode U+0000..U+00FF Basic Latin + Latin-1 Supplement
|
||||||
// Ref: http://www.utf8-chartable.de/unicode-utf8-table.pl
|
// REF: http://www.utf8-chartable.de/unicode-utf8-table.pl
|
||||||
|
|
||||||
defaultFont.glyphCount = 224; // Number of glyphs included in our default font
|
defaultFont.glyphCount = 224; // Number of glyphs included in our default font
|
||||||
defaultFont.glyphPadding = 0; // Characters padding
|
defaultFont.glyphPadding = 0; // Characters padding
|
||||||
|
|||||||
@@ -4203,7 +4203,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
|
|||||||
/*else if (layout == CUBEMAP_LAYOUT_PANORAMA)
|
/*else if (layout == CUBEMAP_LAYOUT_PANORAMA)
|
||||||
{
|
{
|
||||||
// TODO: Implement panorama by converting image to square faces...
|
// TODO: Implement panorama by converting image to square faces...
|
||||||
// Ref: https://github.com/denivip/panorama/blob/master/panorama.cpp
|
// REF: https://github.com/denivip/panorama/blob/master/panorama.cpp
|
||||||
} */
|
} */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -5410,7 +5410,7 @@ int GetPixelDataSize(int width, int height, int format)
|
|||||||
// Module Internal Functions Definition
|
// Module Internal Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Convert half-float (stored as unsigned short) to float
|
// Convert half-float (stored as unsigned short) to float
|
||||||
// Ref: https://stackoverflow.com/questions/1659440/32-bit-to-16-bit-floating-point-conversion/60047308#60047308
|
// REF: https://stackoverflow.com/questions/1659440/32-bit-to-16-bit-floating-point-conversion/60047308#60047308
|
||||||
static float HalfToFloat(unsigned short x)
|
static float HalfToFloat(unsigned short x)
|
||||||
{
|
{
|
||||||
float result = 0.0f;
|
float result = 0.0f;
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ void InitAssetManager(AAssetManager *manager, const char *dataPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replacement for fopen()
|
// Replacement for fopen()
|
||||||
// Ref: https://developer.android.com/ndk/reference/group/asset
|
// REF: https://developer.android.com/ndk/reference/group/asset
|
||||||
FILE *android_fopen(const char *fileName, const char *mode)
|
FILE *android_fopen(const char *fileName, const char *mode)
|
||||||
{
|
{
|
||||||
if (mode[0] == 'w')
|
if (mode[0] == 'w')
|
||||||
@@ -454,7 +454,7 @@ FILE *android_fopen(const char *fileName, const char *mode)
|
|||||||
// NOTE: fopen() is mapped to android_fopen() that only grants read access to
|
// NOTE: fopen() is mapped to android_fopen() that only grants read access to
|
||||||
// assets directory through AAssetManager but we want to also be able to
|
// assets directory through AAssetManager but we want to also be able to
|
||||||
// write data when required using the standard stdio FILE access functions
|
// write data when required using the standard stdio FILE access functions
|
||||||
// Ref: https://stackoverflow.com/questions/11294487/android-writing-saving-files-from-native-code-only
|
// REF: https://stackoverflow.com/questions/11294487/android-writing-saving-files-from-native-code-only
|
||||||
#undef fopen
|
#undef fopen
|
||||||
return fopen(TextFormat("%s/%s", internalDataPath, fileName), mode);
|
return fopen(TextFormat("%s/%s", internalDataPath, fileName), mode);
|
||||||
#define fopen(name, mode) android_fopen(name, mode)
|
#define fopen(name, mode) android_fopen(name, mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user