Merge branch 'master' into rcamera_redesign_vector

This commit is contained in:
Ray 2023-02-01 11:59:23 +01:00 • committed by GitHub
commit 797ce873c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 20620 additions and 5475 deletions

View file

@ -7,7 +7,7 @@
* 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) 2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2022-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@ -24,7 +24,6 @@ static char *text = "いろはにほへと ちりぬるを\nわかよたれそ
// Remove codepoint duplicates if requested
static int *CodepointRemoveDuplicates(int *codepoints, int codepointCount, int *codepointResultCount);
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
@ -58,6 +57,10 @@ int main(void)
bool showFontAtlas = false;
int codepointSize = 0;
int codepoint = 0;
char *ptr = text;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@ -67,6 +70,20 @@ int main(void)
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) showFontAtlas = !showFontAtlas;
// Testing code: getting next and previous codepoints on provided text
if (IsKeyPressed(KEY_RIGHT))
{
// Get next codepoint in string and move pointer
codepoint = GetCodepointNext(ptr, &codepointSize);
ptr += codepointSize;
}
else if (IsKeyPressed(KEY_LEFT))
{
// Get previous codepoint in string and move pointer
codepoint = GetCodepointPrevious(ptr, &codepointSize);
ptr -= codepointSize;
}
//----------------------------------------------------------------------------------
// Draw

View file

@ -22,7 +22,7 @@
* 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) 2021-2022 Vlad Adrian (@demizdor)
* Copyright (c) 2021-2023 Vlad Adrian (@demizdor)
*
********************************************************************************************/
@ -153,13 +153,13 @@ int main(void)
if (IsFileExtension(droppedFiles.paths[0], ".ttf"))
{
UnloadFont(font);
font = LoadFontEx(droppedFiles.paths[0], fontSize, 0, 0);
font = LoadFontEx(droppedFiles.paths[0], (int)fontSize, 0, 0);
}
else if (IsFileExtension(droppedFiles.paths[0], ".fnt"))
{
UnloadFont(font);
font = LoadFont(droppedFiles.paths[0]);
fontSize = font.baseSize;
fontSize = (float)font.baseSize;
}
UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory
@ -743,7 +743,7 @@ static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, fl
static Color GenerateRandomColor(float s, float v)
{
const float Phi = 0.618033988749895f; // Golden ratio conjugate
float h = GetRandomValue(0, 360);
float h = (float)GetRandomValue(0, 360);
h = fmodf((h + h*Phi), 360.0f);
return ColorFromHSV(h, s, v);
}

View file

@ -11,7 +11,7 @@
* 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) 2015-2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View file

@ -16,7 +16,7 @@
* 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) 2016-2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2016-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View file

@ -7,7 +7,7 @@
* 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) 2015-2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View file

@ -17,7 +17,7 @@
* 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) 2014-2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View file

@ -7,7 +7,7 @@
* 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) 2014-2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View file

@ -7,7 +7,7 @@
* 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) 2017-2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2017-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View file

@ -10,7 +10,7 @@
* 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) 2017-2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2017-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View file

@ -9,7 +9,7 @@
* 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) 2018-2022 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
* Copyright (c) 2018-2023 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@ -263,6 +263,6 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
}
}
textOffsetX += glyphWidth;
if ((textOffsetX != 0) || (codepoint != ' ')) textOffsetX += glyphWidth; // avoid leading spaces
}
}
}

View file

@ -9,7 +9,7 @@
* 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) 2019-2022 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
* Copyright (c) 2019-2023 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@ -153,7 +153,7 @@ static int hovered = -1, selected = -1;
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(int argc, char **argv)
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
@ -267,6 +267,7 @@ int main(int argc, char **argv)
a = b;
b = tmp;
}
if (msgRect.x + msgRect.width > screenWidth) msgRect.x -= (msgRect.x + msgRect.width) - screenWidth + 10;
// Draw chat bubble
@ -286,11 +287,11 @@ int main(int argc, char **argv)
DrawText(info, (int)pos.x, (int)pos.y, 10, RAYWHITE);
}
//------------------------------------------------------------------------------
// Draw the info text
DrawText("These emojis have something to tell you, click each to find out!", (screenWidth - 650)/2, screenHeight - 40, 20, GRAY);
DrawText("Each emoji is a unicode character from a font, not a texture... Press [SPACEBAR] to refresh", (screenWidth - 484)/2, screenHeight - 16, 10, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}

View file

@ -7,7 +7,7 @@
* 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) 2016-2022 Ramon Santamaria (@raysan5)
* Copyright (c) 2016-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/