mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-26 12:27:01 +00:00
Removed trailing spaces
This commit is contained in:
12
.github/workflows/build_windows.yml
vendored
12
.github/workflows/build_windows.yml
vendored
@@ -40,10 +40,10 @@ jobs:
|
||||
ziptarget: "win64"
|
||||
- compiler: msvc16
|
||||
ARCH: "x86"
|
||||
VSARCHPATH: "Win32"
|
||||
VSARCHPATH: "Win32"
|
||||
ziptarget: "win32"
|
||||
- compiler: msvc16
|
||||
ARCH: "x64"
|
||||
ARCH: "x64"
|
||||
VSARCHPATH: "x64"
|
||||
ziptarget: "win64"
|
||||
- compiler: msvc16
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
|
||||
- name: Setup Release Version
|
||||
run: |
|
||||
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_${{ matrix.ziptarget }}_${{ matrix.compiler }}" >> $GITHUB_ENV
|
||||
@@ -69,7 +69,7 @@ jobs:
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
run: |
|
||||
dir
|
||||
mkdir build
|
||||
cd build
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
if: |
|
||||
matrix.compiler == 'mingw-w64' &&
|
||||
matrix.arch == 'i686'
|
||||
|
||||
|
||||
- name: Build Library (MinGW-w64 64bit)
|
||||
run: |
|
||||
cd src
|
||||
@@ -144,7 +144,7 @@ jobs:
|
||||
with:
|
||||
name: ${{ env.RELEASE_NAME }}.zip
|
||||
path: ./build/${{ env.RELEASE_NAME }}.zip
|
||||
|
||||
|
||||
- name: Upload Artifact to Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
|
||||
@@ -119,7 +119,6 @@ int main(void)
|
||||
// Some default standard keyboard/mouse inputs are hardcoded to simplify use
|
||||
// For advanced camera controls, it's recommended to compute camera movement manually
|
||||
UpdateCamera(&camera, cameraMode); // Update camera
|
||||
|
||||
/*
|
||||
// Camera PRO usage example (EXPERIMENTAL)
|
||||
// This new camera function allows custom movement/rotation values to be directly provided
|
||||
|
||||
@@ -26,7 +26,7 @@ int main(void)
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - render texture");
|
||||
|
||||
|
||||
// Define a render texture to render
|
||||
int renderTextureWidth = 300;
|
||||
int renderTextureHeight = 300;
|
||||
@@ -62,14 +62,14 @@ int main(void)
|
||||
//-----------------------------------------------------
|
||||
// Draw our scene to the render texture
|
||||
BeginTextureMode(target);
|
||||
|
||||
|
||||
ClearBackground(SKYBLUE);
|
||||
|
||||
|
||||
DrawRectangle(0, 0, 20, 20, RED);
|
||||
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
||||
|
||||
|
||||
EndTextureMode();
|
||||
|
||||
|
||||
// Draw render texture to main framebuffer
|
||||
BeginDrawing();
|
||||
|
||||
@@ -77,14 +77,14 @@ int main(void)
|
||||
|
||||
// Draw our render texture with rotation applied
|
||||
// NOTE 1: We set the origin of the texture to the center of the render texture
|
||||
// NOTE 2: We flip vertically the texture setting negative source rectangle height
|
||||
DrawTexturePro(target.texture,
|
||||
// NOTE 2: We flip vertically the texture setting negative source rectangle height
|
||||
DrawTexturePro(target.texture,
|
||||
(Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height },
|
||||
(Rectangle){ screenWidth/2.0f, screenHeight/2.0f, (float)target.texture.width, (float)target.texture.height },
|
||||
(Vector2){ target.texture.width/2.0f, target.texture.height/2.0f }, rotation, WHITE);
|
||||
|
||||
DrawText("DRAWING BOUNCING BALL INSIDE RENDER TEXTURE!", 10, screenHeight - 40, 20, BLACK);
|
||||
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ int main(void)
|
||||
if (lines[i][j] == ' ')
|
||||
{
|
||||
// Making a C Style string by adding a '\0' at the required location so that we can use the MeasureText function
|
||||
lines[i][j] = '\0';
|
||||
lines[i][j] = '\0';
|
||||
|
||||
// Checking if the text has crossed the wrapWidth, then going back and inserting a newline
|
||||
if (MeasureText(lines[i] + lastWrapStart, fontSize) > wrapWidth)
|
||||
@@ -112,8 +112,8 @@ int main(void)
|
||||
cam.target.y -= scroll*fontSize*1.5f; // Choosing an arbitrary speed for scroll
|
||||
|
||||
if (cam.target.y < 0) cam.target.y = 0; // Snapping to 0 if we go too far back
|
||||
|
||||
// Ensuring that the camera does not scroll past all text
|
||||
|
||||
// Ensuring that the camera does not scroll past all text
|
||||
if (cam.target.y > textHeight - screenHeight + textTop)
|
||||
cam.target.y = textHeight - screenHeight + textTop;
|
||||
|
||||
@@ -133,10 +133,10 @@ int main(void)
|
||||
{
|
||||
// Each time we go through and calculate the height of the text to move the cursor appropriately
|
||||
Vector2 size = MeasureTextEx(GetFontDefault(), lines[i], fontSize, 2);
|
||||
|
||||
|
||||
DrawText(lines[i], 10, t, fontSize, RED);
|
||||
|
||||
// Inserting extra space for real newlines,
|
||||
// Inserting extra space for real newlines,
|
||||
// wrapped lines are rendered closer together
|
||||
t += size.y + 10;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ int main(void)
|
||||
// Definition of particles
|
||||
Particle *particles = (Particle*)RL_CALLOC(MAX_PARTICLES, sizeof(Particle)); // Particle array
|
||||
CircularBuffer circularBuffer = { 0, 0, particles };
|
||||
|
||||
|
||||
// Particle emitter parameters
|
||||
int emissionRate = -2; // Negative: on average every -X frames. Positive: particles per frame
|
||||
ParticleType currentType = WATER;
|
||||
@@ -100,7 +100,7 @@ int main(void)
|
||||
|
||||
// Update the parameters of each particle
|
||||
UpdateParticles(&circularBuffer, screenWidth, screenHeight);
|
||||
|
||||
|
||||
// Remove dead particles from the circular buffer
|
||||
UpdateCircularBuffer(&circularBuffer);
|
||||
|
||||
@@ -252,10 +252,10 @@ static void UpdateParticles(CircularBuffer *circularBuffer, int screenWidth, int
|
||||
// Disable particle when out of screen
|
||||
Vector2 center = circularBuffer->buffer[i].position;
|
||||
float radius = circularBuffer->buffer[i].radius;
|
||||
|
||||
|
||||
if ((center.x < -radius) || (center.x > (screenWidth + radius)) ||
|
||||
(center.y < -radius) || (center.y > (screenHeight + radius)))
|
||||
{
|
||||
{
|
||||
circularBuffer->buffer[i].alive = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ int GetCurrentMonitor(void)
|
||||
if (display == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "GetCurrentMonitor() couldn't get the display object");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jclass displayClass = (*env)->FindClass(env, "android/view/Display");
|
||||
|
||||
@@ -1048,6 +1048,7 @@ Image GetClipboardImage(void)
|
||||
void ShowCursor(void)
|
||||
{
|
||||
glfwSetInputMode(platform.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
|
||||
CORE.Input.Mouse.cursorHidden = false;
|
||||
}
|
||||
|
||||
@@ -1055,6 +1056,7 @@ void ShowCursor(void)
|
||||
void HideCursor(void)
|
||||
{
|
||||
glfwSetInputMode(platform.handle, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||
|
||||
CORE.Input.Mouse.cursorHidden = true;
|
||||
}
|
||||
|
||||
@@ -1075,13 +1077,10 @@ void EnableCursor(void)
|
||||
void DisableCursor(void)
|
||||
{
|
||||
// Reset mouse position within the window area before disabling cursor
|
||||
SetMousePosition(CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
|
||||
|
||||
glfwSetInputMode(platform.handle, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
|
||||
// Set cursor position in the middle
|
||||
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
|
||||
|
||||
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
||||
|
||||
CORE.Input.Mouse.cursorLocked = true;
|
||||
|
||||
@@ -80,7 +80,7 @@ void CloseWindow(void);
|
||||
#define CloseWindow CloseWindow_win32
|
||||
#define ShowCursor __imp_ShowCursor
|
||||
#define _APISETSTRING_
|
||||
|
||||
|
||||
#undef MAX_PATH
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@@ -262,7 +262,7 @@ static int RGFW_gpConvTable[18] = {
|
||||
[RGFW_gamepadRight] = GAMEPAD_BUTTON_LEFT_FACE_RIGHT,
|
||||
[RGFW_gamepadDown] = GAMEPAD_BUTTON_LEFT_FACE_DOWN,
|
||||
[RGFW_gamepadLeft] = GAMEPAD_BUTTON_LEFT_FACE_LEFT,
|
||||
[RGFW_gamepadL3] = GAMEPAD_BUTTON_LEFT_THUMB,
|
||||
[RGFW_gamepadL3] = GAMEPAD_BUTTON_LEFT_THUMB,
|
||||
[RGFW_gamepadR3] = GAMEPAD_BUTTON_RIGHT_THUMB,
|
||||
};
|
||||
|
||||
@@ -933,7 +933,7 @@ void PollInputEvents(void)
|
||||
// because ProcessGestureEvent() is just called on an event, not every frame
|
||||
UpdateGestures();
|
||||
#endif
|
||||
|
||||
|
||||
// Reset keys/chars pressed registered
|
||||
CORE.Input.Keyboard.keyPressedQueueCount = 0;
|
||||
CORE.Input.Keyboard.charPressedQueueCount = 0;
|
||||
@@ -1025,7 +1025,7 @@ void PollInputEvents(void)
|
||||
|
||||
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
||||
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], event->droppedFiles[i]);
|
||||
|
||||
|
||||
CORE.Window.dropFileCount++;
|
||||
}
|
||||
else if (CORE.Window.dropFileCount < 1024)
|
||||
@@ -1229,7 +1229,7 @@ void PollInputEvents(void)
|
||||
int button = (axis == GAMEPAD_AXIS_LEFT_TRIGGER)? GAMEPAD_BUTTON_LEFT_TRIGGER_2 : GAMEPAD_BUTTON_RIGHT_TRIGGER_2;
|
||||
int pressed = (value > 0.1f);
|
||||
CORE.Input.Gamepad.currentButtonState[event->gamepad][button] = pressed;
|
||||
|
||||
|
||||
if (pressed) CORE.Input.Gamepad.lastButtonPressed = button;
|
||||
else if (CORE.Input.Gamepad.lastButtonPressed == button) CORE.Input.Gamepad.lastButtonPressed = 0;
|
||||
}
|
||||
@@ -1345,7 +1345,7 @@ int InitPlatform(void)
|
||||
// TODO: Is this needed by raylib now?
|
||||
// If so, rcore_desktop_sdl should be updated too
|
||||
//SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||
|
||||
|
||||
if (CORE.Window.flags & FLAG_VSYNC_HINT) RGFW_window_swapInterval(platform.window, 1);
|
||||
RGFW_window_makeCurrent(platform.window);
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// NOTE: appScreenSize is the last screen size requested by the app,
|
||||
// the backend must keep the client area this size (after DPI scaling is applied)
|
||||
// NOTE: appScreenSize is the last screen size requested by the app,
|
||||
// the backend must keep the client area this size (after DPI scaling is applied)
|
||||
// when the window isn't fullscreen/maximized/minimized
|
||||
typedef struct {
|
||||
HWND hwnd; // Window handler
|
||||
@@ -141,7 +141,7 @@ static PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = NULL;
|
||||
AToWCopy(inAnsi, outWstr, outLen); \
|
||||
outWstr[outLen] = 0; \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define STYLE_MASK_ALL 0xffffffff
|
||||
#define STYLE_MASK_READONLY (WS_MINIMIZE | WS_MAXIMIZE)
|
||||
#define STYLE_MASK_WRITABLE (~STYLE_MASK_READONLY)
|
||||
@@ -206,10 +206,10 @@ static PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = NULL;
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
// Maximize-minimize request types
|
||||
typedef enum {
|
||||
MIZED_NONE,
|
||||
MIZED_MIN,
|
||||
MIZED_MAX
|
||||
typedef enum {
|
||||
MIZED_NONE,
|
||||
MIZED_MIN,
|
||||
MIZED_MAX
|
||||
} Mized;
|
||||
|
||||
// Flag operations
|
||||
@@ -234,7 +234,7 @@ typedef struct {
|
||||
static size_t AToWLen(const char *ascii)
|
||||
{
|
||||
int sizeNeeded = MultiByteToWideChar(CP_UTF8, 0, ascii, -1, NULL, 0);
|
||||
|
||||
|
||||
if (sizeNeeded < 0) TRACELOG(LOG_ERROR, "WIN32: Failed to calculate wide length [ERROR: %u]", GetLastError());
|
||||
|
||||
return sizeNeeded;
|
||||
@@ -268,7 +268,7 @@ static DWORD MakeWindowStyle(unsigned flags)
|
||||
// it improves efficiency, plus, windows adds this flag automatically anyway
|
||||
// so it keeps our flags in sync with the OS
|
||||
DWORD style = WS_CLIPSIBLINGS;
|
||||
|
||||
|
||||
style |= (flags & FLAG_WINDOW_HIDDEN)? 0 : WS_VISIBLE;
|
||||
style |= (flags & FLAG_WINDOW_RESIZABLE)? STYLE_FLAGS_RESIZABLE : 0;
|
||||
style |= (flags & FLAG_WINDOW_UNDECORATED)? STYLE_FLAGS_UNDECORATED_ON : STYLE_FLAGS_UNDECORATED_OFF;
|
||||
@@ -339,7 +339,7 @@ static void CheckFlags(const char *context, HWND hwnd, DWORD flags, DWORD expect
|
||||
static SIZE CalcWindowSize(UINT dpi, SIZE clientSize, DWORD style)
|
||||
{
|
||||
RECT rect = { 0, 0, clientSize.cx, clientSize.cy };
|
||||
|
||||
|
||||
int result = AdjustWindowRectExForDpi(&rect, style, 0, WINDOW_STYLE_EX, dpi);
|
||||
if (result == 0) TRACELOG(LOG_ERROR, "WIN32: Failed to adjust window rect [ERROR: %lu]", GetLastError());
|
||||
|
||||
@@ -442,8 +442,8 @@ static bool UpdateWindowSize(int mode, HWND hwnd, int width, int height, unsigne
|
||||
static BOOL IsWindows10Version1703OrGreaterWin32(void)
|
||||
{
|
||||
HMODULE ntdll = LoadLibraryW(L"ntdll.dll");
|
||||
|
||||
DWORD (*Verify)(RTL_OSVERSIONINFOEXW*, ULONG, ULONGLONG) =
|
||||
|
||||
DWORD (*Verify)(RTL_OSVERSIONINFOEXW*, ULONG, ULONGLONG) =
|
||||
(DWORD (*)(RTL_OSVERSIONINFOEXW*, ULONG, ULONGLONG))GetProcAddress(ntdll, "RtlVerifyVersionInfo");
|
||||
if (!Verify)
|
||||
{
|
||||
@@ -461,7 +461,7 @@ static BOOL IsWindows10Version1703OrGreaterWin32(void)
|
||||
VER_SET_CONDITION(cond, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||
VER_SET_CONDITION(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
VER_SET_CONDITION(cond, VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
||||
|
||||
|
||||
return 0 == (*Verify)(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, cond);
|
||||
}
|
||||
|
||||
@@ -473,8 +473,8 @@ static void *WglGetProcAddress(const char *procname)
|
||||
if ((proc == NULL) ||
|
||||
// NOTE: Some GPU drivers could return following
|
||||
// invalid sentinel values instead of NULL
|
||||
(proc == (void *)0x1) ||
|
||||
(proc == (void *)0x2) ||
|
||||
(proc == (void *)0x1) ||
|
||||
(proc == (void *)0x2) ||
|
||||
(proc == (void *)0x3) ||
|
||||
(proc == (void *)-1))
|
||||
{
|
||||
@@ -767,7 +767,7 @@ static void GetStyleChangeFlagOps(DWORD coreWindowFlags, STYLESTRUCT *style, Fla
|
||||
}
|
||||
|
||||
// Adopt window resize
|
||||
// NOTE: Call when the window is rezised, returns true
|
||||
// NOTE: Call when the window is rezised, returns true
|
||||
// if the new window size should update the desired app size
|
||||
static bool AdoptWindowResize(unsigned flags)
|
||||
{
|
||||
@@ -776,7 +776,7 @@ static bool AdoptWindowResize(unsigned flags)
|
||||
if (flags & FLAG_FULLSCREEN_MODE) return false;
|
||||
if (flags & FLAG_BORDERLESS_WINDOWED_MODE) return false;
|
||||
if (!(flags & FLAG_WINDOW_RESIZABLE)) return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -947,10 +947,10 @@ void SetWindowIcons(Image *images, int count)
|
||||
void SetWindowTitle(const char *title)
|
||||
{
|
||||
CORE.Window.title = title;
|
||||
|
||||
|
||||
WCHAR *titleWide = NULL;
|
||||
A_TO_W_ALLOCA(titleWide, CORE.Window.title);
|
||||
|
||||
|
||||
int result = SetWindowTextW(platform.hwnd, titleWide);
|
||||
if (result == 0) TRACELOG(LOG_WARNING, "WIN32: Failed to set window title [ERROR: %lu]", GetLastError());
|
||||
}
|
||||
@@ -1023,7 +1023,7 @@ void *GetWindowHandle(void)
|
||||
int GetMonitorCount(void)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
|
||||
int result = EnumDisplayMonitors(NULL, NULL, CountMonitorsProc, (LPARAM)&count);
|
||||
if (result == 0) TRACELOG(LOG_ERROR, "%s failed, error=%lu", "EnumDisplayMonitors", GetLastError());
|
||||
|
||||
@@ -1040,7 +1040,7 @@ int GetCurrentMonitor(void)
|
||||
info.needle = monitor;
|
||||
info.index = 0;
|
||||
info.matchIndex = -1;
|
||||
|
||||
|
||||
int result = EnumDisplayMonitors(NULL, NULL, FindMonitorProc, (LPARAM)&info);
|
||||
if (result == 0) TRACELOG(LOG_ERROR, "%s failed, error=%lu", "EnumDisplayMonitors", GetLastError());
|
||||
|
||||
@@ -1127,7 +1127,7 @@ const char *GetClipboardText(void)
|
||||
Image GetClipboardImage(void)
|
||||
{
|
||||
Image image = { 0 };
|
||||
|
||||
|
||||
TRACELOG(LOG_WARNING, "GetClipboardText not implemented");
|
||||
|
||||
return image;
|
||||
@@ -1193,7 +1193,7 @@ void DisableCursor(void)
|
||||
|
||||
TRACELOG(LOG_INFO, "WIN32: Clip cursor client rect: [%d,%d %d,%d], top-left: (%d,%d)",
|
||||
clientRect.left, clientRect.top, clientRect.right, clientRect.bottom, topleft.x, topleft.y);
|
||||
|
||||
|
||||
LONG centerX = topleft.x + width/2;
|
||||
LONG centerY = topleft.y + height/2;
|
||||
RECT clipRect = { centerX, centerY, centerX + 1, centerY + 1 };
|
||||
@@ -1502,7 +1502,7 @@ int InitPlatform(void)
|
||||
if (IsWindows10Version1703OrGreaterWin32())
|
||||
{
|
||||
TRACELOG(LOG_INFO, "DpiAware: >=Win10Creators");
|
||||
if (!SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2))
|
||||
if (!SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2))
|
||||
TRACELOG(LOG_ERROR, "%s failed, error %u", "SetProcessDpiAwarenessContext", GetLastError());
|
||||
}
|
||||
else
|
||||
@@ -1620,7 +1620,7 @@ int InitPlatform(void)
|
||||
}
|
||||
|
||||
CORE.Window.ready = true;
|
||||
|
||||
|
||||
// TODO: Should this function be called before or after drawing context is created? --> After swInit() called!
|
||||
//UpdateWindowSize(UPDATE_WINDOW_FIRST, platform.hwnd, platform.appScreenWidth, platform.appScreenHeight, platform.desiredFlags);
|
||||
UpdateFlags(platform.hwnd, platform.desiredFlags, platform.appScreenWidth, platform.appScreenHeight);
|
||||
@@ -1660,7 +1660,7 @@ int InitPlatform(void)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP: WIN32: Initialized successfully");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1691,7 +1691,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
|
||||
FlagsOp flagsOp = { 0 };
|
||||
FlagsOp *deferredFlags = &flagsOp;
|
||||
|
||||
|
||||
// Message processing
|
||||
//------------------------------------------------------------------------------------
|
||||
switch (msg)
|
||||
@@ -1707,13 +1707,13 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
// Clean up for window destruction
|
||||
if (rlGetVersion() == RL_OPENGL_11_SOFTWARE) // Using software renderer
|
||||
{
|
||||
if (platform.hdcmem)
|
||||
if (platform.hdcmem)
|
||||
{
|
||||
DeleteDC(platform.hdcmem);
|
||||
platform.hdcmem = NULL;
|
||||
}
|
||||
|
||||
if (platform.hbitmap)
|
||||
if (platform.hbitmap)
|
||||
{
|
||||
DeleteObject(platform.hbitmap); // Clears platform.pixels data
|
||||
platform.hbitmap = NULL;
|
||||
@@ -1751,9 +1751,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
if (CORE.Window.flags & FLAG_WINDOW_RESIZABLE)
|
||||
{
|
||||
// TODO: Enforce min/max size
|
||||
}
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "WIN32: WINDOW: Trying to resize a non-resizable window");
|
||||
|
||||
|
||||
result = TRUE;
|
||||
} break;
|
||||
case WM_STYLECHANGING:
|
||||
@@ -1770,11 +1770,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
SIZE clientSize = { rect.right, rect.bottom };
|
||||
SIZE oldSize = CalcWindowSize(dpi, clientSize, ss->styleOld);
|
||||
SIZE newSize = CalcWindowSize(dpi, clientSize, ss->styleNew);
|
||||
|
||||
|
||||
if (oldSize.cx != newSize.cx || oldSize.cy != newSize.cy)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "WIN32: WINDOW: Resize from style change [%dx%d] to [%dx%d]", oldSize.cx, oldSize.cy, newSize.cx, newSize.cy);
|
||||
|
||||
|
||||
if (CORE.Window.flags & FLAG_WINDOW_MAXIMIZED)
|
||||
{
|
||||
// looks like windows will automatically "unminimize" a window
|
||||
@@ -1795,7 +1795,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
bool isIconic = IsIconic(hwnd);
|
||||
bool styleMinimized = !!(WS_MINIMIZE & GetWindowLongPtrW(hwnd, GWL_STYLE));
|
||||
if (isIconic != styleMinimized) TRACELOG(LOG_WARNING, "WIN32: IsIconic state different from WS_MINIMIZED state");
|
||||
|
||||
|
||||
if (isIconic) mized = MIZED_MIN;
|
||||
else
|
||||
{
|
||||
@@ -1871,7 +1871,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
};
|
||||
inoutSize->cx = desired.cx;
|
||||
inoutSize->cy = desired.cy;
|
||||
|
||||
|
||||
result = TRUE;
|
||||
} break;
|
||||
case WM_DPICHANGED:
|
||||
@@ -1929,7 +1929,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
case WM_RBUTTONUP : HandleMouseButton(MOUSE_BUTTON_RIGHT, 0); break;
|
||||
case WM_MBUTTONDOWN: HandleMouseButton(MOUSE_BUTTON_MIDDLE, 1); break;
|
||||
case WM_MBUTTONUP : HandleMouseButton(MOUSE_BUTTON_MIDDLE, 0); break;
|
||||
case WM_XBUTTONDOWN:
|
||||
case WM_XBUTTONDOWN:
|
||||
{
|
||||
switch (HIWORD(wparam))
|
||||
{
|
||||
@@ -1975,11 +1975,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
static void HandleKey(WPARAM wparam, LPARAM lparam, char state)
|
||||
{
|
||||
KeyboardKey key = GetKeyFromWparam(wparam);
|
||||
|
||||
|
||||
// TODO: Use scancode?
|
||||
//BYTE scancode = lparam >> 16;
|
||||
//TRACELOG(LOG_INFO, "KEY key=%d vk=%lu scan=%u = %u", key, wparam, scancode, state);
|
||||
|
||||
|
||||
if (key != KEY_NULL)
|
||||
{
|
||||
CORE.Input.Keyboard.currentKeyState[key] = state;
|
||||
@@ -2003,9 +2003,9 @@ static void HandleRawInput(LPARAM lparam)
|
||||
|
||||
UINT inputSize = sizeof(input);
|
||||
UINT size = GetRawInputData((HRAWINPUT)lparam, RID_INPUT, &input, &inputSize, sizeof(RAWINPUTHEADER));
|
||||
|
||||
|
||||
if (size == (UINT)-1) TRACELOG(LOG_ERROR, "WIN32: Failed to get raw input data [ERROR: %lu]", GetLastError());
|
||||
|
||||
|
||||
if (input.header.dwType != RIM_TYPEMOUSE) TRACELOG(LOG_ERROR, "WIN32: Unexpected WM_INPUT type %lu", input.header.dwType);
|
||||
|
||||
if (input.data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) TRACELOG(LOG_ERROR, "TODO: handle absolute mouse inputs!");
|
||||
@@ -2043,7 +2043,7 @@ static void HandleWindowResize(HWND hwnd, int *width, int *height)
|
||||
unsigned int screenHeight = highdpi? (unsigned int)(((float)clientSize.cy)/dpiScale) : clientSize.cy;
|
||||
CORE.Window.screen.width = screenWidth;
|
||||
CORE.Window.screen.height = screenHeight;
|
||||
|
||||
|
||||
if (AdoptWindowResize(CORE.Window.flags))
|
||||
{
|
||||
TRACELOG(LOG_DEBUG, "WIN32: WINDOW: Updating app size to [%ix%i] from window resize", screenWidth, screenHeight);
|
||||
@@ -2062,7 +2062,7 @@ static void UpdateWindowStyle(HWND hwnd, unsigned desiredFlags)
|
||||
{
|
||||
DWORD current = STYLE_MASK_WRITABLE & MakeWindowStyle(CORE.Window.flags);
|
||||
DWORD desired = STYLE_MASK_WRITABLE & MakeWindowStyle(desiredFlags);
|
||||
|
||||
|
||||
if (current != desired)
|
||||
{
|
||||
SetLastError(0);
|
||||
|
||||
@@ -864,7 +864,7 @@ void SwapScreenBuffer(void)
|
||||
// Create framebuffer with the correct format
|
||||
uint32_t fb = 0;
|
||||
result = drmModeAddFB(platform.fd, width, height, depth, bpp, creq.pitch, creq.handle, &fb);
|
||||
if (result != 0)
|
||||
if (result != 0)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "DISPLAY: drmModeAddFB() failed with result: %d (%s)", result, strerror(errno));
|
||||
struct drm_mode_destroy_dumb dreq = { 0 };
|
||||
@@ -974,12 +974,12 @@ void SwapScreenBuffer(void)
|
||||
|
||||
// Set CRTC with better error handling
|
||||
result = drmModeSetCrtc(platform.fd, crtcId, fb, 0, 0, &platform.connector->connector_id, 1, mode);
|
||||
if (result != 0)
|
||||
if (result != 0)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "DISPLAY: drmModeSetCrtc() failed with result: %d (%s)", result, strerror(errno));
|
||||
TRACELOG(LOG_ERROR, "DISPLAY: CRTC ID: %u, FB ID: %u, Connector ID: %u", crtcId, fb, platform.connector->connector_id);
|
||||
TRACELOG(LOG_ERROR, "DISPLAY: Mode: %dx%d@%d", mode->hdisplay, mode->vdisplay, mode->vrefresh);
|
||||
|
||||
|
||||
drmModeRmFB(platform.fd, fb);
|
||||
struct drm_mode_destroy_dumb dreq = {0};
|
||||
dreq.handle = creq.handle;
|
||||
@@ -1229,7 +1229,7 @@ int InitPlatform(void)
|
||||
}
|
||||
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: Connector %i modes detected: %i", i, con->count_modes);
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: Connector %i status: %s", i,
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: Connector %i status: %s", i,
|
||||
(con->connection == DRM_MODE_CONNECTED) ? "CONNECTED" :
|
||||
(con->connection == DRM_MODE_DISCONNECTED) ? "DISCONNECTED" :
|
||||
(con->connection == DRM_MODE_UNKNOWNCONNECTION) ? "UNKNOWN" : "OTHER");
|
||||
@@ -1357,10 +1357,10 @@ int InitPlatform(void)
|
||||
platform.modeIndex = 0;
|
||||
CORE.Window.display.width = platform.connector->modes[0].hdisplay;
|
||||
CORE.Window.display.height = platform.connector->modes[0].vdisplay;
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Selected DRM connector mode %s (%ux%u%c@%u) for software rendering",
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Selected DRM connector mode %s (%ux%u%c@%u) for software rendering",
|
||||
platform.connector->modes[0].name,
|
||||
platform.connector->modes[0].hdisplay,
|
||||
platform.connector->modes[0].hdisplay,
|
||||
platform.connector->modes[0].vdisplay,
|
||||
(platform.connector->modes[0].flags & DRM_MODE_FLAG_INTERLACE) ? 'i' : 'p',
|
||||
platform.connector->modes[0].vrefresh);
|
||||
|
||||
@@ -2524,7 +2524,7 @@ int MakeDirectory(const char *dirPath)
|
||||
// Create final directory
|
||||
if (!DirectoryExists(pathcpy)) MKDIR(pathcpy);
|
||||
RL_FREE(pathcpy);
|
||||
|
||||
|
||||
// In case something failed and requested directory
|
||||
// was not successfully created, return -1
|
||||
if (!DirectoryExists(dirPath)) return -1;
|
||||
@@ -3148,7 +3148,7 @@ unsigned int *ComputeSHA256(unsigned char *data, int dataSize)
|
||||
unsigned char *block = buffer + (blockN*64);
|
||||
unsigned int w[64];
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
{
|
||||
w[i] =
|
||||
((unsigned int)block[i*4 + 0] << 24) |
|
||||
((unsigned int)block[i*4 + 1] << 16) |
|
||||
|
||||
@@ -1701,9 +1701,9 @@ char *GetTextBetween(const char *text, const char *begin, const char *end)
|
||||
char *TextReplace(const char *text, const char *search, const char *replacement)
|
||||
{
|
||||
char *result = NULL;
|
||||
|
||||
|
||||
if (!text || !search) return NULL; // Sanity check
|
||||
|
||||
|
||||
char *insertPoint = NULL; // Next insert point
|
||||
char *temp = NULL; // Temp pointer
|
||||
int searchLen = 0; // Search string length of (the string to remove)
|
||||
@@ -1753,7 +1753,7 @@ char *TextReplaceBetween(const char *text, const char *begin, const char *end, c
|
||||
char *result = NULL;
|
||||
|
||||
if (!text || !begin || !end) return NULL; // Sanity check
|
||||
|
||||
|
||||
int beginIndex = TextFindIndex(text, begin);
|
||||
|
||||
if (beginIndex > -1)
|
||||
|
||||
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
|
||||
// build <example_name> : Build example for Desktop and Web platforms
|
||||
// validate : Validate examples collection, generates report
|
||||
// update : Validate and update examples collection, generates report
|
||||
|
||||
|
||||
if (strcmp(argv[1], "create") == 0)
|
||||
{
|
||||
// Check for valid upcoming argument
|
||||
@@ -394,8 +394,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
// Support building not only individual examples but categories and "ALL"
|
||||
if ((strcmp(argv[2], "ALL") == 0) || TextInList(argv[2], exCategories, REXM_MAX_EXAMPLE_CATEGORIES))
|
||||
{
|
||||
// Category/ALL rebuilt requested
|
||||
{
|
||||
// Category/ALL rebuilt requested
|
||||
strcpy(exRebuildRequested, argv[2]);
|
||||
}
|
||||
else
|
||||
@@ -2432,7 +2432,7 @@ static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath)
|
||||
static bool TextInList(const char *text, const char **list, int listCount)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
|
||||
for (int i = 0; i < listCount; i++)
|
||||
{
|
||||
if (TextIsEqual(text, list[i])) { result = true; break; }
|
||||
|
||||
Reference in New Issue
Block a user