REVIEWED: Formatting, follow raylib coding conventions

This commit is contained in:
Ray 2024-06-30 11:37:58 +02:00
parent 13e3092511
commit 1e1061d5c7
11 changed files with 77 additions and 78 deletions

View file

@ -81,7 +81,7 @@ static PlatformData platform = { 0 }; // Platform specific data
// Local Variables Definition
//----------------------------------------------------------------------------------
#define KEYCODE_MAP_SIZE 162
static const KeyboardKey KeycodeMap[KEYCODE_MAP_SIZE] = {
static const KeyboardKey mapKeycode[KEYCODE_MAP_SIZE] = {
KEY_NULL, // AKEYCODE_UNKNOWN
0, // AKEYCODE_SOFT_LEFT
0, // AKEYCODE_SOFT_RIGHT
@ -1201,7 +1201,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
return 1; // Handled gamepad button
}
KeyboardKey key = (keycode > 0 && keycode < KEYCODE_MAP_SIZE) ? KeycodeMap[keycode] : KEY_NULL;
KeyboardKey key = (keycode > 0 && keycode < KEYCODE_MAP_SIZE)? mapKeycode[keycode] : KEY_NULL;
if (key != KEY_NULL)
{
// Save current key and its state

View file

@ -80,7 +80,7 @@ static PlatformData platform = { 0 }; // Platform specific data
// Local Variables Definition
//----------------------------------------------------------------------------------
#define SCANCODE_MAPPED_NUM 232
static const KeyboardKey ScancodeToKey[SCANCODE_MAPPED_NUM] = {
static const KeyboardKey mapScancodeToKey[SCANCODE_MAPPED_NUM] = {
KEY_NULL, // SDL_SCANCODE_UNKNOWN
0,
0,
@ -478,7 +478,7 @@ void SetWindowIcon(Image image)
{
SDL_Surface *iconSurface = NULL;
Uint32 rmask, gmask, bmask, amask;
unsigned int rmask = 0, gmask = 0, bmask = 0, amask = 0;
int depth = 0; // Depth in bits
int pitch = 0; // Pixel spacing (pitch) in bytes
@ -549,15 +549,10 @@ void SetWindowIcon(Image image)
bmask = 0xFFFF, amask = 0xFFFF;
depth = 64, pitch = image.width*8;
break;
default:
// Compressed formats are not supported
return;
default: return; // Compressed formats are not supported
}
iconSurface = SDL_CreateRGBSurfaceFrom(
image.data, image.width, image.height, depth, pitch,
rmask, gmask, bmask, amask
);
iconSurface = SDL_CreateRGBSurfaceFrom( image.data, image.width, image.height, depth, pitch, rmask, gmask, bmask, amask );
if (iconSurface)
{
@ -1554,6 +1549,7 @@ int InitPlatform(void)
for (int i = 0; (i < SDL_NumJoysticks()) && (i < MAX_GAMEPADS); i++)
{
platform.gamepad[i] = SDL_JoystickOpen(i);
if (platform.gamepad[i])
{
CORE.Input.Gamepad.ready[i] = true;
@ -1608,8 +1604,9 @@ static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode)
{
if (sdlScancode >= 0 && sdlScancode < SCANCODE_MAPPED_NUM)
{
return ScancodeToKey[sdlScancode];
return mapScancodeToKey[sdlScancode];
}
return KEY_NULL; // No equivalent key in Raylib
}
// EOF

View file

@ -190,7 +190,8 @@ void ToggleFullscreen(void)
if (enterFullscreen)
{
// NOTE: The setTimeouts handle the browser mode change delay
EM_ASM(
EM_ASM
(
setTimeout(function()
{
Module.requestFullscreen(false, false);
@ -298,7 +299,8 @@ void ToggleBorderlessWindowed(void)
{
// NOTE: 1. The setTimeouts handle the browser mode change delay
// 2. The style unset handles the possibility of a width="value%" like on the default shell.html file
EM_ASM(
EM_ASM
(
setTimeout(function()
{
Module.requestFullscreen(false, true);

View file

@ -1332,7 +1332,7 @@ RLAPI Image GenImageText(int width, int height, const char *text);
// Image manipulation functions
RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
RLAPI Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece
RLAPI Image ImageFromChannel(Image image, int selectedChannel); // Create an image from a selected channel of another image (GRAYSCALE/R16/R32)
RLAPI Image ImageFromChannel(Image image, int selectedChannel); // Create an image from a selected channel of another image (GRAYSCALE)
RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format