More size_t

This commit is contained in:
Clownacy 2020-09-10 17:42:18 +01:00
parent 988f1128dd
commit b065882f24
5 changed files with 15 additions and 14 deletions

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <stddef.h>
#include <string> #include <string>
#include "../Attributes.h" #include "../Attributes.h"
@ -90,8 +91,8 @@ void Backend_Deinit(void);
void Backend_PostWindowCreation(void); void Backend_PostWindowCreation(void);
bool Backend_GetBasePath(std::string *string_buffer); bool Backend_GetBasePath(std::string *string_buffer);
void Backend_HideMouse(void); void Backend_HideMouse(void);
void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height); void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height);
void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height); void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height);
void PlaybackBackend_EnableDragAndDrop(void); void PlaybackBackend_EnableDragAndDrop(void);
bool Backend_SystemTask(bool active); bool Backend_SystemTask(bool active);
void Backend_GetKeyboardState(bool *keyboard_state); void Backend_GetKeyboardState(bool *keyboard_state);

View file

@ -201,7 +201,7 @@ void Backend_HideMouse(void)
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
} }
void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height)
{ {
// Convert to RGBA, since that's the only thing GLFW3 accepts // Convert to RGBA, since that's the only thing GLFW3 accepts
unsigned char *rgba_pixels = (unsigned char*)malloc(width * height * 4); unsigned char *rgba_pixels = (unsigned char*)malloc(width * height * 4);
@ -211,9 +211,9 @@ void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width,
if (rgba_pixels != NULL) if (rgba_pixels != NULL)
{ {
for (unsigned int y = 0; y < height; ++y) for (size_t y = 0; y < height; ++y)
{ {
for (unsigned int x = 0; x < width; ++x) for (size_t x = 0; x < width; ++x)
{ {
*rgba_pointer++ = *rgb_pointer++; *rgba_pointer++ = *rgb_pointer++;
*rgba_pointer++ = *rgb_pointer++; *rgba_pointer++ = *rgb_pointer++;
@ -229,7 +229,7 @@ void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width,
} }
} }
void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height)
{ {
// Convert to RGBA, since that's the only thing GLFW3 accepts // Convert to RGBA, since that's the only thing GLFW3 accepts
unsigned char *rgba_pixels = (unsigned char*)malloc(width * height * 4); unsigned char *rgba_pixels = (unsigned char*)malloc(width * height * 4);
@ -239,9 +239,9 @@ void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsi
if (rgba_pixels != NULL) if (rgba_pixels != NULL)
{ {
for (unsigned int y = 0; y < height; ++y) for (size_t y = 0; y < height; ++y)
{ {
for (unsigned int x = 0; x < width; ++x) for (size_t x = 0; x < width; ++x)
{ {
if (rgb_pointer[0] == 0xFF && rgb_pointer[1] == 0 && rgb_pointer[2] == 0xFF) // Colour-key if (rgb_pointer[0] == 0xFF && rgb_pointer[1] == 0 && rgb_pointer[2] == 0xFF) // Colour-key
{ {

View file

@ -34,14 +34,14 @@ void Backend_HideMouse(void)
} }
void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height)
{ {
(void)rgb_pixels; (void)rgb_pixels;
(void)width; (void)width;
(void)height; (void)height;
} }
void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height)
{ {
(void)rgb_pixels; (void)rgb_pixels;
(void)width; (void)width;

View file

@ -119,7 +119,7 @@ void Backend_HideMouse(void)
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
} }
void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom((void*)rgb_pixels, width, height, 0, width * 3, SDL_PIXELFORMAT_RGB24); SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom((void*)rgb_pixels, width, height, 0, width * 3, SDL_PIXELFORMAT_RGB24);
@ -134,7 +134,7 @@ void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width,
} }
} }
void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height)
{ {
cursor_surface_pixels = (unsigned char*)malloc(width * height * 3); cursor_surface_pixels = (unsigned char*)malloc(width * height * 3);

View file

@ -76,14 +76,14 @@ void Backend_HideMouse(void)
} }
void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height)
{ {
(void)rgb_pixels; (void)rgb_pixels;
(void)width; (void)width;
(void)height; (void)height;
} }
void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height)
{ {
(void)rgb_pixels; (void)rgb_pixels;
(void)width; (void)width;