mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Avoid references to PLATFORM_ flags #3313
This commit is contained in:
@ -16,8 +16,8 @@
|
||||
* - TRACELOG() function is located in raylib [utils] module
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define RCORE_WEB_CUSTOM_FLAG
|
||||
* Custom flag for rcore on PLATFORM_WEB -not used-
|
||||
* #define RCORE_PLATFORM_CUSTOM_FLAG
|
||||
* Custom flag for rcore on target platform -not used-
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* emscripten - Allow interaction between browser API and C
|
||||
@ -413,49 +413,49 @@ void ToggleFullscreen(void)
|
||||
// Set window state: maximized, if resizable
|
||||
void MaximizeWindow(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MaximizeWindow() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "MaximizeWindow() not available on target platform");
|
||||
}
|
||||
|
||||
// Set window state: minimized
|
||||
void MinimizeWindow(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MinimizeWindow() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "MinimizeWindow() not available on target platform");
|
||||
}
|
||||
|
||||
// Set window state: not minimized/maximized
|
||||
void RestoreWindow(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "RestoreWindow() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "RestoreWindow() not available on target platform");
|
||||
}
|
||||
|
||||
// Toggle borderless windowed mode
|
||||
void ToggleBorderlessWindowed(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "ToggleBorderlessWindowed() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "ToggleBorderlessWindowed() not available on target platform");
|
||||
}
|
||||
|
||||
// Set window configuration state using flags
|
||||
void SetWindowState(unsigned int flags)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SetWindowState() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "SetWindowState() not available on target platform");
|
||||
}
|
||||
|
||||
// Clear window configuration state flags
|
||||
void ClearWindowState(unsigned int flags)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "ClearWindowState() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "ClearWindowState() not available on target platform");
|
||||
}
|
||||
|
||||
// Set icon for window
|
||||
void SetWindowIcon(Image image)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SetWindowIcon() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "SetWindowIcon() not available on target platform");
|
||||
}
|
||||
|
||||
// Set icon for window, multiple images
|
||||
void SetWindowIcons(Image *images, int count)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SetWindowIcons() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "SetWindowIcons() not available on target platform");
|
||||
}
|
||||
|
||||
// Set title for window
|
||||
@ -468,13 +468,13 @@ void SetWindowTitle(const char *title)
|
||||
// Set window position on screen (windowed mode)
|
||||
void SetWindowPosition(int x, int y)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SetWindowPosition() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "SetWindowPosition() not available on target platform");
|
||||
}
|
||||
|
||||
// Set monitor for the current window
|
||||
void SetWindowMonitor(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SetWindowMonitor() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "SetWindowMonitor() not available on target platform");
|
||||
}
|
||||
|
||||
// Set window minimum dimensions (FLAG_WINDOW_RESIZABLE)
|
||||
@ -506,96 +506,96 @@ void SetWindowSize(int width, int height)
|
||||
// Set window opacity, value opacity is between 0.0 and 1.0
|
||||
void SetWindowOpacity(float opacity)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SetWindowOpacity() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "SetWindowOpacity() not available on target platform");
|
||||
}
|
||||
|
||||
// Set window focused
|
||||
void SetWindowFocused(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SetWindowFocused() not available on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "SetWindowFocused() not available on target platform");
|
||||
}
|
||||
|
||||
// Get native window handle
|
||||
void *GetWindowHandle(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetWindowHandle() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetWindowHandle() not implemented on target platform");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get number of monitors
|
||||
int GetMonitorCount(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorCount() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetMonitorCount() not implemented on target platform");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get number of monitors
|
||||
int GetCurrentMonitor(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetCurrentMonitor() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetCurrentMonitor() not implemented on target platform");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get selected monitor position
|
||||
Vector2 GetMonitorPosition(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPosition() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPosition() not implemented on target platform");
|
||||
return (Vector2){ 0, 0 };
|
||||
}
|
||||
|
||||
// Get selected monitor width (currently used by monitor)
|
||||
int GetMonitorWidth(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorWidth() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetMonitorWidth() not implemented on target platform");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get selected monitor height (currently used by monitor)
|
||||
int GetMonitorHeight(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorHeight() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetMonitorHeight() not implemented on target platform");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get selected monitor physical width in millimetres
|
||||
int GetMonitorPhysicalWidth(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalWidth() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalWidth() not implemented on target platform");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get selected monitor physical height in millimetres
|
||||
int GetMonitorPhysicalHeight(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalHeight() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalHeight() not implemented on target platform");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get selected monitor refresh rate
|
||||
int GetMonitorRefreshRate(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorRefreshRate() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetMonitorRefreshRate() not implemented on target platform");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the human-readable, UTF-8 encoded name of the selected monitor
|
||||
const char *GetMonitorName(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorName() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetMonitorName() not implemented on target platform");
|
||||
return "";
|
||||
}
|
||||
|
||||
// Get window position XY on monitor
|
||||
Vector2 GetWindowPosition(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetWindowPosition() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetWindowPosition() not implemented on target platform");
|
||||
return (Vector2){ 0, 0 };
|
||||
}
|
||||
|
||||
// Get window scale DPI factor for current monitor
|
||||
Vector2 GetWindowScaleDPI(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on PLATFORM_WEB");
|
||||
TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform");
|
||||
return (Vector2){ 1.0f, 1.0f };
|
||||
}
|
||||
|
||||
@ -688,7 +688,7 @@ double GetTime(void)
|
||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
||||
void OpenURL(const char *url)
|
||||
{
|
||||
// Security check to (partially) avoid malicious code on PLATFORM_WEB
|
||||
// Security check to (partially) avoid malicious code on target platform
|
||||
if (strchr(url, '\'') != NULL) TRACELOG(LOG_WARNING, "SYSTEM: Provided URL could be potentially malicious, avoid [\'] character");
|
||||
else emscripten_run_script(TextFormat("window.open('%s', '_blank')", url));
|
||||
}
|
||||
@ -745,9 +745,7 @@ Vector2 GetMousePosition(void)
|
||||
{
|
||||
Vector2 position = { 0 };
|
||||
|
||||
// TODO: Review touch position
|
||||
|
||||
// NOTE: On PLATFORM_WEB, even on canvas scaling, mouse position is proportionally returned
|
||||
// NOTE: On canvas scaling, mouse position is proportionally returned
|
||||
position.x = (CORE.Input.Mouse.currentPosition.x + CORE.Input.Mouse.offset.x)*CORE.Input.Mouse.scale.x;
|
||||
position.y = (CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y;
|
||||
|
||||
@ -846,7 +844,7 @@ void PollInputEvents(void)
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.previousTouchState[i] = CORE.Input.Touch.currentTouchState[i];
|
||||
|
||||
// Reset touch positions
|
||||
// TODO: It resets on PLATFORM_WEB the mouse position and not filled again until a move-event,
|
||||
// TODO: It resets on target platform the mouse position and not filled again until a move-event,
|
||||
// so, if mouse is not moved it returns a (0, 0) position... this behaviour should be reviewed!
|
||||
//for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.position[i] = (Vector2){ 0, 0 };
|
||||
|
||||
@ -1567,7 +1565,7 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
|
||||
else if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) CORE.Input.Touch.currentTouchState[i] = 0;
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM) // PLATFORM_WEB
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
GestureEvent gestureEvent = {0};
|
||||
|
||||
gestureEvent.pointCount = CORE.Input.Touch.pointCount;
|
||||
|
||||
Reference in New Issue
Block a user