mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Compare commits
8 Commits
0246621210
...
91addeb889
| Author | SHA1 | Date | |
|---|---|---|---|
| 91addeb889 | |||
| ee3be5799a | |||
| 87d49262f8 | |||
| 81004135a4 | |||
| cc83b2bd8e | |||
| 46e8343a30 | |||
| 3cf3b309c6 | |||
| 5fbf67a630 |
@ -551,6 +551,7 @@ CORE = \
|
|||||||
core/core_storage_values \
|
core/core_storage_values \
|
||||||
core/core_text_file_loading \
|
core/core_text_file_loading \
|
||||||
core/core_undo_redo \
|
core/core_undo_redo \
|
||||||
|
core/core_viewport_scaling \
|
||||||
core/core_vr_simulator \
|
core/core_vr_simulator \
|
||||||
core/core_window_flags \
|
core/core_window_flags \
|
||||||
core/core_window_letterbox \
|
core/core_window_letterbox \
|
||||||
|
|||||||
@ -539,6 +539,7 @@ CORE = \
|
|||||||
core/core_storage_values \
|
core/core_storage_values \
|
||||||
core/core_text_file_loading \
|
core/core_text_file_loading \
|
||||||
core/core_undo_redo \
|
core/core_undo_redo \
|
||||||
|
core/core_viewport_scaling \
|
||||||
core/core_vr_simulator \
|
core/core_vr_simulator \
|
||||||
core/core_window_flags \
|
core/core_window_flags \
|
||||||
core/core_window_letterbox \
|
core/core_window_letterbox \
|
||||||
|
|||||||
@ -64,6 +64,7 @@ Examples using raylib[core](../src/rcore.c) platform functionality like window c
|
|||||||
| [core_high_dpi](core/core_high_dpi.c) | <img src="core/core_high_dpi.png" alt="core_high_dpi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.5 | [Jonathan Marler](https://github.com/marler8997) |
|
| [core_high_dpi](core/core_high_dpi.c) | <img src="core/core_high_dpi.png" alt="core_high_dpi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.5 | [Jonathan Marler](https://github.com/marler8997) |
|
||||||
| [core_render_texture](core/core_render_texture.c) | <img src="core/core_render_texture.png" alt="core_render_texture" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_render_texture](core/core_render_texture.c) | <img src="core/core_render_texture.png" alt="core_render_texture" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_undo_redo](core/core_undo_redo.c) | <img src="core/core_undo_redo.png" alt="core_undo_redo" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.6 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_undo_redo](core/core_undo_redo.c) | <img src="core/core_undo_redo.png" alt="core_undo_redo" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.6 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_viewport_scaling](core/core_viewport_scaling.c) | <img src="core/core_viewport_scaling.png" alt="core_viewport_scaling" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Agnis Aldins](https://github.com/nezvers) |
|
||||||
| [core_input_actions](core/core_input_actions.c) | <img src="core/core_input_actions.png" alt="core_input_actions" width="80"> | ⭐⭐☆☆ | 5.5 | 5.6 | [Jett](https://github.com/JettMonstersGoBoom) |
|
| [core_input_actions](core/core_input_actions.c) | <img src="core/core_input_actions.png" alt="core_input_actions" width="80"> | ⭐⭐☆☆ | 5.5 | 5.6 | [Jett](https://github.com/JettMonstersGoBoom) |
|
||||||
| [core_directory_files](core/core_directory_files.c) | <img src="core/core_directory_files.png" alt="core_directory_files" width="80"> | ⭐☆☆☆ | 5.5 | 5.6 | [Hugo ARNAL](https://github.com/hugoarnal) |
|
| [core_directory_files](core/core_directory_files.c) | <img src="core/core_directory_files.png" alt="core_directory_files" width="80"> | ⭐☆☆☆ | 5.5 | 5.6 | [Hugo ARNAL](https://github.com/hugoarnal) |
|
||||||
| [core_highdpi_testbed](core/core_highdpi_testbed.c) | <img src="core/core_highdpi_testbed.png" alt="core_highdpi_testbed" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_highdpi_testbed](core/core_highdpi_testbed.c) | <img src="core/core_highdpi_testbed.png" alt="core_highdpi_testbed" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
|||||||
351
examples/core/core_viewport_scaling.c
Normal file
351
examples/core/core_viewport_scaling.c
Normal file
@ -0,0 +1,351 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - viewport scaling
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.5
|
||||||
|
*
|
||||||
|
* Example contributed by Agnis Aldins (@nezvers) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Agnis Aldins (@nezvers)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
// For itteration purposes and teaching example
|
||||||
|
#define RESOLUTION_COUNT 4
|
||||||
|
|
||||||
|
enum ViewportType
|
||||||
|
{
|
||||||
|
// Only upscale, useful for pixel art
|
||||||
|
KEEP_ASPECT_INTEGER,
|
||||||
|
KEEP_HEIGHT_INTEGER,
|
||||||
|
KEEP_WIDTH_INTEGER,
|
||||||
|
// Can also downscale
|
||||||
|
KEEP_ASPECT,
|
||||||
|
KEEP_HEIGHT,
|
||||||
|
KEEP_WIDTH,
|
||||||
|
// For itteration purposes and as a teaching example
|
||||||
|
VIEWPORT_TYPE_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
static void KeepAspectCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
|
||||||
|
static void KeepHeightCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
|
||||||
|
static void KeepWidthCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
|
||||||
|
static void KeepAspectCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
|
||||||
|
static void KeepHeightCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
|
||||||
|
static void KeepWidthCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
|
||||||
|
static void ResizeRenderSize(enum ViewportType viewportType, int *screenWidth, int *screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect, RenderTexture2D *target);
|
||||||
|
|
||||||
|
// Example how to calculate position on RenderTexture
|
||||||
|
static Vector2 Screen2RenderTexturePosition(Vector2 point, Rectangle *textureRect, Rectangle *scaledRect);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Preset resolutions that could be created by subdividing screen resolution
|
||||||
|
Vector2 resolutionList[RESOLUTION_COUNT] = {
|
||||||
|
(Vector2){64, 64},
|
||||||
|
(Vector2){256, 240},
|
||||||
|
(Vector2){320, 180},
|
||||||
|
// 4K doesn't work with integer scaling but included for example purposes with non-integer scaling
|
||||||
|
(Vector2){3840, 2160},
|
||||||
|
};
|
||||||
|
int resolutionIndex = 0;
|
||||||
|
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
int gameWidth = 64;
|
||||||
|
int gameHeight = 64;
|
||||||
|
|
||||||
|
RenderTexture2D target = (RenderTexture2D){0};
|
||||||
|
Rectangle sourceRect = (Rectangle){0};
|
||||||
|
Rectangle destRect = (Rectangle){0};
|
||||||
|
|
||||||
|
// For displaying on GUI
|
||||||
|
const char *ViewportTypeNames[VIEWPORT_TYPE_COUNT] = {
|
||||||
|
"KEEP_ASPECT_INTEGER",
|
||||||
|
"KEEP_HEIGHT_INTEGER",
|
||||||
|
"KEEP_WIDTH_INTEGER",
|
||||||
|
"KEEP_ASPECT",
|
||||||
|
"KEEP_HEIGHT",
|
||||||
|
"KEEP_WIDTH",
|
||||||
|
};
|
||||||
|
enum ViewportType viewportType = KEEP_ASPECT_INTEGER;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - Viewport Scaling");
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//----------------------------------------------------------
|
||||||
|
|
||||||
|
// Button rectangles
|
||||||
|
Rectangle decreaseResolutionButton = (Rectangle){200, 30, 10, 10};
|
||||||
|
Rectangle increaseResolutionButton = (Rectangle){215, 30, 10, 10};
|
||||||
|
Rectangle decreaseTypeButton = (Rectangle){200, 45, 10, 10};
|
||||||
|
Rectangle increaseTypeButton = (Rectangle){215, 45, 10, 10};
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//-----------------------------------------------------
|
||||||
|
if (IsWindowResized()){
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
Vector2 mousePosition = GetMousePosition();
|
||||||
|
bool mousePressed = IsMouseButtonPressed(MOUSE_BUTTON_LEFT);
|
||||||
|
|
||||||
|
// Check buttons and rescale
|
||||||
|
if (CheckCollisionPointRec(mousePosition, decreaseResolutionButton) && mousePressed){
|
||||||
|
resolutionIndex = (resolutionIndex + RESOLUTION_COUNT - 1) % RESOLUTION_COUNT;
|
||||||
|
gameWidth = resolutionList[resolutionIndex].x;
|
||||||
|
gameHeight = resolutionList[resolutionIndex].y;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
if (CheckCollisionPointRec(mousePosition, increaseResolutionButton) && mousePressed){
|
||||||
|
resolutionIndex = (resolutionIndex + 1) % RESOLUTION_COUNT;
|
||||||
|
gameWidth = resolutionList[resolutionIndex].x;
|
||||||
|
gameHeight = resolutionList[resolutionIndex].y;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
if (CheckCollisionPointRec(mousePosition, decreaseTypeButton) && mousePressed){
|
||||||
|
viewportType = (viewportType + VIEWPORT_TYPE_COUNT - 1) % VIEWPORT_TYPE_COUNT;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
if (CheckCollisionPointRec(mousePosition, increaseTypeButton) && mousePressed){
|
||||||
|
viewportType = (viewportType + 1) % VIEWPORT_TYPE_COUNT;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 textureMousePosition = Screen2RenderTexturePosition(mousePosition, &sourceRect, &destRect);
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// Draw our scene to the render texture
|
||||||
|
BeginTextureMode(target);
|
||||||
|
ClearBackground(WHITE);
|
||||||
|
DrawCircle(textureMousePosition.x, textureMousePosition.y, 20.f, LIME);
|
||||||
|
|
||||||
|
|
||||||
|
EndTextureMode();
|
||||||
|
|
||||||
|
// Draw render texture to main framebuffer
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
|
// Draw our render texture with rotation applied
|
||||||
|
const Vector2 ORIGIN_POSITION = (Vector2){ 0.0f, 0.0f };
|
||||||
|
const float ROTATION = 0.f;
|
||||||
|
DrawTexturePro(target.texture, sourceRect, destRect, ORIGIN_POSITION, ROTATION, WHITE);
|
||||||
|
|
||||||
|
// Draw Native resolution (GUI or anything)
|
||||||
|
// Draw info box
|
||||||
|
Rectangle infoRect = (Rectangle){5, 5, 330, 105};
|
||||||
|
DrawRectangleRec(infoRect, Fade(LIGHTGRAY, 0.7f));
|
||||||
|
DrawRectangleLines(infoRect.x, infoRect.y, infoRect.width, infoRect.height, BLUE);
|
||||||
|
|
||||||
|
DrawText(TextFormat("Window Resolution: %d x %d", screenWidth, screenHeight), 15, 15, 10, BLACK);
|
||||||
|
DrawText(TextFormat("Game Resolution: %d x %d", gameWidth, gameHeight), 15, 30, 10, BLACK);
|
||||||
|
|
||||||
|
DrawText(TextFormat("Type: %s", ViewportTypeNames[viewportType]), 15, 45, 10, BLACK);
|
||||||
|
Vector2 scaleRatio = (Vector2){destRect.width / sourceRect.width, destRect.height / -sourceRect.height};
|
||||||
|
if (scaleRatio.x < 0.001f || scaleRatio.y < 0.001f)
|
||||||
|
{
|
||||||
|
DrawText(TextFormat("Scale ratio: INVALID"), 15, 60, 10, BLACK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText(TextFormat("Scale ratio: %.2f x %.2f", scaleRatio.x, scaleRatio.y), 15, 60, 10, BLACK);
|
||||||
|
}
|
||||||
|
DrawText(TextFormat("Source size: %.2f x %.2f", sourceRect.width, -sourceRect.height), 15, 75, 10, BLACK);
|
||||||
|
DrawText(TextFormat("Destination size: %.2f x %.2f", destRect.width, destRect.height), 15, 90, 10, BLACK);
|
||||||
|
|
||||||
|
// Draw buttons
|
||||||
|
DrawRectangleRec(decreaseTypeButton, SKYBLUE);
|
||||||
|
DrawRectangleRec(increaseTypeButton, SKYBLUE);
|
||||||
|
DrawRectangleRec(decreaseResolutionButton, SKYBLUE);
|
||||||
|
DrawRectangleRec(increaseResolutionButton, SKYBLUE);
|
||||||
|
DrawText("<", decreaseTypeButton.x + 3, decreaseTypeButton.y + 1, 10, BLACK);
|
||||||
|
DrawText(">", increaseTypeButton.x + 3, increaseTypeButton.y + 1, 10, BLACK);
|
||||||
|
DrawText("<", decreaseResolutionButton.x + 3, decreaseResolutionButton.y + 1, 10, BLACK);
|
||||||
|
DrawText(">", increaseResolutionButton.x + 3, increaseResolutionButton.y + 1, 10, BLACK);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//-----------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//---------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//----------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
static void KeepAspectCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
sourceRect->x = 0.f;
|
||||||
|
sourceRect->y = (float)gameHeight;
|
||||||
|
sourceRect->width = (float)gameWidth;
|
||||||
|
sourceRect->height = (float)-gameHeight;
|
||||||
|
|
||||||
|
const int ratio_x = (screenWidth/gameWidth);
|
||||||
|
const int ratio_y = (screenHeight/gameHeight);
|
||||||
|
const float resizeRatio = (float)(ratio_x < ratio_y ? ratio_x : ratio_y);
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (gameWidth * resizeRatio)) * 0.5);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (gameHeight * resizeRatio)) * 0.5);
|
||||||
|
destRect->width = (float)(int)(gameWidth * resizeRatio);
|
||||||
|
destRect->height = (float)(int)(gameHeight * resizeRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepHeightCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
const float resizeRatio = (float)(screenHeight/gameHeight);
|
||||||
|
sourceRect->x = 0.f;
|
||||||
|
sourceRect->y = 0.f;
|
||||||
|
sourceRect->width = (float)(int)(screenWidth / resizeRatio);
|
||||||
|
sourceRect->height = (float)-gameHeight;
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (sourceRect->width * resizeRatio)) * 0.5);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (gameHeight * resizeRatio)) * 0.5);
|
||||||
|
destRect->width = (float)(int)(sourceRect->width * resizeRatio);
|
||||||
|
destRect->height = (float)(int)(gameHeight * resizeRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepWidthCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
const float resizeRatio = (float)(screenWidth/gameWidth);
|
||||||
|
sourceRect->x = 0.f;
|
||||||
|
sourceRect->y = 0.f;
|
||||||
|
sourceRect->width = (float)gameWidth;
|
||||||
|
sourceRect->height = (float)(int)(screenHeight / resizeRatio);
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (gameWidth * resizeRatio)) * 0.5);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (sourceRect->height * resizeRatio)) * 0.5);
|
||||||
|
destRect->width = (float)(int)(gameWidth * resizeRatio);
|
||||||
|
destRect->height = (float)(int)(sourceRect->height * resizeRatio);
|
||||||
|
|
||||||
|
sourceRect->height *= -1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepAspectCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
sourceRect->x = 0.f;
|
||||||
|
sourceRect->y = (float)gameHeight;
|
||||||
|
sourceRect->width = (float)gameWidth;
|
||||||
|
sourceRect->height = (float)-gameHeight;
|
||||||
|
|
||||||
|
const float ratio_x = ((float)screenWidth/(float)gameWidth);
|
||||||
|
const float ratio_y = ((float)screenHeight/(float)gameHeight);
|
||||||
|
const float resizeRatio = (ratio_x < ratio_y ? ratio_x : ratio_y);
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (gameWidth * resizeRatio)) * 0.5);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (gameHeight * resizeRatio)) * 0.5);
|
||||||
|
destRect->width = (float)(int)(gameWidth * resizeRatio);
|
||||||
|
destRect->height = (float)(int)(gameHeight * resizeRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepHeightCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
const float resizeRatio = ((float)screenHeight/(float)gameHeight);
|
||||||
|
sourceRect->x = 0.f;
|
||||||
|
sourceRect->y = 0.f;
|
||||||
|
sourceRect->width = (float)(int)((float)screenWidth / resizeRatio);
|
||||||
|
sourceRect->height = (float)-gameHeight;
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (sourceRect->width * resizeRatio)) * 0.5);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (gameHeight * resizeRatio)) * 0.5);
|
||||||
|
destRect->width = (float)(int)(sourceRect->width * resizeRatio);
|
||||||
|
destRect->height = (float)(int)(gameHeight * resizeRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepWidthCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
const float resizeRatio = ((float)screenWidth/(float)gameWidth);
|
||||||
|
sourceRect->x = 0.f;
|
||||||
|
sourceRect->y = 0.f;
|
||||||
|
sourceRect->width = (float)gameWidth;
|
||||||
|
sourceRect->height = (float)(int)((float)screenHeight / resizeRatio);
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (gameWidth * resizeRatio)) * 0.5);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (sourceRect->height * resizeRatio)) * 0.5);
|
||||||
|
destRect->width = (float)(int)(gameWidth * resizeRatio);
|
||||||
|
destRect->height = (float)(int)(sourceRect->height * resizeRatio);
|
||||||
|
|
||||||
|
sourceRect->height *= -1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ResizeRenderSize(enum ViewportType viewportType, int *screenWidth, int *screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect, RenderTexture2D *target)
|
||||||
|
{
|
||||||
|
*screenWidth = GetScreenWidth();
|
||||||
|
*screenHeight = GetScreenHeight();
|
||||||
|
|
||||||
|
switch(viewportType)
|
||||||
|
{
|
||||||
|
case KEEP_ASPECT_INTEGER:
|
||||||
|
{
|
||||||
|
KeepAspectCenteredInteger(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KEEP_HEIGHT_INTEGER:
|
||||||
|
{
|
||||||
|
KeepHeightCenteredInteger(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KEEP_WIDTH_INTEGER:
|
||||||
|
{
|
||||||
|
KeepWidthCenteredInteger(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KEEP_ASPECT:
|
||||||
|
{
|
||||||
|
KeepAspectCentered(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KEEP_HEIGHT:
|
||||||
|
{
|
||||||
|
KeepHeightCentered(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KEEP_WIDTH:
|
||||||
|
{
|
||||||
|
KeepWidthCentered(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {}
|
||||||
|
}
|
||||||
|
UnloadRenderTexture(*target);
|
||||||
|
*target = LoadRenderTexture(sourceRect->width, -sourceRect->height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example how to calculate position on RenderTexture
|
||||||
|
static Vector2 Screen2RenderTexturePosition(Vector2 point, Rectangle *textureRect, Rectangle *scaledRect)
|
||||||
|
{
|
||||||
|
Vector2 relativePosition = {point.x - scaledRect->x, point.y - scaledRect->y};
|
||||||
|
Vector2 ratio = {textureRect->width / scaledRect->width, -textureRect->height / scaledRect->height};
|
||||||
|
|
||||||
|
return (Vector2){relativePosition.x * ratio.x, relativePosition.y * ratio.x};
|
||||||
|
}
|
||||||
BIN
examples/core/core_viewport_scaling.png
Normal file
BIN
examples/core/core_viewport_scaling.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
@ -46,6 +46,7 @@ core;core_automation_events;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@r
|
|||||||
core;core_high_dpi;★★☆☆;5.0;5.5;2025;2025;"Jonathan Marler";@marler8997
|
core;core_high_dpi;★★☆☆;5.0;5.5;2025;2025;"Jonathan Marler";@marler8997
|
||||||
core;core_render_texture;★☆☆☆;5.6-dev;5.6-dev;2025;2025;"Ramon Santamaria";@raysan5
|
core;core_render_texture;★☆☆☆;5.6-dev;5.6-dev;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_undo_redo;★★★☆;5.5;5.6;2025;2025;"Ramon Santamaria";@raysan5
|
core;core_undo_redo;★★★☆;5.5;5.6;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_viewport_scaling;★★☆☆;5.5;5.5;2025;2025;"Agnis Aldins";@nezvers
|
||||||
core;core_input_actions;★★☆☆;5.5;5.6;2025;2025;"Jett";@JettMonstersGoBoom
|
core;core_input_actions;★★☆☆;5.5;5.6;2025;2025;"Jett";@JettMonstersGoBoom
|
||||||
core;core_directory_files;★☆☆☆;5.5;5.6;2025;2025;"Hugo ARNAL";@hugoarnal
|
core;core_directory_files;★☆☆☆;5.5;5.6;2025;2025;"Hugo ARNAL";@hugoarnal
|
||||||
core;core_highdpi_testbed;★☆☆☆;5.6-dev;5.6-dev;2025;2025;"Ramon Santamaria";@raysan5
|
core;core_highdpi_testbed;★☆☆☆;5.6-dev;5.6-dev;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
|
|||||||
569
projects/VS2022/examples/core_viewport_scaling.vcxproj
Normal file
569
projects/VS2022/examples/core_viewport_scaling.vcxproj
Normal file
@ -0,0 +1,569 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug.DLL|ARM64">
|
||||||
|
<Configuration>Debug.DLL</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug.DLL|Win32">
|
||||||
|
<Configuration>Debug.DLL</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug.DLL|x64">
|
||||||
|
<Configuration>Debug.DLL</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|ARM64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release.DLL|ARM64">
|
||||||
|
<Configuration>Release.DLL</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release.DLL|Win32">
|
||||||
|
<Configuration>Release.DLL</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release.DLL|x64">
|
||||||
|
<Configuration>Release.DLL</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|ARM64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>core_viewport_scaling</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
<ProjectName>core_viewport_scaling</ProjectName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/FS %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/FS %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
<Message>Copy Debug DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
<Message>Copy Debug DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
<Message>Copy Debug DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Message>Copy Release DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Message>Copy Release DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Message>Copy Release DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\examples\core\core_viewport_scaling.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="..\..\..\examples\examples.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\raylib\raylib.vcxproj">
|
||||||
|
<Project>{e89d61ac-55de-4482-afd4-df7242ebc859}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
@ -405,6 +405,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_decals", "examples\m
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_lines_drawing", "examples\shapes_lines_drawing.vcxproj", "{666346D7-C84B-498D-AE17-53B20C62DB1A}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_lines_drawing", "examples\shapes_lines_drawing.vcxproj", "{666346D7-C84B-498D-AE17-53B20C62DB1A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_viewport_scaling", "examples\core_viewport_scaling.vcxproj", "{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug.DLL|ARM64 = Debug.DLL|ARM64
|
Debug.DLL|ARM64 = Debug.DLL|ARM64
|
||||||
@ -5027,6 +5029,30 @@ Global
|
|||||||
{666346D7-C84B-498D-AE17-53B20C62DB1A}.Release|x64.Build.0 = Release|x64
|
{666346D7-C84B-498D-AE17-53B20C62DB1A}.Release|x64.Build.0 = Release|x64
|
||||||
{666346D7-C84B-498D-AE17-53B20C62DB1A}.Release|x86.ActiveCfg = Release|Win32
|
{666346D7-C84B-498D-AE17-53B20C62DB1A}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{666346D7-C84B-498D-AE17-53B20C62DB1A}.Release|x86.Build.0 = Release|Win32
|
{666346D7-C84B-498D-AE17-53B20C62DB1A}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug.DLL|x64.Build.0 = Debug.DLL|x64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release.DLL|x64.ActiveCfg = Release.DLL|x64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release.DLL|x64.Build.0 = Release.DLL|x64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release.DLL|x86.Build.0 = Release.DLL|Win32
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release|ARM64.Build.0 = Release|ARM64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release|x64.Build.0 = Release|x64
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -5231,6 +5257,7 @@ Global
|
|||||||
{B7FDD40F-DDA4-468E-9C40-EEB175964A26} = {278D8859-20B1-428F-8448-064F46E1F021}
|
{B7FDD40F-DDA4-468E-9C40-EEB175964A26} = {278D8859-20B1-428F-8448-064F46E1F021}
|
||||||
{028F0967-B253-45DA-B1C4-FACCE45D0D8D} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C}
|
{028F0967-B253-45DA-B1C4-FACCE45D0D8D} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C}
|
||||||
{666346D7-C84B-498D-AE17-53B20C62DB1A} = {278D8859-20B1-428F-8448-064F46E1F021}
|
{666346D7-C84B-498D-AE17-53B20C62DB1A} = {278D8859-20B1-428F-8448-064F46E1F021}
|
||||||
|
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29}
|
SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29}
|
||||||
|
|||||||
@ -796,10 +796,10 @@ int InitPlatform(void)
|
|||||||
//AConfiguration_getScreenLong(platform.app->config);
|
//AConfiguration_getScreenLong(platform.app->config);
|
||||||
|
|
||||||
// Set some default window flags
|
// Set some default window flags
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN; // false
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_HIDDEN); // false
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // false
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // false
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED; // true
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // true
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED; // false
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // false
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Initialize App command system
|
// Initialize App command system
|
||||||
@ -883,11 +883,11 @@ void ClosePlatform(void)
|
|||||||
static int InitGraphicsDevice(void)
|
static int InitGraphicsDevice(void)
|
||||||
{
|
{
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
|
|
||||||
EGLint samples = 0;
|
EGLint samples = 0;
|
||||||
EGLint sampleBuffer = 0;
|
EGLint sampleBuffer = 0;
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
samples = 4;
|
samples = 4;
|
||||||
sampleBuffer = 1;
|
sampleBuffer = 1;
|
||||||
@ -992,7 +992,7 @@ static int InitGraphicsDevice(void)
|
|||||||
|
|
||||||
CORE.Window.ready = true;
|
CORE.Window.ready = true;
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) MinimizeWindow();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1059,7 +1059,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
|
|||||||
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
||||||
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
||||||
Rectangle rec = GetFontDefault().recs[95];
|
Rectangle rec = GetFontDefault().recs[95];
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
||||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
||||||
@ -1102,14 +1102,14 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
|
|||||||
case APP_CMD_GAINED_FOCUS:
|
case APP_CMD_GAINED_FOCUS:
|
||||||
{
|
{
|
||||||
platform.appEnabled = true;
|
platform.appEnabled = true;
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
|
||||||
//ResumeMusicStream();
|
//ResumeMusicStream();
|
||||||
} break;
|
} break;
|
||||||
case APP_CMD_PAUSE: break;
|
case APP_CMD_PAUSE: break;
|
||||||
case APP_CMD_LOST_FOCUS:
|
case APP_CMD_LOST_FOCUS:
|
||||||
{
|
{
|
||||||
platform.appEnabled = false;
|
platform.appEnabled = false;
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
|
||||||
//PauseMusicStream();
|
//PauseMusicStream();
|
||||||
} break;
|
} break;
|
||||||
case APP_CMD_TERM_WINDOW:
|
case APP_CMD_TERM_WINDOW:
|
||||||
@ -1187,8 +1187,8 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||||||
|
|
||||||
if (type == AINPUT_EVENT_TYPE_MOTION)
|
if (type == AINPUT_EVENT_TYPE_MOTION)
|
||||||
{
|
{
|
||||||
if (((source & AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
|
if (FLAG_IS_SET(source, AINPUT_SOURCE_JOYSTICK) ||
|
||||||
((source & AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD))
|
FLAG_IS_SET(source, AINPUT_SOURCE_GAMEPAD))
|
||||||
{
|
{
|
||||||
// For now we'll assume a single gamepad which we "detect" on its input event
|
// For now we'll assume a single gamepad which we "detect" on its input event
|
||||||
CORE.Input.Gamepad.ready[0] = true;
|
CORE.Input.Gamepad.ready[0] = true;
|
||||||
@ -1251,8 +1251,8 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||||||
//int32_t AKeyEvent_getMetaState(event);
|
//int32_t AKeyEvent_getMetaState(event);
|
||||||
|
|
||||||
// Handle gamepad button presses and releases
|
// Handle gamepad button presses and releases
|
||||||
if (((source & AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
|
if (FLAG_IS_SET(source, AINPUT_SOURCE_JOYSTICK) ||
|
||||||
((source & AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD))
|
FLAG_IS_SET(source, AINPUT_SOURCE_GAMEPAD))
|
||||||
{
|
{
|
||||||
// For now we'll assume a single gamepad which we "detect" on its input event
|
// For now we'll assume a single gamepad which we "detect" on its input event
|
||||||
CORE.Input.Gamepad.ready[0] = true;
|
CORE.Input.Gamepad.ready[0] = true;
|
||||||
|
|||||||
@ -195,14 +195,14 @@ void ToggleFullscreen(void)
|
|||||||
TRACELOG(LOG_WARNING, "GLFW: Failed to get monitor");
|
TRACELOG(LOG_WARNING, "GLFW: Failed to get monitor");
|
||||||
|
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
|
|
||||||
glfwSetWindowMonitor(platform.handle, NULL, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
glfwSetWindowMonitor(platform.handle, NULL, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
|
|
||||||
glfwSetWindowMonitor(platform.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
glfwSetWindowMonitor(platform.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ void ToggleFullscreen(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
|
|
||||||
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.previousPosition.x, CORE.Window.previousPosition.y, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.previousPosition.x, CORE.Window.previousPosition.y, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ void ToggleFullscreen(void)
|
|||||||
|
|
||||||
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
||||||
// NOTE: V-Sync can be enabled by graphic driver configuration
|
// NOTE: V-Sync can be enabled by graphic driver configuration
|
||||||
if (CORE.Window.flags & FLAG_VSYNC_HINT) glfwSwapInterval(1);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_VSYNC_HINT)) glfwSwapInterval(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle borderless windowed mode
|
// Toggle borderless windowed mode
|
||||||
@ -256,7 +256,7 @@ void ToggleBorderlessWindowed(void)
|
|||||||
|
|
||||||
// Set undecorated flag
|
// Set undecorated flag
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED);
|
||||||
|
|
||||||
// Get monitor position and size
|
// Get monitor position and size
|
||||||
int monitorPosX = 0;
|
int monitorPosX = 0;
|
||||||
@ -272,13 +272,13 @@ void ToggleBorderlessWindowed(void)
|
|||||||
// Refocus window
|
// Refocus window
|
||||||
glfwFocusWindow(platform.handle);
|
glfwFocusWindow(platform.handle);
|
||||||
|
|
||||||
CORE.Window.flags |= FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Remove undecorated flag
|
// Remove undecorated flag
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNDECORATED);
|
||||||
|
|
||||||
// Return previous screen size and position
|
// Return previous screen size and position
|
||||||
// NOTE: The order matters here, it must set size first, then set position, otherwise the screen will be positioned incorrectly
|
// NOTE: The order matters here, it must set size first, then set position, otherwise the screen will be positioned incorrectly
|
||||||
@ -288,7 +288,7 @@ void ToggleBorderlessWindowed(void)
|
|||||||
// Refocus window
|
// Refocus window
|
||||||
glfwFocusWindow(platform.handle);
|
glfwFocusWindow(platform.handle);
|
||||||
|
|
||||||
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
|
|
||||||
CORE.Window.position.x = CORE.Window.previousPosition.x;
|
CORE.Window.position.x = CORE.Window.previousPosition.x;
|
||||||
CORE.Window.position.y = CORE.Window.previousPosition.y;
|
CORE.Window.position.y = CORE.Window.previousPosition.y;
|
||||||
@ -305,7 +305,7 @@ void MaximizeWindow(void)
|
|||||||
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE)
|
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE)
|
||||||
{
|
{
|
||||||
glfwMaximizeWindow(platform.handle);
|
glfwMaximizeWindow(platform.handle);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,8 +323,8 @@ void RestoreWindow(void)
|
|||||||
{
|
{
|
||||||
// Restores the specified window if it was previously iconified (minimized) or maximized
|
// Restores the specified window if it was previously iconified (minimized) or maximized
|
||||||
glfwRestoreWindow(platform.handle);
|
glfwRestoreWindow(platform.handle);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,109 +337,109 @@ void SetWindowState(unsigned int flags)
|
|||||||
// NOTE: In most cases the functions already change the flags internally
|
// NOTE: In most cases the functions already change the flags internally
|
||||||
|
|
||||||
// State change: FLAG_VSYNC_HINT
|
// State change: FLAG_VSYNC_HINT
|
||||||
if (((CORE.Window.flags & FLAG_VSYNC_HINT) != (flags & FLAG_VSYNC_HINT)) && ((flags & FLAG_VSYNC_HINT) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_VSYNC_HINT) != FLAG_IS_SET(flags, FLAG_VSYNC_HINT)) && FLAG_IS_SET(flags, FLAG_VSYNC_HINT))
|
||||||
{
|
{
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
CORE.Window.flags |= FLAG_VSYNC_HINT;
|
FLAG_SET(CORE.Window.flags, FLAG_VSYNC_HINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
||||||
// NOTE: This must be handled before FLAG_FULLSCREEN_MODE because ToggleBorderlessWindowed() needs to get some fullscreen values if fullscreen is running
|
// NOTE: This must be handled before FLAG_FULLSCREEN_MODE because ToggleBorderlessWindowed() needs to get some fullscreen values if fullscreen is running
|
||||||
if (((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) != (flags & FLAG_BORDERLESS_WINDOWED_MODE)) && ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE) != FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE)) && FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_FULLSCREEN_MODE
|
// State change: FLAG_FULLSCREEN_MODE
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) != (flags & FLAG_FULLSCREEN_MODE) && ((flags & FLAG_FULLSCREEN_MODE) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE) != FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE)) && FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_RESIZABLE
|
// State change: FLAG_WINDOW_RESIZABLE
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE) != FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE)) && FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_RESIZABLE;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNDECORATED
|
// State change: FLAG_WINDOW_UNDECORATED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) != (flags & FLAG_WINDOW_UNDECORATED)) && (flags & FLAG_WINDOW_UNDECORATED))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED) != FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED)) && FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIDDEN
|
// State change: FLAG_WINDOW_HIDDEN
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) != (flags & FLAG_WINDOW_HIDDEN)) && ((flags & FLAG_WINDOW_HIDDEN) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN) != FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN)) && FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN))
|
||||||
{
|
{
|
||||||
glfwHideWindow(platform.handle);
|
glfwHideWindow(platform.handle);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_HIDDEN;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MINIMIZED
|
// State change: FLAG_WINDOW_MINIMIZED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) != (flags & FLAG_WINDOW_MINIMIZED)) && ((flags & FLAG_WINDOW_MINIMIZED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) != FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED)) && FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
//GLFW_ICONIFIED
|
//GLFW_ICONIFIED
|
||||||
MinimizeWindow(); // NOTE: Window state flag updated inside function
|
MinimizeWindow(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MAXIMIZED
|
// State change: FLAG_WINDOW_MAXIMIZED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) != (flags & FLAG_WINDOW_MAXIMIZED)) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED) != FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED)) && FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED))
|
||||||
{
|
{
|
||||||
//GLFW_MAXIMIZED
|
//GLFW_MAXIMIZED
|
||||||
MaximizeWindow(); // NOTE: Window state flag updated inside function
|
MaximizeWindow(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNFOCUSED
|
// State change: FLAG_WINDOW_UNFOCUSED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) != (flags & FLAG_WINDOW_UNFOCUSED)) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED) != FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED)) && FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TOPMOST
|
// State change: FLAG_WINDOW_TOPMOST
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) != (flags & FLAG_WINDOW_TOPMOST)) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TOPMOST) != FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST)) && FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_TOPMOST;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_TOPMOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_ALWAYS_RUN
|
// State change: FLAG_WINDOW_ALWAYS_RUN
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) != (flags & FLAG_WINDOW_ALWAYS_RUN)) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN) != FLAG_IS_SET(flags, FLAG_WINDOW_ALWAYS_RUN)) && FLAG_IS_SET(flags, FLAG_WINDOW_ALWAYS_RUN))
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following states can not be changed after window creation
|
// The following states can not be changed after window creation
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TRANSPARENT
|
// State change: FLAG_WINDOW_TRANSPARENT
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) != (flags & FLAG_WINDOW_TRANSPARENT)) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TRANSPARENT) != FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT)) && FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIGHDPI
|
// State change: FLAG_WINDOW_HIGHDPI
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) != (flags & FLAG_WINDOW_HIGHDPI)) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI) != FLAG_IS_SET(flags, FLAG_WINDOW_HIGHDPI)) && FLAG_IS_SET(flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) != (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)) && ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MOUSE_PASSTHROUGH) != FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH)) && FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MOUSE_PASSTHROUGH;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MOUSE_PASSTHROUGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_MSAA_4X_HINT
|
// State change: FLAG_MSAA_4X_HINT
|
||||||
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) != (flags & FLAG_MSAA_4X_HINT)) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT) != FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT)) && FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_INTERLACED_HINT
|
// State change: FLAG_INTERLACED_HINT
|
||||||
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) != (flags & FLAG_INTERLACED_HINT)) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_INTERLACED_HINT) != FLAG_IS_SET(flags, FLAG_INTERLACED_HINT)) && FLAG_IS_SET(flags, FLAG_INTERLACED_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: Interlaced mode can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: Interlaced mode can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
@ -452,107 +452,107 @@ void ClearWindowState(unsigned int flags)
|
|||||||
// NOTE: In most cases the functions already change the flags internally
|
// NOTE: In most cases the functions already change the flags internally
|
||||||
|
|
||||||
// State change: FLAG_VSYNC_HINT
|
// State change: FLAG_VSYNC_HINT
|
||||||
if (((CORE.Window.flags & FLAG_VSYNC_HINT) > 0) && ((flags & FLAG_VSYNC_HINT) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_VSYNC_HINT)) && (FLAG_IS_SET(flags, FLAG_VSYNC_HINT)))
|
||||||
{
|
{
|
||||||
glfwSwapInterval(0);
|
glfwSwapInterval(0);
|
||||||
CORE.Window.flags &= ~FLAG_VSYNC_HINT;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_VSYNC_HINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
||||||
// NOTE: This must be handled before FLAG_FULLSCREEN_MODE because ToggleBorderlessWindowed() needs to get some fullscreen values if fullscreen is running
|
// NOTE: This must be handled before FLAG_FULLSCREEN_MODE because ToggleBorderlessWindowed() needs to get some fullscreen values if fullscreen is running
|
||||||
if (((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0) && ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE)) && (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE)))
|
||||||
{
|
{
|
||||||
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_FULLSCREEN_MODE
|
// State change: FLAG_FULLSCREEN_MODE
|
||||||
if (((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) && ((flags & FLAG_FULLSCREEN_MODE) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) && (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE)))
|
||||||
{
|
{
|
||||||
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_RESIZABLE
|
// State change: FLAG_WINDOW_RESIZABLE
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) && (FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE)))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_RESIZABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIDDEN
|
// State change: FLAG_WINDOW_HIDDEN
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) && ((flags & FLAG_WINDOW_HIDDEN) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) && (FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN)))
|
||||||
{
|
{
|
||||||
glfwShowWindow(platform.handle);
|
glfwShowWindow(platform.handle);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_HIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MINIMIZED
|
// State change: FLAG_WINDOW_MINIMIZED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) && ((flags & FLAG_WINDOW_MINIMIZED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) && (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED)))
|
||||||
{
|
{
|
||||||
RestoreWindow(); // NOTE: Window state flag updated inside function
|
RestoreWindow(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MAXIMIZED
|
// State change: FLAG_WINDOW_MAXIMIZED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)) && (FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED)))
|
||||||
{
|
{
|
||||||
RestoreWindow(); // NOTE: Window state flag updated inside function
|
RestoreWindow(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNDECORATED
|
// State change: FLAG_WINDOW_UNDECORATED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) && ((flags & FLAG_WINDOW_UNDECORATED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED)) && (FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED)))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNDECORATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNFOCUSED
|
// State change: FLAG_WINDOW_UNFOCUSED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) && (FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED)))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FOCUS_ON_SHOW, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_FOCUS_ON_SHOW, GLFW_TRUE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TOPMOST
|
// State change: FLAG_WINDOW_TOPMOST
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TOPMOST)) && (FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST)))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_TOPMOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_ALWAYS_RUN
|
// State change: FLAG_WINDOW_ALWAYS_RUN
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) > 0) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN)) && (FLAG_IS_SET(flags, FLAG_WINDOW_ALWAYS_RUN)))
|
||||||
{
|
{
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following states can not be changed after window creation
|
// The following states can not be changed after window creation
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TRANSPARENT
|
// State change: FLAG_WINDOW_TRANSPARENT
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TRANSPARENT)) && (FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT)))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIGHDPI
|
// State change: FLAG_WINDOW_HIGHDPI
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)) && (FLAG_IS_SET(flags, FLAG_WINDOW_HIGHDPI)))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) && ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MOUSE_PASSTHROUGH)) && (FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH)))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MOUSE_PASSTHROUGH;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MOUSE_PASSTHROUGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_MSAA_4X_HINT
|
// State change: FLAG_MSAA_4X_HINT
|
||||||
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) > 0) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT)) && (FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT)))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_INTERLACED_HINT
|
// State change: FLAG_INTERLACED_HINT
|
||||||
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) > 0) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_INTERLACED_HINT)) && (FLAG_IS_SET(flags, FLAG_INTERLACED_HINT)))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
@ -1070,6 +1070,7 @@ void EnableCursor(void)
|
|||||||
|
|
||||||
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_FALSE);
|
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_FALSE);
|
||||||
|
|
||||||
|
CORE.Input.Mouse.cursorHidden = false;
|
||||||
CORE.Input.Mouse.cursorLocked = false;
|
CORE.Input.Mouse.cursorLocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1083,6 +1084,7 @@ void DisableCursor(void)
|
|||||||
|
|
||||||
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
||||||
|
|
||||||
|
CORE.Input.Mouse.cursorHidden = true;
|
||||||
CORE.Input.Mouse.cursorLocked = true;
|
CORE.Input.Mouse.cursorLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1391,31 +1393,31 @@ int InitPlatform(void)
|
|||||||
unsigned int requestedWindowFlags = CORE.Window.flags;
|
unsigned int requestedWindowFlags = CORE.Window.flags;
|
||||||
|
|
||||||
// Check window creation flags
|
// Check window creation flags
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) CORE.Window.fullscreen = true;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) CORE.Window.fullscreen = true;
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Visible window
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Visible window
|
||||||
else glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); // Window initially hidden
|
else glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); // Window initially hidden
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // Border and buttons on Window
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED)) glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // Border and buttons on Window
|
||||||
else glfwWindowHint(GLFW_DECORATED, GLFW_TRUE); // Decorated window
|
else glfwWindowHint(GLFW_DECORATED, GLFW_TRUE); // Decorated window
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // Resizable window
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // Resizable window
|
||||||
else glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // Avoid window being resizable
|
else glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // Avoid window being resizable
|
||||||
|
|
||||||
// Disable FLAG_WINDOW_MINIMIZED, not supported on initialization
|
// Disable FLAG_WINDOW_MINIMIZED, not supported on initialization
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED);
|
||||||
|
|
||||||
// Disable FLAG_WINDOW_MAXIMIZED, not supported on initialization
|
// Disable FLAG_WINDOW_MAXIMIZED, not supported on initialization
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
|
||||||
else glfwWindowHint(GLFW_FOCUSED, GLFW_TRUE);
|
else glfwWindowHint(GLFW_FOCUSED, GLFW_TRUE);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TOPMOST)) glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
|
||||||
else glfwWindowHint(GLFW_FLOATING, GLFW_FALSE);
|
else glfwWindowHint(GLFW_FLOATING, GLFW_FALSE);
|
||||||
|
|
||||||
// NOTE: Some GLFW flags are not supported on HTML5
|
// NOTE: Some GLFW flags are not supported on HTML5
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TRANSPARENT)) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer
|
||||||
else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer
|
else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer
|
||||||
|
|
||||||
// HACK: Most of this was written before GLFW_SCALE_FRAMEBUFFER existed and
|
// HACK: Most of this was written before GLFW_SCALE_FRAMEBUFFER existed and
|
||||||
@ -1428,7 +1430,7 @@ int InitPlatform(void)
|
|||||||
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
|
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
// since we skipped it before, now make sure to set this on macOS
|
// since we skipped it before, now make sure to set this on macOS
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
@ -1445,10 +1447,10 @@ int InitPlatform(void)
|
|||||||
else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
|
else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
|
||||||
|
|
||||||
// Mouse passthrough
|
// Mouse passthrough
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) glfwWindowHint(GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MOUSE_PASSTHROUGH)) glfwWindowHint(GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE);
|
||||||
else glfwWindowHint(GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE);
|
else glfwWindowHint(GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE);
|
||||||
|
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
// NOTE: MSAA is only enabled for main framebuffer, not user-created FBOs
|
// NOTE: MSAA is only enabled for main framebuffer, not user-created FBOs
|
||||||
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4");
|
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4");
|
||||||
@ -1640,7 +1642,7 @@ int InitPlatform(void)
|
|||||||
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
||||||
// NOTE: V-Sync can be enabled by graphic driver configuration, it doesn't need
|
// NOTE: V-Sync can be enabled by graphic driver configuration, it doesn't need
|
||||||
// to be activated on web platforms since VSync is enforced there
|
// to be activated on web platforms since VSync is enforced there
|
||||||
if (CORE.Window.flags & FLAG_VSYNC_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_VSYNC_HINT))
|
||||||
{
|
{
|
||||||
// WARNING: It seems to hit a critical render path in Intel HD Graphics
|
// WARNING: It seems to hit a critical render path in Intel HD Graphics
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
@ -1650,7 +1652,7 @@ int InitPlatform(void)
|
|||||||
int fbWidth = CORE.Window.screen.width;
|
int fbWidth = CORE.Window.screen.width;
|
||||||
int fbHeight = CORE.Window.screen.height;
|
int fbHeight = CORE.Window.screen.height;
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
// NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling
|
// NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling
|
||||||
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
||||||
@ -1682,7 +1684,7 @@ int InitPlatform(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) MinimizeWindow();
|
||||||
|
|
||||||
// If graphic device is no properly initialized, we end program
|
// If graphic device is no properly initialized, we end program
|
||||||
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
|
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
|
||||||
@ -1726,7 +1728,7 @@ int InitPlatform(void)
|
|||||||
glfwSetWindowFocusCallback(platform.handle, WindowFocusCallback);
|
glfwSetWindowFocusCallback(platform.handle, WindowFocusCallback);
|
||||||
glfwSetDropCallback(platform.handle, WindowDropCallback);
|
glfwSetDropCallback(platform.handle, WindowDropCallback);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
glfwSetWindowContentScaleCallback(platform.handle, WindowContentScaleCallback);
|
glfwSetWindowContentScaleCallback(platform.handle, WindowContentScaleCallback);
|
||||||
}
|
}
|
||||||
@ -1847,22 +1849,22 @@ static void WindowContentScaleCallback(GLFWwindow *window, float scalex, float s
|
|||||||
// GLFW3 WindowIconify Callback, runs when window is minimized/restored
|
// GLFW3 WindowIconify Callback, runs when window is minimized/restored
|
||||||
static void WindowIconifyCallback(GLFWwindow *window, int iconified)
|
static void WindowIconifyCallback(GLFWwindow *window, int iconified)
|
||||||
{
|
{
|
||||||
if (iconified) CORE.Window.flags |= FLAG_WINDOW_MINIMIZED; // The window was iconified
|
if (iconified) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was iconified
|
||||||
else CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored
|
else FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was restored
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3 WindowMaximize Callback, runs when window is maximized/restored
|
// GLFW3 WindowMaximize Callback, runs when window is maximized/restored
|
||||||
static void WindowMaximizeCallback(GLFWwindow *window, int maximized)
|
static void WindowMaximizeCallback(GLFWwindow *window, int maximized)
|
||||||
{
|
{
|
||||||
if (maximized) CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED; // The window was maximized
|
if (maximized) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // The window was maximized
|
||||||
else CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED; // The window was restored
|
else FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // The window was restored
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3 WindowFocus Callback, runs when window get/lose focus
|
// GLFW3 WindowFocus Callback, runs when window get/lose focus
|
||||||
static void WindowFocusCallback(GLFWwindow *window, int focused)
|
static void WindowFocusCallback(GLFWwindow *window, int focused)
|
||||||
{
|
{
|
||||||
if (focused) CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED; // The window was focused
|
if (focused) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // The window was focused
|
||||||
else CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED; // The window lost focus
|
else FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // The window lost focus
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3 Window Drop Callback, runs when drop files into window
|
// GLFW3 Window Drop Callback, runs when drop files into window
|
||||||
@ -1905,8 +1907,8 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
|||||||
else if (action == GLFW_REPEAT) CORE.Input.Keyboard.keyRepeatInFrame[key] = 1;
|
else if (action == GLFW_REPEAT) CORE.Input.Keyboard.keyRepeatInFrame[key] = 1;
|
||||||
|
|
||||||
// WARNING: Check if CAPS/NUM key modifiers are enabled and force down state for those keys
|
// WARNING: Check if CAPS/NUM key modifiers are enabled and force down state for those keys
|
||||||
if (((key == KEY_CAPS_LOCK) && ((mods & GLFW_MOD_CAPS_LOCK) > 0)) ||
|
if (((key == KEY_CAPS_LOCK) && (FLAG_IS_SET(mods, GLFW_MOD_CAPS_LOCK))) ||
|
||||||
((key == KEY_NUM_LOCK) && ((mods & GLFW_MOD_NUM_LOCK) > 0))) CORE.Input.Keyboard.currentKeyState[key] = 1;
|
((key == KEY_NUM_LOCK) && (FLAG_IS_SET(mods, GLFW_MOD_NUM_LOCK)))) CORE.Input.Keyboard.currentKeyState[key] = 1;
|
||||||
|
|
||||||
// Check if there is space available in the key queue
|
// Check if there is space available in the key queue
|
||||||
if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS))
|
if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS))
|
||||||
|
|||||||
@ -303,7 +303,7 @@ void ToggleFullscreen(void)
|
|||||||
|
|
||||||
platform.mon = RGFW_window_getMonitor(platform.window);
|
platform.mon = RGFW_window_getMonitor(platform.window);
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
|
|
||||||
RGFW_monitor_scaleToWindow(platform.mon, platform.window);
|
RGFW_monitor_scaleToWindow(platform.mon, platform.window);
|
||||||
RGFW_window_setFullscreen(platform.window, 1);
|
RGFW_window_setFullscreen(platform.window, 1);
|
||||||
@ -311,7 +311,7 @@ void ToggleFullscreen(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
|
|
||||||
if (platform.mon.mode.area.w)
|
if (platform.mon.mode.area.w)
|
||||||
{
|
{
|
||||||
@ -330,7 +330,7 @@ void ToggleFullscreen(void)
|
|||||||
|
|
||||||
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
||||||
// NOTE: V-Sync can be enabled by graphic driver configuration
|
// NOTE: V-Sync can be enabled by graphic driver configuration
|
||||||
if (CORE.Window.flags & FLAG_VSYNC_HINT) RGFW_window_swapInterval(platform.window, 1);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_VSYNC_HINT)) RGFW_window_swapInterval(platform.window, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle borderless windowed mode
|
// Toggle borderless windowed mode
|
||||||
@ -372,7 +372,7 @@ void MinimizeWindow(void)
|
|||||||
// Restore window from being minimized/maximized
|
// Restore window from being minimized/maximized
|
||||||
void RestoreWindow(void)
|
void RestoreWindow(void)
|
||||||
{
|
{
|
||||||
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window);
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window);
|
||||||
|
|
||||||
RGFW_window_restore(platform.window);
|
RGFW_window_restore(platform.window);
|
||||||
}
|
}
|
||||||
@ -382,72 +382,72 @@ void SetWindowState(unsigned int flags)
|
|||||||
{
|
{
|
||||||
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
|
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
|
||||||
|
|
||||||
CORE.Window.flags |= flags;
|
FLAG_SET(CORE.Window.flags, flags);
|
||||||
|
|
||||||
if (flags & FLAG_VSYNC_HINT)
|
if (FLAG_IS_SET(flags, FLAG_VSYNC_HINT))
|
||||||
{
|
{
|
||||||
RGFW_window_swapInterval(platform.window, 1);
|
RGFW_window_swapInterval(platform.window, 1);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_FULLSCREEN_MODE)
|
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
if (!CORE.Window.fullscreen) ToggleFullscreen();
|
if (!CORE.Window.fullscreen) ToggleFullscreen();
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_RESIZABLE)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE))
|
||||||
{
|
{
|
||||||
RGFW_window_setMaxSize(platform.window, RGFW_AREA(0, 0));
|
RGFW_window_setMaxSize(platform.window, RGFW_AREA(0, 0));
|
||||||
RGFW_window_setMinSize(platform.window, RGFW_AREA(0, 0));
|
RGFW_window_setMinSize(platform.window, RGFW_AREA(0, 0));
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNDECORATED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
{
|
{
|
||||||
RGFW_window_setBorder(platform.window, 0);
|
RGFW_window_setBorder(platform.window, 0);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIDDEN)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN))
|
||||||
{
|
{
|
||||||
RGFW_window_hide(platform.window);
|
RGFW_window_hide(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MINIMIZED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
RGFW_window_minimize(platform.window);
|
RGFW_window_minimize(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MAXIMIZED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED))
|
||||||
{
|
{
|
||||||
RGFW_window_maximize(platform.window);
|
RGFW_window_maximize(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNFOCUSED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
|
||||||
platform.window->_flags &= ~RGFW_windowFocusOnShow;
|
FLAG_CLEAR(platform.window->_flags, RGFW_windowFocusOnShow);
|
||||||
RGFW_window_setFlags(platform.window, platform.window->_flags);
|
RGFW_window_setFlags(platform.window, platform.window->_flags);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_TOPMOST)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST))
|
||||||
{
|
{
|
||||||
RGFW_window_setFloating(platform.window, RGFW_TRUE);
|
RGFW_window_setFloating(platform.window, RGFW_TRUE);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_ALWAYS_RUN)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_ALWAYS_RUN))
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_TRANSPARENT)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIGHDPI)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
{
|
{
|
||||||
RGFW_window_setMousePassthrough(platform.window, 1);
|
RGFW_window_setMousePassthrough(platform.window, 1);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
if (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
ToggleBorderlessWindowed();
|
ToggleBorderlessWindowed();
|
||||||
}
|
}
|
||||||
if (flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
RGFW_setGLHint(RGFW_glSamples, 4);
|
RGFW_setGLHint(RGFW_glSamples, 4);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_INTERLACED_HINT)
|
if (FLAG_IS_SET(flags, FLAG_INTERLACED_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
@ -456,77 +456,72 @@ void SetWindowState(unsigned int flags)
|
|||||||
// Clear window configuration state flags
|
// Clear window configuration state flags
|
||||||
void ClearWindowState(unsigned int flags)
|
void ClearWindowState(unsigned int flags)
|
||||||
{
|
{
|
||||||
CORE.Window.flags &= ~flags;
|
FLAG_CLEAR(CORE.Window.flags, flags);
|
||||||
|
|
||||||
if (flags & FLAG_VSYNC_HINT)
|
if (FLAG_IS_SET(flags, FLAG_VSYNC_HINT))
|
||||||
{
|
{
|
||||||
RGFW_window_swapInterval(platform.window, 0);
|
RGFW_window_swapInterval(platform.window, 0);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_FULLSCREEN_MODE)
|
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
if (CORE.Window.fullscreen) ToggleFullscreen();
|
if (CORE.Window.fullscreen) ToggleFullscreen();
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_RESIZABLE)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE))
|
||||||
{
|
{
|
||||||
RGFW_window_setMaxSize(platform.window, RGFW_AREA(platform.window->r.w, platform.window->r.h));
|
RGFW_window_setMaxSize(platform.window, RGFW_AREA(platform.window->r.w, platform.window->r.h));
|
||||||
RGFW_window_setMinSize(platform.window, RGFW_AREA(platform.window->r.w, platform.window->r.h));
|
RGFW_window_setMinSize(platform.window, RGFW_AREA(platform.window->r.w, platform.window->r.h));
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNDECORATED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
{
|
{
|
||||||
RGFW_window_setBorder(platform.window, 1);
|
RGFW_window_setBorder(platform.window, 1);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIDDEN)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN))
|
||||||
{
|
{
|
||||||
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window);
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window);
|
||||||
|
|
||||||
RGFW_window_show(platform.window);
|
RGFW_window_show(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MINIMIZED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window);
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window);
|
||||||
|
|
||||||
RGFW_window_restore(platform.window);
|
RGFW_window_restore(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MAXIMIZED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED))
|
||||||
{
|
{
|
||||||
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window);
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window);
|
||||||
|
|
||||||
RGFW_window_restore(platform.window);
|
RGFW_window_restore(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNFOCUSED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
{
|
{
|
||||||
RGFW_window_setFlags(platform.window, platform.window->_flags | RGFW_windowFocusOnShow);
|
RGFW_window_setFlags(platform.window, platform.window->_flags | RGFW_windowFocusOnShow);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_TOPMOST)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST))
|
||||||
{
|
{
|
||||||
RGFW_window_setFloating(platform.window, RGFW_FALSE);
|
RGFW_window_setFloating(platform.window, RGFW_FALSE);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_ALWAYS_RUN)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
{
|
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN;
|
|
||||||
}
|
|
||||||
if (flags & FLAG_WINDOW_TRANSPARENT)
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIGHDPI)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
{
|
{
|
||||||
RGFW_window_setMousePassthrough(platform.window, 0);
|
RGFW_window_setMousePassthrough(platform.window, 0);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
if (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
if (CORE.Window.fullscreen) ToggleBorderlessWindowed();
|
if (CORE.Window.fullscreen) ToggleBorderlessWindowed();
|
||||||
}
|
}
|
||||||
if (flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
RGFW_setGLHint(RGFW_glSamples, 0);
|
RGFW_setGLHint(RGFW_glSamples, 0);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_INTERLACED_HINT)
|
if (FLAG_IS_SET(flags, FLAG_INTERLACED_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
@ -843,8 +838,9 @@ void EnableCursor(void)
|
|||||||
|
|
||||||
// Set cursor position in the middle
|
// Set cursor position in the middle
|
||||||
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
|
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
|
||||||
RGFW_window_showMouse(platform.window, true);
|
ShowCursor();
|
||||||
CORE.Input.Mouse.cursorHidden = false;
|
|
||||||
|
CORE.Input.Mouse.cursorLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disables cursor (lock cursor)
|
// Disables cursor (lock cursor)
|
||||||
@ -853,6 +849,8 @@ void DisableCursor(void)
|
|||||||
RGFW_disableCursor = true;
|
RGFW_disableCursor = true;
|
||||||
RGFW_window_mouseHold(platform.window, RGFW_AREA(0, 0));
|
RGFW_window_mouseHold(platform.window, RGFW_AREA(0, 0));
|
||||||
HideCursor();
|
HideCursor();
|
||||||
|
|
||||||
|
CORE.Input.Mouse.cursorLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Swap back buffer with front buffer (screen drawing)
|
// Swap back buffer with front buffer (screen drawing)
|
||||||
@ -983,7 +981,7 @@ void PollInputEvents(void)
|
|||||||
CORE.Window.resizedLastFrame = false;
|
CORE.Window.resizedLastFrame = false;
|
||||||
|
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
||||||
if (platform.window->_flags & RGFW_HOLD_MOUSE)
|
if (FLAG_IS_SET(platform.window->_flags, RGFW_HOLD_MOUSE))
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.previousPosition = (Vector2){ 0.0f, 0.0f };
|
CORE.Input.Mouse.previousPosition = (Vector2){ 0.0f, 0.0f };
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ 0.0f, 0.0f };
|
CORE.Input.Mouse.currentPosition = (Vector2){ 0.0f, 0.0f };
|
||||||
@ -1062,18 +1060,18 @@ void PollInputEvents(void)
|
|||||||
} break;
|
} break;
|
||||||
case RGFW_windowMaximized:
|
case RGFW_windowMaximized:
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED; // The window was maximized
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // The window was maximized
|
||||||
} break;
|
} break;
|
||||||
case RGFW_windowMinimized:
|
case RGFW_windowMinimized:
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MINIMIZED; // The window was iconified
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was iconified
|
||||||
} break;
|
} break;
|
||||||
case RGFW_windowRestored:
|
case RGFW_windowRestored:
|
||||||
{
|
{
|
||||||
if (RGFW_window_isMaximized(platform.window))
|
if (RGFW_window_isMaximized(platform.window))
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED; // The window was restored
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // The window was restored
|
||||||
if (RGFW_window_isMinimized(platform.window))
|
if (RGFW_window_isMinimized(platform.window))
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was restored
|
||||||
} break;
|
} break;
|
||||||
case RGFW_windowMoved:
|
case RGFW_windowMoved:
|
||||||
{
|
{
|
||||||
@ -1159,7 +1157,7 @@ void PollInputEvents(void)
|
|||||||
} break;
|
} break;
|
||||||
case RGFW_mousePosChanged:
|
case RGFW_mousePosChanged:
|
||||||
{
|
{
|
||||||
if (platform.window->_flags & RGFW_HOLD_MOUSE)
|
if (FLAG_IS_SET(platform.window->_flags, RGFW_HOLD_MOUSE))
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition.x += (float)event->vector.x;
|
CORE.Input.Mouse.currentPosition.x += (float)event->vector.x;
|
||||||
CORE.Input.Mouse.currentPosition.y += (float)event->vector.y;
|
CORE.Input.Mouse.currentPosition.y += (float)event->vector.y;
|
||||||
@ -1283,24 +1281,24 @@ int InitPlatform(void)
|
|||||||
unsigned int flags = RGFW_windowCenter | RGFW_windowAllowDND;
|
unsigned int flags = RGFW_windowCenter | RGFW_windowAllowDND;
|
||||||
|
|
||||||
// Check window creation flags
|
// Check window creation flags
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
flags |= RGFW_windowFullscreen;
|
FLAG_SET(flags, RGFW_windowFullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
flags |= RGFW_windowedFullscreen;
|
FLAG_SET(flags, RGFW_windowedFullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) flags |= RGFW_windowNoBorder;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED)) FLAG_SET(flags, RGFW_windowNoBorder);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) flags |= RGFW_windowNoResize;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) FLAG_SET(flags, RGFW_windowNoResize);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) flags |= RGFW_windowTransparent;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TRANSPARENT)) FLAG_SET(flags, RGFW_windowTransparent);
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) flags |= RGFW_windowFullscreen;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) FLAG_SET(flags, RGFW_windowFullscreen);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) flags |= RGFW_windowHide;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) FLAG_SET(flags, RGFW_windowHide);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) flags |= RGFW_windowMaximize;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)) FLAG_SET(flags, RGFW_windowMaximize);
|
||||||
|
|
||||||
// NOTE: Some OpenGL context attributes must be set before window creation
|
// NOTE: Some OpenGL context attributes must be set before window creation
|
||||||
// Check selection OpenGL version
|
// Check selection OpenGL version
|
||||||
@ -1320,9 +1318,9 @@ int InitPlatform(void)
|
|||||||
RGFW_setGLHint(RGFW_glMinor, 3);
|
RGFW_setGLHint(RGFW_glMinor, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT) RGFW_setGLHint(RGFW_glSamples, 4);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT)) RGFW_setGLHint(RGFW_glSamples, 4);
|
||||||
|
|
||||||
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) flags |= RGFW_windowFocusOnShow | RGFW_windowFocus;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) FLAG_SET(flags, RGFW_windowFocusOnShow | RGFW_windowFocus);
|
||||||
|
|
||||||
platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags);
|
platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags);
|
||||||
platform.mon.mode.area.w = 0;
|
platform.mon.mode.area.w = 0;
|
||||||
@ -1345,8 +1343,8 @@ int InitPlatform(void)
|
|||||||
// TODO: Is this needed by raylib now?
|
// TODO: Is this needed by raylib now?
|
||||||
// If so, rcore_desktop_sdl should be updated too
|
// If so, rcore_desktop_sdl should be updated too
|
||||||
//SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
//SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||||
|
|
||||||
if (CORE.Window.flags & FLAG_VSYNC_HINT) RGFW_window_swapInterval(platform.window, 1);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_VSYNC_HINT)) RGFW_window_swapInterval(platform.window, 1);
|
||||||
RGFW_window_makeCurrent(platform.window);
|
RGFW_window_makeCurrent(platform.window);
|
||||||
|
|
||||||
// Check surface and context activation
|
// Check surface and context activation
|
||||||
|
|||||||
@ -468,16 +468,16 @@ void ToggleFullscreen(void)
|
|||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < monitorCount))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(platform.window, 0);
|
SDL_SetWindowFullscreen(platform.window, 0);
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN);
|
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN);
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -496,15 +496,15 @@ void ToggleBorderlessWindowed(void)
|
|||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < monitorCount))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(platform.window, 0);
|
SDL_SetWindowFullscreen(platform.window, 0);
|
||||||
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
CORE.Window.flags |= FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
||||||
@ -514,14 +514,14 @@ void ToggleBorderlessWindowed(void)
|
|||||||
void MaximizeWindow(void)
|
void MaximizeWindow(void)
|
||||||
{
|
{
|
||||||
SDL_MaximizeWindow(platform.window);
|
SDL_MaximizeWindow(platform.window);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) == 0) CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set window state: minimized
|
// Set window state: minimized
|
||||||
void MinimizeWindow(void)
|
void MinimizeWindow(void)
|
||||||
{
|
{
|
||||||
SDL_MinimizeWindow(platform.window);
|
SDL_MinimizeWindow(platform.window);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) == 0) CORE.Window.flags |= FLAG_WINDOW_MINIMIZED;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore window from being minimized/maximized
|
// Restore window from being minimized/maximized
|
||||||
@ -536,13 +536,13 @@ void SetWindowState(unsigned int flags)
|
|||||||
{
|
{
|
||||||
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
|
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
|
||||||
|
|
||||||
CORE.Window.flags |= flags;
|
FLAG_SET(CORE.Window.flags, flags);
|
||||||
|
|
||||||
if (flags & FLAG_VSYNC_HINT)
|
if (FLAG_IS_SET(flags, FLAG_VSYNC_HINT))
|
||||||
{
|
{
|
||||||
SDL_GL_SetSwapInterval(1);
|
SDL_GL_SetSwapInterval(1);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_FULLSCREEN_MODE)
|
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
const int monitorCount = SDL_GetNumVideoDisplays();
|
||||||
@ -558,55 +558,55 @@ void SetWindowState(unsigned int flags)
|
|||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_RESIZABLE)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE))
|
||||||
{
|
{
|
||||||
SDL_SetWindowResizable(platform.window, SDL_TRUE);
|
SDL_SetWindowResizable(platform.window, SDL_TRUE);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNDECORATED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
{
|
{
|
||||||
SDL_SetWindowBordered(platform.window, SDL_FALSE);
|
SDL_SetWindowBordered(platform.window, SDL_FALSE);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIDDEN)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN))
|
||||||
{
|
{
|
||||||
SDL_HideWindow(platform.window);
|
SDL_HideWindow(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MINIMIZED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
SDL_MinimizeWindow(platform.window);
|
SDL_MinimizeWindow(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MAXIMIZED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED))
|
||||||
{
|
{
|
||||||
SDL_MaximizeWindow(platform.window);
|
SDL_MaximizeWindow(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNFOCUSED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
{
|
{
|
||||||
// NOTE: To be able to implement this part it seems that we should
|
// NOTE: To be able to implement this part it seems that we should
|
||||||
// do it ourselves, via 'windows.h', 'X11/Xlib.h' or even 'Cocoa.h'
|
// do it ourselves, via 'windows.h', 'X11/Xlib.h' or even 'Cocoa.h'
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_UNFOCUSED is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_UNFOCUSED is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_TOPMOST)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST))
|
||||||
{
|
{
|
||||||
SDL_SetWindowAlwaysOnTop(platform.window, SDL_FALSE);
|
SDL_SetWindowAlwaysOnTop(platform.window, SDL_FALSE);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_ALWAYS_RUN)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_ALWAYS_RUN)
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_TRANSPARENT)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_TRANSPARENT is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_TRANSPARENT is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIGHDPI)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
// NOTE: Such a function does not seem to exist
|
// NOTE: Such a function does not seem to exist
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_HIGHDPI is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_HIGHDPI is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
{
|
{
|
||||||
//SDL_SetWindowGrab(platform.window, SDL_FALSE);
|
//SDL_SetWindowGrab(platform.window, SDL_FALSE);
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_MOUSE_PASSTHROUGH is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_MOUSE_PASSTHROUGH is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
if (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
const int monitorCount = SDL_GetNumVideoDisplays();
|
||||||
@ -621,12 +621,12 @@ void SetWindowState(unsigned int flags)
|
|||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); // Enable multisampling buffers
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); // Enable multisampling buffers
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); // Enable multisampling
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); // Enable multisampling
|
||||||
}
|
}
|
||||||
if (flags & FLAG_INTERLACED_HINT)
|
if (FLAG_IS_SET(flags, FLAG_INTERLACED_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_INTERLACED_HINT is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_INTERLACED_HINT is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
@ -635,74 +635,69 @@ void SetWindowState(unsigned int flags)
|
|||||||
// Clear window configuration state flags
|
// Clear window configuration state flags
|
||||||
void ClearWindowState(unsigned int flags)
|
void ClearWindowState(unsigned int flags)
|
||||||
{
|
{
|
||||||
CORE.Window.flags &= ~flags;
|
FLAG_CLEAR(CORE.Window.flags, flags);
|
||||||
|
|
||||||
if (flags & FLAG_VSYNC_HINT)
|
if (FLAG_IS_SET(flags, FLAG_VSYNC_HINT))
|
||||||
{
|
{
|
||||||
SDL_GL_SetSwapInterval(0);
|
SDL_GL_SetSwapInterval(0);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_FULLSCREEN_MODE)
|
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(platform.window, 0);
|
SDL_SetWindowFullscreen(platform.window, 0);
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_RESIZABLE)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE))
|
||||||
{
|
{
|
||||||
SDL_SetWindowResizable(platform.window, SDL_FALSE);
|
SDL_SetWindowResizable(platform.window, SDL_FALSE);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNDECORATED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
{
|
{
|
||||||
SDL_SetWindowBordered(platform.window, SDL_TRUE);
|
SDL_SetWindowBordered(platform.window, SDL_TRUE);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIDDEN)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN))
|
||||||
{
|
{
|
||||||
SDL_ShowWindow(platform.window);
|
SDL_ShowWindow(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MINIMIZED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
SDL_RestoreWindow(platform.window);
|
SDL_RestoreWindow(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MAXIMIZED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED))
|
||||||
{
|
{
|
||||||
SDL_RestoreWindow(platform.window);
|
SDL_RestoreWindow(platform.window);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNFOCUSED)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
{
|
{
|
||||||
//SDL_RaiseWindow(platform.window);
|
//SDL_RaiseWindow(platform.window);
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_UNFOCUSED is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_UNFOCUSED is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_TOPMOST)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST))
|
||||||
{
|
{
|
||||||
SDL_SetWindowAlwaysOnTop(platform.window, SDL_FALSE);
|
SDL_SetWindowAlwaysOnTop(platform.window, SDL_FALSE);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_ALWAYS_RUN)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
{
|
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN;
|
|
||||||
}
|
|
||||||
if (flags & FLAG_WINDOW_TRANSPARENT)
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_TRANSPARENT is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_TRANSPARENT is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIGHDPI)
|
|
||||||
{
|
{
|
||||||
// NOTE: There also doesn't seem to be a feature to disable high DPI once enabled
|
// NOTE: There also doesn't seem to be a feature to disable high DPI once enabled
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_HIGHDPI is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_HIGHDPI is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
{
|
{
|
||||||
//SDL_SetWindowGrab(platform.window, SDL_TRUE);
|
//SDL_SetWindowGrab(platform.window, SDL_TRUE);
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_MOUSE_PASSTHROUGH is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_MOUSE_PASSTHROUGH is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
if (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(platform.window, 0);
|
SDL_SetWindowFullscreen(platform.window, 0);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); // Disable multisampling buffers
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); // Disable multisampling buffers
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); // Disable multisampling
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); // Disable multisampling
|
||||||
}
|
}
|
||||||
if (flags & FLAG_INTERLACED_HINT)
|
if (FLAG_IS_SET(flags, FLAG_INTERLACED_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_INTERLACED_HINT is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_INTERLACED_HINT is not supported on PLATFORM_DESKTOP_SDL");
|
||||||
}
|
}
|
||||||
@ -847,7 +842,7 @@ void SetWindowMonitor(int monitor)
|
|||||||
// 1. SDL started supporting moving exclusive fullscreen windows between displays on SDL3,
|
// 1. SDL started supporting moving exclusive fullscreen windows between displays on SDL3,
|
||||||
// see commit https://github.com/libsdl-org/SDL/commit/3f5ef7dd422057edbcf3e736107e34be4b75d9ba
|
// see commit https://github.com/libsdl-org/SDL/commit/3f5ef7dd422057edbcf3e736107e34be4b75d9ba
|
||||||
// 2. A workaround for SDL2 is leaving fullscreen, moving the window, then entering full screen again
|
// 2. A workaround for SDL2 is leaving fullscreen, moving the window, then entering full screen again
|
||||||
const bool wasFullscreen = ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0)? true : false;
|
const bool wasFullscreen = (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))? true : false;
|
||||||
|
|
||||||
const int screenWidth = CORE.Window.screen.width;
|
const int screenWidth = CORE.Window.screen.width;
|
||||||
const int screenHeight = CORE.Window.screen.height;
|
const int screenHeight = CORE.Window.screen.height;
|
||||||
@ -1242,13 +1237,7 @@ void EnableCursor(void)
|
|||||||
{
|
{
|
||||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||||
|
|
||||||
#if defined(USING_VERSION_SDL3)
|
ShowCursor();
|
||||||
// NOTE: SDL_ShowCursor() has been split into three functions:
|
|
||||||
// SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()
|
|
||||||
SDL_ShowCursor();
|
|
||||||
#else
|
|
||||||
SDL_ShowCursor(SDL_ENABLE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CORE.Input.Mouse.cursorLocked = false;
|
CORE.Input.Mouse.cursorLocked = false;
|
||||||
}
|
}
|
||||||
@ -1258,6 +1247,9 @@ void DisableCursor(void)
|
|||||||
{
|
{
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
|
|
||||||
|
HideCursor();
|
||||||
|
|
||||||
|
platform.cursorRelative = true;
|
||||||
CORE.Input.Mouse.cursorLocked = true;
|
CORE.Input.Mouse.cursorLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1410,7 +1402,7 @@ void PollInputEvents(void)
|
|||||||
|
|
||||||
CORE.Window.resizedLastFrame = false;
|
CORE.Window.resizedLastFrame = false;
|
||||||
|
|
||||||
if ((CORE.Window.eventWaiting) || (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) && ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0)))
|
if ((CORE.Window.eventWaiting) || (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) && !FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN)))
|
||||||
{
|
{
|
||||||
SDL_WaitEvent(NULL);
|
SDL_WaitEvent(NULL);
|
||||||
CORE.Time.previous = GetTime();
|
CORE.Time.previous = GetTime();
|
||||||
@ -1498,7 +1490,7 @@ void PollInputEvents(void)
|
|||||||
|
|
||||||
#ifndef USING_VERSION_SDL3
|
#ifndef USING_VERSION_SDL3
|
||||||
// Manually detect if the window was maximized (due to SDL2 restore being unreliable on some platforms) to remove the FLAG_WINDOW_MAXIMIZED accordingly
|
// Manually detect if the window was maximized (due to SDL2 restore being unreliable on some platforms) to remove the FLAG_WINDOW_MAXIMIZED accordingly
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED))
|
||||||
{
|
{
|
||||||
int borderTop = 0;
|
int borderTop = 0;
|
||||||
int borderLeft = 0;
|
int borderLeft = 0;
|
||||||
@ -1508,7 +1500,7 @@ void PollInputEvents(void)
|
|||||||
SDL_Rect usableBounds;
|
SDL_Rect usableBounds;
|
||||||
SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(platform.window), &usableBounds);
|
SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(platform.window), &usableBounds);
|
||||||
|
|
||||||
if ((width + borderLeft + borderRight != usableBounds.w) && (height + borderTop + borderBottom != usableBounds.h)) CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED;
|
if ((width + borderLeft + borderRight != usableBounds.w) && (height + borderTop + borderBottom != usableBounds.h)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} break;
|
} break;
|
||||||
@ -1524,43 +1516,43 @@ void PollInputEvents(void)
|
|||||||
|
|
||||||
case SDL_WINDOWEVENT_MINIMIZED:
|
case SDL_WINDOWEVENT_MINIMIZED:
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) == 0) CORE.Window.flags |= FLAG_WINDOW_MINIMIZED;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED);
|
||||||
} break;
|
} break;
|
||||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) == 0) CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
} break;
|
} break;
|
||||||
case SDL_WINDOWEVENT_RESTORED:
|
case SDL_WINDOWEVENT_RESTORED:
|
||||||
{
|
{
|
||||||
if ((SDL_GetWindowFlags(platform.window) & SDL_WINDOW_MINIMIZED) == 0)
|
if (!FLAG_IS_SET(SDL_GetWindowFlags(platform.window), SDL_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USING_VERSION_SDL3
|
#ifdef USING_VERSION_SDL3
|
||||||
if ((SDL_GetWindowFlags(platform.window) & SDL_WINDOW_MAXIMIZED) == 0)
|
if (!FLAG_IS_SET(SDL_GetWindowFlags(platform.window), SDL_WINDOW_MAXIMIZED))
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & SDL_WINDOW_MAXIMIZED) > 0) CORE.Window.flags &= ~SDL_WINDOW_MAXIMIZED;
|
if (FLAG_IS_SET(CORE.Window.flags, SDL_WINDOW_MAXIMIZED)) FLAG_CLEAR(CORE.Window.flags, SDL_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_HIDDEN:
|
case SDL_WINDOWEVENT_HIDDEN:
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) == 0) CORE.Window.flags |= FLAG_WINDOW_HIDDEN;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN);
|
||||||
} break;
|
} break;
|
||||||
case SDL_WINDOWEVENT_SHOWN:
|
case SDL_WINDOWEVENT_SHOWN:
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_HIDDEN);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
|
||||||
} break;
|
} break;
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
{
|
{
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) == 0) CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
#ifndef USING_VERSION_SDL3
|
#ifndef USING_VERSION_SDL3
|
||||||
@ -1930,38 +1922,34 @@ int InitPlatform(void)
|
|||||||
// Initialize graphic device: display/window and graphic context
|
// Initialize graphic device: display/window and graphic context
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
flags |= SDL_WINDOW_SHOWN;
|
FLAG_SET(flags, SDL_WINDOW_SHOWN);
|
||||||
flags |= SDL_WINDOW_INPUT_FOCUS;
|
FLAG_SET(flags, SDL_WINDOW_INPUT_FOCUS);
|
||||||
flags |= SDL_WINDOW_MOUSE_FOCUS;
|
FLAG_SET(flags, SDL_WINDOW_MOUSE_FOCUS);
|
||||||
flags |= SDL_WINDOW_MOUSE_CAPTURE; // Window has mouse captured
|
FLAG_SET(flags, SDL_WINDOW_MOUSE_CAPTURE); // Window has mouse captured
|
||||||
|
|
||||||
// Check window creation flags
|
// Check window creation flags
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
flags |= SDL_WINDOW_FULLSCREEN;
|
FLAG_SET(flags, SDL_WINDOW_FULLSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) == 0) flags |= SDL_WINDOW_HIDDEN;
|
//if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) FLAG_SET(flags, SDL_WINDOW_HIDDEN);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) flags |= SDL_WINDOW_BORDERLESS;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED)) FLAG_SET(flags, SDL_WINDOW_BORDERLESS);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) flags |= SDL_WINDOW_RESIZABLE;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) FLAG_SET(flags, SDL_WINDOW_RESIZABLE);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) flags |= SDL_WINDOW_MINIMIZED;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) FLAG_SET(flags, SDL_WINDOW_MINIMIZED);
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) flags |= SDL_WINDOW_MAXIMIZED;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)) FLAG_SET(flags, SDL_WINDOW_MAXIMIZED);
|
||||||
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0)
|
|
||||||
{
|
{
|
||||||
flags &= ~SDL_WINDOW_INPUT_FOCUS;
|
FLAG_CLEAR(flags, SDL_WINDOW_INPUT_FOCUS);
|
||||||
flags &= ~SDL_WINDOW_MOUSE_FOCUS;
|
FLAG_CLEAR(flags, SDL_WINDOW_MOUSE_FOCUS);
|
||||||
}
|
}
|
||||||
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TOPMOST)) FLAG_SET(flags, SDL_WINDOW_ALWAYS_ON_TOP);
|
||||||
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MOUSE_PASSTHROUGH)) FLAG_CLEAR(flags, SDL_WINDOW_MOUSE_CAPTURE);
|
||||||
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)) FLAG_SET(flags, SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) flags |= SDL_WINDOW_ALWAYS_ON_TOP;
|
//if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TRANSPARENT)) FLAG_SET(flags, SDL_WINDOW_TRANSPARENT); // Alternative: SDL_GL_ALPHA_SIZE = 8
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) flags &= ~SDL_WINDOW_MOUSE_CAPTURE;
|
//if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_DESKTOP)) FLAG_SET(flags, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) flags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
|
||||||
|
|
||||||
//if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) flags |= SDL_WINDOW_TRANSPARENT; // Alternative: SDL_GL_ALPHA_SIZE = 8
|
|
||||||
|
|
||||||
//if ((CORE.Window.flags & FLAG_FULLSCREEN_DESKTOP) > 0) flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
|
||||||
|
|
||||||
// NOTE: Some OpenGL context attributes must be set before window creation
|
// NOTE: Some OpenGL context attributes must be set before window creation
|
||||||
|
|
||||||
@ -2004,7 +1992,7 @@ int InitPlatform(void)
|
|||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||||
@ -2047,7 +2035,7 @@ int InitPlatform(void)
|
|||||||
|
|
||||||
if (platform.glContext != NULL)
|
if (platform.glContext != NULL)
|
||||||
{
|
{
|
||||||
SDL_GL_SetSwapInterval((CORE.Window.flags & FLAG_VSYNC_HINT)? 1 : 0);
|
SDL_GL_SetSwapInterval((FLAG_IS_SET(CORE.Window.flags, FLAG_VSYNC_HINT))? 1: 0);
|
||||||
|
|
||||||
// Load OpenGL extensions
|
// Load OpenGL extensions
|
||||||
// NOTE: GL procedures address loader is required to load extensions
|
// NOTE: GL procedures address loader is required to load extensions
|
||||||
|
|||||||
@ -271,7 +271,7 @@ static DWORD MakeWindowStyle(unsigned flags)
|
|||||||
|
|
||||||
// Minimized takes precedence over maximized
|
// Minimized takes precedence over maximized
|
||||||
int mized = MIZED_NONE;
|
int mized = MIZED_NONE;
|
||||||
if (FLAG_CHECK(flags, FLAG_WINDOW_MINIMIZED)) mized = MIZED_MIN;
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED)) mized = MIZED_MIN;
|
||||||
if (flags & FLAG_WINDOW_MAXIMIZED) mized = MIZED_MAX;
|
if (flags & FLAG_WINDOW_MAXIMIZED) mized = MIZED_MAX;
|
||||||
|
|
||||||
switch (mized)
|
switch (mized)
|
||||||
|
|||||||
@ -1148,7 +1148,7 @@ int InitPlatform(void)
|
|||||||
// Initialize graphic device: display/window and graphic context
|
// Initialize graphic device: display/window and graphic context
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
|
|
||||||
#if defined(DEFAULT_GRAPHIC_DEVICE_DRM)
|
#if defined(DEFAULT_GRAPHIC_DEVICE_DRM)
|
||||||
platform.fd = open(DEFAULT_GRAPHIC_DEVICE_DRM, O_RDWR);
|
platform.fd = open(DEFAULT_GRAPHIC_DEVICE_DRM, O_RDWR);
|
||||||
@ -1297,7 +1297,7 @@ int InitPlatform(void)
|
|||||||
CORE.Window.screen.height = CORE.Window.display.height;
|
CORE.Window.screen.height = CORE.Window.display.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool allowInterlaced = CORE.Window.flags & FLAG_INTERLACED_HINT;
|
const bool allowInterlaced = FLAG_IS_SET(CORE.Window.flags, FLAG_INTERLACED_HINT);
|
||||||
const int fps = (CORE.Time.target > 0) ? (1.0/CORE.Time.target) : 60;
|
const int fps = (CORE.Time.target > 0) ? (1.0/CORE.Time.target) : 60;
|
||||||
|
|
||||||
// Try to find an exact matching mode
|
// Try to find an exact matching mode
|
||||||
@ -1328,7 +1328,7 @@ int InitPlatform(void)
|
|||||||
|
|
||||||
TRACELOG(LOG_INFO, "DISPLAY: Selected DRM connector mode %s (%ux%u%c@%u)", platform.connector->modes[platform.modeIndex].name,
|
TRACELOG(LOG_INFO, "DISPLAY: Selected DRM connector mode %s (%ux%u%c@%u)", platform.connector->modes[platform.modeIndex].name,
|
||||||
platform.connector->modes[platform.modeIndex].hdisplay, platform.connector->modes[platform.modeIndex].vdisplay,
|
platform.connector->modes[platform.modeIndex].hdisplay, platform.connector->modes[platform.modeIndex].vdisplay,
|
||||||
(platform.connector->modes[platform.modeIndex].flags & DRM_MODE_FLAG_INTERLACE) ? 'i' : 'p',
|
FLAG_IS_SET(platform.connector->modes[platform.modeIndex].flags, DRM_MODE_FLAG_INTERLACE)? 'i' : 'p',
|
||||||
platform.connector->modes[platform.modeIndex].vrefresh);
|
platform.connector->modes[platform.modeIndex].vrefresh);
|
||||||
|
|
||||||
drmModeFreeEncoder(enc);
|
drmModeFreeEncoder(enc);
|
||||||
@ -1384,7 +1384,7 @@ int InitPlatform(void)
|
|||||||
|
|
||||||
EGLint samples = 0;
|
EGLint samples = 0;
|
||||||
EGLint sampleBuffer = 0;
|
EGLint sampleBuffer = 0;
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
samples = 4;
|
samples = 4;
|
||||||
sampleBuffer = 1;
|
sampleBuffer = 1;
|
||||||
@ -1561,17 +1561,17 @@ int InitPlatform(void)
|
|||||||
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) MinimizeWindow();
|
||||||
|
|
||||||
// If graphic device is no properly initialized, we end program
|
// If graphic device is no properly initialized, we end program
|
||||||
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
|
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
|
||||||
else SetWindowPosition(GetMonitorWidth(GetCurrentMonitor())/2 - CORE.Window.screen.width/2, GetMonitorHeight(GetCurrentMonitor())/2 - CORE.Window.screen.height/2);
|
else SetWindowPosition(GetMonitorWidth(GetCurrentMonitor())/2 - CORE.Window.screen.width/2, GetMonitorHeight(GetCurrentMonitor())/2 - CORE.Window.screen.height/2);
|
||||||
|
|
||||||
// Set some default window flags
|
// Set some default window flags
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN; // false
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_HIDDEN); // false
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // false
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // false
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED; // true
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // true
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED; // false
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // false
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Initialize timing system
|
// Initialize timing system
|
||||||
@ -1720,8 +1720,8 @@ static void InitKeyboard(void)
|
|||||||
|
|
||||||
// New terminal settings for keyboard: turn off buffering (non-canonical mode), echo and key processing
|
// New terminal settings for keyboard: turn off buffering (non-canonical mode), echo and key processing
|
||||||
// NOTE: ISIG controls if ^C and ^Z generate break signals or not
|
// NOTE: ISIG controls if ^C and ^Z generate break signals or not
|
||||||
keyboardNewSettings.c_lflag &= ~(ICANON | ECHO | ISIG);
|
FLAG_CLEAR(keyboardNewSettings.c_lflag, ICANON | ECHO | ISIG);
|
||||||
//keyboardNewSettings.c_iflag &= ~(ISTRIP | INLCR | ICRNL | IGNCR | IXON | IXOFF);
|
//FLAG_CLEAR(keyboardNewSettings.c_iflag, ISTRIP | INLCR | ICRNL | IGNCR | IXON | IXOFF);
|
||||||
keyboardNewSettings.c_cc[VMIN] = 1;
|
keyboardNewSettings.c_cc[VMIN] = 1;
|
||||||
keyboardNewSettings.c_cc[VTIME] = 0;
|
keyboardNewSettings.c_cc[VTIME] = 0;
|
||||||
|
|
||||||
@ -2402,7 +2402,7 @@ static int FindMatchingConnectorMode(const drmModeConnector *connector, const dr
|
|||||||
for (size_t i = 0; i < connector->count_modes; i++)
|
for (size_t i = 0; i < connector->count_modes; i++)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode: %d %ux%u@%u %s", i, connector->modes[i].hdisplay, connector->modes[i].vdisplay,
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode: %d %ux%u@%u %s", i, connector->modes[i].hdisplay, connector->modes[i].vdisplay,
|
||||||
connector->modes[i].vrefresh, (connector->modes[i].flags & DRM_MODE_FLAG_INTERLACE)? "interlaced" : "progressive");
|
connector->modes[i].vrefresh, (FLAG_IS_SET(connector->modes[i].flags, DRM_MODE_FLAG_INTERLACE) > 0)? "interlaced" : "progressive");
|
||||||
|
|
||||||
if (0 == BINCMP(&platform.crtc->mode, &platform.connector->modes[i])) return i;
|
if (0 == BINCMP(&platform.crtc->mode, &platform.connector->modes[i])) return i;
|
||||||
}
|
}
|
||||||
@ -2423,9 +2423,9 @@ static int FindExactConnectorMode(const drmModeConnector *connector, uint width,
|
|||||||
{
|
{
|
||||||
const drmModeModeInfo *const mode = &platform.connector->modes[i];
|
const drmModeModeInfo *const mode = &platform.connector->modes[i];
|
||||||
|
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM Mode %d %ux%u@%u %s", i, mode->hdisplay, mode->vdisplay, mode->vrefresh, (mode->flags & DRM_MODE_FLAG_INTERLACE)? "interlaced" : "progressive");
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM Mode %d %ux%u@%u %s", i, mode->hdisplay, mode->vdisplay, mode->vrefresh, (FLAG_IS_SET(mode->flags, DRM_MODE_FLAG_INTERLACE) > 0)? "interlaced" : "progressive");
|
||||||
|
|
||||||
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && !allowInterlaced) continue;
|
if ((FLAG_IS_SET(mode->flags, DRM_MODE_FLAG_INTERLACE) > 0) && !allowInterlaced) continue;
|
||||||
|
|
||||||
if ((mode->hdisplay == width) && (mode->vdisplay == height) && (mode->vrefresh == fps)) return i;
|
if ((mode->hdisplay == width) && (mode->vdisplay == height) && (mode->vrefresh == fps)) return i;
|
||||||
}
|
}
|
||||||
@ -2449,7 +2449,7 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
|
|||||||
const drmModeModeInfo *const mode = &platform.connector->modes[i];
|
const drmModeModeInfo *const mode = &platform.connector->modes[i];
|
||||||
|
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode: %d %ux%u@%u %s", i, mode->hdisplay, mode->vdisplay, mode->vrefresh,
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode: %d %ux%u@%u %s", i, mode->hdisplay, mode->vdisplay, mode->vrefresh,
|
||||||
(mode->flags & DRM_MODE_FLAG_INTERLACE)? "interlaced" : "progressive");
|
(FLAG_IS_SET(mode->flags, DRM_MODE_FLAG_INTERLACE) > 0)? "interlaced" : "progressive");
|
||||||
|
|
||||||
if ((mode->hdisplay < width) || (mode->vdisplay < height))
|
if ((mode->hdisplay < width) || (mode->vdisplay < height))
|
||||||
{
|
{
|
||||||
@ -2457,7 +2457,7 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && !allowInterlaced)
|
if ((FLAG_IS_SET(mode->flags, DRM_MODE_FLAG_INTERLACE) > 0) && !allowInterlaced)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM shouldn't choose an interlaced mode");
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM shouldn't choose an interlaced mode");
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -460,11 +460,11 @@ int InitPlatform(void)
|
|||||||
// Below example illustrates that process using EGL library
|
// Below example illustrates that process using EGL library
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
|
|
||||||
EGLint samples = 0;
|
EGLint samples = 0;
|
||||||
EGLint sampleBuffer = 0;
|
EGLint sampleBuffer = 0;
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
samples = 4;
|
samples = 4;
|
||||||
sampleBuffer = 1;
|
sampleBuffer = 1;
|
||||||
|
|||||||
@ -181,8 +181,8 @@ void ToggleFullscreen(void)
|
|||||||
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
||||||
if (wasFullscreen)
|
if (wasFullscreen)
|
||||||
{
|
{
|
||||||
if (CORE.Window.flags & FLAG_FULLSCREEN_MODE) enterFullscreen = false;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) enterFullscreen = false;
|
||||||
else if (CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) enterFullscreen = true;
|
else if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE)) enterFullscreen = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
||||||
@ -194,8 +194,8 @@ void ToggleFullscreen(void)
|
|||||||
EM_ASM(document.exitFullscreen(););
|
EM_ASM(document.exitFullscreen(););
|
||||||
|
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
}
|
}
|
||||||
else enterFullscreen = true;
|
else enterFullscreen = true;
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ void ToggleFullscreen(void)
|
|||||||
}, 100);
|
}, 100);
|
||||||
);
|
);
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Old notes below:
|
// NOTE: Old notes below:
|
||||||
@ -263,7 +263,7 @@ void ToggleFullscreen(void)
|
|||||||
TRACELOG(LOG_WARNING, "Emscripten: Enter fullscreen: Canvas size: %i x %i", width, height);
|
TRACELOG(LOG_WARNING, "Emscripten: Enter fullscreen: Canvas size: %i x %i", width, height);
|
||||||
|
|
||||||
CORE.Window.fullscreen = true; // Toggle fullscreen flag
|
CORE.Window.fullscreen = true; // Toggle fullscreen flag
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -275,7 +275,7 @@ void ToggleFullscreen(void)
|
|||||||
TRACELOG(LOG_WARNING, "Emscripten: Exit fullscreen: Canvas size: %i x %i", width, height);
|
TRACELOG(LOG_WARNING, "Emscripten: Exit fullscreen: Canvas size: %i x %i", width, height);
|
||||||
|
|
||||||
CORE.Window.fullscreen = false; // Toggle fullscreen flag
|
CORE.Window.fullscreen = false; // Toggle fullscreen flag
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@ -289,8 +289,8 @@ void ToggleBorderlessWindowed(void)
|
|||||||
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
||||||
if (wasFullscreen)
|
if (wasFullscreen)
|
||||||
{
|
{
|
||||||
if (CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) enterBorderless = false;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE)) enterBorderless = false;
|
||||||
else if (CORE.Window.flags & FLAG_FULLSCREEN_MODE) enterBorderless = true;
|
else if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) enterBorderless = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
||||||
@ -302,8 +302,8 @@ void ToggleBorderlessWindowed(void)
|
|||||||
EM_ASM(document.exitFullscreen(););
|
EM_ASM(document.exitFullscreen(););
|
||||||
|
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
}
|
}
|
||||||
else enterBorderless = true;
|
else enterBorderless = true;
|
||||||
|
|
||||||
@ -322,14 +322,14 @@ void ToggleBorderlessWindowed(void)
|
|||||||
}, 100);
|
}, 100);
|
||||||
}, 100);
|
}, 100);
|
||||||
);
|
);
|
||||||
CORE.Window.flags |= FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set window state: maximized, if resizable
|
// Set window state: maximized, if resizable
|
||||||
void MaximizeWindow(void)
|
void MaximizeWindow(void)
|
||||||
{
|
{
|
||||||
if ((glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE) && !(CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
|
if ((glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE) && !(FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)))
|
||||||
{
|
{
|
||||||
platform.unmaximizedWidth = CORE.Window.screen.width;
|
platform.unmaximizedWidth = CORE.Window.screen.width;
|
||||||
platform.unmaximizedHeight = CORE.Window.screen.height;
|
platform.unmaximizedHeight = CORE.Window.screen.height;
|
||||||
@ -339,7 +339,7 @@ void MaximizeWindow(void)
|
|||||||
|
|
||||||
if (tabWidth && tabHeight) glfwSetWindowSize(platform.handle, tabWidth, tabHeight);
|
if (tabWidth && tabHeight) glfwSetWindowSize(platform.handle, tabWidth, tabHeight);
|
||||||
|
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,11 +352,11 @@ void MinimizeWindow(void)
|
|||||||
// Restore window from being minimized/maximized
|
// Restore window from being minimized/maximized
|
||||||
void RestoreWindow(void)
|
void RestoreWindow(void)
|
||||||
{
|
{
|
||||||
if ((glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE) && (CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
|
if ((glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE) && (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)))
|
||||||
{
|
{
|
||||||
if (platform.unmaximizedWidth && platform.unmaximizedHeight) glfwSetWindowSize(platform.handle, platform.unmaximizedWidth, platform.unmaximizedHeight);
|
if (platform.unmaximizedWidth && platform.unmaximizedHeight) glfwSetWindowSize(platform.handle, platform.unmaximizedWidth, platform.unmaximizedHeight);
|
||||||
|
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,13 +369,13 @@ void SetWindowState(unsigned int flags)
|
|||||||
// NOTE: In most cases the functions already change the flags internally
|
// NOTE: In most cases the functions already change the flags internally
|
||||||
|
|
||||||
// State change: FLAG_VSYNC_HINT
|
// State change: FLAG_VSYNC_HINT
|
||||||
if ((flags & FLAG_VSYNC_HINT) > 0)
|
if (FLAG_IS_SET(flags, FLAG_VSYNC_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_VSYNC_HINT) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_VSYNC_HINT) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
||||||
if ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0)
|
if (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
// NOTE: Window state flag updated inside ToggleBorderlessWindowed() function
|
// NOTE: Window state flag updated inside ToggleBorderlessWindowed() function
|
||||||
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
||||||
@ -383,13 +383,13 @@ void SetWindowState(unsigned int flags)
|
|||||||
{
|
{
|
||||||
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
||||||
const int canvasStyleWidth = EM_ASM_INT( { return parseInt(Module.canvas.style.width); }, 0);
|
const int canvasStyleWidth = EM_ASM_INT( { return parseInt(Module.canvas.style.width); }, 0);
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) || canvasStyleWidth > canvasWidth) ToggleBorderlessWindowed();
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) || canvasStyleWidth > canvasWidth) ToggleBorderlessWindowed();
|
||||||
}
|
}
|
||||||
else ToggleBorderlessWindowed();
|
else ToggleBorderlessWindowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_FULLSCREEN_MODE
|
// State change: FLAG_FULLSCREEN_MODE
|
||||||
if ((flags & FLAG_FULLSCREEN_MODE) > 0)
|
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
// NOTE: Window state flag updated inside ToggleFullscreen() function
|
// NOTE: Window state flag updated inside ToggleFullscreen() function
|
||||||
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
||||||
@ -397,38 +397,38 @@ void SetWindowState(unsigned int flags)
|
|||||||
{
|
{
|
||||||
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
||||||
const int screenWidth = EM_ASM_INT( { return screen.width; }, 0);
|
const int screenWidth = EM_ASM_INT( { return screen.width; }, 0);
|
||||||
if ((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) || screenWidth == canvasWidth ) ToggleFullscreen();
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE)) || screenWidth == canvasWidth ) ToggleFullscreen();
|
||||||
}
|
}
|
||||||
else ToggleFullscreen();
|
else ToggleFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_RESIZABLE
|
// State change: FLAG_WINDOW_RESIZABLE
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE) != FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE)) && (FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE)))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_RESIZABLE;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNDECORATED
|
// State change: FLAG_WINDOW_UNDECORATED
|
||||||
if ((flags & FLAG_WINDOW_UNDECORATED) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_UNDECORATED) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_UNDECORATED) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIDDEN
|
// State change: FLAG_WINDOW_HIDDEN
|
||||||
if ((flags & FLAG_WINDOW_HIDDEN) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_HIDDEN) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_HIDDEN) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MINIMIZED
|
// State change: FLAG_WINDOW_MINIMIZED
|
||||||
if ((flags & FLAG_WINDOW_MINIMIZED) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_MINIMIZED) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_MINIMIZED) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MAXIMIZED
|
// State change: FLAG_WINDOW_MAXIMIZED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) != (flags & FLAG_WINDOW_MAXIMIZED)) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED) != FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED)) && (FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED)))
|
||||||
{
|
{
|
||||||
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE)
|
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE)
|
||||||
{
|
{
|
||||||
@ -440,24 +440,24 @@ void SetWindowState(unsigned int flags)
|
|||||||
|
|
||||||
if (tabWidth && tabHeight) glfwSetWindowSize(platform.handle, tabWidth, tabHeight);
|
if (tabWidth && tabHeight) glfwSetWindowSize(platform.handle, tabWidth, tabHeight);
|
||||||
|
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED;
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNFOCUSED
|
// State change: FLAG_WINDOW_UNFOCUSED
|
||||||
if ((flags & FLAG_WINDOW_UNFOCUSED) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_UNFOCUSED) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_UNFOCUSED) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TOPMOST
|
// State change: FLAG_WINDOW_TOPMOST
|
||||||
if ((flags & FLAG_WINDOW_TOPMOST) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_TOPMOST) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_TOPMOST) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_ALWAYS_RUN
|
// State change: FLAG_WINDOW_ALWAYS_RUN
|
||||||
if ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_ALWAYS_RUN))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_ALWAYS_RUN) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_ALWAYS_RUN) not available on target platform");
|
||||||
}
|
}
|
||||||
@ -466,31 +466,31 @@ void SetWindowState(unsigned int flags)
|
|||||||
// NOTE: Review for PLATFORM_WEB
|
// NOTE: Review for PLATFORM_WEB
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TRANSPARENT
|
// State change: FLAG_WINDOW_TRANSPARENT
|
||||||
if ((flags & FLAG_WINDOW_TRANSPARENT) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_TRANSPARENT) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_TRANSPARENT) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIGHDPI
|
// State change: FLAG_WINDOW_HIGHDPI
|
||||||
if ((flags & FLAG_WINDOW_HIGHDPI) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_HIGHDPI) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_HIGHDPI) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||||
if ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_MOUSE_PASSTHROUGH) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_MOUSE_PASSTHROUGH) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_MSAA_4X_HINT
|
// State change: FLAG_MSAA_4X_HINT
|
||||||
if ((flags & FLAG_MSAA_4X_HINT) > 0)
|
if (FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_MSAA_4X_HINT) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_MSAA_4X_HINT) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_INTERLACED_HINT
|
// State change: FLAG_INTERLACED_HINT
|
||||||
if ((flags & FLAG_INTERLACED_HINT) > 0)
|
if (FLAG_IS_SET(flags, FLAG_INTERLACED_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_INTERLACED_HINT) not available on target platform");
|
TRACELOG(LOG_WARNING, "SetWindowState(FLAG_INTERLACED_HINT) not available on target platform");
|
||||||
}
|
}
|
||||||
@ -503,90 +503,90 @@ void ClearWindowState(unsigned int flags)
|
|||||||
// NOTE: In most cases the functions already change the flags internally
|
// NOTE: In most cases the functions already change the flags internally
|
||||||
|
|
||||||
// State change: FLAG_VSYNC_HINT
|
// State change: FLAG_VSYNC_HINT
|
||||||
if ((flags & FLAG_VSYNC_HINT) > 0)
|
if (FLAG_IS_SET(flags, FLAG_VSYNC_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_VSYNC_HINT) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_VSYNC_HINT) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
||||||
if ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0)
|
if (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
||||||
if (wasFullscreen)
|
if (wasFullscreen)
|
||||||
{
|
{
|
||||||
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
||||||
const int screenWidth = EM_ASM_INT( { return screen.width; }, 0);
|
const int screenWidth = EM_ASM_INT( { return screen.width; }, 0);
|
||||||
if ((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) || (screenWidth == canvasWidth)) EM_ASM(document.exitFullscreen(););
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE) || (screenWidth == canvasWidth)) EM_ASM(document.exitFullscreen(););
|
||||||
}
|
}
|
||||||
|
|
||||||
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_FULLSCREEN_MODE
|
// State change: FLAG_FULLSCREEN_MODE
|
||||||
if ((flags & FLAG_FULLSCREEN_MODE) > 0)
|
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
|
||||||
if (wasFullscreen)
|
if (wasFullscreen)
|
||||||
{
|
{
|
||||||
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
const int canvasWidth = EM_ASM_INT( { return Module.canvas.width; }, 0);
|
||||||
const int canvasStyleWidth = EM_ASM_INT( { return parseInt(Module.canvas.style.width); }, 0);
|
const int canvasStyleWidth = EM_ASM_INT( { return parseInt(Module.canvas.style.width); }, 0);
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) || (canvasStyleWidth > canvasWidth)) EM_ASM(document.exitFullscreen(););
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE) || (canvasStyleWidth > canvasWidth)) EM_ASM(document.exitFullscreen(););
|
||||||
}
|
}
|
||||||
|
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_RESIZABLE
|
// State change: FLAG_WINDOW_RESIZABLE
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) && (FLAG_IS_SET(flags, FLAG_WINDOW_RESIZABLE)))
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_RESIZABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIDDEN
|
// State change: FLAG_WINDOW_HIDDEN
|
||||||
if ((flags & FLAG_WINDOW_HIDDEN) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIDDEN))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_HIDDEN) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_HIDDEN) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MINIMIZED
|
// State change: FLAG_WINDOW_MINIMIZED
|
||||||
if ((flags & FLAG_WINDOW_MINIMIZED) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_MINIMIZED) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_MINIMIZED) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MAXIMIZED
|
// State change: FLAG_WINDOW_MAXIMIZED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0))
|
if ((FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)) && (FLAG_IS_SET(flags, FLAG_WINDOW_MAXIMIZED)))
|
||||||
{
|
{
|
||||||
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE)
|
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE)
|
||||||
{
|
{
|
||||||
if (platform.unmaximizedWidth && platform.unmaximizedHeight) glfwSetWindowSize(platform.handle, platform.unmaximizedWidth, platform.unmaximizedHeight);
|
if (platform.unmaximizedWidth && platform.unmaximizedHeight) glfwSetWindowSize(platform.handle, platform.unmaximizedWidth, platform.unmaximizedHeight);
|
||||||
|
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNDECORATED
|
// State change: FLAG_WINDOW_UNDECORATED
|
||||||
if ((flags & FLAG_WINDOW_UNDECORATED) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_UNDECORATED) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_UNDECORATED) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNFOCUSED
|
// State change: FLAG_WINDOW_UNFOCUSED
|
||||||
if ((flags & FLAG_WINDOW_UNFOCUSED) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_UNFOCUSED) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_UNFOCUSED) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TOPMOST
|
// State change: FLAG_WINDOW_TOPMOST
|
||||||
if ((flags & FLAG_WINDOW_TOPMOST) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TOPMOST))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_TOPMOST) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_TOPMOST) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_ALWAYS_RUN
|
// State change: FLAG_WINDOW_ALWAYS_RUN
|
||||||
if ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_ALWAYS_RUN))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_ALWAYS_RUN) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_ALWAYS_RUN) not available on target platform");
|
||||||
}
|
}
|
||||||
@ -595,31 +595,31 @@ void ClearWindowState(unsigned int flags)
|
|||||||
// NOTE: Review for PLATFORM_WEB
|
// NOTE: Review for PLATFORM_WEB
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TRANSPARENT
|
// State change: FLAG_WINDOW_TRANSPARENT
|
||||||
if ((flags & FLAG_WINDOW_TRANSPARENT) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_TRANSPARENT) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_TRANSPARENT) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIGHDPI
|
// State change: FLAG_WINDOW_HIGHDPI
|
||||||
if ((flags & FLAG_WINDOW_HIGHDPI) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_HIGHDPI) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_HIGHDPI) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||||
if ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0)
|
if (FLAG_IS_SET(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_MOUSE_PASSTHROUGH) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_MOUSE_PASSTHROUGH) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_MSAA_4X_HINT
|
// State change: FLAG_MSAA_4X_HINT
|
||||||
if ((flags & FLAG_MSAA_4X_HINT) > 0)
|
if (FLAG_IS_SET(flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_MSAA_4X_HINT) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_MSAA_4X_HINT) not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_INTERLACED_HINT
|
// State change: FLAG_INTERLACED_HINT
|
||||||
if ((flags & FLAG_INTERLACED_HINT) > 0)
|
if (FLAG_IS_SET(flags, FLAG_INTERLACED_HINT))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_INTERLACED_HINT) not available on target platform");
|
TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_INTERLACED_HINT) not available on target platform");
|
||||||
}
|
}
|
||||||
@ -663,7 +663,7 @@ void SetWindowMinSize(int width, int height)
|
|||||||
CORE.Window.screenMin.height = height;
|
CORE.Window.screenMin.height = height;
|
||||||
|
|
||||||
// Trigger the resize event once to update the window minimum width and height
|
// Trigger the resize event once to update the window minimum width and height
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != 0) EmscriptenResizeCallback(EMSCRIPTEN_EVENT_RESIZE, NULL, NULL);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE) != 0) EmscriptenResizeCallback(EMSCRIPTEN_EVENT_RESIZE, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set window maximum dimensions (FLAG_WINDOW_RESIZABLE)
|
// Set window maximum dimensions (FLAG_WINDOW_RESIZABLE)
|
||||||
@ -673,7 +673,7 @@ void SetWindowMaxSize(int width, int height)
|
|||||||
CORE.Window.screenMax.height = height;
|
CORE.Window.screenMax.height = height;
|
||||||
|
|
||||||
// Trigger the resize event once to update the window maximum width and height
|
// Trigger the resize event once to update the window maximum width and height
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != 0) EmscriptenResizeCallback(EMSCRIPTEN_EVENT_RESIZE, NULL, NULL);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE) != 0) EmscriptenResizeCallback(EMSCRIPTEN_EVENT_RESIZE, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set window dimensions
|
// Set window dimensions
|
||||||
@ -1122,27 +1122,27 @@ int InitPlatform(void)
|
|||||||
// glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
|
// glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
|
||||||
|
|
||||||
// Check window creation flags
|
// Check window creation flags
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) CORE.Window.fullscreen = true;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) CORE.Window.fullscreen = true;
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Visible window
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Visible window
|
||||||
else glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); // Window initially hidden
|
else glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); // Window initially hidden
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // Border and buttons on Window
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED)) glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // Border and buttons on Window
|
||||||
else glfwWindowHint(GLFW_DECORATED, GLFW_TRUE); // Decorated window
|
else glfwWindowHint(GLFW_DECORATED, GLFW_TRUE); // Decorated window
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // Resizable window
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // Resizable window
|
||||||
else glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // Avoid window being resizable
|
else glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // Avoid window being resizable
|
||||||
|
|
||||||
// Disable FLAG_WINDOW_MINIMIZED, not supported on initialization
|
// Disable FLAG_WINDOW_MINIMIZED, not supported on initialization
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED);
|
||||||
|
|
||||||
// Disable FLAG_WINDOW_MAXIMIZED, not supported on initialization
|
// Disable FLAG_WINDOW_MAXIMIZED, not supported on initialization
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED;
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED)) FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED)) glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
|
||||||
else glfwWindowHint(GLFW_FOCUSED, GLFW_TRUE);
|
else glfwWindowHint(GLFW_FOCUSED, GLFW_TRUE);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TOPMOST)) glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
|
||||||
else glfwWindowHint(GLFW_FLOATING, GLFW_FALSE);
|
else glfwWindowHint(GLFW_FLOATING, GLFW_FALSE);
|
||||||
|
|
||||||
// NOTE: Some GLFW flags are not supported on HTML5
|
// NOTE: Some GLFW flags are not supported on HTML5
|
||||||
@ -1150,10 +1150,10 @@ int InitPlatform(void)
|
|||||||
|
|
||||||
// Scale content area based on the monitor content scale where window is placed on
|
// Scale content area based on the monitor content scale where window is placed on
|
||||||
// NOTE: This feature requires emscripten 3.1.51
|
// NOTE: This feature requires emscripten 3.1.51
|
||||||
//if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
//if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)) glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||||
//else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
|
//else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
|
||||||
|
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
// NOTE: MSAA is only enabled for main framebuffer, not user-created FBOs
|
// NOTE: MSAA is only enabled for main framebuffer, not user-created FBOs
|
||||||
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4");
|
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4");
|
||||||
@ -1296,7 +1296,7 @@ int InitPlatform(void)
|
|||||||
glfwSetWindowFocusCallback(platform.handle, WindowFocusCallback);
|
glfwSetWindowFocusCallback(platform.handle, WindowFocusCallback);
|
||||||
glfwSetDropCallback(platform.handle, WindowDropCallback);
|
glfwSetDropCallback(platform.handle, WindowDropCallback);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
// Window content (framebuffer) scale callback
|
// Window content (framebuffer) scale callback
|
||||||
glfwSetWindowContentScaleCallback(platform.handle, WindowContentScaleCallback);
|
glfwSetWindowContentScaleCallback(platform.handle, WindowContentScaleCallback);
|
||||||
@ -1338,7 +1338,7 @@ int InitPlatform(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) MinimizeWindow();
|
||||||
|
|
||||||
// If graphic device is no properly initialized, we end program
|
// If graphic device is no properly initialized, we end program
|
||||||
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
|
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
|
||||||
@ -1423,7 +1423,7 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
|||||||
if (IsWindowFullscreen()) return;
|
if (IsWindowFullscreen()) return;
|
||||||
|
|
||||||
// Set current screen size
|
// Set current screen size
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
Vector2 windowScaleDPI = GetWindowScaleDPI();
|
Vector2 windowScaleDPI = GetWindowScaleDPI();
|
||||||
|
|
||||||
@ -1448,15 +1448,15 @@ static void WindowContentScaleCallback(GLFWwindow *window, float scalex, float s
|
|||||||
// GLFW3: Called on windows minimized/restored
|
// GLFW3: Called on windows minimized/restored
|
||||||
static void WindowIconifyCallback(GLFWwindow *window, int iconified)
|
static void WindowIconifyCallback(GLFWwindow *window, int iconified)
|
||||||
{
|
{
|
||||||
if (iconified) CORE.Window.flags |= FLAG_WINDOW_MINIMIZED; // The window was iconified
|
if (iconified) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was iconified
|
||||||
else CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored
|
else FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was restored
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3: Called on windows get/lose focus
|
// GLFW3: Called on windows get/lose focus
|
||||||
static void WindowFocusCallback(GLFWwindow *window, int focused)
|
static void WindowFocusCallback(GLFWwindow *window, int focused)
|
||||||
{
|
{
|
||||||
if (focused) CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED; // The window was focused
|
if (focused) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // The window was focused
|
||||||
else CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED; // The window lost focus
|
else FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // The window lost focus
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3: Called on file-drop over the window
|
// GLFW3: Called on file-drop over the window
|
||||||
@ -1782,8 +1782,8 @@ static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const Emscripte
|
|||||||
if (!wasFullscreen)
|
if (!wasFullscreen)
|
||||||
{
|
{
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||||
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
|
FLAG_CLEAR(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1794,7 +1794,7 @@ static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const Emscripte
|
|||||||
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *event, void *userData)
|
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *event, void *userData)
|
||||||
{
|
{
|
||||||
// Don't resize non-resizeable windows
|
// Don't resize non-resizeable windows
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) return 1;
|
if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) return 1;
|
||||||
|
|
||||||
// This event is called whenever the window changes sizes,
|
// This event is called whenever the window changes sizes,
|
||||||
// so the size of the canvas object is explicitly retrieved below
|
// so the size of the canvas object is explicitly retrieved below
|
||||||
@ -1844,8 +1844,8 @@ static EM_BOOL EmscriptenFocusCallback(int eventType, const EmscriptenFocusEvent
|
|||||||
// Emscripten: Called on visibility change events
|
// Emscripten: Called on visibility change events
|
||||||
static EM_BOOL EmscriptenVisibilityChangeCallback(int eventType, const EmscriptenVisibilityChangeEvent *visibilityChangeEvent, void *userData)
|
static EM_BOOL EmscriptenVisibilityChangeCallback(int eventType, const EmscriptenVisibilityChangeEvent *visibilityChangeEvent, void *userData)
|
||||||
{
|
{
|
||||||
if (visibilityChangeEvent->hidden) CORE.Window.flags |= FLAG_WINDOW_HIDDEN; // The window was hidden
|
if (visibilityChangeEvent->hidden) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN); // The window was hidden
|
||||||
else CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN; // The window was restored
|
else FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_HIDDEN); // The window was restored
|
||||||
return 1; // The event was consumed by the callback handler
|
return 1; // The event was consumed by the callback handler
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -2552,7 +2552,38 @@ RMAPI int QuaternionEquals(Quaternion p, Quaternion q)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compose a transformation matrix from rotational, translational and scaling components
|
||||||
|
// TODO: This function is not following raymath conventions defined in header: NOT self-contained
|
||||||
|
RMAPI Matrix MatrixCompose(Vector3 translation, Quaternion rotation, Vector3 scale)
|
||||||
|
{
|
||||||
|
// Initialize vectors
|
||||||
|
Vector3 right = { 1.0f, 0.0f, 0.0f };
|
||||||
|
Vector3 up = { 0.0f, 1.0f, 0.0f };
|
||||||
|
Vector3 forward = { 0.0f, 0.0f, 1.0f };
|
||||||
|
|
||||||
|
// Scale vectors
|
||||||
|
right = Vector3Scale(right, scale.x);
|
||||||
|
up = Vector3Scale(up, scale.y);
|
||||||
|
forward = Vector3Scale(forward , scale.z);
|
||||||
|
|
||||||
|
// Rotate vectors
|
||||||
|
right = Vector3RotateByQuaternion(right, rotation);
|
||||||
|
up = Vector3RotateByQuaternion(up, rotation);
|
||||||
|
forward = Vector3RotateByQuaternion(forward, rotation);
|
||||||
|
|
||||||
|
// Set result matrix output
|
||||||
|
Matrix result = {
|
||||||
|
right.x, up.x, forward.x, translation.x,
|
||||||
|
right.y, up.y, forward.y, translation.y,
|
||||||
|
right.z, up.z, forward.z, translation.z,
|
||||||
|
0.0f, 0.0f, 0.0f, 1.0f
|
||||||
|
};
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Decompose a transformation matrix into its rotational, translational and scaling components and remove shear
|
// Decompose a transformation matrix into its rotational, translational and scaling components and remove shear
|
||||||
|
// TODO: This function is not following raymath conventions defined in header: NOT self-contained
|
||||||
RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale)
|
RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale)
|
||||||
{
|
{
|
||||||
float eps = (float)1e-9;
|
float eps = (float)1e-9;
|
||||||
@ -2587,10 +2618,7 @@ RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotatio
|
|||||||
|
|
||||||
// X Scale
|
// X Scale
|
||||||
scl.x = Vector3Length(matColumns[0]);
|
scl.x = Vector3Length(matColumns[0]);
|
||||||
if (scl.x > eps)
|
if (scl.x > eps) matColumns[0] = Vector3Scale(matColumns[0], 1.0f / scl.x);
|
||||||
{
|
|
||||||
matColumns[0] = Vector3Scale(matColumns[0], 1.0f / scl.x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute XY shear and make col2 orthogonal
|
// Compute XY shear and make col2 orthogonal
|
||||||
shear[0] = Vector3DotProduct(matColumns[0], matColumns[1]);
|
shear[0] = Vector3DotProduct(matColumns[0], matColumns[1]);
|
||||||
|
|||||||
18
src/rcore.c
18
src/rcore.c
@ -280,7 +280,7 @@ __declspec(dllimport) unsigned int __stdcall timeEndPeriod(unsigned int uPeriod)
|
|||||||
#define FLAG_SET(n, f) ((n) |= (f))
|
#define FLAG_SET(n, f) ((n) |= (f))
|
||||||
#define FLAG_CLEAR(n, f) ((n) &= ~(f))
|
#define FLAG_CLEAR(n, f) ((n) &= ~(f))
|
||||||
#define FLAG_TOGGLE(n, f) ((n) ^= (f))
|
#define FLAG_TOGGLE(n, f) ((n) ^= (f))
|
||||||
#define FLAG_CHECK(n, f) ((n) & (f))
|
#define FLAG_IS_SET(n, f) (((n) & (f)) > 0)
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Types and Structures Definition
|
// Types and Structures Definition
|
||||||
@ -725,7 +725,7 @@ void InitWindow(int width, int height, const char *title)
|
|||||||
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
||||||
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
||||||
Rectangle rec = GetFontDefault().recs[95];
|
Rectangle rec = GetFontDefault().recs[95];
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||||
{
|
{
|
||||||
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
||||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
||||||
@ -797,25 +797,25 @@ bool IsWindowFullscreen(void)
|
|||||||
// Check if window is currently hidden
|
// Check if window is currently hidden
|
||||||
bool IsWindowHidden(void)
|
bool IsWindowHidden(void)
|
||||||
{
|
{
|
||||||
return ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0);
|
return (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if window has been minimized
|
// Check if window has been minimized
|
||||||
bool IsWindowMinimized(void)
|
bool IsWindowMinimized(void)
|
||||||
{
|
{
|
||||||
return ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0);
|
return (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if window has been maximized
|
// Check if window has been maximized
|
||||||
bool IsWindowMaximized(void)
|
bool IsWindowMaximized(void)
|
||||||
{
|
{
|
||||||
return ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0);
|
return (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if window has the focus
|
// Check if window has the focus
|
||||||
bool IsWindowFocused(void)
|
bool IsWindowFocused(void)
|
||||||
{
|
{
|
||||||
return ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) == 0);
|
return (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if window has been resizedLastFrame
|
// Check if window has been resizedLastFrame
|
||||||
@ -827,7 +827,7 @@ bool IsWindowResized(void)
|
|||||||
// Check if one specific window flag is enabled
|
// Check if one specific window flag is enabled
|
||||||
bool IsWindowState(unsigned int flag)
|
bool IsWindowState(unsigned int flag)
|
||||||
{
|
{
|
||||||
return ((CORE.Window.flags & flag) > 0);
|
return (FLAG_IS_SET(CORE.Window.flags, flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current screen width
|
// Get current screen width
|
||||||
@ -1208,7 +1208,7 @@ void BeginScissorMode(int x, int y, int width, int height)
|
|||||||
rlScissor((int)(x*scale.x), (int)(GetScreenHeight()*scale.y - (((y + height)*scale.y))), (int)(width*scale.x), (int)(height*scale.y));
|
rlScissor((int)(x*scale.x), (int)(GetScreenHeight()*scale.y - (((y + height)*scale.y))), (int)(width*scale.x), (int)(height*scale.y));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (!CORE.Window.usingFbo && ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0))
|
if (!CORE.Window.usingFbo && (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)))
|
||||||
{
|
{
|
||||||
Vector2 scale = GetWindowScaleDPI();
|
Vector2 scale = GetWindowScaleDPI();
|
||||||
rlScissor((int)(x*scale.x), (int)(CORE.Window.currentFbo.height - (y + height)*scale.y), (int)(width*scale.x), (int)(height*scale.y));
|
rlScissor((int)(x*scale.x), (int)(CORE.Window.currentFbo.height - (y + height)*scale.y), (int)(width*scale.x), (int)(height*scale.y));
|
||||||
@ -1931,7 +1931,7 @@ void SetConfigFlags(unsigned int flags)
|
|||||||
|
|
||||||
// Selected flags are set but not evaluated at this point,
|
// Selected flags are set but not evaluated at this point,
|
||||||
// flag evaluation happens at InitWindow() or SetWindowState()
|
// flag evaluation happens at InitWindow() or SetWindowState()
|
||||||
CORE.Window.flags |= flags;
|
FLAG_SET(CORE.Window.flags, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -50,12 +50,12 @@
|
|||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h> // Required for: NULL, calloc(), free()
|
||||||
#include <stdio.h> // Required for: rename(), remove()
|
#include <stdio.h> // Required for: rename(), remove()
|
||||||
#include <string.h> // Required for: strcmp(), strcpy()
|
#include <string.h> // Required for: strcmp(), strcpy()
|
||||||
|
|
||||||
#define SUPPORT_LOG_INFO
|
#define SUPPORT_LOG_INFO
|
||||||
#if defined(SUPPORT_LOG_INFO) && defined(_DEBUG)
|
#if defined(SUPPORT_LOG_INFO) //&& defined(_DEBUG)
|
||||||
#define LOG(...) printf("REXM: "__VA_ARGS__)
|
#define LOG(...) printf("REXM: "__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define LOG(...)
|
#define LOG(...)
|
||||||
|
|||||||
Reference in New Issue
Block a user