feat(fixLib): fix release raylib
This commit is contained in:
parent
ae50bfa2cc
commit
2f5406bbd9
25 changed files with 1840 additions and 1840 deletions
|
|
@ -85,7 +85,7 @@ int main(void)
|
|||
UnloadTexture(midground); // Unload midground texture
|
||||
UnloadTexture(foreground); // Unload foreground texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ int main(void)
|
|||
UnloadTexture(fgTexture); // Unload foreground texture
|
||||
UnloadTexture(bgTexture); // Unload background texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ int main(void)
|
|||
DrawTexture(texBunny, (int)bunnies[i].position.x, (int)bunnies[i].position.y, bunnies[i].color);
|
||||
}
|
||||
|
||||
DrawRectangle(0, 0, screenWidth, 40, BLACK);
|
||||
DrawrayRectangle(0, 0, screenWidth, 40, BLACK);
|
||||
DrawText(TextFormat("bunnies: %i", bunniesCount), 120, 10, 20, GREEN);
|
||||
DrawText(TextFormat("batched draw calls: %i", 1 + bunniesCount/MAX_BATCH_ELEMENTS), 320, 10, 20, MAROON);
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ int main(void)
|
|||
|
||||
UnloadTexture(texBunny); // Unload bunny texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
#define MARGIN_SIZE 8 // Size for the margins
|
||||
#define COLOR_SIZE 16 // Size of the color select buttons
|
||||
|
||||
// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
|
||||
void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint);
|
||||
// Draw part of a texture (defined by a rayRectangle) with rotation and scale tiled into dest.
|
||||
void DrawTextureTiled(Texture2D texture, rayRectangle source, rayRectangle dest, Vector2 origin, float rotation, float scale, Color tint);
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
|
|
@ -41,21 +41,21 @@ int main(void)
|
|||
SetTextureFilter(texPattern, TEXTURE_FILTER_TRILINEAR); // Makes the texture smoother when upscaled
|
||||
|
||||
// Coordinates for all patterns inside the texture
|
||||
const Rectangle recPattern[] = {
|
||||
(Rectangle){ 3, 3, 66, 66 },
|
||||
(Rectangle){ 75, 3, 100, 100 },
|
||||
(Rectangle){ 3, 75, 66, 66 },
|
||||
(Rectangle){ 7, 156, 50, 50 },
|
||||
(Rectangle){ 85, 106, 90, 45 },
|
||||
(Rectangle){ 75, 154, 100, 60}
|
||||
const rayRectangle recPattern[] = {
|
||||
(rayRectangle){ 3, 3, 66, 66 },
|
||||
(rayRectangle){ 75, 3, 100, 100 },
|
||||
(rayRectangle){ 3, 75, 66, 66 },
|
||||
(rayRectangle){ 7, 156, 50, 50 },
|
||||
(rayRectangle){ 85, 106, 90, 45 },
|
||||
(rayRectangle){ 75, 154, 100, 60}
|
||||
};
|
||||
|
||||
// Setup colors
|
||||
const Color colors[] = { BLACK, MAROON, ORANGE, BLUE, PURPLE, BEIGE, LIME, RED, DARKGRAY, SKYBLUE };
|
||||
enum { MAX_COLORS = SIZEOF(colors) };
|
||||
Rectangle colorRec[MAX_COLORS] = { 0 };
|
||||
rayRectangle colorRec[MAX_COLORS] = { 0 };
|
||||
|
||||
// Calculate rectangle for each color
|
||||
// Calculate rayRectangle for each color
|
||||
for (int i = 0, x = 0, y = 0; i < MAX_COLORS; i++)
|
||||
{
|
||||
colorRec[i].x = 2.0f + MARGIN_SIZE + x;
|
||||
|
|
@ -90,7 +90,7 @@ int main(void)
|
|||
// Check which pattern was clicked and set it as the active pattern
|
||||
for (int i = 0; i < SIZEOF(recPattern); i++)
|
||||
{
|
||||
if (CheckCollisionPointRec(mouse, (Rectangle){ 2 + MARGIN_SIZE + recPattern[i].x, 40 + MARGIN_SIZE + recPattern[i].y, recPattern[i].width, recPattern[i].height }))
|
||||
if (CheckCollisionPointRec(mouse, (rayRectangle){ 2 + MARGIN_SIZE + recPattern[i].x, 40 + MARGIN_SIZE + recPattern[i].y, recPattern[i].width, recPattern[i].height }))
|
||||
{
|
||||
activePattern = i;
|
||||
break;
|
||||
|
|
@ -130,21 +130,21 @@ int main(void)
|
|||
ClearBackground(RAYWHITE);
|
||||
|
||||
// Draw the tiled area
|
||||
DrawTextureTiled(texPattern, recPattern[activePattern], (Rectangle){(float)OPT_WIDTH+MARGIN_SIZE, (float)MARGIN_SIZE, GetScreenWidth() - OPT_WIDTH - 2.0f*MARGIN_SIZE, GetScreenHeight() - 2.0f*MARGIN_SIZE},
|
||||
DrawTextureTiled(texPattern, recPattern[activePattern], (rayRectangle){(float)OPT_WIDTH+MARGIN_SIZE, (float)MARGIN_SIZE, GetScreenWidth() - OPT_WIDTH - 2.0f*MARGIN_SIZE, GetScreenHeight() - 2.0f*MARGIN_SIZE},
|
||||
(Vector2){0.0f, 0.0f}, rotation, scale, colors[activeCol]);
|
||||
|
||||
// Draw options
|
||||
DrawRectangle(MARGIN_SIZE, MARGIN_SIZE, OPT_WIDTH - MARGIN_SIZE, GetScreenHeight() - 2*MARGIN_SIZE, ColorAlpha(LIGHTGRAY, 0.5f));
|
||||
DrawrayRectangle(MARGIN_SIZE, MARGIN_SIZE, OPT_WIDTH - MARGIN_SIZE, GetScreenHeight() - 2*MARGIN_SIZE, ColorAlpha(LIGHTGRAY, 0.5f));
|
||||
|
||||
DrawText("Select Pattern", 2 + MARGIN_SIZE, 30 + MARGIN_SIZE, 10, BLACK);
|
||||
DrawTexture(texPattern, 2 + MARGIN_SIZE, 40 + MARGIN_SIZE, BLACK);
|
||||
DrawRectangle(2 + MARGIN_SIZE + (int)recPattern[activePattern].x, 40 + MARGIN_SIZE + (int)recPattern[activePattern].y, (int)recPattern[activePattern].width, (int)recPattern[activePattern].height, ColorAlpha(DARKBLUE, 0.3f));
|
||||
DrawrayRectangle(2 + MARGIN_SIZE + (int)recPattern[activePattern].x, 40 + MARGIN_SIZE + (int)recPattern[activePattern].y, (int)recPattern[activePattern].width, (int)recPattern[activePattern].height, ColorAlpha(DARKBLUE, 0.3f));
|
||||
|
||||
DrawText("Select Color", 2+MARGIN_SIZE, 10+256+MARGIN_SIZE, 10, BLACK);
|
||||
for (int i = 0; i < MAX_COLORS; i++)
|
||||
{
|
||||
DrawRectangleRec(colorRec[i], colors[i]);
|
||||
if (activeCol == i) DrawRectangleLinesEx(colorRec[i], 3, ColorAlpha(WHITE, 0.5f));
|
||||
DrawrayRectangleRec(colorRec[i], colors[i]);
|
||||
if (activeCol == i) DrawrayRectangleLinesEx(colorRec[i], 3, ColorAlpha(WHITE, 0.5f));
|
||||
}
|
||||
|
||||
DrawText("Scale (UP/DOWN to change)", 2 + MARGIN_SIZE, 80 + 256 + MARGIN_SIZE, 10, BLACK);
|
||||
|
|
@ -165,14 +165,14 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texPattern); // Unload texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
|
||||
void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint)
|
||||
// Draw part of a texture (defined by a rayRectangle) with rotation and scale tiled into dest.
|
||||
void DrawTextureTiled(Texture2D texture, rayRectangle source, rayRectangle dest, Vector2 origin, float rotation, float scale, Color tint)
|
||||
{
|
||||
if ((texture.id <= 0) || (scale <= 0.0f)) return; // Wanna see a infinite loop?!...just delete this line!
|
||||
if ((source.width == 0) || (source.height == 0)) return;
|
||||
|
|
@ -181,8 +181,8 @@ void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vecto
|
|||
if ((dest.width < tileWidth) && (dest.height < tileHeight))
|
||||
{
|
||||
// Can fit only one tile
|
||||
DrawTexturePro(texture, (Rectangle){source.x, source.y, ((float)dest.width/tileWidth)*source.width, ((float)dest.height/tileHeight)*source.height},
|
||||
(Rectangle){dest.x, dest.y, dest.width, dest.height}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, (rayRectangle){source.x, source.y, ((float)dest.width/tileWidth)*source.width, ((float)dest.height/tileHeight)*source.height},
|
||||
(rayRectangle){dest.x, dest.y, dest.width, dest.height}, origin, rotation, tint);
|
||||
}
|
||||
else if (dest.width <= tileWidth)
|
||||
{
|
||||
|
|
@ -190,14 +190,14 @@ void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vecto
|
|||
int dy = 0;
|
||||
for (;dy+tileHeight < dest.height; dy += tileHeight)
|
||||
{
|
||||
DrawTexturePro(texture, (Rectangle){source.x, source.y, ((float)dest.width/tileWidth)*source.width, source.height}, (Rectangle){dest.x, dest.y + dy, dest.width, (float)tileHeight}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, (rayRectangle){source.x, source.y, ((float)dest.width/tileWidth)*source.width, source.height}, (rayRectangle){dest.x, dest.y + dy, dest.width, (float)tileHeight}, origin, rotation, tint);
|
||||
}
|
||||
|
||||
// Fit last tile
|
||||
if (dy < dest.height)
|
||||
{
|
||||
DrawTexturePro(texture, (Rectangle){source.x, source.y, ((float)dest.width/tileWidth)*source.width, ((float)(dest.height - dy)/tileHeight)*source.height},
|
||||
(Rectangle){dest.x, dest.y + dy, dest.width, dest.height - dy}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, (rayRectangle){source.x, source.y, ((float)dest.width/tileWidth)*source.width, ((float)(dest.height - dy)/tileHeight)*source.height},
|
||||
(rayRectangle){dest.x, dest.y + dy, dest.width, dest.height - dy}, origin, rotation, tint);
|
||||
}
|
||||
}
|
||||
else if (dest.height <= tileHeight)
|
||||
|
|
@ -206,14 +206,14 @@ void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vecto
|
|||
int dx = 0;
|
||||
for (;dx+tileWidth < dest.width; dx += tileWidth)
|
||||
{
|
||||
DrawTexturePro(texture, (Rectangle){source.x, source.y, source.width, ((float)dest.height/tileHeight)*source.height}, (Rectangle){dest.x + dx, dest.y, (float)tileWidth, dest.height}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, (rayRectangle){source.x, source.y, source.width, ((float)dest.height/tileHeight)*source.height}, (rayRectangle){dest.x + dx, dest.y, (float)tileWidth, dest.height}, origin, rotation, tint);
|
||||
}
|
||||
|
||||
// Fit last tile
|
||||
if (dx < dest.width)
|
||||
{
|
||||
DrawTexturePro(texture, (Rectangle){source.x, source.y, ((float)(dest.width - dx)/tileWidth)*source.width, ((float)dest.height/tileHeight)*source.height},
|
||||
(Rectangle){dest.x + dx, dest.y, dest.width - dx, dest.height}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, (rayRectangle){source.x, source.y, ((float)(dest.width - dx)/tileWidth)*source.width, ((float)dest.height/tileHeight)*source.height},
|
||||
(rayRectangle){dest.x + dx, dest.y, dest.width - dx, dest.height}, origin, rotation, tint);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -225,13 +225,13 @@ void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vecto
|
|||
int dy = 0;
|
||||
for (;dy+tileHeight < dest.height; dy += tileHeight)
|
||||
{
|
||||
DrawTexturePro(texture, source, (Rectangle){dest.x + dx, dest.y + dy, (float)tileWidth, (float)tileHeight}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, source, (rayRectangle){dest.x + dx, dest.y + dy, (float)tileWidth, (float)tileHeight}, origin, rotation, tint);
|
||||
}
|
||||
|
||||
if (dy < dest.height)
|
||||
{
|
||||
DrawTexturePro(texture, (Rectangle){source.x, source.y, source.width, ((float)(dest.height - dy)/tileHeight)*source.height},
|
||||
(Rectangle){dest.x + dx, dest.y + dy, (float)tileWidth, dest.height - dy}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, (rayRectangle){source.x, source.y, source.width, ((float)(dest.height - dy)/tileHeight)*source.height},
|
||||
(rayRectangle){dest.x + dx, dest.y + dy, (float)tileWidth, dest.height - dy}, origin, rotation, tint);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -241,15 +241,15 @@ void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vecto
|
|||
int dy = 0;
|
||||
for (;dy+tileHeight < dest.height; dy += tileHeight)
|
||||
{
|
||||
DrawTexturePro(texture, (Rectangle){source.x, source.y, ((float)(dest.width - dx)/tileWidth)*source.width, source.height},
|
||||
(Rectangle){dest.x + dx, dest.y + dy, dest.width - dx, (float)tileHeight}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, (rayRectangle){source.x, source.y, ((float)(dest.width - dx)/tileWidth)*source.width, source.height},
|
||||
(rayRectangle){dest.x + dx, dest.y + dy, dest.width - dx, (float)tileHeight}, origin, rotation, tint);
|
||||
}
|
||||
|
||||
// Draw final tile in the bottom right corner
|
||||
if (dy < dest.height)
|
||||
{
|
||||
DrawTexturePro(texture, (Rectangle){source.x, source.y, ((float)(dest.width - dx)/tileWidth)*source.width, ((float)(dest.height - dy)/tileHeight)*source.height},
|
||||
(Rectangle){dest.x + dx, dest.y + dy, dest.width - dx, dest.height - dy}, origin, rotation, tint);
|
||||
DrawTexturePro(texture, (rayRectangle){source.x, source.y, ((float)(dest.width - dx)/tileWidth)*source.width, ((float)(dest.height - dy)/tileHeight)*source.height},
|
||||
(rayRectangle){dest.x + dx, dest.y + dy, dest.width - dx, dest.height - dy}, origin, rotation, tint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ int main(void)
|
|||
ClearBackground(BLANK);
|
||||
for (unsigned int y = 0; y < map.tilesY; y++)
|
||||
for (unsigned int x = 0; x < map.tilesX; x++)
|
||||
if (map.tileFog[y*map.tilesX + x] == 0) DrawRectangle(x, y, 1, 1, BLACK);
|
||||
else if (map.tileFog[y*map.tilesX + x] == 2) DrawRectangle(x, y, 1, 1, Fade(BLACK, 0.8f));
|
||||
if (map.tileFog[y*map.tilesX + x] == 0) DrawrayRectangle(x, y, 1, 1, BLACK);
|
||||
else if (map.tileFog[y*map.tilesX + x] == 2) DrawrayRectangle(x, y, 1, 1, Fade(BLACK, 0.8f));
|
||||
EndTextureMode();
|
||||
|
||||
BeginDrawing();
|
||||
|
|
@ -118,19 +118,19 @@ int main(void)
|
|||
for (unsigned int x = 0; x < map.tilesX; x++)
|
||||
{
|
||||
// Draw tiles from id (and tile borders)
|
||||
DrawRectangle(x*MAP_TILE_SIZE, y*MAP_TILE_SIZE, MAP_TILE_SIZE, MAP_TILE_SIZE,
|
||||
DrawrayRectangle(x*MAP_TILE_SIZE, y*MAP_TILE_SIZE, MAP_TILE_SIZE, MAP_TILE_SIZE,
|
||||
(map.tileIds[y*map.tilesX + x] == 0)? BLUE : Fade(BLUE, 0.9f));
|
||||
DrawRectangleLines(x*MAP_TILE_SIZE, y*MAP_TILE_SIZE, MAP_TILE_SIZE, MAP_TILE_SIZE, Fade(DARKBLUE, 0.5f));
|
||||
DrawrayRectangleLines(x*MAP_TILE_SIZE, y*MAP_TILE_SIZE, MAP_TILE_SIZE, MAP_TILE_SIZE, Fade(DARKBLUE, 0.5f));
|
||||
}
|
||||
}
|
||||
|
||||
// Draw player
|
||||
DrawRectangleV(playerPosition, (Vector2){ PLAYER_SIZE, PLAYER_SIZE }, RED);
|
||||
DrawrayRectangleV(playerPosition, (Vector2){ PLAYER_SIZE, PLAYER_SIZE }, RED);
|
||||
|
||||
|
||||
// Draw fog of war (scaled to full map, bilinear filtering)
|
||||
DrawTexturePro(fogOfWar.texture, (Rectangle){ 0, 0, (float)fogOfWar.texture.width, (float)-fogOfWar.texture.height },
|
||||
(Rectangle){ 0, 0, (float)map.tilesX*MAP_TILE_SIZE, (float)map.tilesY*MAP_TILE_SIZE },
|
||||
DrawTexturePro(fogOfWar.texture, (rayRectangle){ 0, 0, (float)fogOfWar.texture.width, (float)-fogOfWar.texture.height },
|
||||
(rayRectangle){ 0, 0, (float)map.tilesX*MAP_TILE_SIZE, (float)map.tilesY*MAP_TILE_SIZE },
|
||||
(Vector2){ 0, 0 }, 0.0f, WHITE);
|
||||
|
||||
// Draw player current tile
|
||||
|
|
@ -148,7 +148,7 @@ int main(void)
|
|||
|
||||
UnloadRenderTexture(fogOfWar); // Unload render texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ int main(void)
|
|||
|
||||
for (int i = 0; i < MAX_FRAME_DELAY; i++)
|
||||
{
|
||||
if (i < frameDelay) DrawRectangle(190 + 21*i, 300, 20, 20, RED);
|
||||
DrawRectangleLines(190 + 21*i, 300, 20, 20, MAROON);
|
||||
if (i < frameDelay) DrawrayRectangle(190 + 21*i, 300, 20, 20, RED);
|
||||
DrawrayRectangleLines(190 + 21*i, 300, 20, 20, MAROON);
|
||||
}
|
||||
|
||||
DrawTexture(texScarfyAnim, GetScreenWidth()/2 - texScarfyAnim.width/2, 140, WHITE);
|
||||
|
|
@ -114,7 +114,7 @@ int main(void)
|
|||
UnloadTexture(texScarfyAnim); // Unload texture
|
||||
UnloadImage(imScarfyAnim); // Unload image (contains all frames)
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -30,20 +30,20 @@ int main(void)
|
|||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||
|
||||
Image cat = LoadImage("resources/cat.png"); // Load image in CPU memory (RAM)
|
||||
ImageCrop(&cat, (Rectangle){ 100, 10, 280, 380 }); // Crop an image piece
|
||||
ImageCrop(&cat, (rayRectangle){ 100, 10, 280, 380 }); // Crop an image piece
|
||||
ImageFlipHorizontal(&cat); // Flip cropped image horizontally
|
||||
ImageResize(&cat, 150, 200); // Resize flipped-cropped image
|
||||
|
||||
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
|
||||
|
||||
// Draw one image over the other with a scaling of 1.5f
|
||||
ImageDraw(&parrots, cat, (Rectangle){ 0, 0, (float)cat.width, (float)cat.height }, (Rectangle){ 30, 40, cat.width*1.5f, cat.height*1.5f }, WHITE);
|
||||
ImageCrop(&parrots, (Rectangle){ 0, 50, (float)parrots.width, (float)parrots.height - 100 }); // Crop resulting image
|
||||
ImageDraw(&parrots, cat, (rayRectangle){ 0, 0, (float)cat.width, (float)cat.height }, (rayRectangle){ 30, 40, cat.width*1.5f, cat.height*1.5f }, WHITE);
|
||||
ImageCrop(&parrots, (rayRectangle){ 0, 50, (float)parrots.width, (float)parrots.height - 100 }); // Crop resulting image
|
||||
|
||||
// Draw on the image with a few image draw methods
|
||||
ImageDrawPixel(&parrots, 10, 10, RAYWHITE);
|
||||
ImageDrawCircleLines(&parrots, 10, 10, 5, RAYWHITE);
|
||||
ImageDrawRectangle(&parrots, 5, 20, 10, 10, RAYWHITE);
|
||||
ImageDrawrayRectangle(&parrots, 5, 20, 10, 10, RAYWHITE);
|
||||
|
||||
UnloadImage(cat); // Unload image from RAM
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ int main(void)
|
|||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, WHITE);
|
||||
DrawRectangleLines(screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, texture.width, texture.height, DARKGRAY);
|
||||
DrawrayRectangleLines(screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, texture.width, texture.height, DARKGRAY);
|
||||
|
||||
DrawText("We are drawing only one texture from various images composed!", 240, 350, 10, DARKGRAY);
|
||||
DrawText("Source images have been cropped, scaled, flipped and copied one over the other.", 190, 370, 10, DARKGRAY);
|
||||
|
|
@ -89,7 +89,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Texture unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ int main(void)
|
|||
|
||||
DrawTexture(textures[currentTexture], 0, 0, WHITE);
|
||||
|
||||
DrawRectangle(30, 400, 325, 30, Fade(SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(30, 400, 325, 30, Fade(WHITE, 0.5f));
|
||||
DrawrayRectangle(30, 400, 325, 30, Fade(SKYBLUE, 0.5f));
|
||||
DrawrayRectangleLines(30, 400, 325, 30, Fade(WHITE, 0.5f));
|
||||
DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL TEXTURES", 40, 410, 10, WHITE);
|
||||
|
||||
switch(currentTexture)
|
||||
|
|
@ -112,7 +112,7 @@ int main(void)
|
|||
// Unload textures data (GPU VRAM)
|
||||
for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(textures[i]);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Texture unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ int main(void)
|
|||
int currentProcess = NONE;
|
||||
bool textureReload = false;
|
||||
|
||||
Rectangle toggleRecs[NUM_PROCESSES] = { 0 };
|
||||
rayRectangle toggleRecs[NUM_PROCESSES] = { 0 };
|
||||
int mouseHoverRec = -1;
|
||||
|
||||
for (int i = 0; i < NUM_PROCESSES; i++) toggleRecs[i] = (Rectangle){ 40.0f, (float)(50 + 32*i), 150.0f, 30.0f };
|
||||
for (int i = 0; i < NUM_PROCESSES; i++) toggleRecs[i] = (rayRectangle){ 40.0f, (float)(50 + 32*i), 150.0f, 30.0f };
|
||||
|
||||
SetTargetFPS(60);
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
|
@ -149,16 +149,16 @@ int main(void)
|
|||
|
||||
DrawText("IMAGE PROCESSING:", 40, 30, 10, DARKGRAY);
|
||||
|
||||
// Draw rectangles
|
||||
// Draw rayRectangles
|
||||
for (int i = 0; i < NUM_PROCESSES; i++)
|
||||
{
|
||||
DrawRectangleRec(toggleRecs[i], ((i == currentProcess) || (i == mouseHoverRec)) ? SKYBLUE : LIGHTGRAY);
|
||||
DrawRectangleLines((int)toggleRecs[i].x, (int) toggleRecs[i].y, (int) toggleRecs[i].width, (int) toggleRecs[i].height, ((i == currentProcess) || (i == mouseHoverRec)) ? BLUE : GRAY);
|
||||
DrawrayRectangleRec(toggleRecs[i], ((i == currentProcess) || (i == mouseHoverRec)) ? SKYBLUE : LIGHTGRAY);
|
||||
DrawrayRectangleLines((int)toggleRecs[i].x, (int) toggleRecs[i].y, (int) toggleRecs[i].width, (int) toggleRecs[i].height, ((i == currentProcess) || (i == mouseHoverRec)) ? BLUE : GRAY);
|
||||
DrawText( processText[i], (int)( toggleRecs[i].x + toggleRecs[i].width/2 - MeasureText(processText[i], 10)/2), (int) toggleRecs[i].y + 11, 10, ((i == currentProcess) || (i == mouseHoverRec)) ? DARKBLUE : DARKGRAY);
|
||||
}
|
||||
|
||||
DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE);
|
||||
DrawRectangleLines(screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, texture.width, texture.height, BLACK);
|
||||
DrawrayRectangleLines(screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, texture.width, texture.height, BLACK);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -170,7 +170,7 @@ int main(void)
|
|||
UnloadImage(imOrigin); // Unload image-origin from RAM
|
||||
UnloadImage(imCopy); // Unload image-copy from RAM
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(textures[i]);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ int main(void)
|
|||
|
||||
UnloadFont(font); // Unload custom font
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Texture unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ int main(void)
|
|||
SKYBLUE, BLUE, DARKBLUE, PURPLE, VIOLET, DARKPURPLE, BEIGE, BROWN, DARKBROWN,
|
||||
LIGHTGRAY, GRAY, DARKGRAY, BLACK };
|
||||
|
||||
// Define colorsRecs data (for every rectangle)
|
||||
Rectangle colorsRecs[MAX_COLORS_COUNT] = { 0 };
|
||||
// Define colorsRecs data (for every rayRectangle)
|
||||
rayRectangle colorsRecs[MAX_COLORS_COUNT] = { 0 };
|
||||
|
||||
for (int i = 0; i < MAX_COLORS_COUNT; i++)
|
||||
{
|
||||
|
|
@ -52,7 +52,7 @@ int main(void)
|
|||
float brushSize = 20.0f;
|
||||
bool mouseWasPressed = false;
|
||||
|
||||
Rectangle btnSaveRec = { 750, 10, 40, 30 };
|
||||
rayRectangle btnSaveRec = { 750, 10, 40, 30 };
|
||||
bool btnSaveMouseHover = false;
|
||||
bool showSaveMessage = false;
|
||||
int saveMessageCounter = 0;
|
||||
|
|
@ -177,7 +177,7 @@ int main(void)
|
|||
ClearBackground(RAYWHITE);
|
||||
|
||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||
DrawTextureRec(target.texture, (Rectangle) { 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2) { 0, 0 }, WHITE);
|
||||
DrawTextureRec(target.texture, (rayRectangle) { 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2) { 0, 0 }, WHITE);
|
||||
|
||||
// Draw drawing circle for reference
|
||||
if (mousePos.y > 50)
|
||||
|
|
@ -187,27 +187,27 @@ int main(void)
|
|||
}
|
||||
|
||||
// Draw top panel
|
||||
DrawRectangle(0, 0, GetScreenWidth(), 50, RAYWHITE);
|
||||
DrawrayRectangle(0, 0, GetScreenWidth(), 50, RAYWHITE);
|
||||
DrawLine(0, 50, GetScreenWidth(), 50, LIGHTGRAY);
|
||||
|
||||
// Draw color selection rectangles
|
||||
for (int i = 0; i < MAX_COLORS_COUNT; i++) DrawRectangleRec(colorsRecs[i], colors[i]);
|
||||
DrawRectangleLines(10, 10, 30, 30, LIGHTGRAY);
|
||||
// Draw color selection rayRectangles
|
||||
for (int i = 0; i < MAX_COLORS_COUNT; i++) DrawrayRectangleRec(colorsRecs[i], colors[i]);
|
||||
DrawrayRectangleLines(10, 10, 30, 30, LIGHTGRAY);
|
||||
|
||||
if (colorMouseHover >= 0) DrawRectangleRec(colorsRecs[colorMouseHover], Fade(WHITE, 0.6f));
|
||||
if (colorMouseHover >= 0) DrawrayRectangleRec(colorsRecs[colorMouseHover], Fade(WHITE, 0.6f));
|
||||
|
||||
DrawRectangleLinesEx((Rectangle){ colorsRecs[colorSelected].x - 2, colorsRecs[colorSelected].y - 2,
|
||||
DrawrayRectangleLinesEx((rayRectangle){ colorsRecs[colorSelected].x - 2, colorsRecs[colorSelected].y - 2,
|
||||
colorsRecs[colorSelected].width + 4, colorsRecs[colorSelected].height + 4 }, 2, BLACK);
|
||||
|
||||
// Draw save image button
|
||||
DrawRectangleLinesEx(btnSaveRec, 2, btnSaveMouseHover ? RED : BLACK);
|
||||
DrawrayRectangleLinesEx(btnSaveRec, 2, btnSaveMouseHover ? RED : BLACK);
|
||||
DrawText("SAVE!", 755, 20, 10, btnSaveMouseHover ? RED : BLACK);
|
||||
|
||||
// Draw save image message
|
||||
if (showSaveMessage)
|
||||
{
|
||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
DrawRectangle(0, 150, GetScreenWidth(), 80, BLACK);
|
||||
DrawrayRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
DrawrayRectangle(0, 150, GetScreenWidth(), 80, BLACK);
|
||||
DrawText("IMAGE SAVED: my_amazing_texture_painting.png", 150, 180, 20, RAYWHITE);
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadRenderTexture(target); // Unload render texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -36,20 +36,20 @@ int main(void)
|
|||
Vector2 origin = { 0.0f, 0.0f };
|
||||
|
||||
// Position and size of the n-patches
|
||||
Rectangle dstRec1 = { 480.0f, 160.0f, 32.0f, 32.0f };
|
||||
Rectangle dstRec2 = { 160.0f, 160.0f, 32.0f, 32.0f };
|
||||
Rectangle dstRecH = { 160.0f, 93.0f, 32.0f, 32.0f };
|
||||
Rectangle dstRecV = { 92.0f, 160.0f, 32.0f, 32.0f };
|
||||
rayRectangle dstRec1 = { 480.0f, 160.0f, 32.0f, 32.0f };
|
||||
rayRectangle dstRec2 = { 160.0f, 160.0f, 32.0f, 32.0f };
|
||||
rayRectangle dstRecH = { 160.0f, 93.0f, 32.0f, 32.0f };
|
||||
rayRectangle dstRecV = { 92.0f, 160.0f, 32.0f, 32.0f };
|
||||
|
||||
// A 9-patch (NPATCH_NINE_PATCH) changes its sizes in both axis
|
||||
NPatchInfo ninePatchInfo1 = { (Rectangle){ 0.0f, 0.0f, 64.0f, 64.0f }, 12, 40, 12, 12, NPATCH_NINE_PATCH };
|
||||
NPatchInfo ninePatchInfo2 = { (Rectangle){ 0.0f, 128.0f, 64.0f, 64.0f }, 16, 16, 16, 16, NPATCH_NINE_PATCH };
|
||||
NPatchInfo ninePatchInfo1 = { (rayRectangle){ 0.0f, 0.0f, 64.0f, 64.0f }, 12, 40, 12, 12, NPATCH_NINE_PATCH };
|
||||
NPatchInfo ninePatchInfo2 = { (rayRectangle){ 0.0f, 128.0f, 64.0f, 64.0f }, 16, 16, 16, 16, NPATCH_NINE_PATCH };
|
||||
|
||||
// A horizontal 3-patch (NPATCH_THREE_PATCH_HORIZONTAL) changes its sizes along the x axis only
|
||||
NPatchInfo h3PatchInfo = { (Rectangle){ 0.0f, 64.0f, 64.0f, 64.0f }, 8, 8, 8, 8, NPATCH_THREE_PATCH_HORIZONTAL };
|
||||
NPatchInfo h3PatchInfo = { (rayRectangle){ 0.0f, 64.0f, 64.0f, 64.0f }, 8, 8, 8, 8, NPATCH_THREE_PATCH_HORIZONTAL };
|
||||
|
||||
// A vertical 3-patch (NPATCH_THREE_PATCH_VERTICAL) changes its sizes along the y axis only
|
||||
NPatchInfo v3PatchInfo = { (Rectangle){ 0.0f, 192.0f, 64.0f, 64.0f }, 6, 6, 6, 6, NPATCH_THREE_PATCH_VERTICAL };
|
||||
NPatchInfo v3PatchInfo = { (rayRectangle){ 0.0f, 192.0f, 64.0f, 64.0f }, 6, 6, 6, 6, NPATCH_THREE_PATCH_VERTICAL };
|
||||
|
||||
SetTargetFPS(60);
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
|
@ -93,7 +93,7 @@ int main(void)
|
|||
DrawTextureNPatch(nPatchTexture, v3PatchInfo, dstRecV, origin, 0.0f, WHITE);
|
||||
|
||||
// Draw the source texture
|
||||
DrawRectangleLines(5, 88, 74, 266, BLUE);
|
||||
DrawrayRectangleLines(5, 88, 74, 266, BLUE);
|
||||
DrawTexture(nPatchTexture, 10, 93, WHITE);
|
||||
DrawText("TEXTURE", 15, 360, 10, DARKGRAY);
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(nPatchTexture); // Texture unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ int main(void)
|
|||
// Draw active particles
|
||||
for (int i = 0; i < MAX_PARTICLES; i++)
|
||||
{
|
||||
if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0.0f, 0.0f, (float)smoke.width, (float)smoke.height },
|
||||
(Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size },
|
||||
if (mouseTail[i].active) DrawTexturePro(smoke, (rayRectangle){ 0.0f, 0.0f, (float)smoke.width, (float)smoke.height },
|
||||
(rayRectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size },
|
||||
(Vector2){ (float)(smoke.width*mouseTail[i].size/2.0f), (float)(smoke.height*mouseTail[i].size/2.0f) }, mouseTail[i].rotation,
|
||||
Fade(mouseTail[i].color, mouseTail[i].alpha));
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(smoke);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Unload texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ int main(void)
|
|||
UnloadTexture(fudesumi); // Texture unloading
|
||||
UnloadTexture(checked); // Texture unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ int main(void)
|
|||
Texture2D scarfy = LoadTexture("resources/scarfy.png"); // Texture loading
|
||||
|
||||
Vector2 position = { 350.0f, 280.0f };
|
||||
Rectangle frameRec = { 0.0f, 0.0f, (float)scarfy.width/6, (float)scarfy.height };
|
||||
rayRectangle frameRec = { 0.0f, 0.0f, (float)scarfy.width/6, (float)scarfy.height };
|
||||
int currentFrame = 0;
|
||||
|
||||
int framesCounter = 0;
|
||||
|
|
@ -73,8 +73,8 @@ int main(void)
|
|||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawTexture(scarfy, 15, 40, WHITE);
|
||||
DrawRectangleLines(15, 40, scarfy.width, scarfy.height, LIME);
|
||||
DrawRectangleLines(15 + (int)frameRec.x, 40 + (int)frameRec.y, (int)frameRec.width, (int)frameRec.height, RED);
|
||||
DrawrayRectangleLines(15, 40, scarfy.width, scarfy.height, LIME);
|
||||
DrawrayRectangleLines(15 + (int)frameRec.x, 40 + (int)frameRec.y, (int)frameRec.width, (int)frameRec.height, RED);
|
||||
|
||||
DrawText("FRAME SPEED: ", 165, 210, 10, DARKGRAY);
|
||||
DrawText(TextFormat("%02i FPS", framesSpeed), 575, 210, 10, DARKGRAY);
|
||||
|
|
@ -82,8 +82,8 @@ int main(void)
|
|||
|
||||
for (int i = 0; i < MAX_FRAME_SPEED; i++)
|
||||
{
|
||||
if (i < framesSpeed) DrawRectangle(250 + 21*i, 205, 20, 20, RED);
|
||||
DrawRectangleLines(250 + 21*i, 205, 20, 20, MAROON);
|
||||
if (i < framesSpeed) DrawrayRectangle(250 + 21*i, 205, 20, 20, RED);
|
||||
DrawrayRectangleLines(250 + 21*i, 205, 20, 20, MAROON);
|
||||
}
|
||||
|
||||
DrawTextureRec(scarfy, frameRec, position, WHITE); // Draw part of the texture
|
||||
|
|
@ -98,7 +98,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(scarfy); // Texture unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
#define NUM_FRAMES 3 // Number of frames (rectangles) for the button sprite texture
|
||||
#define NUM_FRAMES 3 // Number of frames (rayRectangles) for the button sprite texture
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
|
|
@ -32,12 +32,12 @@ int main(void)
|
|||
Sound fxButton = LoadSound("resources/buttonfx.wav"); // Load button sound
|
||||
Texture2D button = LoadTexture("resources/button.png"); // Load button texture
|
||||
|
||||
// Define frame rectangle for drawing
|
||||
// Define frame rayRectangle for drawing
|
||||
float frameHeight = (float)button.height/NUM_FRAMES;
|
||||
Rectangle sourceRec = { 0, 0, (float)button.width, frameHeight };
|
||||
rayRectangle sourceRec = { 0, 0, (float)button.width, frameHeight };
|
||||
|
||||
// Define button bounds on screen
|
||||
Rectangle btnBounds = { screenWidth/2.0f - button.width/2.0f, screenHeight/2.0f - button.height/NUM_FRAMES/2.0f, (float)button.width, frameHeight };
|
||||
rayRectangle btnBounds = { screenWidth/2.0f - button.width/2.0f, screenHeight/2.0f - button.height/NUM_FRAMES/2.0f, (float)button.width, frameHeight };
|
||||
|
||||
int btnState = 0; // Button state: 0-NORMAL, 1-MOUSE_HOVER, 2-PRESSED
|
||||
bool btnAction = false; // Button action should be activated
|
||||
|
|
@ -72,7 +72,7 @@ int main(void)
|
|||
// TODO: Any desired action
|
||||
}
|
||||
|
||||
// Calculate button frame rectangle to draw depending on button state
|
||||
// Calculate button frame rayRectangle to draw depending on button state
|
||||
sourceRec.y = btnState*frameHeight;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ int main(void)
|
|||
|
||||
CloseAudioDevice(); // Close audio device
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
rayCloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue