feat(fixLib): fix release raylib
This commit is contained in:
parent
ae50bfa2cc
commit
2f5406bbd9
1 changed files with 1840 additions and 1840 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue