mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-06 06:13:10 +00:00
Compare commits
6 Commits
ee3d65cbc9
...
49868b356f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49868b356f | ||
|
|
8fcd99c8dd | ||
|
|
646e814baf | ||
|
|
5aee9f9d50 | ||
|
|
282c4b0eab | ||
|
|
1f7f9ab22b |
4
.gitignore
vendored
4
.gitignore
vendored
@ -62,10 +62,14 @@ packages/
|
||||
emsdk
|
||||
|
||||
# Ignore wasm data in examples/
|
||||
examples/**/*
|
||||
examples/**/*.wasm
|
||||
examples/**/*.data
|
||||
examples/**/*.js
|
||||
examples/**/*.html
|
||||
!examples/**/*.*
|
||||
!examples/**/*/
|
||||
examples/**/logs/*
|
||||
|
||||
# Ignore files build by xcode
|
||||
*.mode*v*
|
||||
|
||||
@ -231,7 +231,7 @@ endif
|
||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||
# -Wno-unused-value ignore unused return values of some functions (i.e. fread())
|
||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||
CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
||||
CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wno-unused-result
|
||||
|
||||
ifeq ($(BUILD_MODE),DEBUG)
|
||||
CFLAGS += -g -D_DEBUG
|
||||
|
||||
@ -17,7 +17,8 @@
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
|
||||
#include "raymath.h" // Required for: Clamp()
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
@ -33,18 +34,14 @@ int main(void)
|
||||
|
||||
Texture2D booth = LoadTexture("resources/booth.png");
|
||||
|
||||
// The overall scale of the stacked sprite
|
||||
float stackScale = 3.0f;
|
||||
// The vertical spacing between each layer
|
||||
float stackSpacing = 2.0f;
|
||||
// The number of layers. Used for calculating the size of a single slice
|
||||
unsigned int stackCount = 122;
|
||||
// The speed to rotate the stacked sprite
|
||||
float rotationSpeed = 30.0f;
|
||||
// The current rotation of the stacked sprite
|
||||
float rotation = 0.0f;
|
||||
// The amount that speed will change by when the user presses A/D
|
||||
const float speedChange = 0.25f;
|
||||
float stackScale = 3.0f; // Overall scale of the stacked sprite
|
||||
float stackSpacing = 2.0f; // Vertical spacing between each layer
|
||||
unsigned int stackCount = 122; // Number of layers, used for calculating the size of a single slice
|
||||
float rotationSpeed = 30.0f; // Stacked sprites rotation speed
|
||||
float rotation = 0.0f; // Current rotation of the stacked sprite
|
||||
const float speedChange = 0.25f; // Amount speed will change by when the user presses A/D
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
@ -57,22 +54,16 @@ int main(void)
|
||||
stackSpacing = Clamp(stackSpacing, 0.0f, 5.0f);
|
||||
|
||||
// Add a positive/negative offset to spin right/left at different speeds
|
||||
if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_A))
|
||||
{
|
||||
rotationSpeed -= speedChange;
|
||||
}
|
||||
|
||||
if (IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_D))
|
||||
{
|
||||
rotationSpeed += speedChange;
|
||||
}
|
||||
|
||||
rotation += rotationSpeed * GetFrameTime();
|
||||
if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_A)) rotationSpeed -= speedChange;
|
||||
if (IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_D)) rotationSpeed += speedChange;
|
||||
|
||||
rotation += rotationSpeed*GetFrameTime();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
// Get the size of a single slice
|
||||
@ -86,20 +77,19 @@ int main(void)
|
||||
// Draw the stacked sprite, rotated to the correct angle, with an vertical offset applied based on its y location
|
||||
for (int i = stackCount - 1; i >= 0; i--)
|
||||
{
|
||||
Rectangle source = { 0.0f, (float)i*frameHeight, frameWidth, frameHeight };
|
||||
// Center vertically
|
||||
Rectangle source = { 0.0f, (float)i*frameHeight, frameWidth, frameHeight };
|
||||
Rectangle dest = { screenWidth/2.0f, (screenHeight/2.0f) + (i*stackSpacing) - (stackSpacing*stackCount/2.0f), scaledWidth, scaledHeight };
|
||||
Vector2 origin = { scaledWidth/2.0f, scaledHeight/2.0f };
|
||||
|
||||
DrawTexturePro(booth, source, dest, origin, rotation, WHITE);
|
||||
}
|
||||
|
||||
DrawText("a/d to spin\nmouse wheel to change separation (aka 'angle')", 10, 10, 20, DARKGRAY);
|
||||
const char *spacingText = TextFormat("current spacing: %.01f", stackSpacing);
|
||||
DrawText(spacingText, 10, 50, 20, DARKGRAY);
|
||||
const char *speedText = TextFormat("current speed: %.02f", rotationSpeed);
|
||||
DrawText(speedText, 10, 70, 20, DARKGRAY);
|
||||
DrawText("A/D to spin\nmouse wheel to change separation (aka 'angle')", 10, 10, 20, DARKGRAY);
|
||||
DrawText(TextFormat("current spacing: %.01f", stackSpacing), 10, 50, 20, DARKGRAY);
|
||||
DrawText(TextFormat("current speed: %.02f", rotationSpeed), 10, 70, 20, DARKGRAY);
|
||||
DrawText("redbooth model (c) kluchek under cc 4.0", 10, 420, 20, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
22
tools/rexm/reports/examples_testing_linux.md
Normal file
22
tools/rexm/reports/examples_testing_linux.md
Normal file
@ -0,0 +1,22 @@
|
||||
# EXAMPLES COLLECTION - TESTING REPORT
|
||||
|
||||
## Tested Platform: Linux
|
||||
|
||||
```
|
||||
Example automated testing elements validated:
|
||||
- [CWARN] : Compilation WARNING messages
|
||||
- [LWARN] : Log WARNING messages count
|
||||
- [INIT] : Initialization
|
||||
- [CLOSE] : Closing
|
||||
- [ASSETS] : Assets loading
|
||||
- [RLGL] : OpenGL-wrapped initialization
|
||||
- [PLAT] : Platform initialization
|
||||
- [FONT] : Font default initialization
|
||||
- [TIMER] : Timer initialization
|
||||
```
|
||||
| **EXAMPLE NAME** | [CWARN] | [LWARN] | [INIT] | [CLOSE] | [ASSETS] | [RLGL] | [PLAT] | [FONT] | [TIMER] |
|
||||
|:---------------------------------|:-------:|:-------:|:------:|:-------:|:--------:|:------:|:------:|:------:|:-------:|
|
||||
| text_font_loading | 0 | 10 | âś” | âś” | âś” | âś” | âś” | âś” | âś” |
|
||||
| text_codepoints_loading | 0 | 1 | âś” | âś” | âś” | âś” | âś” | âś” | âś” |
|
||||
| models_animation_playing | 0 | 1 | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ |
|
||||
|
||||
@ -51,9 +51,9 @@
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <stdlib.h> // Required for: NULL, calloc(), free()
|
||||
#include <stdio.h> // Required for: rename(), remove()
|
||||
#include <string.h> // Required for: strcmp(), strcpy()
|
||||
#include <stdlib.h> // Required for: NULL, calloc(), free()
|
||||
|
||||
#define SUPPORT_LOG_INFO
|
||||
#if defined(SUPPORT_LOG_INFO) //&& defined(_DEBUG)
|
||||
@ -1517,7 +1517,7 @@ int main(int argc, char *argv[])
|
||||
TextFormat("%s/%s/%s.original.c", exBasePath, exCategory, exName));
|
||||
char *srcText = LoadFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
|
||||
|
||||
#define BUILD_TESTING_WEB
|
||||
//#define BUILD_TESTING_WEB
|
||||
#if defined(BUILD_TESTING_WEB)
|
||||
static const char *mainReplaceText =
|
||||
"#include <stdio.h>\n"
|
||||
@ -1620,8 +1620,9 @@ int main(int argc, char *argv[])
|
||||
exBasePath, exCategory, exName, exBasePath, exCategory, exName));
|
||||
#else
|
||||
LOG("INFO: [%s] Building example for PLATFORM_DESKTOP (Host: POSIX)\n", exName);
|
||||
system(TextFormat("make -C %s %s/%s PLATFORM=PLATFORM_DESKTOP -B", exBasePath, exCategory, exName));
|
||||
#endif
|
||||
system(TextFormat("make -C %s %s/%s PLATFORM=PLATFORM_DESKTOP -B > %s/%s/logs/%s.build.log 2>&1",
|
||||
exBasePath, exCategory, exName, exBasePath, exCategory, exName));
|
||||
#endif
|
||||
// Restore original source code before continue
|
||||
FileCopy(TextFormat("%s/%s/%s.original.c", exBasePath, exCategory, exName),
|
||||
TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
|
||||
@ -1630,7 +1631,7 @@ int main(int argc, char *argv[])
|
||||
// STEP 3: Run example with required arguments
|
||||
// NOTE: Not easy to retrieve process return value from system(), it's platform dependant
|
||||
ChangeDirectory(TextFormat("%s/%s", exBasePath, exCategory));
|
||||
system(TextFormat("%s --frames 2 > logs/%s.log", exName, exName));
|
||||
system(TextFormat("./%s --frames 2 > logs/%s.log", exName, exName));
|
||||
#endif
|
||||
}
|
||||
} break;
|
||||
@ -1712,7 +1713,9 @@ int main(int argc, char *argv[])
|
||||
char **exTestLogLines = LoadTextLines(exTestLog, &exTestLogLinesCount);
|
||||
for (int k = 0; k < exTestLogLinesCount; k++)
|
||||
{
|
||||
if (TextFindIndex(exTestLogLines[k], "WARNING: GL: NPOT") >= 0) continue; // Ignore warning
|
||||
#if defined(BUILD_TESTING_WEB)
|
||||
if (TextFindIndex(exTestLogLines[k], "WARNING: GL: NPOT") >= 0) continue; // Ignore web-specific warning
|
||||
#endif
|
||||
if (TextFindIndex(exTestLogLines[k], "WARNING") >= 0) testing[i].warnings++;
|
||||
}
|
||||
UnloadTextLines(exTestLogLines, exTestLogLinesCount);
|
||||
@ -1842,6 +1845,7 @@ int main(int argc, char *argv[])
|
||||
printf(" rename <old_examples_name> <new_example_name> : Rename an existing example\n");
|
||||
printf(" remove <example_name> : Remove an existing example\n");
|
||||
printf(" build <example_name> : Build example for Desktop and Web platforms\n");
|
||||
printf(" test <example_name> : Build and Test example for Desktop and Web platforms\n");
|
||||
printf(" validate : Validate examples collection, generates report\n");
|
||||
printf(" update : Validate and update examples collection, generates report\n\n");
|
||||
printf("OPTIONS:\n\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user