mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-07 03:48:15 +00:00
EXAMPLES: Format tweaks
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [audio] example - Mixed audio processing
|
* raylib [audio] example - mixed audio processing
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★★] 4/4
|
* Example complexity rating: [★★★★] 4/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [audio] example - Playing spatialized 3D sound
|
* raylib [audio] example - spatialized 3D sound
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
@@ -32,7 +32,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [audio] example - Playing spatialized 3D sound");
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - spatialized 3D sound");
|
||||||
|
|
||||||
InitAudioDevice();
|
InitAudioDevice();
|
||||||
|
|
||||||
|
@@ -13,12 +13,10 @@
|
|||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color)
|
//------------------------------------------------------------------------------------
|
||||||
{
|
// Module functions declaration
|
||||||
Vector2 size = MeasureTextEx(GetFontDefault(), text, (float)fontSize, 3);
|
//------------------------------------------------------------------------------------
|
||||||
Vector2 pos = (Vector2){x - size.x/2, y - size.y/2 };
|
static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color);
|
||||||
DrawTextEx(GetFontDefault(), text, pos, (float)fontSize, 3, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
@@ -31,10 +29,20 @@ int main(void)
|
|||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
SetConfigFlags(FLAG_WINDOW_HIGHDPI | FLAG_WINDOW_RESIZABLE);
|
SetConfigFlags(FLAG_WINDOW_HIGHDPI | FLAG_WINDOW_RESIZABLE);
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - highdpi");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - highdpi");
|
||||||
SetWindowMinSize(450, 450);
|
SetWindowMinSize(450, 450);
|
||||||
|
|
||||||
|
int logicalGridDescY = 120;
|
||||||
|
int logicalGridLabelY = logicalGridDescY + 30;
|
||||||
|
int logicalGridTop = logicalGridLabelY + 30;
|
||||||
|
int logicalGridBottom = logicalGridTop + 80;
|
||||||
|
int pixelGridTop = logicalGridBottom - 20;
|
||||||
|
int pixelGridBottom = pixelGridTop + 80;
|
||||||
|
int pixelGridLabelY = pixelGridBottom + 30;
|
||||||
|
int pixelGridDescY = pixelGridLabelY + 30;
|
||||||
|
int cellSize = 50;
|
||||||
|
float cellSizePx = (float)cellSize;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -44,67 +52,60 @@ int main(void)
|
|||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int monitorCount = GetMonitorCount();
|
int monitorCount = GetMonitorCount();
|
||||||
if (monitorCount > 1 && IsKeyPressed(KEY_N)) {
|
|
||||||
SetWindowMonitor((GetCurrentMonitor() + 1) % monitorCount);
|
if ((monitorCount > 1) && IsKeyPressed(KEY_N))
|
||||||
|
{
|
||||||
|
SetWindowMonitor((GetCurrentMonitor() + 1)%monitorCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentMonitor = GetCurrentMonitor();
|
int currentMonitor = GetCurrentMonitor();
|
||||||
|
Vector2 dpiScale = GetWindowScaleDPI();
|
||||||
|
cellSizePx = ((float)cellSize)/dpiScale.x;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
Vector2 dpiScale = GetWindowScaleDPI();
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
int windowCenter = GetScreenWidth() / 2;
|
int windowCenter = GetScreenWidth()/2;
|
||||||
DrawTextCenter(TextFormat("Dpi Scale: %f", dpiScale.x), windowCenter, 30, 40, DARKGRAY);
|
DrawTextCenter(TextFormat("Dpi Scale: %f", dpiScale.x), windowCenter, 30, 40, DARKGRAY);
|
||||||
DrawTextCenter(TextFormat("Monitor: %d/%d ([N] next monitor)", currentMonitor+1, monitorCount), windowCenter, 70, 16, LIGHTGRAY);
|
DrawTextCenter(TextFormat("Monitor: %d/%d ([N] next monitor)", currentMonitor+1, monitorCount), windowCenter, 70, 20, LIGHTGRAY);
|
||||||
|
|
||||||
const int logicalGridDescY = 120;
|
|
||||||
const int logicalGridLabelY = logicalGridDescY + 30;
|
|
||||||
const int logicalGridTop = logicalGridLabelY + 30;
|
|
||||||
const int logicalGridBottom = logicalGridTop + 80;
|
|
||||||
const int pixelGridTop = logicalGridBottom - 20;
|
|
||||||
const int pixelGridBottom = pixelGridTop + 80;
|
|
||||||
const int pixelGridLabelY = pixelGridBottom + 30;
|
|
||||||
const int pixelGridDescY = pixelGridLabelY + 30;
|
|
||||||
|
|
||||||
const int cellSize = 50;
|
|
||||||
const float cellSizePx = ((float)cellSize) / dpiScale.x;
|
|
||||||
|
|
||||||
DrawTextCenter(TextFormat("Window is %d \"logical points\" wide", GetScreenWidth()), windowCenter, logicalGridDescY, 20, ORANGE);
|
DrawTextCenter(TextFormat("Window is %d \"logical points\" wide", GetScreenWidth()), windowCenter, logicalGridDescY, 20, ORANGE);
|
||||||
|
|
||||||
bool odd = true;
|
bool odd = true;
|
||||||
for (int i = cellSize; i < GetScreenWidth(); i += cellSize, odd = !odd) {
|
for (int i = cellSize; i < GetScreenWidth(); i += cellSize, odd = !odd)
|
||||||
if (odd) {
|
{
|
||||||
DrawRectangle(i, logicalGridTop, cellSize, logicalGridBottom-logicalGridTop, ORANGE);
|
if (odd) DrawRectangle(i, logicalGridTop, cellSize, logicalGridBottom-logicalGridTop, ORANGE);
|
||||||
}
|
|
||||||
DrawTextCenter(TextFormat("%d", i), i, logicalGridLabelY, 12, LIGHTGRAY);
|
DrawTextCenter(TextFormat("%d", i), i, logicalGridLabelY, 10, LIGHTGRAY);
|
||||||
DrawLine(i, logicalGridLabelY + 10, i, logicalGridBottom, GRAY);
|
DrawLine(i, logicalGridLabelY + 10, i, logicalGridBottom, GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
odd = true;
|
odd = true;
|
||||||
const int minTextSpace = 30;
|
const int minTextSpace = 30;
|
||||||
int last_text_x = -minTextSpace;
|
int lastTextX = -minTextSpace;
|
||||||
for (int i = cellSize; i < GetRenderWidth(); i += cellSize, odd = !odd) {
|
for (int i = cellSize; i < GetRenderWidth(); i += cellSize, odd = !odd)
|
||||||
int x = (int)(((float)i) / dpiScale.x);
|
{
|
||||||
if (odd) {
|
int x = (int)(((float)i)/dpiScale.x);
|
||||||
DrawRectangle(x, pixelGridTop, (int)cellSizePx, pixelGridBottom-pixelGridTop, CLITERAL(Color){ 0, 121, 241, 100 });
|
if (odd) DrawRectangle(x, pixelGridTop, (int)cellSizePx, pixelGridBottom - pixelGridTop, CLITERAL(Color){ 0, 121, 241, 100 });
|
||||||
}
|
|
||||||
DrawLine(x, pixelGridTop, (int)(((float)i) / dpiScale.x), pixelGridLabelY - 10, GRAY);
|
DrawLine(x, pixelGridTop, (int)(((float)i) / dpiScale.x), pixelGridLabelY - 10, GRAY);
|
||||||
if (x - last_text_x >= minTextSpace) {
|
|
||||||
DrawTextCenter(TextFormat("%d", i), x, pixelGridLabelY, 12, LIGHTGRAY);
|
if ((x - lastTextX) >= minTextSpace)
|
||||||
last_text_x = x;
|
{
|
||||||
|
DrawTextCenter(TextFormat("%d", i), x, pixelGridLabelY, 10, LIGHTGRAY);
|
||||||
|
lastTextX = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTextCenter(TextFormat("Window is %d \"physical pixels\" wide", GetRenderWidth()), windowCenter, pixelGridDescY, 20, BLUE);
|
DrawTextCenter(TextFormat("Window is %d \"physical pixels\" wide", GetRenderWidth()), windowCenter, pixelGridDescY, 20, BLUE);
|
||||||
|
|
||||||
{
|
const char *text = "Can you see this?";
|
||||||
const char *text = "Can you see this?";
|
Vector2 size = MeasureTextEx(GetFontDefault(), text, 20, 3);
|
||||||
Vector2 size = MeasureTextEx(GetFontDefault(), text, 16, 3);
|
Vector2 pos = (Vector2){ GetScreenWidth() - size.x - 5, GetScreenHeight() - size.y - 5 };
|
||||||
Vector2 pos = (Vector2){GetScreenWidth() - size.x - 5, GetScreenHeight() - size.y - 5};
|
DrawTextEx(GetFontDefault(), text, pos, 20, 3, LIGHTGRAY);
|
||||||
DrawTextEx(GetFontDefault(), text, pos, 16, 3, LIGHTGRAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@@ -117,3 +118,13 @@ int main(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module functions definition
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color)
|
||||||
|
{
|
||||||
|
Vector2 size = MeasureTextEx(GetFontDefault(), text, (float)fontSize, 3);
|
||||||
|
Vector2 pos = (Vector2){ x - size.x/2, y - size.y/2 };
|
||||||
|
DrawTextEx(GetFontDefault(), text, pos, (float)fontSize, 3, color);
|
||||||
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [core] example - Generates a random sequence
|
* raylib [core] example - generate random sequence
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
@@ -43,7 +43,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - Generates a random sequence");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random sequence");
|
||||||
|
|
||||||
int rectCount = 20;
|
int rectCount = 20;
|
||||||
float rectSize = (float)screenWidth/rectCount;
|
float rectSize = (float)screenWidth/rectCount;
|
||||||
|
@@ -71,7 +71,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib - point particles");
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - point particles");
|
||||||
|
|
||||||
Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/point_particle.vs", GLSL_VERSION),
|
Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/point_particle.vs", GLSL_VERSION),
|
||||||
TextFormat("resources/shaders/glsl%i/point_particle.fs", GLSL_VERSION));
|
TextFormat("resources/shaders/glsl%i/point_particle.fs", GLSL_VERSION));
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shaders] example - Sieve of Eratosthenes
|
* raylib [shaders] example - sieve of Eratosthenes
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
@@ -45,7 +45,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Sieve of Eratosthenes");
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - sieve of Eratosthenes");
|
||||||
|
|
||||||
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
|
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shaders] example - Hot reloading
|
* raylib [shaders] example - hot reloading
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shaders] example - Hybrid Rendering
|
* raylib [shaders] example - hybrid rendering
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★★] 4/4
|
* Example complexity rating: [★★★★] 4/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shaders] example - Multiple sample2D with default batch system
|
* raylib [shaders] example - multi sample2D
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
@@ -38,7 +38,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib - multiple sample2D");
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - multi sample2D");
|
||||||
|
|
||||||
Image imRed = GenImageColor(800, 450, (Color){ 255, 0, 0, 255 });
|
Image imRed = GenImageColor(800, 450, (Color){ 255, 0, 0, 255 });
|
||||||
Texture texRed = LoadTextureFromImage(imRed);
|
Texture texRed = LoadTextureFromImage(imRed);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shaders] example - Apply an shdrOutline to a texture
|
* raylib [shaders] example - texture outline
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
@@ -36,7 +36,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture");
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - texture outline");
|
||||||
|
|
||||||
Texture2D texture = LoadTexture("resources/fudesumi.png");
|
Texture2D texture = LoadTexture("resources/fudesumi.png");
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shader] example - render depth texture
|
* raylib [shaders] example - render depth texture
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
@@ -36,7 +36,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shader] example - render depth texture");
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - render depth texture");
|
||||||
|
|
||||||
// Init camera
|
// Init camera
|
||||||
Camera camera = { 0 };
|
Camera camera = { 0 };
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shaders] example - Depth buffer writing
|
* raylib [shaders] example - depth buffer writing
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shapes] example - Draw raylib logo using basic shapes
|
* raylib [shapes] example - draw raylib logo using basic shapes
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [shapes] example - Rectangle advanced
|
* raylib [shapes] example - advanced rectangle drawing
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★★] 4/4
|
* Example complexity rating: [★★★★] 4/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Codepoints loading
|
* raylib [text] example - text codepoints loading
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Draw 3d
|
* raylib [text] example - drawing 3d text
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★★] 4/4
|
* Example complexity rating: [★★★★] 4/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Font filters
|
* raylib [text] example - font texture filters
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Font SDF loading
|
* raylib [text] example - font SDF loading
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Sprite font loading
|
* raylib [text] example - sprite font loading
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Text formatting
|
* raylib [text] example - text formating
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Input Box
|
* raylib [text] example - text input box
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Rectangle bounds
|
* raylib [text] example - rectangle bounds
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★★] 4/4
|
* Example complexity rating: [★★★★] 4/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Unicode
|
* raylib [text] example - unicode text drawing
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★★] 4/4
|
* Example complexity rating: [★★★★] 4/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [text] example - Text Writing Animation
|
* raylib [text] example - text writing animation
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Background scrolling
|
* raylib [textures] example - background scrolling
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Bunnymark
|
* raylib [textures] example - bunnymark
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Draw part of the texture tiled
|
* raylib [textures] example - draw texture tiled
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
@@ -36,7 +36,7 @@ int main(void)
|
|||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE); // Make the window resizable
|
SetConfigFlags(FLAG_WINDOW_RESIZABLE); // Make the window resizable
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [textures] example - Draw part of a texture tiled");
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - draw texture tiled");
|
||||||
|
|
||||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
Texture texPattern = LoadTexture("resources/patterns.png");
|
Texture texPattern = LoadTexture("resources/patterns.png");
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Fog of war
|
* raylib [textures] example - fog of war
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Retrive image channel (mask)
|
* raylib [textures] example - extract image channel
|
||||||
*
|
*
|
||||||
* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM)
|
* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM)
|
||||||
*
|
*
|
||||||
@@ -104,6 +104,7 @@ int main(void)
|
|||||||
UnloadTexture(textureGreen);
|
UnloadTexture(textureGreen);
|
||||||
UnloadTexture(textureBlue);
|
UnloadTexture(textureBlue);
|
||||||
UnloadTexture(textureAlpha);
|
UnloadTexture(textureAlpha);
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Image loading and drawing on it
|
* raylib [textures] example - image loading and drawing
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Procedural images generation
|
* raylib [textures] example - procedural images generation
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Image loading and texture creation
|
* raylib [textures] example - image loading and texture creation
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Image Rotation
|
* raylib [textures] example - image rotation
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
@@ -27,7 +27,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture rotation");
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - image rotation");
|
||||||
|
|
||||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
Image image45 = LoadImage("resources/raylib_logo.png");
|
Image image45 = LoadImage("resources/raylib_logo.png");
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Image text drawing using TTF generated font
|
* raylib [textures] example - image text drawing using TTF generated font
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Texture loading and drawing
|
* raylib [textures] example - texture loading and drawing
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Mouse painting
|
* raylib [textures] example - mouse painting
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Draw Textured Polygon
|
* raylib [textures] example - draw textured polygon
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Load textures from raw data
|
* raylib [textures] example - load textures from raw data
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Sprite animation
|
* raylib [textures] example - sprite animation
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Texture source and destination rectangles
|
* raylib [textures] example - texture source and destination rectangles
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Draw a texture along a segmented curve
|
* raylib [textures] example - draw texture along segmented curve
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Retrieve image data from texture: LoadImageFromTexture()
|
* raylib [textures] example - texture to image
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user