mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-06 06:13:10 +00:00
Compare commits
6 Commits
3ba186f2c1
...
78a81bf407
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78a81bf407 | ||
|
|
944567651c | ||
|
|
1bbc8682f4 | ||
|
|
ed5da45203 | ||
|
|
d3addad9a7 | ||
|
|
d13314fe1c |
@ -565,7 +565,7 @@ Detailed changes:
|
|||||||
[rtext] ADDED: SetTextLineSpacing() to define line breaks text drawing spacing by @raysan5
|
[rtext] ADDED: SetTextLineSpacing() to define line breaks text drawing spacing by @raysan5
|
||||||
[rtext] RENAMED: LoadFont*() parameter names for consistency and coherence by @raysan5
|
[rtext] RENAMED: LoadFont*() parameter names for consistency and coherence by @raysan5
|
||||||
[rtext] REVIEWED: GetCodepointCount(), ignore unused return value of GetCodepointNext by @ashn-dot-dev
|
[rtext] REVIEWED: GetCodepointCount(), ignore unused return value of GetCodepointNext by @ashn-dot-dev
|
||||||
[rtext] REVIEWED: TextFormat() warn user if buffer overflow occured (#3399) by @Murlocohol
|
[rtext] REVIEWED: TextFormat() warn user if buffer overflow occurred (#3399) by @Murlocohol
|
||||||
[rtext] REVIEWED: TextFormat(), added "..." for truncation (#3366) by @raysan5
|
[rtext] REVIEWED: TextFormat(), added "..." for truncation (#3366) by @raysan5
|
||||||
[rtext] REVIEWED: GetGlyphIndex() (#3000) by @raysan5
|
[rtext] REVIEWED: GetGlyphIndex() (#3000) by @raysan5
|
||||||
[rtext] REVIEWED: GetCodepointNext() to return default value by @chocolate42
|
[rtext] REVIEWED: GetCodepointNext() to return default value by @chocolate42
|
||||||
|
|||||||
@ -43,7 +43,7 @@ int main(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Set configuration flags for window creation
|
// Set configuration flags for window creation
|
||||||
//SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);
|
//SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);// | FLAG_WINDOW_TRANSPARENT);
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags");
|
||||||
|
|
||||||
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||||
|
|||||||
@ -83,7 +83,7 @@ int main(void)
|
|||||||
pressOffset.y = mousePos.y - ball->pos.y;
|
pressOffset.y = mousePos.y - ball->pos.y;
|
||||||
|
|
||||||
// If the distance between the ball position and the mouse press position
|
// If the distance between the ball position and the mouse press position
|
||||||
// is less or equal the ball radius, the event occured inside the ball
|
// is less than or equal to the ball radius, the event occurred inside the ball
|
||||||
if (hypot(pressOffset.x, pressOffset.y) <= ball->radius)
|
if (hypot(pressOffset.x, pressOffset.y) <= ball->radius)
|
||||||
{
|
{
|
||||||
ball->grabbed = true;
|
ball->grabbed = true;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ int main(void)
|
|||||||
SetConfigFlags(FLAG_WINDOW_HIGHDPI);
|
SetConfigFlags(FLAG_WINDOW_HIGHDPI);
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - double pendulum");
|
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - double pendulum");
|
||||||
|
|
||||||
// Simulation Paramters
|
// Simulation Parameters
|
||||||
float l1 = 15.0f, m1 = 0.2f, theta1 = DEG2RAD*170, w1 = 0;
|
float l1 = 15.0f, m1 = 0.2f, theta1 = DEG2RAD*170, w1 = 0;
|
||||||
float l2 = 15.0f, m2 = 0.1f, theta2 = DEG2RAD*0, w2 = 0;
|
float l2 = 15.0f, m2 = 0.1f, theta2 = DEG2RAD*0, w2 = 0;
|
||||||
float lengthScaler = 0.1f;
|
float lengthScaler = 0.1f;
|
||||||
|
|||||||
@ -16,14 +16,18 @@
|
|||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "raylib.h"
|
|
||||||
|
|
||||||
#define STR_MAX_SIZE 10000
|
#define STR_MAX_SIZE 10000
|
||||||
#define TURTLE_STACK_MAX_SIZE 50
|
#define TURTLE_STACK_MAX_SIZE 50
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
typedef struct TurtleState {
|
typedef struct TurtleState {
|
||||||
Vector2 origin;
|
Vector2 origin;
|
||||||
double angle;
|
double angle;
|
||||||
@ -40,162 +44,21 @@ typedef struct PenroseLSystem {
|
|||||||
float theta;
|
float theta;
|
||||||
} PenroseLSystem;
|
} PenroseLSystem;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
static TurtleState turtleStack[TURTLE_STACK_MAX_SIZE];
|
static TurtleState turtleStack[TURTLE_STACK_MAX_SIZE];
|
||||||
static int turtleTop = -1;
|
static int turtleTop = -1;
|
||||||
|
|
||||||
void PushTurtleState(TurtleState state)
|
//----------------------------------------------------------------------------------
|
||||||
{
|
// Module Functions Declaration
|
||||||
if (turtleTop < TURTLE_STACK_MAX_SIZE - 1)
|
//----------------------------------------------------------------------------------
|
||||||
{
|
static void PushTurtleState(TurtleState state);
|
||||||
turtleStack[++turtleTop] = state;
|
static TurtleState PopTurtleState(void);
|
||||||
}
|
static PenroseLSystem CreatePenroseLSystem(float drawLength);
|
||||||
else
|
static void BuildProductionStep(PenroseLSystem *ls);
|
||||||
{
|
static void BuildPenroseLSystem(PenroseLSystem *ls, float drawLength, int generations);
|
||||||
TraceLog(LOG_WARNING, "TURTLE STACK OVERFLOW!");
|
static void DrawPenroseLSystem(PenroseLSystem *ls);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TurtleState PopTurtleState(void)
|
|
||||||
{
|
|
||||||
if (turtleTop >= 0)
|
|
||||||
{
|
|
||||||
return turtleStack[turtleTop--];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TraceLog(LOG_WARNING, "TURTLE STACK UNDERFLOW!");
|
|
||||||
}
|
|
||||||
return (TurtleState) {0};
|
|
||||||
}
|
|
||||||
|
|
||||||
PenroseLSystem CreatePenroseLSystem(float drawLength)
|
|
||||||
{
|
|
||||||
PenroseLSystem ls = {
|
|
||||||
.steps = 0,
|
|
||||||
.ruleW = "YF++ZF4-XF[-YF4-WF]++",
|
|
||||||
.ruleX = "+YF--ZF[3-WF--XF]+",
|
|
||||||
.ruleY = "-WF++XF[+++YF++ZF]-",
|
|
||||||
.ruleZ = "--YF++++WF[+ZF++++XF]--XF",
|
|
||||||
.drawLength = drawLength,
|
|
||||||
.theta = 36.0f // in degrees
|
|
||||||
};
|
|
||||||
ls.production = (char*) malloc(sizeof(char) * STR_MAX_SIZE);
|
|
||||||
ls.production[0] = '\0';
|
|
||||||
strncpy(ls.production, "[X]++[X]++[X]++[X]++[X]", STR_MAX_SIZE);
|
|
||||||
return ls;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawPenroseLSystem(PenroseLSystem *ls)
|
|
||||||
{
|
|
||||||
Vector2 screenCenter = {GetScreenWidth()/2, GetScreenHeight()/2};
|
|
||||||
|
|
||||||
TurtleState turtle = {
|
|
||||||
.origin = {0},
|
|
||||||
.angle = -90.0f
|
|
||||||
};
|
|
||||||
|
|
||||||
int repeats = 1;
|
|
||||||
int productionLength = (int) strnlen(ls->production, STR_MAX_SIZE);
|
|
||||||
ls->steps += 12;
|
|
||||||
|
|
||||||
if (ls->steps > productionLength)
|
|
||||||
{
|
|
||||||
ls->steps = productionLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < ls->steps; i++)
|
|
||||||
{
|
|
||||||
char step = ls->production[i];
|
|
||||||
if ( step == 'F' )
|
|
||||||
{
|
|
||||||
for ( int j = 0; j < repeats; j++ )
|
|
||||||
{
|
|
||||||
Vector2 startPosWorld = turtle.origin;
|
|
||||||
float radAngle = DEG2RAD * turtle.angle;
|
|
||||||
turtle.origin.x += ls->drawLength * cosf(radAngle);
|
|
||||||
turtle.origin.y += ls->drawLength * sinf(radAngle);
|
|
||||||
Vector2 startPosScreen = {startPosWorld.x + screenCenter.x, startPosWorld.y + screenCenter.y};
|
|
||||||
Vector2 endPosScreen = {turtle.origin.x + screenCenter.x, turtle.origin.y + screenCenter.y};
|
|
||||||
DrawLineEx(startPosScreen, endPosScreen, 2, Fade(BLACK, 0.2));
|
|
||||||
}
|
|
||||||
repeats = 1;
|
|
||||||
}
|
|
||||||
else if ( step == '+' )
|
|
||||||
{
|
|
||||||
for ( int j = 0; j < repeats; j++ )
|
|
||||||
{
|
|
||||||
turtle.angle += ls->theta;
|
|
||||||
}
|
|
||||||
repeats = 1;
|
|
||||||
}
|
|
||||||
else if ( step == '-' )
|
|
||||||
{
|
|
||||||
for ( int j = 0; j < repeats; j++ )
|
|
||||||
{
|
|
||||||
turtle.angle += -ls->theta;
|
|
||||||
}
|
|
||||||
repeats = 1;
|
|
||||||
}
|
|
||||||
else if ( step == '[' )
|
|
||||||
{
|
|
||||||
PushTurtleState(turtle);
|
|
||||||
}
|
|
||||||
else if ( step == ']' )
|
|
||||||
{
|
|
||||||
turtle = PopTurtleState();
|
|
||||||
}
|
|
||||||
else if ( ( step >= 48 ) && ( step <= 57 ) )
|
|
||||||
{
|
|
||||||
repeats = (int) step - 48;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
turtleTop = -1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildProductionStep(PenroseLSystem *ls)
|
|
||||||
{
|
|
||||||
char *newProduction = (char*) malloc(sizeof(char) * STR_MAX_SIZE);
|
|
||||||
newProduction[0] = '\0';
|
|
||||||
|
|
||||||
int productionLength = strnlen(ls->production, STR_MAX_SIZE);
|
|
||||||
|
|
||||||
for (int i = 0; i < productionLength; i++)
|
|
||||||
{
|
|
||||||
char step = ls->production[i];
|
|
||||||
int remainingSpace = STR_MAX_SIZE - strnlen(newProduction, STR_MAX_SIZE) - 1;
|
|
||||||
switch (step)
|
|
||||||
{
|
|
||||||
case 'W': strncat(newProduction, ls->ruleW, remainingSpace); break;
|
|
||||||
case 'X': strncat(newProduction, ls->ruleX, remainingSpace); break;
|
|
||||||
case 'Y': strncat(newProduction, ls->ruleY, remainingSpace); break;
|
|
||||||
case 'Z': strncat(newProduction, ls->ruleZ, remainingSpace); break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
if (step != 'F')
|
|
||||||
{
|
|
||||||
int t = strnlen(newProduction, STR_MAX_SIZE);
|
|
||||||
newProduction[t] = step;
|
|
||||||
newProduction[t+1] = '\0';
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ls->drawLength *= 0.5f;
|
|
||||||
strncpy(ls->production, newProduction, STR_MAX_SIZE);
|
|
||||||
free( newProduction );
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildPenroseLSystem(PenroseLSystem *ls, float drawLength, int generations)
|
|
||||||
{
|
|
||||||
*ls = CreatePenroseLSystem(drawLength);
|
|
||||||
for (int i = 0; i < generations; i++)
|
|
||||||
{
|
|
||||||
BuildProductionStep(ls);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
@ -207,7 +70,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
SetConfigFlags( FLAG_MSAA_4X_HINT );
|
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - penrose tile");
|
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - penrose tile");
|
||||||
|
|
||||||
float drawLength = 460.0f;
|
float drawLength = 460.0f;
|
||||||
@ -216,7 +79,7 @@ int main(void)
|
|||||||
int generations = 0;
|
int generations = 0;
|
||||||
|
|
||||||
PenroseLSystem ls = {0};
|
PenroseLSystem ls = {0};
|
||||||
BuildPenroseLSystem(&ls, drawLength * (generations / (float) maxGenerations), generations);
|
BuildPenroseLSystem(&ls, drawLength*(generations/(float)maxGenerations), generations);
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
@ -240,26 +103,25 @@ int main(void)
|
|||||||
if (generations > minGenerations)
|
if (generations > minGenerations)
|
||||||
{
|
{
|
||||||
generations--;
|
generations--;
|
||||||
rebuild = generations > 0;
|
if (generations > 0) rebuild = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rebuild)
|
|
||||||
{
|
if (rebuild) BuildPenroseLSystem(&ls, drawLength*(generations/(float)maxGenerations), generations);
|
||||||
BuildPenroseLSystem(&ls, drawLength * (generations / (float) maxGenerations), generations);
|
|
||||||
}
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground( RAYWHITE );
|
ClearBackground( RAYWHITE );
|
||||||
if (generations > 0)
|
|
||||||
{
|
if (generations > 0) DrawPenroseLSystem(&ls);
|
||||||
DrawPenroseLSystem(&ls);
|
|
||||||
}
|
|
||||||
DrawText("penrose l-system", 10, 10, 20, DARKGRAY);
|
DrawText("penrose l-system", 10, 10, 20, DARKGRAY);
|
||||||
DrawText("press up or down to change generations", 10, 30, 20, DARKGRAY);
|
DrawText("press up or down to change generations", 10, 30, 20, DARKGRAY);
|
||||||
DrawText(TextFormat("generations: %d", generations), 10, 50, 20, DARKGRAY);
|
DrawText(TextFormat("generations: %d", generations), 10, 50, 20, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
@ -270,4 +132,144 @@ int main(void)
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void PushTurtleState(TurtleState state)
|
||||||
|
{
|
||||||
|
if (turtleTop < (TURTLE_STACK_MAX_SIZE - 1)) turtleStack[++turtleTop] = state;
|
||||||
|
else TraceLog(LOG_WARNING, "TURTLE STACK OVERFLOW!");
|
||||||
|
}
|
||||||
|
|
||||||
|
TurtleState PopTurtleState(void)
|
||||||
|
{
|
||||||
|
if (turtleTop >= 0) return turtleStack[turtleTop--];
|
||||||
|
else TraceLog(LOG_WARNING, "TURTLE STACK UNDERFLOW!");
|
||||||
|
|
||||||
|
return (TurtleState){ 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
PenroseLSystem CreatePenroseLSystem(float drawLength)
|
||||||
|
{
|
||||||
|
PenroseLSystem ls = {
|
||||||
|
.steps = 0,
|
||||||
|
.ruleW = "YF++ZF4-XF[-YF4-WF]++",
|
||||||
|
.ruleX = "+YF--ZF[3-WF--XF]+",
|
||||||
|
.ruleY = "-WF++XF[+++YF++ZF]-",
|
||||||
|
.ruleZ = "--YF++++WF[+ZF++++XF]--XF",
|
||||||
|
.drawLength = drawLength,
|
||||||
|
.theta = 36.0f // Degrees
|
||||||
|
};
|
||||||
|
|
||||||
|
ls.production = (char *)RL_MALLOC(sizeof(char)*STR_MAX_SIZE);
|
||||||
|
ls.production[0] = '\0';
|
||||||
|
strncpy(ls.production, "[X]++[X]++[X]++[X]++[X]", STR_MAX_SIZE);
|
||||||
|
|
||||||
|
return ls;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildProductionStep(PenroseLSystem *ls)
|
||||||
|
{
|
||||||
|
char *newProduction = (char *)RL_MALLOC(sizeof(char)*STR_MAX_SIZE);
|
||||||
|
newProduction[0] = '\0';
|
||||||
|
|
||||||
|
int productionLength = strnlen(ls->production, STR_MAX_SIZE);
|
||||||
|
|
||||||
|
for (int i = 0; i < productionLength; i++)
|
||||||
|
{
|
||||||
|
char step = ls->production[i];
|
||||||
|
int remainingSpace = STR_MAX_SIZE - strnlen(newProduction, STR_MAX_SIZE) - 1;
|
||||||
|
switch (step)
|
||||||
|
{
|
||||||
|
case 'W': strncat(newProduction, ls->ruleW, remainingSpace); break;
|
||||||
|
case 'X': strncat(newProduction, ls->ruleX, remainingSpace); break;
|
||||||
|
case 'Y': strncat(newProduction, ls->ruleY, remainingSpace); break;
|
||||||
|
case 'Z': strncat(newProduction, ls->ruleZ, remainingSpace); break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if (step != 'F')
|
||||||
|
{
|
||||||
|
int t = strnlen(newProduction, STR_MAX_SIZE);
|
||||||
|
newProduction[t] = step;
|
||||||
|
newProduction[t + 1] = '\0';
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ls->drawLength *= 0.5f;
|
||||||
|
strncpy(ls->production, newProduction, STR_MAX_SIZE);
|
||||||
|
|
||||||
|
RL_FREE(newProduction);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildPenroseLSystem(PenroseLSystem *ls, float drawLength, int generations)
|
||||||
|
{
|
||||||
|
*ls = CreatePenroseLSystem(drawLength);
|
||||||
|
for (int i = 0; i < generations; i++) BuildProductionStep(ls);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawPenroseLSystem(PenroseLSystem *ls)
|
||||||
|
{
|
||||||
|
Vector2 screenCenter = { GetScreenWidth()/2, GetScreenHeight()/2 };
|
||||||
|
|
||||||
|
TurtleState turtle = {
|
||||||
|
.origin = {0},
|
||||||
|
.angle = -90.0f
|
||||||
|
};
|
||||||
|
|
||||||
|
int repeats = 1;
|
||||||
|
int productionLength = (int)strnlen(ls->production, STR_MAX_SIZE);
|
||||||
|
ls->steps += 12;
|
||||||
|
|
||||||
|
if (ls->steps > productionLength) ls->steps = productionLength;
|
||||||
|
|
||||||
|
for (int i = 0; i < ls->steps; i++)
|
||||||
|
{
|
||||||
|
char step = ls->production[i];
|
||||||
|
if (step == 'F')
|
||||||
|
{
|
||||||
|
for (int j = 0; j < repeats; j++)
|
||||||
|
{
|
||||||
|
Vector2 startPosWorld = turtle.origin;
|
||||||
|
float radAngle = DEG2RAD*turtle.angle;
|
||||||
|
turtle.origin.x += ls->drawLength*cosf(radAngle);
|
||||||
|
turtle.origin.y += ls->drawLength*sinf(radAngle);
|
||||||
|
Vector2 startPosScreen = { startPosWorld.x + screenCenter.x, startPosWorld.y + screenCenter.y };
|
||||||
|
Vector2 endPosScreen = { turtle.origin.x + screenCenter.x, turtle.origin.y + screenCenter.y };
|
||||||
|
|
||||||
|
DrawLineEx(startPosScreen, endPosScreen, 2, Fade(BLACK, 0.2));
|
||||||
|
}
|
||||||
|
|
||||||
|
repeats = 1;
|
||||||
|
}
|
||||||
|
else if (step == '+')
|
||||||
|
{
|
||||||
|
for (int j = 0; j < repeats; j++) turtle.angle += ls->theta;
|
||||||
|
|
||||||
|
repeats = 1;
|
||||||
|
}
|
||||||
|
else if (step == '-')
|
||||||
|
{
|
||||||
|
for (int j = 0; j < repeats; j++) turtle.angle += -ls->theta;
|
||||||
|
|
||||||
|
repeats = 1;
|
||||||
|
}
|
||||||
|
else if (step == '[')
|
||||||
|
{
|
||||||
|
PushTurtleState(turtle);
|
||||||
|
}
|
||||||
|
else if (step == ']')
|
||||||
|
{
|
||||||
|
turtle = PopTurtleState();
|
||||||
|
}
|
||||||
|
else if ((step >= 48) && (step <= 57))
|
||||||
|
{
|
||||||
|
repeats = (int) step - 48;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
turtleTop = -1;
|
||||||
|
}
|
||||||
|
|||||||
@ -8,13 +8,15 @@
|
|||||||
| fonts/mecha.png | Captain Falcon | [Freeware](https://www.dafont.com/es/mecha-cf.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
| fonts/mecha.png | Captain Falcon | [Freeware](https://www.dafont.com/es/mecha-cf.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
||||||
| fonts/pixelplay.png | Aleksander Shevchuk | [Freeware](https://www.dafont.com/es/pixelplay.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
| fonts/pixelplay.png | Aleksander Shevchuk | [Freeware](https://www.dafont.com/es/pixelplay.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
||||||
| fonts/pixantiqua.ttf | Gerhard GroĂźmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
| fonts/pixantiqua.ttf | Gerhard GroĂźmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
||||||
| anonymous_pro_bold.ttf | [Mark Simonson](https://fonts.google.com/specimen/Anonymous+Pro) | [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | - |
|
| anonymous_pro_bold.ttf | [Mark Simonson](https://fonts.google.com/specimen/Anonymous+Pro) | [SIL Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | - |
|
||||||
| custom_alagard.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
| custom_alagard.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
||||||
| custom_jupiter_crash.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
| custom_jupiter_crash.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
||||||
| custom_mecha.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
| custom_mecha.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) |
|
||||||
| dejavu.fnt, dejavu.png | [DejaVu Fonts](https://dejavu-fonts.github.io/) | [Free](https://dejavu-fonts.github.io/License.html) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) |
|
| dejavu.fnt, dejavu.png | [DejaVu Fonts](https://dejavu-fonts.github.io/) | [Free](https://dejavu-fonts.github.io/License.html) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) |
|
||||||
| KAISG.ttf | [Dieter Steffmann](http://www.steffmann.de/wordpress/) | [Freeware](https://www.1001fonts.com/users/steffmann/) | [Kaiserzeit Gotisch](https://www.dafont.com/es/kaiserzeit-gotisch.font) font |
|
| KAISG.ttf | [Dieter Steffmann](http://www.steffmann.de/wordpress/) | [Freeware](https://www.1001fonts.com/users/steffmann/) | [Kaiserzeit Gotisch](https://www.dafont.com/es/kaiserzeit-gotisch.font) font |
|
||||||
| noto_cjk.fnt, noto_cjk.png | [Google Fonts](https://www.google.com/get/noto/help/cjk/) | [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) |
|
| noto_cjk.fnt, noto_cjk.png | [Google Fonts](https://www.google.com/get/noto/help/cjk/) | [SIL Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) |
|
||||||
| pixantiqua.fnt, pixantiqua.png | Gerhard GroĂźmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) |
|
| pixantiqua.fnt, pixantiqua.png | Gerhard GroĂźmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) |
|
||||||
| pixantiqua.ttf | Gerhard GroĂźmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | - |
|
| pixantiqua.ttf | Gerhard GroĂźmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | - |
|
||||||
| symbola.fnt, symbola.png | George Douros | [Freeware](https://fontlibrary.org/en/font/symbola) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) |
|
| symbola.fnt, symbola.png | George Douros | [Freeware](https://fontlibrary.org/en/font/symbola) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) |
|
||||||
|
| DotGothic16-Regular.ttf | [The DotGothic16 Project Authors](https://github.com/fontworks-fonts/DotGothic16) | [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | - |
|
||||||
|
| NotoSansTC-Regular.ttf | [Adobe](http://www.adobe.com/) | [SIL Open Font License](https://openfontlicense.org/documents/OFL.txt) | - |
|
||||||
|
|||||||
@ -265,8 +265,15 @@ void ToggleBorderlessWindowed(void)
|
|||||||
const int monitorHeight = mode->height;
|
const int monitorHeight = mode->height;
|
||||||
|
|
||||||
// Set screen position and size
|
// Set screen position and size
|
||||||
glfwSetWindowPos(platform.handle, monitorPosX, monitorPosY);
|
glfwSetWindowMonitor(
|
||||||
glfwSetWindowSize(platform.handle, monitorWidth, monitorHeight);
|
platform.handle,
|
||||||
|
monitors[monitor],
|
||||||
|
monitorPosX,
|
||||||
|
monitorPosY,
|
||||||
|
monitorWidth,
|
||||||
|
monitorHeight,
|
||||||
|
mode->refreshRate
|
||||||
|
);
|
||||||
|
|
||||||
// Refocus window
|
// Refocus window
|
||||||
glfwFocusWindow(platform.handle);
|
glfwFocusWindow(platform.handle);
|
||||||
@ -281,8 +288,15 @@ void ToggleBorderlessWindowed(void)
|
|||||||
|
|
||||||
// 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
|
||||||
glfwSetWindowSize(platform.handle, CORE.Window.previousScreen.width, CORE.Window.previousScreen.height);
|
glfwSetWindowMonitor(
|
||||||
glfwSetWindowPos(platform.handle, CORE.Window.previousPosition.x, CORE.Window.previousPosition.y);
|
platform.handle,
|
||||||
|
NULL,
|
||||||
|
CORE.Window.previousPosition.x,
|
||||||
|
CORE.Window.previousPosition.y,
|
||||||
|
CORE.Window.previousScreen.width,
|
||||||
|
CORE.Window.previousScreen.height,
|
||||||
|
mode->refreshRate
|
||||||
|
);
|
||||||
|
|
||||||
// Refocus window
|
// Refocus window
|
||||||
glfwFocusWindow(platform.handle);
|
glfwFocusWindow(platform.handle);
|
||||||
|
|||||||
@ -1865,7 +1865,7 @@ static void ProcessKeyboard(void)
|
|||||||
}
|
}
|
||||||
#endif // SUPPORT_SSH_KEYBOARD_RPI
|
#endif // SUPPORT_SSH_KEYBOARD_RPI
|
||||||
|
|
||||||
// Initialise user input from evdev(/dev/input/event<N>)
|
// Initialize user input from evdev(/dev/input/event<N>)
|
||||||
// this means mouse, keyboard or gamepad devices
|
// this means mouse, keyboard or gamepad devices
|
||||||
static void InitEvdevInput(void)
|
static void InitEvdevInput(void)
|
||||||
{
|
{
|
||||||
@ -1873,7 +1873,7 @@ static void InitEvdevInput(void)
|
|||||||
DIR *directory = NULL;
|
DIR *directory = NULL;
|
||||||
struct dirent *entity = NULL;
|
struct dirent *entity = NULL;
|
||||||
|
|
||||||
// Initialise keyboard file descriptor
|
// Initialize keyboard file descriptor
|
||||||
platform.keyboardFd = -1;
|
platform.keyboardFd = -1;
|
||||||
platform.mouseFd = -1;
|
platform.mouseFd = -1;
|
||||||
|
|
||||||
|
|||||||
@ -4308,12 +4308,12 @@ const char *TextFormat(const char *text, ...)
|
|||||||
int requiredByteCount = vsnprintf(currentBuffer, MAX_TEXT_BUFFER_LENGTH, text, args);
|
int requiredByteCount = vsnprintf(currentBuffer, MAX_TEXT_BUFFER_LENGTH, text, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
// If requiredByteCount is larger than the MAX_TEXT_BUFFER_LENGTH, then overflow occured
|
// If requiredByteCount is larger than the MAX_TEXT_BUFFER_LENGTH, then overflow occurred
|
||||||
if (requiredByteCount >= MAX_TEXT_BUFFER_LENGTH)
|
if (requiredByteCount >= MAX_TEXT_BUFFER_LENGTH)
|
||||||
{
|
{
|
||||||
// Inserting "..." at the end of the string to mark as truncated
|
// Inserting "..." at the end of the string to mark as truncated
|
||||||
char *truncBuffer = buffers[index] + MAX_TEXT_BUFFER_LENGTH - 4; // Adding 4 bytes = "...\0"
|
char *truncBuffer = buffers[index] + MAX_TEXT_BUFFER_LENGTH - 4; // Adding 4 bytes = "...\0"
|
||||||
sprintf(truncBuffer, "...");
|
snprintf(truncBuffer, 4, "...");
|
||||||
}
|
}
|
||||||
|
|
||||||
index += 1; // Move to next buffer for next function call
|
index += 1; // Move to next buffer for next function call
|
||||||
|
|||||||
@ -1524,12 +1524,12 @@ const char *TextFormat(const char *text, ...)
|
|||||||
int requiredByteCount = vsnprintf(currentBuffer, MAX_TEXT_BUFFER_LENGTH, text, args);
|
int requiredByteCount = vsnprintf(currentBuffer, MAX_TEXT_BUFFER_LENGTH, text, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
// If requiredByteCount is larger than the MAX_TEXT_BUFFER_LENGTH, then overflow occured
|
// If requiredByteCount is larger than the MAX_TEXT_BUFFER_LENGTH, then overflow occurred
|
||||||
if (requiredByteCount >= MAX_TEXT_BUFFER_LENGTH)
|
if (requiredByteCount >= MAX_TEXT_BUFFER_LENGTH)
|
||||||
{
|
{
|
||||||
// Inserting "..." at the end of the string to mark as truncated
|
// Inserting "..." at the end of the string to mark as truncated
|
||||||
char *truncBuffer = buffers[index] + MAX_TEXT_BUFFER_LENGTH - 4; // Adding 4 bytes = "...\0"
|
char *truncBuffer = buffers[index] + MAX_TEXT_BUFFER_LENGTH - 4; // Adding 4 bytes = "...\0"
|
||||||
sprintf(truncBuffer, "...");
|
snprintf(truncBuffer, 4, "...");
|
||||||
}
|
}
|
||||||
|
|
||||||
index += 1; // Move to next buffer for next function call
|
index += 1; // Move to next buffer for next function call
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user