Fixing all other macros by adding RL_ prefix.
This commit is contained in:
parent
8579d1386d
commit
b6cb51e3e8
|
|
@ -36,8 +36,8 @@ int main()
|
||||||
|
|
||||||
InitAudioDevice(); // Initialize audio device
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
Color colors[14] = { ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK,
|
Color colors[14] = { RL_ORANGE, RL_RED, RL_GOLD, RL_LIME, RL_BLUE, RL_VIOLET, RL_BROWN, RL_LIGHTGRAY, RL_PINK,
|
||||||
YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE };
|
RL_YELLOW, RL_GREEN, RL_SKYBLUE, RL_PURPLE, RL_BEIGE };
|
||||||
|
|
||||||
// Creates ome circles for visual effect
|
// Creates ome circles for visual effect
|
||||||
CircleWave circles[MAX_CIRCLES];
|
CircleWave circles[MAX_CIRCLES];
|
||||||
|
|
@ -112,7 +112,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|
@ -120,9 +120,9 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw time bar
|
// Draw time bar
|
||||||
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY);
|
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, RL_LIGHTGRAY);
|
||||||
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
|
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, RL_MAROON);
|
||||||
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, GRAY);
|
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -67,16 +67,16 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, LIGHTGRAY);
|
DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
DrawRectangle(200, 200, 400, 12, LIGHTGRAY);
|
DrawRectangle(200, 200, 400, 12, RL_LIGHTGRAY);
|
||||||
DrawRectangle(200, 200, (int)timePlayed, 12, MAROON);
|
DrawRectangle(200, 200, (int)timePlayed, 12, RL_MAROON);
|
||||||
DrawRectangleLines(200, 200, 400, 12, GRAY);
|
DrawRectangleLines(200, 200, 400, 12, RL_GRAY);
|
||||||
|
|
||||||
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, LIGHTGRAY);
|
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, RL_LIGHTGRAY);
|
||||||
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, LIGHTGRAY);
|
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -132,10 +132,10 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText(FormatText("sine frequency: %i",(int)frequency), GetScreenWidth() - 220, 10, 20, RED);
|
DrawText(FormatText("sine frequency: %i",(int)frequency), GetScreenWidth() - 220, 10, 20, RL_RED);
|
||||||
DrawText("click mouse button to change frequency", 10, 10, 20, DARKGRAY);
|
DrawText("click mouse button to change frequency", 10, 10, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
// Draw the current buffer state proportionate to the screen
|
// Draw the current buffer state proportionate to the screen
|
||||||
for (int i = 0; i < screenWidth; i++)
|
for (int i = 0; i < screenWidth; i++)
|
||||||
|
|
@ -143,7 +143,7 @@ int main()
|
||||||
position.x = i;
|
position.x = i;
|
||||||
position.y = 250 + 50*data[i*MAX_SAMPLES/screenWidth]/32000;
|
position.y = 250 + 50*data[i*MAX_SAMPLES/screenWidth]/32000;
|
||||||
|
|
||||||
DrawPixelV(position, RED);
|
DrawPixelV(position, RL_RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY);
|
DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY);
|
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -95,36 +95,36 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode2D(camera);
|
BeginMode2D(camera);
|
||||||
|
|
||||||
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY);
|
DrawRectangle(-6000, 320, 13000, 8000, RL_DARKGRAY);
|
||||||
|
|
||||||
for (int i = 0; i < MAX_BUILDINGS; i++) DrawRectangleRec(buildings[i], buildColors[i]);
|
for (int i = 0; i < MAX_BUILDINGS; i++) DrawRectangleRec(buildings[i], buildColors[i]);
|
||||||
|
|
||||||
DrawRectangleRec(player, RED);
|
DrawRectangleRec(player, RL_RED);
|
||||||
|
|
||||||
DrawLine(camera.target.x, -screenHeight*10, camera.target.x, screenHeight*10, GREEN);
|
DrawLine(camera.target.x, -screenHeight*10, camera.target.x, screenHeight*10, RL_GREEN);
|
||||||
DrawLine(-screenWidth*10, camera.target.y, screenWidth*10, camera.target.y, GREEN);
|
DrawLine(-screenWidth*10, camera.target.y, screenWidth*10, camera.target.y, RL_GREEN);
|
||||||
|
|
||||||
EndMode2D();
|
EndMode2D();
|
||||||
|
|
||||||
DrawText("SCREEN AREA", 640, 10, 20, RED);
|
DrawText("SCREEN AREA", 640, 10, 20, RL_RED);
|
||||||
|
|
||||||
DrawRectangle(0, 0, screenWidth, 5, RED);
|
DrawRectangle(0, 0, screenWidth, 5, RL_RED);
|
||||||
DrawRectangle(0, 5, 5, screenHeight - 10, RED);
|
DrawRectangle(0, 5, 5, screenHeight - 10, RL_RED);
|
||||||
DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, RED);
|
DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, RL_RED);
|
||||||
DrawRectangle(0, screenHeight - 5, screenWidth, 5, RED);
|
DrawRectangle(0, screenHeight - 5, screenWidth, 5, RL_RED);
|
||||||
|
|
||||||
DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5f));
|
DrawRectangle( 10, 10, 250, 113, Fade(RL_SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines( 10, 10, 250, 113, BLUE);
|
DrawRectangleLines( 10, 10, 250, 113, RL_BLUE);
|
||||||
|
|
||||||
DrawText("Free 2d camera controls:", 20, 20, 10, BLACK);
|
DrawText("Free 2d camera controls:", 20, 20, 10, RL_BLACK);
|
||||||
DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY);
|
DrawText("- Right/Left to move Offset", 40, 40, 10, RL_DARKGRAY);
|
||||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY);
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, RL_DARKGRAY);
|
||||||
DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY);
|
DrawText("- A / S to Rotate", 40, 80, 10, RL_DARKGRAY);
|
||||||
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY);
|
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -59,30 +59,30 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground
|
DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, RL_LIGHTGRAY); // Draw ground
|
||||||
DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
|
DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, RL_BLUE); // Draw a blue wall
|
||||||
DrawCube((Vector3){ 16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, LIME); // Draw a green wall
|
DrawCube((Vector3){ 16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, RL_LIME); // Draw a green wall
|
||||||
DrawCube((Vector3){ 0.0f, 2.5f, 16.0f }, 32.0f, 5.0f, 1.0f, GOLD); // Draw a yellow wall
|
DrawCube((Vector3){ 0.0f, 2.5f, 16.0f }, 32.0f, 5.0f, 1.0f, RL_GOLD); // Draw a yellow wall
|
||||||
|
|
||||||
// Draw some cubes around
|
// Draw some cubes around
|
||||||
for (int i = 0; i < MAX_COLUMNS; i++)
|
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||||
{
|
{
|
||||||
DrawCube(positions[i], 2.0f, heights[i], 2.0f, colors[i]);
|
DrawCube(positions[i], 2.0f, heights[i], 2.0f, colors[i]);
|
||||||
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
|
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, RL_MAROON);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f));
|
DrawRectangle( 10, 10, 220, 70, Fade(RL_SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines( 10, 10, 220, 70, BLUE);
|
DrawRectangleLines( 10, 10, 220, 70, RL_BLUE);
|
||||||
|
|
||||||
DrawText("First person camera default controls:", 20, 20, 10, BLACK);
|
DrawText("First person camera default controls:", 20, 20, 10, RL_BLACK);
|
||||||
DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY);
|
DrawText("- Move with keys: W, A, S, D", 40, 40, 10, RL_DARKGRAY);
|
||||||
DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY);
|
DrawText("- Mouse move to look around", 40, 60, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -49,26 +49,26 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RL_RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RL_MAROON);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5f));
|
DrawRectangle( 10, 10, 320, 133, Fade(RL_SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines( 10, 10, 320, 133, BLUE);
|
DrawRectangleLines( 10, 10, 320, 133, RL_BLUE);
|
||||||
|
|
||||||
DrawText("Free camera default controls:", 20, 20, 10, BLACK);
|
DrawText("Free camera default controls:", 20, 20, 10, RL_BLACK);
|
||||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY);
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, RL_DARKGRAY);
|
||||||
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY);
|
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, RL_DARKGRAY);
|
||||||
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY);
|
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, RL_DARKGRAY);
|
||||||
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY);
|
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, RL_DARKGRAY);
|
||||||
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY);
|
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -45,18 +45,18 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RL_RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RL_MAROON);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
|
DrawText("Welcome to the third dimension!", 10, 40, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,31 +62,31 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
if (collision)
|
if (collision)
|
||||||
{
|
{
|
||||||
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RL_RED);
|
||||||
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RL_MAROON);
|
||||||
|
|
||||||
DrawCubeWires(cubePosition, cubeSize.x + 0.2f, cubeSize.y + 0.2f, cubeSize.z + 0.2f, GREEN);
|
DrawCubeWires(cubePosition, cubeSize.x + 0.2f, cubeSize.y + 0.2f, cubeSize.z + 0.2f, RL_GREEN);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY);
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RL_GRAY);
|
||||||
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY);
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RL_DARKGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRay(ray, MAROON);
|
DrawRay(ray, RL_MAROON);
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
DrawText("Try selecting the box with mouse!", 240, 10, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN);
|
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, RL_GREEN);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
DrawText("Congrats! You created your first window!", 190, 200, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ int main(int argc, char* argv[])
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
DrawText("Congrats! You created your first window!", 190, 200, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,9 @@ void UpdateDrawFrame(void)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
DrawText("Congrats! You created your first window!", 190, 200, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ int main()
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
|
||||||
|
|
||||||
Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
|
Color colors[21] = { RL_DARKGRAY, RL_MAROON, RL_ORANGE, RL_DARKGREEN, RL_DARKBLUE, RL_DARKPURPLE, RL_DARKBROWN,
|
||||||
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
|
RL_GRAY, RL_RED, RL_GOLD, RL_LIME, RL_BLUE, RL_VIOLET, RL_BROWN, RL_LIGHTGRAY, RL_PINK, RL_YELLOW,
|
||||||
GREEN, SKYBLUE, PURPLE, BEIGE };
|
RL_GREEN, RL_SKYBLUE, RL_PURPLE, RL_BEIGE };
|
||||||
|
|
||||||
Rectangle colorsRecs[21]; // Rectangles array
|
Rectangle colorsRecs[21]; // Rectangles array
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
for (int i = 0; i < 21; i++) // Draw all rectangles
|
for (int i = 0; i < 21; i++) // Draw all rectangles
|
||||||
{
|
{
|
||||||
|
|
@ -74,10 +74,10 @@ int main()
|
||||||
// Draw four rectangles around selected rectangle
|
// Draw four rectangles around selected rectangle
|
||||||
if (selected[i])
|
if (selected[i])
|
||||||
{
|
{
|
||||||
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 100, 10, RAYWHITE); // Square top rectangle
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 100, 10, RL_RAYWHITE); // Square top rectangle
|
||||||
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RAYWHITE); // Square left rectangle
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RL_RAYWHITE); // Square left rectangle
|
||||||
DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RAYWHITE); // Square right rectangle
|
DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RL_RAYWHITE); // Square right rectangle
|
||||||
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RL_RAYWHITE); // Square bottom rectangle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ int main(int argc, char* argv[])
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("Check out the console output to see the custom logger in action!", 60, 200, 20, LIGHTGRAY);
|
DrawText("Check out the console output to see the custom logger in action!", 60, 200, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -43,22 +43,22 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
|
if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, RL_DARKGRAY);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
|
DrawText("Dropped files:", 100, 40, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
|
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(RL_LIGHTGRAY, 0.5f));
|
||||||
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
|
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(RL_LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
DrawText(droppedFiles[i], 120, 100 + 40*i, 10, GRAY);
|
DrawText(droppedFiles[i], 120, 100 + 40*i, 10, RL_GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
|
DrawText("Drop new files...", 100, 110 + 40*count, 20, RL_DARKGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
|
@ -83,26 +83,26 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawRectangleRec(touchArea, GRAY);
|
DrawRectangleRec(touchArea, RL_GRAY);
|
||||||
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE);
|
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5f));
|
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(RL_GRAY, 0.5f));
|
||||||
|
|
||||||
for (int i = 0; i < gesturesCount; i++)
|
for (int i = 0; i < gesturesCount; i++)
|
||||||
{
|
{
|
||||||
if (i%2 == 0) DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.5f));
|
if (i%2 == 0) DrawRectangle(10, 30 + 20*i, 200, 20, Fade(RL_LIGHTGRAY, 0.5f));
|
||||||
else DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.3f));
|
else DrawRectangle(10, 30 + 20*i, 200, 20, Fade(RL_LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
if (i < gesturesCount - 1) DrawText(gestureStrings[i], 35, 36 + 20*i, 10, DARKGRAY);
|
if (i < gesturesCount - 1) DrawText(gestureStrings[i], 35, 36 + 20*i, 10, RL_DARKGRAY);
|
||||||
else DrawText(gestureStrings[i], 35, 36 + 20*i, 10, MAROON);
|
else DrawText(gestureStrings[i], 35, 36 + 20*i, 10, RL_MAROON);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY);
|
DrawRectangleLines(10, 29, 200, screenHeight - 50, RL_GRAY);
|
||||||
DrawText("DETECTED GESTURES", 50, 15, 10, GRAY);
|
DrawText("DETECTED GESTURES", 50, 15, 10, RL_GRAY);
|
||||||
|
|
||||||
if (currentGesture != GESTURE_NONE) DrawCircleV(touchPosition, 30, MAROON);
|
if (currentGesture != GESTURE_NONE) DrawCircleV(touchPosition, 30, RL_MAROON);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -55,127 +55,127 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
||||||
{
|
{
|
||||||
DrawText(FormatText("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
|
DrawText(FormatText("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, RL_BLACK);
|
||||||
|
|
||||||
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
|
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
|
||||||
{
|
{
|
||||||
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
DrawTexture(texXboxPad, 0, 0, RL_DARKGRAY);
|
||||||
|
|
||||||
// Draw buttons: xbox home
|
// Draw buttons: xbox home
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_HOME)) DrawCircle(394, 89, 19, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_HOME)) DrawCircle(394, 89, 19, RL_RED);
|
||||||
|
|
||||||
// Draw buttons: basic
|
// Draw buttons: basic
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_START)) DrawCircle(436, 150, 9, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_START)) DrawCircle(436, 150, 9, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_SELECT)) DrawCircle(352, 150, 9, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_SELECT)) DrawCircle(352, 150, 9, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_X)) DrawCircle(501, 151, 15, BLUE);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_X)) DrawCircle(501, 151, 15, RL_BLUE);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_A)) DrawCircle(536, 187, 15, LIME);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_A)) DrawCircle(536, 187, 15, RL_LIME);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_B)) DrawCircle(572, 151, 15, MAROON);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_B)) DrawCircle(572, 151, 15, RL_MAROON);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_Y)) DrawCircle(536, 115, 15, GOLD);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_Y)) DrawCircle(536, 115, 15, RL_GOLD);
|
||||||
|
|
||||||
// Draw buttons: d-pad
|
// Draw buttons: d-pad
|
||||||
DrawRectangle(317, 202, 19, 71, BLACK);
|
DrawRectangle(317, 202, 19, 71, RL_BLACK);
|
||||||
DrawRectangle(293, 228, 69, 19, BLACK);
|
DrawRectangle(293, 228, 69, 19, RL_BLACK);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_UP)) DrawRectangle(317, 202, 19, 26, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LEFT)) DrawRectangle(292, 228, 25, 19, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RL_RED);
|
||||||
|
|
||||||
// Draw buttons: left-right back
|
// Draw buttons: left-right back
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LB)) DrawCircle(259, 61, 20, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LB)) DrawCircle(259, 61, 20, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RB)) DrawCircle(536, 61, 20, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RB)) DrawCircle(536, 61, 20, RL_RED);
|
||||||
|
|
||||||
// Draw axis: left joystick
|
// Draw axis: left joystick
|
||||||
DrawCircle(259, 152, 39, BLACK);
|
DrawCircle(259, 152, 39, RL_BLACK);
|
||||||
DrawCircle(259, 152, 34, LIGHTGRAY);
|
DrawCircle(259, 152, 34, RL_LIGHTGRAY);
|
||||||
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_X)*20),
|
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_X)*20),
|
||||||
152 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_Y)*20), 25, BLACK);
|
152 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_Y)*20), 25, RL_BLACK);
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
DrawCircle(461, 237, 38, BLACK);
|
DrawCircle(461, 237, 38, RL_BLACK);
|
||||||
DrawCircle(461, 237, 33, LIGHTGRAY);
|
DrawCircle(461, 237, 33, RL_LIGHTGRAY);
|
||||||
DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_X)*20),
|
DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_X)*20),
|
||||||
237 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_Y)*20), 25, BLACK);
|
237 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_Y)*20), 25, RL_BLACK);
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(170, 30, 15, 70, GRAY);
|
DrawRectangle(170, 30, 15, 70, RL_GRAY);
|
||||||
DrawRectangle(604, 30, 15, 70, GRAY);
|
DrawRectangle(604, 30, 15, 70, RL_GRAY);
|
||||||
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT))/2.0f)*70), RED);
|
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT))/2.0f)*70), RL_RED);
|
||||||
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT))/2.0f)*70), RED);
|
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT))/2.0f)*70), RL_RED);
|
||||||
|
|
||||||
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, BLACK);
|
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, RL_BLACK);
|
||||||
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, BLACK);
|
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, RL_BLACK);
|
||||||
}
|
}
|
||||||
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
|
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
|
||||||
{
|
{
|
||||||
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
DrawTexture(texPs3Pad, 0, 0, RL_DARKGRAY);
|
||||||
|
|
||||||
// Draw buttons: ps
|
// Draw buttons: ps
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_PS)) DrawCircle(396, 222, 13, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_PS)) DrawCircle(396, 222, 13, RL_RED);
|
||||||
|
|
||||||
// Draw buttons: basic
|
// Draw buttons: basic
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SELECT)) DrawRectangle(328, 170, 32, 13, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SELECT)) DrawRectangle(328, 170, 32, 13, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_START)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_START)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_TRIANGLE)) DrawCircle(557, 144, 13, LIME);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_TRIANGLE)) DrawCircle(557, 144, 13, RL_LIME);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CIRCLE)) DrawCircle(586, 173, 13, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CIRCLE)) DrawCircle(586, 173, 13, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CROSS)) DrawCircle(557, 203, 13, VIOLET);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CROSS)) DrawCircle(557, 203, 13, RL_VIOLET);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SQUARE)) DrawCircle(527, 173, 13, PINK);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SQUARE)) DrawCircle(527, 173, 13, RL_PINK);
|
||||||
|
|
||||||
// Draw buttons: d-pad
|
// Draw buttons: d-pad
|
||||||
DrawRectangle(225, 132, 24, 84, BLACK);
|
DrawRectangle(225, 132, 24, 84, RL_BLACK);
|
||||||
DrawRectangle(195, 161, 84, 25, BLACK);
|
DrawRectangle(195, 161, 84, 25, RL_BLACK);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_UP)) DrawRectangle(225, 132, 24, 29, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_LEFT)) DrawRectangle(195, 161, 30, 25, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RL_RED);
|
||||||
|
|
||||||
// Draw buttons: left-right back buttons
|
// Draw buttons: left-right back buttons
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_L1)) DrawCircle(239, 82, 20, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_L1)) DrawCircle(239, 82, 20, RL_RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_R1)) DrawCircle(557, 82, 20, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_R1)) DrawCircle(557, 82, 20, RL_RED);
|
||||||
|
|
||||||
// Draw axis: left joystick
|
// Draw axis: left joystick
|
||||||
DrawCircle(319, 255, 35, BLACK);
|
DrawCircle(319, 255, 35, RL_BLACK);
|
||||||
DrawCircle(319, 255, 31, LIGHTGRAY);
|
DrawCircle(319, 255, 31, RL_LIGHTGRAY);
|
||||||
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_X)*20),
|
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_X)*20),
|
||||||
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_Y)*20), 25, BLACK);
|
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_Y)*20), 25, RL_BLACK);
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
DrawCircle(475, 255, 35, BLACK);
|
DrawCircle(475, 255, 35, RL_BLACK);
|
||||||
DrawCircle(475, 255, 31, LIGHTGRAY);
|
DrawCircle(475, 255, 31, RL_LIGHTGRAY);
|
||||||
DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_X)*20),
|
DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_X)*20),
|
||||||
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_Y)*20), 25, BLACK);
|
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_Y)*20), 25, RL_BLACK);
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(169, 48, 15, 70, GRAY);
|
DrawRectangle(169, 48, 15, 70, RL_GRAY);
|
||||||
DrawRectangle(611, 48, 15, 70, GRAY);
|
DrawRectangle(611, 48, 15, 70, RL_GRAY);
|
||||||
DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_L2))/2.0f)*70), RED);
|
DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_L2))/2.0f)*70), RL_RED);
|
||||||
DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_R2))/2.0f)*70), RED);
|
DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_R2))/2.0f)*70), RL_RED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY);
|
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, RL_GRAY);
|
||||||
|
|
||||||
// TODO: Draw generic gamepad
|
// TODO: Draw generic gamepad
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
|
DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, RL_MAROON);
|
||||||
|
|
||||||
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
|
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
|
||||||
{
|
{
|
||||||
DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, RL_DARKGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
|
if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RL_RED);
|
||||||
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
|
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, RL_GRAY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY);
|
DrawText("GP1: NOT DETECTED", 10, 10, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
|
DrawTexture(texXboxPad, 0, 0, RL_LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
|
DrawText("move the ball with arrow keys", 10, 10, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawCircleV(ballPosition, 50, MAROON);
|
DrawCircleV(ballPosition, 50, RL_MAROON);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ int main()
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
|
||||||
|
|
||||||
Vector2 ballPosition = { -100.0f, -100.0f };
|
Vector2 ballPosition = { -100.0f, -100.0f };
|
||||||
Color ballColor = DARKBLUE;
|
Color ballColor = RL_DARKBLUE;
|
||||||
|
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
@ -33,20 +33,20 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
ballPosition = GetMousePosition();
|
ballPosition = GetMousePosition();
|
||||||
|
|
||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = RL_MAROON;
|
||||||
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
|
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = RL_LIME;
|
||||||
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
|
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = RL_DARKBLUE;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawCircleV(ballPosition, 40, ballColor);
|
DrawCircleV(ballPosition, 40, ballColor);
|
||||||
|
|
||||||
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,12 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
|
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, RL_MAROON);
|
||||||
|
|
||||||
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
|
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, RL_GRAY);
|
||||||
DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
|
DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
ballPosition = GetMousePosition();
|
ballPosition = GetMousePosition();
|
||||||
|
|
||||||
ballColor = BEIGE;
|
ballColor = RL_BEIGE;
|
||||||
|
|
||||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
|
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) ballColor = RL_MAROON;
|
||||||
if (IsMouseButtonDown(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
|
if (IsMouseButtonDown(MOUSE_MIDDLE_BUTTON)) ballColor = RL_LIME;
|
||||||
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
|
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) ballColor = RL_DARKBLUE;
|
||||||
|
|
||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) PressedCounter = 10;
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) PressedCounter = 10;
|
||||||
if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) PressedCounter = 10;
|
if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) PressedCounter = 10;
|
||||||
|
|
@ -55,7 +55,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Multitouch
|
// Multitouch
|
||||||
for (int i = 0; i < RL_MAX_TOUCH_POINTS; ++i)
|
for (int i = 0; i < RL_MAX_TOUCH_POINTS; ++i)
|
||||||
|
|
@ -64,18 +64,18 @@ int main()
|
||||||
|
|
||||||
if( (TouchPos.x >= 0) && (TouchPos.y >= 0) ) // Make sure point is not (-1,-1) as this means there is no touch for it
|
if( (TouchPos.x >= 0) && (TouchPos.y >= 0) ) // Make sure point is not (-1,-1) as this means there is no touch for it
|
||||||
{
|
{
|
||||||
DrawCircleV(TouchPos, 34, ORANGE); // Draw a circle there
|
DrawCircleV(TouchPos, 34, RL_ORANGE); // Draw a circle there
|
||||||
|
|
||||||
sprintf(Str,"%d",i);
|
sprintf(Str,"%d",i);
|
||||||
DrawText(Str, TouchPos.x - 10, TouchPos.y - 70, 40, BLACK); // Also show its index number
|
DrawText(Str, TouchPos.x - 10, TouchPos.y - 70, 40, RL_BLACK); // Also show its index number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the normal mouse location
|
// Draw the normal mouse location
|
||||||
DrawCircleV(ballPosition, 30 + (PressedCounter * 3), ballColor);
|
DrawCircleV(ballPosition, 30 + (PressedCounter * 3), ballColor);
|
||||||
|
|
||||||
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, RL_DARKGRAY);
|
||||||
DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, DARKGRAY);
|
DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
|
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, RL_MAROON);
|
||||||
|
|
||||||
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
|
DrawText(FormatText("%i", randValue), 360, 180, 80, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -61,16 +61,16 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText(FormatText("SCORE: %i", score), 280, 130, 40, MAROON);
|
DrawText(FormatText("SCORE: %i", score), 280, 130, 40, RL_MAROON);
|
||||||
DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
|
DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, RL_BLACK);
|
||||||
|
|
||||||
DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, LIME);
|
DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, RL_LIME);
|
||||||
|
|
||||||
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY);
|
DrawText("Press R to generate random numbers", 220, 40, 20, RL_LIGHTGRAY);
|
||||||
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY);
|
DrawText("Press ENTER to SAVE values", 250, 310, 20, RL_LIGHTGRAY);
|
||||||
DrawText("Press SPACE to LOAD values", 252, 350, 20, LIGHTGRAY);
|
DrawText("Press SPACE to LOAD values", 252, 350, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -54,14 +54,14 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginVrDrawing();
|
BeginVrDrawing();
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RL_RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RL_MAROON);
|
||||||
|
|
||||||
DrawGrid(40, 1.0f);
|
DrawGrid(40, 1.0f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,19 +52,19 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RL_RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RL_MAROON);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, cubeScreenPosition.y, 20, BLACK);
|
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, cubeScreenPosition.y, 20, RL_BLACK);
|
||||||
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2, 25, 20, GRAY);
|
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2, 25, 20, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -48,13 +48,13 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
|
DrawBillboard(camera, bill, billPosition, 2.0f, RL_WHITE);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ int main()
|
||||||
|
|
||||||
Vector3 playerPosition = { 0.0f, 1.0f, 2.0f };
|
Vector3 playerPosition = { 0.0f, 1.0f, 2.0f };
|
||||||
Vector3 playerSize = { 1.0f, 2.0f, 1.0f };
|
Vector3 playerSize = { 1.0f, 2.0f, 1.0f };
|
||||||
Color playerColor = GREEN;
|
Color playerColor = RL_GREEN;
|
||||||
|
|
||||||
Vector3 enemyBoxPos = { -4.0f, 1.0f, 0.0f };
|
Vector3 enemyBoxPos = { -4.0f, 1.0f, 0.0f };
|
||||||
Vector3 enemyBoxSize = { 2.0f, 2.0f, 2.0f };
|
Vector3 enemyBoxSize = { 2.0f, 2.0f, 2.0f };
|
||||||
|
|
@ -77,25 +77,25 @@ int main()
|
||||||
playerPosition.z + playerSize.z/2 }},
|
playerPosition.z + playerSize.z/2 }},
|
||||||
enemySpherePos, enemySphereSize)) collision = true;
|
enemySpherePos, enemySphereSize)) collision = true;
|
||||||
|
|
||||||
if (collision) playerColor = RED;
|
if (collision) playerColor = RL_RED;
|
||||||
else playerColor = GREEN;
|
else playerColor = RL_GREEN;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
// Draw enemy-box
|
// Draw enemy-box
|
||||||
DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, GRAY);
|
DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, RL_GRAY);
|
||||||
DrawCubeWires(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, DARKGRAY);
|
DrawCubeWires(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, RL_DARKGRAY);
|
||||||
|
|
||||||
// Draw enemy-sphere
|
// Draw enemy-sphere
|
||||||
DrawSphere(enemySpherePos, enemySphereSize, GRAY);
|
DrawSphere(enemySpherePos, enemySphereSize, RL_GRAY);
|
||||||
DrawSphereWires(enemySpherePos, enemySphereSize, 16, 16, DARKGRAY);
|
DrawSphereWires(enemySpherePos, enemySphereSize, 16, 16, RL_DARKGRAY);
|
||||||
|
|
||||||
// Draw player
|
// Draw player
|
||||||
DrawCubeV(playerPosition, playerSize, playerColor);
|
DrawCubeV(playerPosition, playerSize, playerColor);
|
||||||
|
|
@ -104,7 +104,7 @@ int main()
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Move player with cursors to collide", 220, 40, 20, GRAY);
|
DrawText("Move player with cursors to collide", 220, 40, 20, RL_GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,19 +54,19 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, mapPosition, 1.0f, WHITE);
|
DrawModel(model, mapPosition, 1.0f, RL_WHITE);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
|
DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, RL_WHITE);
|
||||||
DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN);
|
DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, RL_GREEN);
|
||||||
|
|
||||||
DrawText("cubicmap image used to", 658, 90, 10, GRAY);
|
DrawText("cubicmap image used to", 658, 90, 10, RL_GRAY);
|
||||||
DrawText("generate map 3d model", 658, 104, 10, GRAY);
|
DrawText("generate map 3d model", 658, 104, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,23 +43,23 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED);
|
DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RL_RED);
|
||||||
DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD);
|
DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RL_GOLD);
|
||||||
DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, MAROON);
|
DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, RL_MAROON);
|
||||||
|
|
||||||
DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, GREEN);
|
DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, RL_GREEN);
|
||||||
DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, LIME);
|
DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, RL_LIME);
|
||||||
|
|
||||||
DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, SKYBLUE);
|
DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, RL_SKYBLUE);
|
||||||
DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, DARKBLUE);
|
DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, RL_DARKBLUE);
|
||||||
DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, BROWN);
|
DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, RL_BROWN);
|
||||||
|
|
||||||
DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD);
|
DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, RL_GOLD);
|
||||||
DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK);
|
DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, RL_PINK);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,18 +51,18 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, mapPosition, 1.0f, RED);
|
DrawModel(model, mapPosition, 1.0f, RL_RED);
|
||||||
|
|
||||||
DrawGrid(20, 1.0f);
|
DrawGrid(20, 1.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE);
|
DrawTexture(texture, screenWidth - texture.width - 20, 20, RL_WHITE);
|
||||||
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN);
|
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, RL_GREEN);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, Vector3Zero(), 1.0f, WHITE);
|
DrawModel(model, Vector3Zero(), 1.0f, RL_WHITE);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ int main()
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - mesh generation");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - mesh generation");
|
||||||
|
|
||||||
// We generate a checked image for texturing
|
// We generate a checked image for texturing
|
||||||
Image checked = GenImageChecked(2, 2, 1, 1, RED, GREEN);
|
Image checked = GenImageChecked(2, 2, 1, 1, RL_RED, RL_GREEN);
|
||||||
Texture2D texture = LoadTextureFromImage(checked);
|
Texture2D texture = LoadTextureFromImage(checked);
|
||||||
UnloadImage(checked);
|
UnloadImage(checked);
|
||||||
|
|
||||||
|
|
@ -71,30 +71,30 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(models[currentModel], position, 1.0f, WHITE);
|
DrawModel(models[currentModel], position, 1.0f, RL_WHITE);
|
||||||
|
|
||||||
DrawGrid(10, 1.0);
|
DrawGrid(10, 1.0);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawRectangle(30, 400, 310, 30, Fade(SKYBLUE, 0.5f));
|
DrawRectangle(30, 400, 310, 30, Fade(RL_SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines(30, 400, 310, 30, Fade(DARKBLUE, 0.5f));
|
DrawRectangleLines(30, 400, 310, 30, Fade(RL_DARKBLUE, 0.5f));
|
||||||
DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL MODELS", 40, 410, 10, BLUE);
|
DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL MODELS", 40, 410, 10, RL_BLUE);
|
||||||
|
|
||||||
switch(currentModel)
|
switch(currentModel)
|
||||||
{
|
{
|
||||||
case 0: DrawText("PLANE", 680, 10, 20, DARKBLUE); break;
|
case 0: DrawText("PLANE", 680, 10, 20, RL_DARKBLUE); break;
|
||||||
case 1: DrawText("CUBE", 680, 10, 20, DARKBLUE); break;
|
case 1: DrawText("CUBE", 680, 10, 20, RL_DARKBLUE); break;
|
||||||
case 2: DrawText("SPHERE", 680, 10, 20, DARKBLUE); break;
|
case 2: DrawText("SPHERE", 680, 10, 20, RL_DARKBLUE); break;
|
||||||
case 3: DrawText("HEMISPHERE", 640, 10, 20, DARKBLUE); break;
|
case 3: DrawText("HEMISPHERE", 640, 10, 20, RL_DARKBLUE); break;
|
||||||
case 4: DrawText("CYLINDER", 680, 10, 20, DARKBLUE); break;
|
case 4: DrawText("CYLINDER", 680, 10, 20, RL_DARKBLUE); break;
|
||||||
case 5: DrawText("TORUS", 680, 10, 20, DARKBLUE); break;
|
case 5: DrawText("TORUS", 680, 10, 20, RL_DARKBLUE); break;
|
||||||
case 6: DrawText("KNOT", 680, 10, 20, DARKBLUE); break;
|
case 6: DrawText("KNOT", 680, 10, 20, RL_DARKBLUE); break;
|
||||||
case 7: DrawText("POLY", 680, 10, 20, DARKBLUE); break;
|
case 7: DrawText("POLY", 680, 10, 20, RL_DARKBLUE); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ int main()
|
||||||
char *hitObjectName = "None";
|
char *hitObjectName = "None";
|
||||||
nearestHit.distance = FLT_MAX;
|
nearestHit.distance = FLT_MAX;
|
||||||
nearestHit.hit = false;
|
nearestHit.hit = false;
|
||||||
Color cursorColor = WHITE;
|
Color cursorColor = RL_WHITE;
|
||||||
|
|
||||||
// Get ray and test against ground, triangle, and mesh
|
// Get ray and test against ground, triangle, and mesh
|
||||||
ray = GetMouseRay(GetMousePosition(), camera);
|
ray = GetMouseRay(GetMousePosition(), camera);
|
||||||
|
|
@ -77,7 +77,7 @@ int main()
|
||||||
if ((groundHitInfo.hit) && (groundHitInfo.distance < nearestHit.distance))
|
if ((groundHitInfo.hit) && (groundHitInfo.distance < nearestHit.distance))
|
||||||
{
|
{
|
||||||
nearestHit = groundHitInfo;
|
nearestHit = groundHitInfo;
|
||||||
cursorColor = GREEN;
|
cursorColor = RL_GREEN;
|
||||||
hitObjectName = "Ground";
|
hitObjectName = "Ground";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ int main()
|
||||||
if ((triHitInfo.hit) && (triHitInfo.distance < nearestHit.distance))
|
if ((triHitInfo.hit) && (triHitInfo.distance < nearestHit.distance))
|
||||||
{
|
{
|
||||||
nearestHit = triHitInfo;
|
nearestHit = triHitInfo;
|
||||||
cursorColor = PURPLE;
|
cursorColor = RL_PURPLE;
|
||||||
hitObjectName = "Triangle";
|
hitObjectName = "Triangle";
|
||||||
|
|
||||||
bary = Vector3Barycenter(nearestHit.position, ta, tb, tc);
|
bary = Vector3Barycenter(nearestHit.position, ta, tb, tc);
|
||||||
|
|
@ -109,7 +109,7 @@ int main()
|
||||||
if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance))
|
if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance))
|
||||||
{
|
{
|
||||||
nearestHit = meshHitInfo;
|
nearestHit = meshHitInfo;
|
||||||
cursorColor = ORANGE;
|
cursorColor = RL_ORANGE;
|
||||||
hitObjectName = "Mesh";
|
hitObjectName = "Mesh";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,68 +122,68 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
// Draw the tower
|
// Draw the tower
|
||||||
// WARNING: If scale is different than 1.0f,
|
// WARNING: If scale is different than 1.0f,
|
||||||
// not considered by GetCollisionRayModel()
|
// not considered by GetCollisionRayModel()
|
||||||
DrawModel(tower, towerPos, 1.0f, WHITE);
|
DrawModel(tower, towerPos, 1.0f, RL_WHITE);
|
||||||
|
|
||||||
// Draw the test triangle
|
// Draw the test triangle
|
||||||
DrawLine3D(ta, tb, PURPLE);
|
DrawLine3D(ta, tb, RL_PURPLE);
|
||||||
DrawLine3D(tb, tc, PURPLE);
|
DrawLine3D(tb, tc, RL_PURPLE);
|
||||||
DrawLine3D(tc, ta, PURPLE);
|
DrawLine3D(tc, ta, RL_PURPLE);
|
||||||
|
|
||||||
// Draw the mesh bbox if we hit it
|
// Draw the mesh bbox if we hit it
|
||||||
if (hitMeshBBox) DrawBoundingBox(towerBBox, LIME);
|
if (hitMeshBBox) DrawBoundingBox(towerBBox, RL_LIME);
|
||||||
|
|
||||||
// If we hit something, draw the cursor at the hit point
|
// If we hit something, draw the cursor at the hit point
|
||||||
if (nearestHit.hit)
|
if (nearestHit.hit)
|
||||||
{
|
{
|
||||||
DrawCube(nearestHit.position, 0.3, 0.3, 0.3, cursorColor);
|
DrawCube(nearestHit.position, 0.3, 0.3, 0.3, cursorColor);
|
||||||
DrawCubeWires(nearestHit.position, 0.3, 0.3, 0.3, RED);
|
DrawCubeWires(nearestHit.position, 0.3, 0.3, 0.3, RL_RED);
|
||||||
|
|
||||||
Vector3 normalEnd;
|
Vector3 normalEnd;
|
||||||
normalEnd.x = nearestHit.position.x + nearestHit.normal.x;
|
normalEnd.x = nearestHit.position.x + nearestHit.normal.x;
|
||||||
normalEnd.y = nearestHit.position.y + nearestHit.normal.y;
|
normalEnd.y = nearestHit.position.y + nearestHit.normal.y;
|
||||||
normalEnd.z = nearestHit.position.z + nearestHit.normal.z;
|
normalEnd.z = nearestHit.position.z + nearestHit.normal.z;
|
||||||
|
|
||||||
DrawLine3D(nearestHit.position, normalEnd, RED);
|
DrawLine3D(nearestHit.position, normalEnd, RL_RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRay(ray, MAROON);
|
DrawRay(ray, RL_MAROON);
|
||||||
|
|
||||||
DrawGrid(10, 10.0f);
|
DrawGrid(10, 10.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
// Draw some debug GUI text
|
// Draw some debug GUI text
|
||||||
DrawText(FormatText("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
|
DrawText(FormatText("Hit Object: %s", hitObjectName), 10, 50, 10, RL_BLACK);
|
||||||
|
|
||||||
if (nearestHit.hit)
|
if (nearestHit.hit)
|
||||||
{
|
{
|
||||||
int ypos = 70;
|
int ypos = 70;
|
||||||
|
|
||||||
DrawText(FormatText("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK);
|
DrawText(FormatText("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, RL_BLACK);
|
||||||
|
|
||||||
DrawText(FormatText("Hit Pos: %3.2f %3.2f %3.2f",
|
DrawText(FormatText("Hit Pos: %3.2f %3.2f %3.2f",
|
||||||
nearestHit.position.x,
|
nearestHit.position.x,
|
||||||
nearestHit.position.y,
|
nearestHit.position.y,
|
||||||
nearestHit.position.z), 10, ypos + 15, 10, BLACK);
|
nearestHit.position.z), 10, ypos + 15, 10, RL_BLACK);
|
||||||
|
|
||||||
DrawText(FormatText("Hit Norm: %3.2f %3.2f %3.2f",
|
DrawText(FormatText("Hit Norm: %3.2f %3.2f %3.2f",
|
||||||
nearestHit.normal.x,
|
nearestHit.normal.x,
|
||||||
nearestHit.normal.y,
|
nearestHit.normal.y,
|
||||||
nearestHit.normal.z), 10, ypos + 30, 10, BLACK);
|
nearestHit.normal.z), 10, ypos + 30, 10, RL_BLACK);
|
||||||
|
|
||||||
if (hitTriangle) DrawText(FormatText("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
|
if (hitTriangle) DrawText(FormatText("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, RL_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);
|
DrawText("Use Mouse to Move Camera", 10, 430, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, position, 0.2f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 0.2f, RL_WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ int main()
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("(c) Castle 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Castle 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,29 +86,29 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, position, 1.0f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 1.0f, RL_WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(20.0, 10.0); // Draw a grid
|
DrawGrid(20.0, 10.0); // Draw a grid
|
||||||
|
|
||||||
if (selected) DrawBoundingBox(bounds, GREEN);
|
if (selected) DrawBoundingBox(bounds, RL_GREEN);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Free camera default controls:", 10, 20, 10, DARKGRAY);
|
DrawText("Free camera default controls:", 10, 20, 10, RL_DARKGRAY);
|
||||||
DrawText("- Mouse Wheel to Zoom in-out", 20, 40, 10, GRAY);
|
DrawText("- Mouse Wheel to Zoom in-out", 20, 40, 10, RL_GRAY);
|
||||||
DrawText("- Mouse Wheel Pressed to Pan", 20, 60, 10, GRAY);
|
DrawText("- Mouse Wheel Pressed to Pan", 20, 60, 10, RL_GRAY);
|
||||||
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 20, 80, 10, GRAY);
|
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 20, 80, 10, RL_GRAY);
|
||||||
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 20, 100, 10, GRAY);
|
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 20, 100, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawText("Drag & drop .obj/.png to load mesh/texture.", 10, GetScreenHeight() - 20, 10, DARKGRAY);
|
DrawText("Drag & drop .obj/.png to load mesh/texture.", 10, GetScreenHeight() - 20, 10, RL_DARKGRAY);
|
||||||
DrawText(FormatText("Current file: %s", objFilename), 250, GetScreenHeight() - 20, 10, GRAY);
|
DrawText(FormatText("Current file: %s", objFilename), 250, GetScreenHeight() - 20, 10, RL_GRAY);
|
||||||
if (selected) DrawText("MODEL SELECTED", GetScreenWidth() - 110, 10, 10, GREEN);
|
if (selected) DrawText("MODEL SELECTED", GetScreenWidth() - 110, 10, 10, RL_GREEN);
|
||||||
|
|
||||||
DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -55,32 +55,32 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED);
|
DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RL_RED);
|
||||||
DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD);
|
DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RL_GOLD);
|
||||||
DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, MAROON);
|
DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, RL_MAROON);
|
||||||
|
|
||||||
DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, GREEN);
|
DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, RL_GREEN);
|
||||||
DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, LIME);
|
DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, RL_LIME);
|
||||||
|
|
||||||
DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, SKYBLUE);
|
DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, RL_SKYBLUE);
|
||||||
DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, DARKBLUE);
|
DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, RL_DARKBLUE);
|
||||||
DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, BROWN);
|
DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, RL_BROWN);
|
||||||
|
|
||||||
DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD);
|
DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, RL_GOLD);
|
||||||
DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK);
|
DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, RL_PINK);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Press Spacebar to switch camera type", 10, GetScreenHeight() - 30, 20, DARKGRAY);
|
DrawText("Press Spacebar to switch camera type", 10, GetScreenHeight() - 30, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
if (camera.type == CAMERA_ORTHOGRAPHIC) DrawText("ORTHOGRAPHIC", 10, 40, 20, BLACK);
|
if (camera.type == CAMERA_ORTHOGRAPHIC) DrawText("ORTHOGRAPHIC", 10, 40, 20, RL_BLACK);
|
||||||
else if (camera.type == CAMERA_PERSPECTIVE) DrawText("PERSPECTIVE", 10, 40, 20, BLACK);
|
else if (camera.type == CAMERA_PERSPECTIVE) DrawText("PERSPECTIVE", 10, 40, 20, RL_BLACK);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,13 +74,13 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
rlPushMatrix();
|
rlPushMatrix();
|
||||||
rlScalef(sunRadius, sunRadius, sunRadius); // Scale Sun
|
rlScalef(sunRadius, sunRadius, sunRadius); // Scale Sun
|
||||||
DrawSphereBasic(GOLD); // Draw the Sun
|
DrawSphereBasic(RL_GOLD); // Draw the Sun
|
||||||
rlPopMatrix();
|
rlPopMatrix();
|
||||||
|
|
||||||
rlPushMatrix();
|
rlPushMatrix();
|
||||||
|
|
@ -92,7 +92,7 @@ int main()
|
||||||
rlRotatef(earthRotation, 0.25, 1.0, 0.0); // Rotation for Earth itself
|
rlRotatef(earthRotation, 0.25, 1.0, 0.0); // Rotation for Earth itself
|
||||||
rlScalef(earthRadius, earthRadius, earthRadius);// Scale Earth
|
rlScalef(earthRadius, earthRadius, earthRadius);// Scale Earth
|
||||||
|
|
||||||
DrawSphereBasic(BLUE); // Draw the Earth
|
DrawSphereBasic(RL_BLUE); // Draw the Earth
|
||||||
rlPopMatrix();
|
rlPopMatrix();
|
||||||
|
|
||||||
rlRotatef(moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth
|
rlRotatef(moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth
|
||||||
|
|
@ -101,16 +101,16 @@ int main()
|
||||||
rlRotatef(moonRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon itself
|
rlRotatef(moonRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon itself
|
||||||
rlScalef(moonRadius, moonRadius, moonRadius); // Scale Moon
|
rlScalef(moonRadius, moonRadius, moonRadius); // Scale Moon
|
||||||
|
|
||||||
DrawSphereBasic(LIGHTGRAY); // Draw the Moon
|
DrawSphereBasic(RL_LIGHTGRAY); // Draw the Moon
|
||||||
rlPopMatrix();
|
rlPopMatrix();
|
||||||
|
|
||||||
// Some reference elements (not affected by previous matrix transformations)
|
// Some reference elements (not affected by previous matrix transformations)
|
||||||
DrawCircle3D((Vector3){ 0.0f, 0.0f, 0.0f }, earthOrbitRadius, (Vector3){ 1, 0, 0 }, 90.0f, Fade(RED, 0.5f));
|
DrawCircle3D((Vector3){ 0.0f, 0.0f, 0.0f }, earthOrbitRadius, (Vector3){ 1, 0, 0 }, 90.0f, Fade(RL_RED, 0.5f));
|
||||||
DrawGrid(20, 1.0f);
|
DrawGrid(20, 1.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("EARTH ORBITING AROUND THE SUN!", 400, 10, 20, MAROON);
|
DrawText("EARTH ORBITING AROUND THE SUN!", 400, 10, 20, RL_MAROON);
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
|
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, RL_WHITE);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw framebuffer texture (Ahrs Display)
|
// Draw framebuffer texture (Ahrs Display)
|
||||||
int centerX = framebuffer.texture.width/2;
|
int centerX = framebuffer.texture.width/2;
|
||||||
|
|
@ -121,15 +121,15 @@ int main()
|
||||||
|
|
||||||
DrawTexturePro(texBackground, (Rectangle){ 0, 0, texBackground.width, texBackground.height },
|
DrawTexturePro(texBackground, (Rectangle){ 0, 0, texBackground.width, texBackground.height },
|
||||||
(Rectangle){ centerX, centerY, texBackground.width*scaleFactor, texBackground.height*scaleFactor},
|
(Rectangle){ centerX, centerY, texBackground.width*scaleFactor, texBackground.height*scaleFactor},
|
||||||
(Vector2){ texBackground.width/2*scaleFactor, texBackground.height/2*scaleFactor + pitchOffset*scaleFactor }, roll, WHITE);
|
(Vector2){ texBackground.width/2*scaleFactor, texBackground.height/2*scaleFactor + pitchOffset*scaleFactor }, roll, RL_WHITE);
|
||||||
|
|
||||||
DrawTexturePro(texPitch, (Rectangle){ 0, 0, texPitch.width, texPitch.height },
|
DrawTexturePro(texPitch, (Rectangle){ 0, 0, texPitch.width, texPitch.height },
|
||||||
(Rectangle){ centerX, centerY, texPitch.width*scaleFactor, texPitch.height*scaleFactor },
|
(Rectangle){ centerX, centerY, texPitch.width*scaleFactor, texPitch.height*scaleFactor },
|
||||||
(Vector2){ texPitch.width/2*scaleFactor, texPitch.height/2*scaleFactor + pitchOffset*scaleFactor }, roll, WHITE);
|
(Vector2){ texPitch.width/2*scaleFactor, texPitch.height/2*scaleFactor + pitchOffset*scaleFactor }, roll, RL_WHITE);
|
||||||
|
|
||||||
DrawTexturePro(texPlane, (Rectangle){ 0, 0, texPlane.width, texPlane.height },
|
DrawTexturePro(texPlane, (Rectangle){ 0, 0, texPlane.width, texPlane.height },
|
||||||
(Rectangle){ centerX, centerY, texPlane.width*scaleFactor, texPlane.height*scaleFactor },
|
(Rectangle){ centerX, centerY, texPlane.width*scaleFactor, texPlane.height*scaleFactor },
|
||||||
(Vector2){ texPlane.width/2*scaleFactor, texPlane.height/2*scaleFactor }, 0, WHITE);
|
(Vector2){ texPlane.width/2*scaleFactor, texPlane.height/2*scaleFactor }, 0, RL_WHITE);
|
||||||
|
|
||||||
EndBlendMode();
|
EndBlendMode();
|
||||||
|
|
||||||
|
|
@ -138,27 +138,27 @@ int main()
|
||||||
// Draw 3D model (recomended to draw 3D always before 2D)
|
// Draw 3D model (recomended to draw 3D always before 2D)
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, (Vector3){ 0, 6.0f, 0 }, 1.0f, WHITE); // Draw 3d model with texture
|
DrawModel(model, (Vector3){ 0, 6.0f, 0 }, 1.0f, RL_WHITE); // Draw 3d model with texture
|
||||||
DrawGrid(10, 10.0f);
|
DrawGrid(10, 10.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
// Draw 2D GUI stuff
|
// Draw 2D GUI stuff
|
||||||
DrawAngleGauge(texAngleGauge, 80, 70, roll, "roll", RED);
|
DrawAngleGauge(texAngleGauge, 80, 70, roll, "roll", RL_RED);
|
||||||
DrawAngleGauge(texAngleGauge, 190, 70, pitch, "pitch", GREEN);
|
DrawAngleGauge(texAngleGauge, 190, 70, pitch, "pitch", RL_GREEN);
|
||||||
DrawAngleGauge(texAngleGauge, 300, 70, yaw, "yaw", SKYBLUE);
|
DrawAngleGauge(texAngleGauge, 300, 70, yaw, "yaw", RL_SKYBLUE);
|
||||||
|
|
||||||
DrawRectangle(30, 360, 260, 70, Fade(SKYBLUE, 0.5f));
|
DrawRectangle(30, 360, 260, 70, Fade(RL_SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines(30, 360, 260, 70, Fade(DARKBLUE, 0.5f));
|
DrawRectangleLines(30, 360, 260, 70, Fade(RL_DARKBLUE, 0.5f));
|
||||||
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 370, 10, DARKGRAY);
|
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 370, 10, RL_DARKGRAY);
|
||||||
DrawText("Roll controlled with: KEY_LEFT / KEY_RIGHT", 40, 390, 10, DARKGRAY);
|
DrawText("Roll controlled with: KEY_LEFT / KEY_RIGHT", 40, 390, 10, RL_DARKGRAY);
|
||||||
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 410, 10, DARKGRAY);
|
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 410, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
// Draw framebuffer texture
|
// Draw framebuffer texture
|
||||||
DrawTextureRec(framebuffer.texture, (Rectangle){ 0, 0, framebuffer.texture.width, -framebuffer.texture.height },
|
DrawTextureRec(framebuffer.texture, (Rectangle){ 0, 0, framebuffer.texture.width, -framebuffer.texture.height },
|
||||||
(Vector2){ screenWidth - framebuffer.texture.width - 20, 20 }, Fade(WHITE, 0.8f));
|
(Vector2){ screenWidth - framebuffer.texture.width - 20, 20 }, Fade(RL_WHITE, 0.8f));
|
||||||
|
|
||||||
DrawRectangleLines(screenWidth - framebuffer.texture.width - 20, 20, framebuffer.texture.width, framebuffer.texture.height, DARKGRAY);
|
DrawRectangleLines(screenWidth - framebuffer.texture.width - 20, 20, framebuffer.texture.width, framebuffer.texture.height, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -193,6 +193,6 @@ void DrawAngleGauge(Texture2D angleGauge, int x, int y, float angle, char title[
|
||||||
|
|
||||||
DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color);
|
DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color);
|
||||||
|
|
||||||
DrawText(FormatText("%5.1f", angle), x - MeasureText(FormatText("%5.1f", angle), textSize) / 2, y + 10, textSize, DARKGRAY);
|
DrawText(FormatText("%5.1f", angle), x - MeasureText(FormatText("%5.1f", angle), textSize) / 2, y + 10, textSize, RL_DARKGRAY);
|
||||||
DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, DARKGRAY);
|
DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, RL_DARKGRAY);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
for (int i = 0; i < bunniesCount; i++)
|
for (int i = 0; i < bunniesCount; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -78,12 +78,12 @@ int main()
|
||||||
// batching buffer starts being filled again; before launching the draw call,
|
// batching buffer starts being filled again; before launching the draw call,
|
||||||
// updated vertex data from internal buffer is send to GPU... it seems it generates
|
// updated vertex data from internal buffer is send to GPU... it seems it generates
|
||||||
// a stall and consequently a frame drop, limiting number of bunnies drawn at 60 fps
|
// a stall and consequently a frame drop, limiting number of bunnies drawn at 60 fps
|
||||||
DrawTexture(texBunny, bunnies[i].position.x, bunnies[i].position.y, RAYWHITE);
|
DrawTexture(texBunny, bunnies[i].position.x, bunnies[i].position.y, RL_RAYWHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRectangle(0, 0, screenWidth, 40, LIGHTGRAY);
|
DrawRectangle(0, 0, screenWidth, 40, RL_LIGHTGRAY);
|
||||||
DrawText("raylib bunnymark", 10, 10, 20, DARKGRAY);
|
DrawText("raylib bunnymark", 10, 10, 20, RL_DARKGRAY);
|
||||||
DrawText(FormatText("bunnies: %i", bunniesCount), 400, 10, 20, RED);
|
DrawText(FormatText("bunnies: %i", bunniesCount), 400, 10, 20, RL_RED);
|
||||||
DrawFPS(260, 10);
|
DrawFPS(260, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
|
@ -68,19 +68,19 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawAnimatedModel(model, Vector3Zero(), 1.0f, WHITE); // Draw animated model
|
DrawAnimatedModel(model, Vector3Zero(), 1.0f, RL_WHITE); // Draw animated model
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("PRESS SPACE to PLAY IQM MODEL ANIMATION", 10, 10, 20, MAROON);
|
DrawText("PRESS SPACE to PLAY IQM MODEL ANIMATION", 10, 10, 20, RL_MAROON);
|
||||||
|
|
||||||
DrawText("(c) Guy IQM 3D model by @culacant", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Guy IQM 3D model by @culacant", screenWidth - 200, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@
|
||||||
|
|
||||||
#include <GLFW/glfw3.h> // Windows/Context and inputs management
|
#include <GLFW/glfw3.h> // Windows/Context and inputs management
|
||||||
|
|
||||||
#define RED (Color){ 230, 41, 55, 255 } // Red
|
#define RL_RED (Color){ 230, 41, 55, 255 } // Red
|
||||||
#define RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
#define RL_RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
||||||
#define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
|
#define RL_DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
|
|
@ -161,8 +161,8 @@ int main(void)
|
||||||
SetMatrixModelview(matView); // Set internal modelview matrix (default shader)
|
SetMatrixModelview(matView); // Set internal modelview matrix (default shader)
|
||||||
SetMatrixProjection(matProj); // Set internal projection matrix (default shader)
|
SetMatrixProjection(matProj); // Set internal projection matrix (default shader)
|
||||||
|
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RL_RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RAYWHITE);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RL_RAYWHITE);
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
// NOTE: Internal buffers drawing (3D data)
|
// NOTE: Internal buffers drawing (3D data)
|
||||||
|
|
@ -187,7 +187,7 @@ int main(void)
|
||||||
rlMatrixMode(RL_MODELVIEW); // Enable internal modelview matrix
|
rlMatrixMode(RL_MODELVIEW); // Enable internal modelview matrix
|
||||||
rlLoadIdentity(); // Reset internal modelview matrix
|
rlLoadIdentity(); // Reset internal modelview matrix
|
||||||
#endif
|
#endif
|
||||||
DrawRectangleV((Vector2){ 10.0f, 10.0f }, (Vector2){ 780.0f, 20.0f }, DARKGRAY);
|
DrawRectangleV((Vector2){ 10.0f, 10.0f }, (Vector2){ 780.0f, 20.0f }, RL_DARKGRAY);
|
||||||
|
|
||||||
// NOTE: Internal buffers drawing (2D data)
|
// NOTE: Internal buffers drawing (2D data)
|
||||||
rlglDraw();
|
rlglDraw();
|
||||||
|
|
|
||||||
|
|
@ -110,8 +110,8 @@ int main()
|
||||||
material.maps[MAP_DIFFUSE].texture = LoadTexture("../models/resources/pbr/trooper_albedo.png"); // Load model diffuse texture
|
material.maps[MAP_DIFFUSE].texture = LoadTexture("../models/resources/pbr/trooper_albedo.png"); // Load model diffuse texture
|
||||||
material.maps[MAP_NORMAL].texture = LoadTexture("../models/resources/pbr/trooper_normals.png"); // Load model normal texture
|
material.maps[MAP_NORMAL].texture = LoadTexture("../models/resources/pbr/trooper_normals.png"); // Load model normal texture
|
||||||
material.maps[MAP_SPECULAR].texture = LoadTexture("../models/resources/pbr/trooper_roughness.png"); // Load model specular texture
|
material.maps[MAP_SPECULAR].texture = LoadTexture("../models/resources/pbr/trooper_roughness.png"); // Load model specular texture
|
||||||
material.maps[MAP_DIFFUSE].color = WHITE;
|
material.maps[MAP_DIFFUSE].color = RL_WHITE;
|
||||||
material.maps[MAP_SPECULAR].color = WHITE;
|
material.maps[MAP_SPECULAR].color = RL_WHITE;
|
||||||
|
|
||||||
model.material = material; // Apply material to model
|
model.material = material; // Apply material to model
|
||||||
|
|
||||||
|
|
@ -153,11 +153,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, position, 2.0f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 2.0f, RL_WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawLight(spotLight); // Draw spot light
|
DrawLight(spotLight); // Draw spot light
|
||||||
DrawLight(dirLight); // Draw directional light
|
DrawLight(dirLight); // Draw directional light
|
||||||
|
|
@ -268,30 +268,30 @@ void DrawLight(Light light)
|
||||||
{
|
{
|
||||||
case LIGHT_POINT:
|
case LIGHT_POINT:
|
||||||
{
|
{
|
||||||
DrawSphereWires(light->position, 0.3f*light->intensity, 8, 8, (light->enabled ? light->diffuse : GRAY));
|
DrawSphereWires(light->position, 0.3f*light->intensity, 8, 8, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
|
|
||||||
DrawCircle3D(light->position, light->radius, (Vector3){ 0, 0, 0 }, 0.0f, (light->enabled ? light->diffuse : GRAY));
|
DrawCircle3D(light->position, light->radius, (Vector3){ 0, 0, 0 }, 0.0f, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
DrawCircle3D(light->position, light->radius, (Vector3){ 1, 0, 0 }, 90.0f, (light->enabled ? light->diffuse : GRAY));
|
DrawCircle3D(light->position, light->radius, (Vector3){ 1, 0, 0 }, 90.0f, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
DrawCircle3D(light->position, light->radius, (Vector3){ 0, 1, 0 },90.0f, (light->enabled ? light->diffuse : GRAY));
|
DrawCircle3D(light->position, light->radius, (Vector3){ 0, 1, 0 },90.0f, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
} break;
|
} break;
|
||||||
case LIGHT_DIRECTIONAL:
|
case LIGHT_DIRECTIONAL:
|
||||||
{
|
{
|
||||||
DrawLine3D(light->position, light->target, (light->enabled ? light->diffuse : GRAY));
|
DrawLine3D(light->position, light->target, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
|
|
||||||
DrawSphereWires(light->position, 0.3f*light->intensity, 8, 8, (light->enabled ? light->diffuse : GRAY));
|
DrawSphereWires(light->position, 0.3f*light->intensity, 8, 8, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : GRAY));
|
DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
} break;
|
} break;
|
||||||
case LIGHT_SPOT:
|
case LIGHT_SPOT:
|
||||||
{
|
{
|
||||||
DrawLine3D(light->position, light->target, (light->enabled ? light->diffuse : GRAY));
|
DrawLine3D(light->position, light->target, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
|
|
||||||
Vector3 dir = VectorSubtract(light->target, light->position);
|
Vector3 dir = VectorSubtract(light->target, light->position);
|
||||||
VectorNormalize(&dir);
|
VectorNormalize(&dir);
|
||||||
|
|
||||||
DrawCircle3D(light->position, 0.5f, dir, 0.0f, (light->enabled ? light->diffuse : GRAY));
|
DrawCircle3D(light->position, 0.5f, dir, 0.0f, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
|
|
||||||
//DrawCylinderWires(light->position, 0.0f, 0.3f*light->coneAngle/50, 0.6f, 5, (light->enabled ? light->diffuse : GRAY));
|
//DrawCylinderWires(light->position, 0.0f, 0.3f*light->coneAngle/50, 0.6f, 5, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : GRAY));
|
DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : RL_GRAY));
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(BLACK);
|
ClearBackground(RL_BLACK);
|
||||||
|
|
||||||
DrawFPS(screenWidth - 90, screenHeight - 30);
|
DrawFPS(screenWidth - 90, screenHeight - 30);
|
||||||
|
|
||||||
|
|
@ -115,17 +115,17 @@ int main()
|
||||||
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
||||||
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
|
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
|
||||||
|
|
||||||
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
|
DrawLineV(vertexA, vertexB, RL_GREEN); // Draw a line between two vertex positions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("Left mouse button to create a polygon", 10, 10, 10, WHITE);
|
DrawText("Left mouse button to create a polygon", 10, 10, 10, RL_WHITE);
|
||||||
DrawText("Right mouse button to create a circle", 10, 25, 10, WHITE);
|
DrawText("Right mouse button to create a circle", 10, 25, 10, RL_WHITE);
|
||||||
DrawText("Press 'R' to reset example", 10, 40, 10, WHITE);
|
DrawText("Press 'R' to reset example", 10, 40, 10, RL_WHITE);
|
||||||
|
|
||||||
DrawText("Physac", logoX, logoY, 30, WHITE);
|
DrawText("Physac", logoX, logoY, 30, RL_WHITE);
|
||||||
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
|
DrawText("Powered by", logoX + 50, logoY - 7, 10, RL_WHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(BLACK);
|
ClearBackground(RL_BLACK);
|
||||||
|
|
||||||
DrawFPS(screenWidth - 90, screenHeight - 30);
|
DrawFPS(screenWidth - 90, screenHeight - 30);
|
||||||
|
|
||||||
|
|
@ -116,21 +116,21 @@ int main()
|
||||||
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
||||||
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
|
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
|
||||||
|
|
||||||
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
|
DrawLineV(vertexA, vertexB, RL_GREEN); // Draw a line between two vertex positions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRectangle(0, screenHeight - 49, screenWidth, 49, BLACK);
|
DrawRectangle(0, screenHeight - 49, screenWidth, 49, RL_BLACK);
|
||||||
|
|
||||||
DrawText("Friction amount", (screenWidth - MeasureText("Friction amount", 30))/2, 75, 30, WHITE);
|
DrawText("Friction amount", (screenWidth - MeasureText("Friction amount", 30))/2, 75, 30, RL_WHITE);
|
||||||
DrawText("0.1", bodyA->position.x - MeasureText("0.1", 20)/2, bodyA->position.y - 7, 20, WHITE);
|
DrawText("0.1", bodyA->position.x - MeasureText("0.1", 20)/2, bodyA->position.y - 7, 20, RL_WHITE);
|
||||||
DrawText("1", bodyB->position.x - MeasureText("1", 20)/2, bodyB->position.y - 7, 20, WHITE);
|
DrawText("1", bodyB->position.x - MeasureText("1", 20)/2, bodyB->position.y - 7, 20, RL_WHITE);
|
||||||
|
|
||||||
DrawText("Press 'R' to reset example", 10, 10, 10, WHITE);
|
DrawText("Press 'R' to reset example", 10, 10, 10, RL_WHITE);
|
||||||
|
|
||||||
DrawText("Physac", logoX, logoY, 30, WHITE);
|
DrawText("Physac", logoX, logoY, 30, RL_WHITE);
|
||||||
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
|
DrawText("Powered by", logoX + 50, logoY - 7, 10, RL_WHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(BLACK);
|
ClearBackground(RL_BLACK);
|
||||||
|
|
||||||
DrawFPS(screenWidth - 90, screenHeight - 30);
|
DrawFPS(screenWidth - 90, screenHeight - 30);
|
||||||
|
|
||||||
|
|
@ -108,15 +108,15 @@ int main()
|
||||||
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
||||||
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
|
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
|
||||||
|
|
||||||
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
|
DrawLineV(vertexA, vertexB, RL_GREEN); // Draw a line between two vertex positions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("Use 'ARROWS' to move player", 10, 10, 10, WHITE);
|
DrawText("Use 'ARROWS' to move player", 10, 10, 10, RL_WHITE);
|
||||||
DrawText("Press 'R' to reset example", 10, 30, 10, WHITE);
|
DrawText("Press 'R' to reset example", 10, 30, 10, RL_WHITE);
|
||||||
|
|
||||||
DrawText("Physac", logoX, logoY, 30, WHITE);
|
DrawText("Physac", logoX, logoY, 30, RL_WHITE);
|
||||||
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
|
DrawText("Powered by", logoX + 50, logoY - 7, 10, RL_WHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(BLACK);
|
ClearBackground(RL_BLACK);
|
||||||
|
|
||||||
DrawFPS(screenWidth - 90, screenHeight - 30);
|
DrawFPS(screenWidth - 90, screenHeight - 30);
|
||||||
|
|
||||||
|
|
@ -100,19 +100,19 @@ int main()
|
||||||
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
||||||
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
|
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
|
||||||
|
|
||||||
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
|
DrawLineV(vertexA, vertexB, RL_GREEN); // Draw a line between two vertex positions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("Restitution amount", (screenWidth - MeasureText("Restitution amount", 30))/2, 75, 30, WHITE);
|
DrawText("Restitution amount", (screenWidth - MeasureText("Restitution amount", 30))/2, 75, 30, RL_WHITE);
|
||||||
DrawText("0", circleA->position.x - MeasureText("0", 20)/2, circleA->position.y - 7, 20, WHITE);
|
DrawText("0", circleA->position.x - MeasureText("0", 20)/2, circleA->position.y - 7, 20, RL_WHITE);
|
||||||
DrawText("0.5", circleB->position.x - MeasureText("0.5", 20)/2, circleB->position.y - 7, 20, WHITE);
|
DrawText("0.5", circleB->position.x - MeasureText("0.5", 20)/2, circleB->position.y - 7, 20, RL_WHITE);
|
||||||
DrawText("1", circleC->position.x - MeasureText("1", 20)/2, circleC->position.y - 7, 20, WHITE);
|
DrawText("1", circleC->position.x - MeasureText("1", 20)/2, circleC->position.y - 7, 20, RL_WHITE);
|
||||||
|
|
||||||
DrawText("Press 'R' to reset example", 10, 10, 10, WHITE);
|
DrawText("Press 'R' to reset example", 10, 10, 10, RL_WHITE);
|
||||||
|
|
||||||
DrawText("Physac", logoX, logoY, 30, WHITE);
|
DrawText("Physac", logoX, logoY, 30, RL_WHITE);
|
||||||
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
|
DrawText("Powered by", logoX + 50, logoY - 7, 10, RL_WHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(BLACK);
|
ClearBackground(RL_BLACK);
|
||||||
|
|
||||||
// Draw created physics bodies
|
// Draw created physics bodies
|
||||||
int bodiesCount = GetPhysicsBodiesCount();
|
int bodiesCount = GetPhysicsBodiesCount();
|
||||||
|
|
@ -101,14 +101,14 @@ int main()
|
||||||
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
|
||||||
Vector2 vertexB = GetPhysicsShapeVertex(currentBody, jj);
|
Vector2 vertexB = GetPhysicsShapeVertex(currentBody, jj);
|
||||||
|
|
||||||
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
|
DrawLineV(vertexA, vertexB, RL_GREEN); // Draw a line between two vertex positions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("Left mouse button in polygon area to shatter body\nPress 'R' to reset example", 10, 10, 10, WHITE);
|
DrawText("Left mouse button in polygon area to shatter body\nPress 'R' to reset example", 10, 10, 10, RL_WHITE);
|
||||||
|
|
||||||
DrawText("Physac", logoX, logoY, 30, WHITE);
|
DrawText("Physac", logoX, logoY, 30, RL_WHITE);
|
||||||
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
|
DrawText("Powered by", logoX + 50, logoY - 7, 10, RL_WHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -88,33 +88,33 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginTextureMode(target); // Enable drawing to texture
|
BeginTextureMode(target); // Enable drawing to texture
|
||||||
|
|
||||||
ClearBackground(RAYWHITE); // Clear texture background
|
ClearBackground(RL_RAYWHITE); // Clear texture background
|
||||||
|
|
||||||
BeginMode3D(camera); // Begin 3d mode drawing
|
BeginMode3D(camera); // Begin 3d mode drawing
|
||||||
|
|
||||||
DrawModel(model, position, 0.5f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 0.5f, RL_WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode
|
EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode
|
||||||
|
|
||||||
DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, RED);
|
DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, RL_RED);
|
||||||
|
|
||||||
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
||||||
|
|
||||||
BeginShaderMode(shader);
|
BeginShaderMode(shader);
|
||||||
|
|
||||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, RL_WHITE);
|
||||||
|
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
// Draw some 2d text over drawn texture
|
// Draw some 2d text over drawn texture
|
||||||
DrawText("(c) Barracks 3D model by Alberto Cano", screenWidth - 220, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Barracks 3D model by Alberto Cano", screenWidth - 220, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,20 +72,20 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, position, 0.2f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 0.2f, RL_WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("(c) Watermill 3D model by Alberto Cano", screenWidth - 210, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Watermill 3D model by Alberto Cano", screenWidth - 210, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawText(FormatText("Camera position: (%.2f, %.2f, %.2f)", camera.position.x, camera.position.y, camera.position.z), 600, 20, 10, BLACK);
|
DrawText(FormatText("Camera position: (%.2f, %.2f, %.2f)", camera.position.x, camera.position.y, camera.position.z), 600, 20, 10, RL_BLACK);
|
||||||
DrawText(FormatText("Camera target: (%.2f, %.2f, %.2f)", camera.target.x, camera.target.y, camera.target.z), 600, 40, 10, GRAY);
|
DrawText(FormatText("Camera target: (%.2f, %.2f, %.2f)", camera.target.x, camera.target.y, camera.target.z), 600, 40, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,15 +126,15 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
BeginTextureMode(target); // Enable drawing to texture
|
BeginTextureMode(target); // Enable drawing to texture
|
||||||
|
|
||||||
ClearBackground(RAYWHITE); // Clear texture background
|
ClearBackground(RL_RAYWHITE); // Clear texture background
|
||||||
|
|
||||||
BeginMode3D(camera); // Begin 3d mode drawing
|
BeginMode3D(camera); // Begin 3d mode drawing
|
||||||
|
|
||||||
DrawModel(model, position, 0.1f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 0.1f, RL_WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
|
|
@ -146,18 +146,18 @@ int main()
|
||||||
BeginShaderMode(shaders[currentShader]);
|
BeginShaderMode(shaders[currentShader]);
|
||||||
|
|
||||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, RL_WHITE);
|
||||||
|
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
// Draw 2d shapes and text over drawn texture
|
// Draw 2d shapes and text over drawn texture
|
||||||
DrawRectangle(0, 9, 580, 30, Fade(LIGHTGRAY, 0.7f));
|
DrawRectangle(0, 9, 580, 30, Fade(RL_LIGHTGRAY, 0.7f));
|
||||||
|
|
||||||
DrawText("(c) Church 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Church 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
DrawText("CURRENT POSTPRO SHADER:", 10, 15, 20, BLACK);
|
DrawText("CURRENT POSTPRO SHADER:", 10, 15, 20, RL_BLACK);
|
||||||
DrawText(postproShaderText[currentShader], 330, 15, 20, RED);
|
DrawText(postproShaderText[currentShader], 330, 15, 20, RL_RED);
|
||||||
DrawText("< >", 540, 10, 30, DARKBLUE);
|
DrawText("< >", 540, 10, 30, RL_DARKBLUE);
|
||||||
|
|
||||||
DrawFPS(700, 15);
|
DrawFPS(700, 15);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,15 +81,15 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// We only draw a white full-screen rectangle,
|
// We only draw a white full-screen rectangle,
|
||||||
// frame is generated in shader using raymarching
|
// frame is generated in shader using raymarching
|
||||||
BeginShaderMode(shader);
|
BeginShaderMode(shader);
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, WHITE);
|
DrawRectangle(0, 0, screenWidth, screenHeight, RL_WHITE);
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
DrawText("(c) Raymarching shader by Iñigo Quilez. MIT License.", screenWidth - 280, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Raymarching shader by Iñigo Quilez. MIT License.", screenWidth - 280, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -55,50 +55,50 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Start drawing with default shader
|
// Start drawing with default shader
|
||||||
|
|
||||||
DrawText("USING DEFAULT SHADER", 20, 40, 10, RED);
|
DrawText("USING DEFAULT SHADER", 20, 40, 10, RL_RED);
|
||||||
|
|
||||||
DrawCircle(80, 120, 35, DARKBLUE);
|
DrawCircle(80, 120, 35, RL_DARKBLUE);
|
||||||
DrawCircleGradient(80, 220, 60, GREEN, SKYBLUE);
|
DrawCircleGradient(80, 220, 60, RL_GREEN, RL_SKYBLUE);
|
||||||
DrawCircleLines(80, 340, 80, DARKBLUE);
|
DrawCircleLines(80, 340, 80, RL_DARKBLUE);
|
||||||
|
|
||||||
|
|
||||||
// Activate our custom shader to be applied on next shapes/textures drawings
|
// Activate our custom shader to be applied on next shapes/textures drawings
|
||||||
BeginShaderMode(shader);
|
BeginShaderMode(shader);
|
||||||
|
|
||||||
DrawText("USING CUSTOM SHADER", 190, 40, 10, RED);
|
DrawText("USING CUSTOM SHADER", 190, 40, 10, RL_RED);
|
||||||
|
|
||||||
DrawRectangle(250 - 60, 90, 120, 60, RED);
|
DrawRectangle(250 - 60, 90, 120, 60, RL_RED);
|
||||||
DrawRectangleGradientH(250 - 90, 170, 180, 130, MAROON, GOLD);
|
DrawRectangleGradientH(250 - 90, 170, 180, 130, RL_MAROON, RL_GOLD);
|
||||||
DrawRectangleLines(250 - 40, 320, 80, 60, ORANGE);
|
DrawRectangleLines(250 - 40, 320, 80, 60, RL_ORANGE);
|
||||||
|
|
||||||
// Activate our default shader for next drawings
|
// Activate our default shader for next drawings
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
DrawText("USING DEFAULT SHADER", 370, 40, 10, RED);
|
DrawText("USING DEFAULT SHADER", 370, 40, 10, RL_RED);
|
||||||
|
|
||||||
DrawTriangle((Vector2){430, 80},
|
DrawTriangle((Vector2){430, 80},
|
||||||
(Vector2){430 - 60, 150},
|
(Vector2){430 - 60, 150},
|
||||||
(Vector2){430 + 60, 150}, VIOLET);
|
(Vector2){430 + 60, 150}, RL_VIOLET);
|
||||||
|
|
||||||
DrawTriangleLines((Vector2){430, 160},
|
DrawTriangleLines((Vector2){430, 160},
|
||||||
(Vector2){430 - 20, 230},
|
(Vector2){430 - 20, 230},
|
||||||
(Vector2){430 + 20, 230}, DARKBLUE);
|
(Vector2){430 + 20, 230}, RL_DARKBLUE);
|
||||||
|
|
||||||
DrawPoly((Vector2){430, 320}, 6, 80, 0, BROWN);
|
DrawPoly((Vector2){430, 320}, 6, 80, 0, RL_BROWN);
|
||||||
|
|
||||||
// Activate our custom shader to be applied on next shapes/textures drawings
|
// Activate our custom shader to be applied on next shapes/textures drawings
|
||||||
BeginShaderMode(shader);
|
BeginShaderMode(shader);
|
||||||
|
|
||||||
DrawTexture(fudesumi, 500, -30, WHITE); // Using custom shader
|
DrawTexture(fudesumi, 500, -30, RL_WHITE); // Using custom shader
|
||||||
|
|
||||||
// Activate our default shader for next drawings
|
// Activate our default shader for next drawings
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
DrawText("(c) Fudesumi sprite by Eiden Marsal", 380, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Fudesumi sprite by Eiden Marsal", 380, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -35,31 +35,31 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY);
|
DrawText("some basic shapes available on raylib", 20, 20, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawCircle(screenWidth/4, 120, 35, DARKBLUE);
|
DrawCircle(screenWidth/4, 120, 35, RL_DARKBLUE);
|
||||||
|
|
||||||
DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);
|
DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RL_RED);
|
||||||
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE); // NOTE: Uses QUADS internally, not lines
|
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, RL_ORANGE); // NOTE: Uses QUADS internally, not lines
|
||||||
DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
|
DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, RL_MAROON, RL_GOLD);
|
||||||
|
|
||||||
DrawTriangle((Vector2){screenWidth/4*3, 80},
|
DrawTriangle((Vector2){screenWidth/4*3, 80},
|
||||||
(Vector2){screenWidth/4*3 - 60, 150},
|
(Vector2){screenWidth/4*3 - 60, 150},
|
||||||
(Vector2){screenWidth/4*3 + 60, 150}, VIOLET);
|
(Vector2){screenWidth/4*3 + 60, 150}, RL_VIOLET);
|
||||||
|
|
||||||
DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
|
DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, RL_BROWN);
|
||||||
|
|
||||||
DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE);
|
DrawCircleGradient(screenWidth/4, 220, 60, RL_GREEN, RL_SKYBLUE);
|
||||||
|
|
||||||
// NOTE: We draw all LINES based shapes together to optimize internal drawing,
|
// NOTE: We draw all LINES based shapes together to optimize internal drawing,
|
||||||
// this way, all LINES are rendered in a single draw pass
|
// this way, all LINES are rendered in a single draw pass
|
||||||
DrawLine(18, 42, screenWidth - 18, 42, BLACK);
|
DrawLine(18, 42, screenWidth - 18, 42, RL_BLACK);
|
||||||
DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE);
|
DrawCircleLines(screenWidth/4, 340, 80, RL_DARKBLUE);
|
||||||
DrawTriangleLines((Vector2){screenWidth/4*3, 160},
|
DrawTriangleLines((Vector2){screenWidth/4*3, 160},
|
||||||
(Vector2){screenWidth/4*3 - 20, 230},
|
(Vector2){screenWidth/4*3 - 20, 230},
|
||||||
(Vector2){screenWidth/4*3 + 20, 230}, DARKBLUE);
|
(Vector2){screenWidth/4*3 + 20, 230}, RL_DARKBLUE);
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,54 +35,54 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("raylib color palette", 28, 42, 20, BLACK);
|
DrawText("raylib color palette", 28, 42, 20, RL_BLACK);
|
||||||
|
|
||||||
DrawRectangle(26, 80, 100, 100, DARKGRAY);
|
DrawRectangle(26, 80, 100, 100, RL_DARKGRAY);
|
||||||
DrawRectangle(26, 188, 100, 100, GRAY);
|
DrawRectangle(26, 188, 100, 100, RL_GRAY);
|
||||||
DrawRectangle(26, 296, 100, 100, LIGHTGRAY);
|
DrawRectangle(26, 296, 100, 100, RL_LIGHTGRAY);
|
||||||
DrawRectangle(134, 80, 100, 100, MAROON);
|
DrawRectangle(134, 80, 100, 100, RL_MAROON);
|
||||||
DrawRectangle(134, 188, 100, 100, RED);
|
DrawRectangle(134, 188, 100, 100, RL_RED);
|
||||||
DrawRectangle(134, 296, 100, 100, PINK);
|
DrawRectangle(134, 296, 100, 100, RL_PINK);
|
||||||
DrawRectangle(242, 80, 100, 100, ORANGE);
|
DrawRectangle(242, 80, 100, 100, RL_ORANGE);
|
||||||
DrawRectangle(242, 188, 100, 100, GOLD);
|
DrawRectangle(242, 188, 100, 100, RL_GOLD);
|
||||||
DrawRectangle(242, 296, 100, 100, YELLOW);
|
DrawRectangle(242, 296, 100, 100, RL_YELLOW);
|
||||||
DrawRectangle(350, 80, 100, 100, DARKGREEN);
|
DrawRectangle(350, 80, 100, 100, RL_DARKGREEN);
|
||||||
DrawRectangle(350, 188, 100, 100, LIME);
|
DrawRectangle(350, 188, 100, 100, RL_LIME);
|
||||||
DrawRectangle(350, 296, 100, 100, GREEN);
|
DrawRectangle(350, 296, 100, 100, RL_GREEN);
|
||||||
DrawRectangle(458, 80, 100, 100, DARKBLUE);
|
DrawRectangle(458, 80, 100, 100, RL_DARKBLUE);
|
||||||
DrawRectangle(458, 188, 100, 100, BLUE);
|
DrawRectangle(458, 188, 100, 100, RL_BLUE);
|
||||||
DrawRectangle(458, 296, 100, 100, SKYBLUE);
|
DrawRectangle(458, 296, 100, 100, RL_SKYBLUE);
|
||||||
DrawRectangle(566, 80, 100, 100, DARKPURPLE);
|
DrawRectangle(566, 80, 100, 100, RL_DARKPURPLE);
|
||||||
DrawRectangle(566, 188, 100, 100, VIOLET);
|
DrawRectangle(566, 188, 100, 100, RL_VIOLET);
|
||||||
DrawRectangle(566, 296, 100, 100, PURPLE);
|
DrawRectangle(566, 296, 100, 100, RL_PURPLE);
|
||||||
DrawRectangle(674, 80, 100, 100, DARKBROWN);
|
DrawRectangle(674, 80, 100, 100, RL_DARKBROWN);
|
||||||
DrawRectangle(674, 188, 100, 100, BROWN);
|
DrawRectangle(674, 188, 100, 100, RL_BROWN);
|
||||||
DrawRectangle(674, 296, 100, 100, BEIGE);
|
DrawRectangle(674, 296, 100, 100, RL_BEIGE);
|
||||||
|
|
||||||
|
|
||||||
DrawText("DARKGRAY", 65, 166, 10, BLACK);
|
DrawText("RL_DARKGRAY", 65, 166, 10, RL_BLACK);
|
||||||
DrawText("GRAY", 93, 274, 10, BLACK);
|
DrawText("RL_GRAY", 93, 274, 10, RL_BLACK);
|
||||||
DrawText("LIGHTGRAY", 61, 382, 10, BLACK);
|
DrawText("RL_LIGHTGRAY", 61, 382, 10, RL_BLACK);
|
||||||
DrawText("MAROON", 186, 166, 10, BLACK);
|
DrawText("RL_MAROON", 186, 166, 10, RL_BLACK);
|
||||||
DrawText("RED", 208, 274, 10, BLACK);
|
DrawText("RL_RED", 208, 274, 10, RL_BLACK);
|
||||||
DrawText("PINK", 204, 382, 10, BLACK);
|
DrawText("RL_PINK", 204, 382, 10, RL_BLACK);
|
||||||
DrawText("ORANGE", 295, 166, 10, BLACK);
|
DrawText("RL_ORANGE", 295, 166, 10, RL_BLACK);
|
||||||
DrawText("GOLD", 310, 274, 10, BLACK);
|
DrawText("RL_GOLD", 310, 274, 10, RL_BLACK);
|
||||||
DrawText("YELLOW", 300, 382, 10, BLACK);
|
DrawText("RL_YELLOW", 300, 382, 10, RL_BLACK);
|
||||||
DrawText("DARKGREEN", 382, 166, 10, BLACK);
|
DrawText("RL_DARKGREEN", 382, 166, 10, RL_BLACK);
|
||||||
DrawText("LIME", 420, 274, 10, BLACK);
|
DrawText("RL_LIME", 420, 274, 10, RL_BLACK);
|
||||||
DrawText("GREEN", 410, 382, 10, BLACK);
|
DrawText("RL_GREEN", 410, 382, 10, RL_BLACK);
|
||||||
DrawText("DARKBLUE", 498, 166, 10, BLACK);
|
DrawText("RL_DARKBLUE", 498, 166, 10, RL_BLACK);
|
||||||
DrawText("BLUE", 526, 274, 10, BLACK);
|
DrawText("RL_BLUE", 526, 274, 10, RL_BLACK);
|
||||||
DrawText("SKYBLUE", 505, 382, 10, BLACK);
|
DrawText("RL_SKYBLUE", 505, 382, 10, RL_BLACK);
|
||||||
DrawText("DARKPURPLE", 592, 166, 10, BLACK);
|
DrawText("RL_DARKPURPLE", 592, 166, 10, RL_BLACK);
|
||||||
DrawText("VIOLET", 621, 274, 10, BLACK);
|
DrawText("RL_VIOLET", 621, 274, 10, RL_BLACK);
|
||||||
DrawText("PURPLE", 620, 382, 10, BLACK);
|
DrawText("RL_PURPLE", 620, 382, 10, RL_BLACK);
|
||||||
DrawText("DARKBROWN", 705, 166, 10, BLACK);
|
DrawText("RL_DARKBROWN", 705, 166, 10, RL_BLACK);
|
||||||
DrawText("BROWN", 733, 274, 10, BLACK);
|
DrawText("RL_BROWN", 733, 274, 10, RL_BLACK);
|
||||||
DrawText("BEIGE", 737, 382, 10, BLACK);
|
DrawText("RL_BEIGE", 737, 382, 10, RL_BLACK);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS", 15, 20, 20, GRAY);
|
DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS", 15, 20, 20, RL_GRAY);
|
||||||
|
|
||||||
DrawLineBezier(start, end, 2.0f, RED);
|
DrawLineBezier(start, end, 2.0f, RL_RED);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,13 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK);
|
DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, RL_BLACK);
|
||||||
DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RAYWHITE);
|
DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RL_RAYWHITE);
|
||||||
DrawText("raylib", screenWidth/2 - 44, screenHeight/2 + 48, 50, BLACK);
|
DrawText("raylib", screenWidth/2 - 44, screenHeight/2 + 48, 50, RL_BLACK);
|
||||||
|
|
||||||
DrawText("this is NOT a texture!", 350, 370, 10, GRAY);
|
DrawText("this is NOT a texture!", 350, 370, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -111,40 +111,40 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
{
|
{
|
||||||
if ((framesCounter/15)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK);
|
if ((framesCounter/15)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, RL_BLACK);
|
||||||
}
|
}
|
||||||
else if (state == 1)
|
else if (state == 1)
|
||||||
{
|
{
|
||||||
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, RL_BLACK);
|
||||||
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
|
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, RL_BLACK);
|
||||||
}
|
}
|
||||||
else if (state == 2)
|
else if (state == 2)
|
||||||
{
|
{
|
||||||
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, RL_BLACK);
|
||||||
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
|
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, RL_BLACK);
|
||||||
|
|
||||||
DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK);
|
DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, RL_BLACK);
|
||||||
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK);
|
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, RL_BLACK);
|
||||||
}
|
}
|
||||||
else if (state == 3)
|
else if (state == 3)
|
||||||
{
|
{
|
||||||
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha));
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(RL_BLACK, alpha));
|
||||||
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha));
|
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(RL_BLACK, alpha));
|
||||||
|
|
||||||
DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha));
|
DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(RL_BLACK, alpha));
|
||||||
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha));
|
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(RL_BLACK, alpha));
|
||||||
|
|
||||||
DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, Fade(RAYWHITE, alpha));
|
DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, Fade(RL_RAYWHITE, alpha));
|
||||||
|
|
||||||
DrawText(SubText("raylib", 0, lettersCount), screenWidth/2 - 44, screenHeight/2 + 48, 50, Fade(BLACK, alpha));
|
DrawText(SubText("raylib", 0, lettersCount), screenWidth/2 - 44, screenHeight/2 + 48, 50, Fade(RL_BLACK, alpha));
|
||||||
}
|
}
|
||||||
else if (state == 4)
|
else if (state == 4)
|
||||||
{
|
{
|
||||||
DrawText("[R] REPLAY", 340, 200, 20, GRAY);
|
DrawText("[R] REPLAY", 340, 200, 20, RL_GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,10 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTextEx(fontBm, msgBm, fontPosition, fontBm.baseSize, 0, MAROON);
|
DrawTextEx(fontBm, msgBm, fontPosition, fontBm.baseSize, 0, RL_MAROON);
|
||||||
DrawTextEx(fontTtf, msgTtf, (Vector2){ 75.0f, 240.0f }, fontTtf.baseSize*0.8f, 2, LIME);
|
DrawTextEx(fontTtf, msgTtf, (Vector2){ 75.0f, 240.0f }, fontTtf.baseSize*0.8f, 2, RL_LIME);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,13 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("Font name: PixAntiqua", 40, 50, 20, GRAY);
|
DrawText("Font name: PixAntiqua", 40, 50, 20, RL_GRAY);
|
||||||
DrawText(FormatText("Font base size: %i", font.baseSize), 40, 80, 20, GRAY);
|
DrawText(FormatText("Font base size: %i", font.baseSize), 40, 80, 20, RL_GRAY);
|
||||||
DrawText(FormatText("Font chars number: %i", font.charsCount), 40, 110, 20, GRAY);
|
DrawText(FormatText("Font chars number: %i", font.charsCount), 40, 110, 20, RL_GRAY);
|
||||||
|
|
||||||
DrawTextEx(font, msg, (Vector2){ 40, 180 }, font.baseSize, 0, MAROON);
|
DrawTextEx(font, msg, (Vector2){ 40, 180 }, font.baseSize, 0, RL_MAROON);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -81,31 +81,31 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (currentFont == 1)
|
if (currentFont == 1)
|
||||||
{
|
{
|
||||||
// NOTE: SDF fonts require a custom SDf shader to compute fragment color
|
// NOTE: SDF fonts require a custom SDf shader to compute fragment color
|
||||||
BeginShaderMode(shader); // Activate SDF font shader
|
BeginShaderMode(shader); // Activate SDF font shader
|
||||||
DrawTextEx(fontSDF, msg, fontPosition, fontSize, 0, BLACK);
|
DrawTextEx(fontSDF, msg, fontPosition, fontSize, 0, RL_BLACK);
|
||||||
EndShaderMode(); // Activate our default shader for next drawings
|
EndShaderMode(); // Activate our default shader for next drawings
|
||||||
|
|
||||||
DrawTexture(fontSDF.texture, 10, 10, BLACK);
|
DrawTexture(fontSDF.texture, 10, 10, RL_BLACK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawTextEx(fontDefault, msg, fontPosition, fontSize, 0, BLACK);
|
DrawTextEx(fontDefault, msg, fontPosition, fontSize, 0, RL_BLACK);
|
||||||
DrawTexture(fontDefault.texture, 10, 10, BLACK);
|
DrawTexture(fontDefault.texture, 10, 10, RL_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentFont == 1) DrawText("SDF!", 320, 20, 80, RED);
|
if (currentFont == 1) DrawText("SDF!", 320, 20, 80, RL_RED);
|
||||||
else DrawText("default font", 315, 40, 30, GRAY);
|
else DrawText("default font", 315, 40, 30, RL_GRAY);
|
||||||
|
|
||||||
DrawText("FONT SIZE: 16.0", GetScreenWidth() - 240, 20, 20, DARKGRAY);
|
DrawText("FONT SIZE: 16.0", GetScreenWidth() - 240, 20, 20, RL_DARKGRAY);
|
||||||
DrawText(FormatText("RENDER SIZE: %02.02f", fontSize), GetScreenWidth() - 240, 50, 20, DARKGRAY);
|
DrawText(FormatText("RENDER SIZE: %02.02f", fontSize), GetScreenWidth() - 240, 50, 20, RL_DARKGRAY);
|
||||||
DrawText("Use MOUSE WHEEL to SCALE TEXT!", GetScreenWidth() - 240, 90, 10, DARKGRAY);
|
DrawText("Use MOUSE WHEEL to SCALE TEXT!", GetScreenWidth() - 240, 90, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawText("PRESS SPACE to USE SDF FONT VERSION!", 340, GetScreenHeight() - 30, 20, MAROON);
|
DrawText("PRESS SPACE to USE SDF FONT VERSION!", 340, GetScreenHeight() - 30, 20, RL_MAROON);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,15 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText(FormatText("Score: %08i", score), 200, 80, 20, RED);
|
DrawText(FormatText("Score: %08i", score), 200, 80, 20, RL_RED);
|
||||||
|
|
||||||
DrawText(FormatText("HiScore: %08i", hiscore), 200, 120, 20, GREEN);
|
DrawText(FormatText("HiScore: %08i", hiscore), 200, 120, 20, RL_GREEN);
|
||||||
|
|
||||||
DrawText(FormatText("Lives: %02i", lives), 200, 160, 40, BLUE);
|
DrawText(FormatText("Lives: %02i", lives), 200, 160, 40, RL_BLUE);
|
||||||
|
|
||||||
DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK);
|
DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, RL_BLACK);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -69,26 +69,26 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("PLACE MOUSE OVER INPUT BOX!", 240, 140, 20, GRAY);
|
DrawText("PLACE MOUSE OVER INPUT BOX!", 240, 140, 20, RL_GRAY);
|
||||||
|
|
||||||
DrawRectangleRec(textBox, LIGHTGRAY);
|
DrawRectangleRec(textBox, RL_LIGHTGRAY);
|
||||||
if (mouseOnText) DrawRectangleLines(textBox.x, textBox.y, textBox.width, textBox.height, RED);
|
if (mouseOnText) DrawRectangleLines(textBox.x, textBox.y, textBox.width, textBox.height, RL_RED);
|
||||||
else DrawRectangleLines(textBox.x, textBox.y, textBox.width, textBox.height, DARKGRAY);
|
else DrawRectangleLines(textBox.x, textBox.y, textBox.width, textBox.height, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawText(name, textBox.x + 5, textBox.y + 8, 40, MAROON);
|
DrawText(name, textBox.x + 5, textBox.y + 8, 40, RL_MAROON);
|
||||||
|
|
||||||
DrawText(FormatText("INPUT CHARS: %i/%i", letterCount, MAX_INPUT_CHARS), 315, 250, 20, DARKGRAY);
|
DrawText(FormatText("INPUT CHARS: %i/%i", letterCount, MAX_INPUT_CHARS), 315, 250, 20, RL_DARKGRAY);
|
||||||
|
|
||||||
if (mouseOnText)
|
if (mouseOnText)
|
||||||
{
|
{
|
||||||
if (letterCount < MAX_INPUT_CHARS)
|
if (letterCount < MAX_INPUT_CHARS)
|
||||||
{
|
{
|
||||||
// Draw blinking underscore char
|
// Draw blinking underscore char
|
||||||
if (((framesCounter/20)%2) == 0) DrawText("_", textBox.x + 8 + MeasureText(name, 40), textBox.y + 12, 40, MAROON);
|
if (((framesCounter/20)%2) == 0) DrawText("_", textBox.x + 8 + MeasureText(name, 40), textBox.y + 12, 40, RL_MAROON);
|
||||||
}
|
}
|
||||||
else DrawText("Press BACKSPACE to delete chars...", 230, 300, 20, GRAY);
|
else DrawText("Press BACKSPACE to delete chars...", 230, 300, 20, RL_GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ int main()
|
||||||
positions[4].y += 2;
|
positions[4].y += 2;
|
||||||
positions[7].y -= 8;
|
positions[7].y -= 8;
|
||||||
|
|
||||||
Color colors[MAX_FONTS] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED };
|
Color colors[MAX_FONTS] = { RL_MAROON, RL_ORANGE, RL_DARKGREEN, RL_DARKBLUE, RL_DARKPURPLE, RL_LIME, RL_GOLD, RL_RED };
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
|
@ -76,10 +76,10 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("free fonts included with raylib", 250, 20, 20, DARKGRAY);
|
DrawText("free fonts included with raylib", 250, 20, 20, RL_DARKGRAY);
|
||||||
DrawLine(220, 50, 590, 50, DARKGRAY);
|
DrawLine(220, 50, 590, 50, RL_DARKGRAY);
|
||||||
|
|
||||||
for (int i = 0; i < MAX_FONTS; i++)
|
for (int i = 0; i < MAX_FONTS; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTextEx(font1, msg1, fontPosition1, font1.baseSize, -3, WHITE);
|
DrawTextEx(font1, msg1, fontPosition1, font1.baseSize, -3, RL_WHITE);
|
||||||
DrawTextEx(font2, msg2, fontPosition2, font2.baseSize, -2, WHITE);
|
DrawTextEx(font2, msg2, fontPosition2, font2.baseSize, -2, RL_WHITE);
|
||||||
DrawTextEx(font3, msg3, fontPosition3, font3.baseSize, 2, WHITE);
|
DrawTextEx(font3, msg3, fontPosition3, font3.baseSize, 2, RL_WHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -97,26 +97,26 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("Use mouse wheel to change font size", 20, 20, 10, GRAY);
|
DrawText("Use mouse wheel to change font size", 20, 20, 10, RL_GRAY);
|
||||||
DrawText("Use KEY_RIGHT and KEY_LEFT to move text", 20, 40, 10, GRAY);
|
DrawText("Use KEY_RIGHT and KEY_LEFT to move text", 20, 40, 10, RL_GRAY);
|
||||||
DrawText("Use 1, 2, 3 to change texture filter", 20, 60, 10, GRAY);
|
DrawText("Use 1, 2, 3 to change texture filter", 20, 60, 10, RL_GRAY);
|
||||||
DrawText("Drop a new TTF font for dynamic loading", 20, 80, 10, DARKGRAY);
|
DrawText("Drop a new TTF font for dynamic loading", 20, 80, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawTextEx(font, msg, fontPosition, fontSize, 0, BLACK);
|
DrawTextEx(font, msg, fontPosition, fontSize, 0, RL_BLACK);
|
||||||
|
|
||||||
// TODO: It seems texSize measurement is not accurate due to chars offsets...
|
// TODO: It seems texSize measurement is not accurate due to chars offsets...
|
||||||
//DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED);
|
//DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RL_RED);
|
||||||
|
|
||||||
DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY);
|
DrawRectangle(0, screenHeight - 80, screenWidth, 80, RL_LIGHTGRAY);
|
||||||
DrawText(FormatText("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY);
|
DrawText(FormatText("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, RL_DARKGRAY);
|
||||||
DrawText(FormatText("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY);
|
DrawText(FormatText("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, RL_DARKGRAY);
|
||||||
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY);
|
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, RL_GRAY);
|
||||||
|
|
||||||
if (currentFontFilter == 0) DrawText("POINT", 570, 400, 20, BLACK);
|
if (currentFontFilter == 0) DrawText("POINT", 570, 400, 20, RL_BLACK);
|
||||||
else if (currentFontFilter == 1) DrawText("BILINEAR", 570, 400, 20, BLACK);
|
else if (currentFontFilter == 1) DrawText("BILINEAR", 570, 400, 20, RL_BLACK);
|
||||||
else if (currentFontFilter == 2) DrawText("TRILINEAR", 570, 400, 20, BLACK);
|
else if (currentFontFilter == 2) DrawText("TRILINEAR", 570, 400, 20, RL_BLACK);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,12 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText(SubText(message, 0, framesCounter/10), 210, 160, 20, MAROON);
|
DrawText(SubText(message, 0, framesCounter/10), 210, 160, 20, RL_MAROON);
|
||||||
|
|
||||||
DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, LIGHTGRAY);
|
DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, RL_LIGHTGRAY);
|
||||||
DrawText("PRESS [SPACE] to SPEED UP!", 239, 300, 20, LIGHTGRAY);
|
DrawText("PRESS [SPACE] to SPEED UP!", 239, 300, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ int main()
|
||||||
Font font = LoadFont("resources/custom_jupiter_crash.png");
|
Font font = LoadFont("resources/custom_jupiter_crash.png");
|
||||||
|
|
||||||
// Draw over image using custom font
|
// Draw over image using custom font
|
||||||
ImageDrawTextEx(&parrots, (Vector2){ 300, 230 }, font, "PARROTS & CAT", font.baseSize, -2, WHITE);
|
ImageDrawTextEx(&parrots, (Vector2){ 300, 230 }, font, "PARROTS & CAT", font.baseSize, -2, RL_WHITE);
|
||||||
|
|
||||||
UnloadFont(font); // Unload custom spritefont (already drawn used on image)
|
UnloadFont(font); // Unload custom spritefont (already drawn used on image)
|
||||||
|
|
||||||
|
|
@ -63,13 +63,13 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, WHITE);
|
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, RL_WHITE);
|
||||||
DrawRectangleLines(screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, texture.width, texture.height, DARKGRAY);
|
DrawRectangleLines(screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, texture.width, texture.height, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawText("We are drawing only one texture from various images composed!", 240, 350, 10, DARKGRAY);
|
DrawText("We are drawing only one texture from various images composed!", 240, 350, 10, RL_DARKGRAY);
|
||||||
DrawText("Source images have been cropped, scaled, flipped and copied one over the other.", 190, 370, 10, DARKGRAY);
|
DrawText("Source images have been cropped, scaled, flipped and copied one over the other.", 190, 370, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ int main()
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");
|
||||||
|
|
||||||
Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE);
|
Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RL_RED, RL_BLUE);
|
||||||
Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE);
|
Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RL_RED, RL_BLUE);
|
||||||
Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK);
|
Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, RL_WHITE, RL_BLACK);
|
||||||
Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE);
|
Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RL_RED, RL_BLUE);
|
||||||
Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
|
Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
|
||||||
Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0f);
|
Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0f);
|
||||||
Image cellular = GenImageCellular(screenWidth, screenHeight, 32);
|
Image cellular = GenImageCellular(screenWidth, screenHeight, 32);
|
||||||
|
|
@ -68,23 +68,23 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTexture(textures[currentTexture], 0, 0, WHITE);
|
DrawTexture(textures[currentTexture], 0, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawRectangle(30, 400, 325, 30, Fade(SKYBLUE, 0.5f));
|
DrawRectangle(30, 400, 325, 30, Fade(RL_SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines(30, 400, 325, 30, Fade(WHITE, 0.5f));
|
DrawRectangleLines(30, 400, 325, 30, Fade(RL_WHITE, 0.5f));
|
||||||
DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL TEXTURES", 40, 410, 10, WHITE);
|
DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL TEXTURES", 40, 410, 10, RL_WHITE);
|
||||||
|
|
||||||
switch(currentTexture)
|
switch(currentTexture)
|
||||||
{
|
{
|
||||||
case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break;
|
case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RL_RAYWHITE); break;
|
||||||
case 1: DrawText("HORIZONTAL GRADIENT", 540, 10, 20, RAYWHITE); break;
|
case 1: DrawText("HORIZONTAL GRADIENT", 540, 10, 20, RL_RAYWHITE); break;
|
||||||
case 2: DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY); break;
|
case 2: DrawText("RADIAL GRADIENT", 580, 10, 20, RL_LIGHTGRAY); break;
|
||||||
case 3: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break;
|
case 3: DrawText("CHECKED", 680, 10, 20, RL_RAYWHITE); break;
|
||||||
case 4: DrawText("WHITE NOISE", 640, 10, 20, RED); break;
|
case 4: DrawText("RL_WHITE NOISE", 640, 10, 20, RL_RED); break;
|
||||||
case 5: DrawText("PERLIN NOISE", 630, 10, 20, RAYWHITE); break;
|
case 5: DrawText("PERLIN NOISE", 630, 10, 20, RL_RAYWHITE); break;
|
||||||
case 6: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break;
|
case 6: DrawText("CELLULAR", 670, 10, 20, RL_RAYWHITE); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
|
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, RL_WHITE);
|
||||||
|
|
||||||
DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY);
|
DrawText("this IS a texture loaded from an image!", 300, 370, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -73,25 +73,25 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw the n-patches
|
// Draw the n-patches
|
||||||
DrawTextureNPatch(nPatchTexture, ninePatchInfo2, dstRec2, origin, 0.0f, WHITE);
|
DrawTextureNPatch(nPatchTexture, ninePatchInfo2, dstRec2, origin, 0.0f, RL_WHITE);
|
||||||
DrawTextureNPatch(nPatchTexture, ninePatchInfo1, dstRec1, origin, 0.0f, WHITE);
|
DrawTextureNPatch(nPatchTexture, ninePatchInfo1, dstRec1, origin, 0.0f, RL_WHITE);
|
||||||
DrawTextureNPatch(nPatchTexture, h3PatchInfo, dstRecH, origin, 0.0f, WHITE);
|
DrawTextureNPatch(nPatchTexture, h3PatchInfo, dstRecH, origin, 0.0f, RL_WHITE);
|
||||||
DrawTextureNPatch(nPatchTexture, v3PatchInfo, dstRecV, origin, 0.0f, WHITE);
|
DrawTextureNPatch(nPatchTexture, v3PatchInfo, dstRecV, origin, 0.0f, RL_WHITE);
|
||||||
|
|
||||||
// Draw the source texture
|
// Draw the source texture
|
||||||
DrawRectangleLines( 5, 88, 74, 266, BLUE);
|
DrawRectangleLines( 5, 88, 74, 266, RL_BLUE);
|
||||||
DrawTexture(nPatchTexture, 10, 93, WHITE);
|
DrawTexture(nPatchTexture, 10, 93, RL_WHITE);
|
||||||
DrawText("TEXTURE", 15, 360, 10, DARKGRAY);
|
DrawText("TEXTURE", 15, 360, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawRectangle( 10, 10, 250, 73, Fade(SKYBLUE, 0.5));
|
DrawRectangle( 10, 10, 250, 73, Fade(RL_SKYBLUE, 0.5));
|
||||||
DrawRectangleLines( 10, 10, 250, 73, BLUE);
|
DrawRectangleLines( 10, 10, 250, 73, RL_BLUE);
|
||||||
|
|
||||||
DrawText("9-Patch and 3-Patch example", 20, 20, 10, BLACK);
|
DrawText("9-Patch and 3-Patch example", 20, 20, 10, RL_BLACK);
|
||||||
DrawText(" Move the mouse to stretch or", 40, 40, 10, DARKGRAY);
|
DrawText(" Move the mouse to stretch or", 40, 40, 10, RL_DARKGRAY);
|
||||||
DrawText(" shrink the n-patches.", 40, 60, 10, DARKGRAY);
|
DrawText(" shrink the n-patches.", 40, 60, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ int main()
|
||||||
switch (currentProcess)
|
switch (currentProcess)
|
||||||
{
|
{
|
||||||
case COLOR_GRAYSCALE: ImageColorGrayscale(&image); break;
|
case COLOR_GRAYSCALE: ImageColorGrayscale(&image); break;
|
||||||
case COLOR_TINT: ImageColorTint(&image, GREEN); break;
|
case COLOR_TINT: ImageColorTint(&image, RL_GREEN); break;
|
||||||
case COLOR_INVERT: ImageColorInvert(&image); break;
|
case COLOR_INVERT: ImageColorInvert(&image); break;
|
||||||
case COLOR_CONTRAST: ImageColorContrast(&image, -40); break;
|
case COLOR_CONTRAST: ImageColorContrast(&image, -40); break;
|
||||||
case COLOR_BRIGHTNESS: ImageColorBrightness(&image, -80); break;
|
case COLOR_BRIGHTNESS: ImageColorBrightness(&image, -80); break;
|
||||||
|
|
@ -114,20 +114,20 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawText("IMAGE PROCESSING:", 40, 30, 10, DARKGRAY);
|
DrawText("IMAGE PROCESSING:", 40, 30, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
// Draw rectangles
|
// Draw rectangles
|
||||||
for (int i = 0; i < NUM_PROCESSES; i++)
|
for (int i = 0; i < NUM_PROCESSES; i++)
|
||||||
{
|
{
|
||||||
DrawRectangleRec(selectRecs[i], (i == currentProcess) ? SKYBLUE : LIGHTGRAY);
|
DrawRectangleRec(selectRecs[i], (i == currentProcess) ? RL_SKYBLUE : RL_LIGHTGRAY);
|
||||||
DrawRectangleLines((int)selectRecs[i].x, (int) selectRecs[i].y, (int) selectRecs[i].width, (int) selectRecs[i].height, (i == currentProcess) ? BLUE : GRAY);
|
DrawRectangleLines((int)selectRecs[i].x, (int) selectRecs[i].y, (int) selectRecs[i].width, (int) selectRecs[i].height, (i == currentProcess) ? RL_BLUE : RL_GRAY);
|
||||||
DrawText( processText[i], (int)( selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2), (int) selectRecs[i].y + 11, 10, (i == currentProcess) ? DARKBLUE : DARKGRAY);
|
DrawText( processText[i], (int)( selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2), (int) selectRecs[i].y + 11, 10, (i == currentProcess) ? RL_DARKBLUE : RL_DARKGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE);
|
DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, RL_WHITE);
|
||||||
DrawRectangleLines(screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, texture.width, texture.height, BLACK);
|
DrawRectangleLines(screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, texture.width, texture.height, RL_BLACK);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ int main()
|
||||||
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
|
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
|
||||||
|
|
||||||
// Draw over image using custom font
|
// Draw over image using custom font
|
||||||
ImageDrawTextEx(&parrots, (Vector2){ 20.0f, 20.0f }, font, "[Parrots font drawing]", (float)font.baseSize, 0.0f, RED);
|
ImageDrawTextEx(&parrots, (Vector2){ 20.0f, 20.0f }, font, "[Parrots font drawing]", (float)font.baseSize, 0.0f, RL_RED);
|
||||||
|
|
||||||
Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
|
Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
|
||||||
UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
|
UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
|
||||||
|
|
@ -51,20 +51,20 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (!showFont)
|
if (!showFont)
|
||||||
{
|
{
|
||||||
// Draw texture with text already drawn inside
|
// Draw texture with text already drawn inside
|
||||||
DrawTextureV(texture, position, WHITE);
|
DrawTextureV(texture, position, RL_WHITE);
|
||||||
|
|
||||||
// Draw text directly using sprite font
|
// Draw text directly using sprite font
|
||||||
DrawTextEx(font, "[Parrots font drawing]", (Vector2){ position.x + 20,
|
DrawTextEx(font, "[Parrots font drawing]", (Vector2){ position.x + 20,
|
||||||
position.y + 20 + 280 }, (float)font.baseSize, 0.0f, WHITE);
|
position.y + 20 + 280 }, (float)font.baseSize, 0.0f, RL_WHITE);
|
||||||
}
|
}
|
||||||
else DrawTexture(font.texture, screenWidth/2 - font.texture.width/2, 50, BLACK);
|
else DrawTexture(font.texture, screenWidth/2 - font.texture.width/2, 50, RL_BLACK);
|
||||||
|
|
||||||
DrawText("PRESS SPACE to SEE USED SPRITEFONT ", 290, 420, 10, DARKGRAY);
|
DrawText("PRESS SPACE to SEE USED SPRITEFONT ", 290, 420, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
|
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, RL_WHITE);
|
||||||
|
|
||||||
DrawText("this IS a texture!", 360, 370, 10, GRAY);
|
DrawText("this IS a texture!", 360, 370, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(DARKGRAY);
|
ClearBackground(RL_DARKGRAY);
|
||||||
|
|
||||||
BeginBlendMode(blending);
|
BeginBlendMode(blending);
|
||||||
|
|
||||||
|
|
@ -115,10 +115,10 @@ int main()
|
||||||
|
|
||||||
EndBlendMode();
|
EndBlendMode();
|
||||||
|
|
||||||
DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 20, BLACK);
|
DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 20, RL_BLACK);
|
||||||
|
|
||||||
if (blending == BLEND_ALPHA) DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, BLACK);
|
if (blending == BLEND_ALPHA) DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, RL_BLACK);
|
||||||
else DrawText("ADDITIVE BLENDING", 280, screenHeight - 40, 20, RAYWHITE);
|
else DrawText("ADDITIVE BLENDING", 280, screenHeight - 40, 20, RL_RAYWHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ int main()
|
||||||
{
|
{
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
if (((x/32+y/32)/1)%2 == 0) pixels[y*height + x] = ORANGE;
|
if (((x/32+y/32)/1)%2 == 0) pixels[y*height + x] = RL_ORANGE;
|
||||||
else pixels[y*height + x] = GOLD;
|
else pixels[y*height + x] = RL_GOLD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,16 +68,16 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, Fade(WHITE, 0.5f));
|
DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, Fade(RL_WHITE, 0.5f));
|
||||||
DrawTexture(fudesumi, 430, -30, WHITE);
|
DrawTexture(fudesumi, 430, -30, RL_WHITE);
|
||||||
|
|
||||||
DrawText("CHECKED TEXTURE ", 84, 100, 30, BROWN);
|
DrawText("CHECKED TEXTURE ", 84, 100, 30, RL_BROWN);
|
||||||
DrawText("GENERATED by CODE", 72, 164, 30, BROWN);
|
DrawText("GENERATED by CODE", 72, 164, 30, RL_BROWN);
|
||||||
DrawText("and RAW IMAGE LOADING", 46, 226, 30, BROWN);
|
DrawText("and RAW IMAGE LOADING", 46, 226, 30, RL_BROWN);
|
||||||
|
|
||||||
DrawText("(c) Fudesumi sprite by Eiden Marsal", 310, screenHeight - 20, 10, BROWN);
|
DrawText("(c) Fudesumi sprite by Eiden Marsal", 310, screenHeight - 20, 10, RL_BROWN);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -64,25 +64,25 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTexture(scarfy, 15, 40, WHITE);
|
DrawTexture(scarfy, 15, 40, RL_WHITE);
|
||||||
DrawRectangleLines(15, 40, scarfy.width, scarfy.height, LIME);
|
DrawRectangleLines(15, 40, scarfy.width, scarfy.height, RL_LIME);
|
||||||
DrawRectangleLines(15 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RED);
|
DrawRectangleLines(15 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RL_RED);
|
||||||
|
|
||||||
DrawText("FRAME SPEED: ", 165, 210, 10, DARKGRAY);
|
DrawText("FRAME SPEED: ", 165, 210, 10, RL_DARKGRAY);
|
||||||
DrawText(FormatText("%02i FPS", framesSpeed), 575, 210, 10, DARKGRAY);
|
DrawText(FormatText("%02i FPS", framesSpeed), 575, 210, 10, RL_DARKGRAY);
|
||||||
DrawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, DARKGRAY);
|
DrawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, RL_DARKGRAY);
|
||||||
|
|
||||||
for (int i = 0; i < MAX_FRAME_SPEED; i++)
|
for (int i = 0; i < MAX_FRAME_SPEED; i++)
|
||||||
{
|
{
|
||||||
if (i < framesSpeed) DrawRectangle(250 + 21*i, 205, 20, 20, RED);
|
if (i < framesSpeed) DrawRectangle(250 + 21*i, 205, 20, 20, RL_RED);
|
||||||
DrawRectangleLines(250 + 21*i, 205, 20, 20, MAROON);
|
DrawRectangleLines(250 + 21*i, 205, 20, 20, RL_MAROON);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTextureRec(scarfy, frameRec, position, WHITE); // Draw part of the texture
|
DrawTextureRec(scarfy, frameRec, position, RL_WHITE); // Draw part of the texture
|
||||||
|
|
||||||
DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -52,19 +52,19 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
|
// NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
|
||||||
// sourceRec defines the part of the texture we use for drawing
|
// sourceRec defines the part of the texture we use for drawing
|
||||||
// destRec defines the rectangle where our texture part will fit (scaling it to fit)
|
// destRec defines the rectangle where our texture part will fit (scaling it to fit)
|
||||||
// origin defines the point of the texture used as reference for rotation and scaling
|
// origin defines the point of the texture used as reference for rotation and scaling
|
||||||
// rotation defines the texture rotation (using origin as rotation point)
|
// rotation defines the texture rotation (using origin as rotation point)
|
||||||
DrawTexturePro(scarfy, sourceRec, destRec, origin, (float)rotation, WHITE);
|
DrawTexturePro(scarfy, sourceRec, destRec, origin, (float)rotation, RL_WHITE);
|
||||||
|
|
||||||
DrawLine((int) destRec.x, 0, (int) destRec.x, screenHeight, GRAY);
|
DrawLine((int) destRec.x, 0, (int) destRec.x, screenHeight, RL_GRAY);
|
||||||
DrawLine(0, (int)destRec.y, screenWidth, (int)destRec.y, GRAY);
|
DrawLine(0, (int)destRec.y, screenWidth, (int)destRec.y, RL_GRAY);
|
||||||
|
|
||||||
DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,11 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
|
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, RL_WHITE);
|
||||||
|
|
||||||
DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY);
|
DrawText("this IS a texture loaded from an image!", 300, 370, 10, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -281,18 +281,18 @@ void DrawGame(void)
|
||||||
{
|
{
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (!gameOver)
|
if (!gameOver)
|
||||||
{
|
{
|
||||||
// Draw player bar
|
// Draw player bar
|
||||||
DrawRectangle(player.position.x - player.size.x/2, player.position.y - player.size.y/2, player.size.x, player.size.y, BLACK);
|
DrawRectangle(player.position.x - player.size.x/2, player.position.y - player.size.y/2, player.size.x, player.size.y, RL_BLACK);
|
||||||
|
|
||||||
// Draw player lives
|
// Draw player lives
|
||||||
for (int i = 0; i < player.life; i++) DrawRectangle(20 + 40*i, screenHeight - 30, 35, 10, LIGHTGRAY);
|
for (int i = 0; i < player.life; i++) DrawRectangle(20 + 40*i, screenHeight - 30, 35, 10, RL_LIGHTGRAY);
|
||||||
|
|
||||||
// Draw ball
|
// Draw ball
|
||||||
DrawCircleV(ball.position, ball.radius, MAROON);
|
DrawCircleV(ball.position, ball.radius, RL_MAROON);
|
||||||
|
|
||||||
// Draw bricks
|
// Draw bricks
|
||||||
for (int i = 0; i < LINES_OF_BRICKS; i++)
|
for (int i = 0; i < LINES_OF_BRICKS; i++)
|
||||||
|
|
@ -301,15 +301,15 @@ void DrawGame(void)
|
||||||
{
|
{
|
||||||
if (brick[i][j].active)
|
if (brick[i][j].active)
|
||||||
{
|
{
|
||||||
if ((i + j) % 2 == 0) DrawRectangle(brick[i][j].position.x - brickSize.x/2, brick[i][j].position.y - brickSize.y/2, brickSize.x, brickSize.y, GRAY);
|
if ((i + j) % 2 == 0) DrawRectangle(brick[i][j].position.x - brickSize.x/2, brick[i][j].position.y - brickSize.y/2, brickSize.x, brickSize.y, RL_GRAY);
|
||||||
else DrawRectangle(brick[i][j].position.x - brickSize.x/2, brick[i][j].position.y - brickSize.y/2, brickSize.x, brickSize.y, DARKGRAY);
|
else DrawRectangle(brick[i][j].position.x - brickSize.x/2, brick[i][j].position.y - brickSize.y/2, brickSize.x, brickSize.y, RL_DARKGRAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
|
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
|
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ void InitGame(void)
|
||||||
player.acceleration = 0;
|
player.acceleration = 0;
|
||||||
player.rotation = 0;
|
player.rotation = 0;
|
||||||
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
|
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
|
||||||
player.color = LIGHTGRAY;
|
player.color = RL_LIGHTGRAY;
|
||||||
|
|
||||||
destroyedMeteorsCount = 0;
|
destroyedMeteorsCount = 0;
|
||||||
|
|
||||||
|
|
@ -165,7 +165,7 @@ void InitGame(void)
|
||||||
shoot[i].radius = 2;
|
shoot[i].radius = 2;
|
||||||
shoot[i].active = false;
|
shoot[i].active = false;
|
||||||
shoot[i].lifeSpawn = 0;
|
shoot[i].lifeSpawn = 0;
|
||||||
shoot[i].color = WHITE;
|
shoot[i].color = RL_WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_BIG_METEORS; i++)
|
for (int i = 0; i < MAX_BIG_METEORS; i++)
|
||||||
|
|
@ -207,7 +207,7 @@ void InitGame(void)
|
||||||
bigMeteor[i].speed = (Vector2){velx, vely};
|
bigMeteor[i].speed = (Vector2){velx, vely};
|
||||||
bigMeteor[i].radius = 40;
|
bigMeteor[i].radius = 40;
|
||||||
bigMeteor[i].active = true;
|
bigMeteor[i].active = true;
|
||||||
bigMeteor[i].color = BLUE;
|
bigMeteor[i].color = RL_BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
|
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
|
||||||
|
|
@ -216,7 +216,7 @@ void InitGame(void)
|
||||||
mediumMeteor[i].speed = (Vector2){0,0};
|
mediumMeteor[i].speed = (Vector2){0,0};
|
||||||
mediumMeteor[i].radius = 20;
|
mediumMeteor[i].radius = 20;
|
||||||
mediumMeteor[i].active = false;
|
mediumMeteor[i].active = false;
|
||||||
mediumMeteor[i].color = BLUE;
|
mediumMeteor[i].color = RL_BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_SMALL_METEORS; i++)
|
for (int i = 0; i < MAX_SMALL_METEORS; i++)
|
||||||
|
|
@ -225,7 +225,7 @@ void InitGame(void)
|
||||||
smallMeteor[i].speed = (Vector2){0,0};
|
smallMeteor[i].speed = (Vector2){0,0};
|
||||||
smallMeteor[i].radius = 10;
|
smallMeteor[i].radius = 10;
|
||||||
smallMeteor[i].active = false;
|
smallMeteor[i].active = false;
|
||||||
smallMeteor[i].color = BLUE;
|
smallMeteor[i].color = RL_BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
midMeteorsCount = 0;
|
midMeteorsCount = 0;
|
||||||
|
|
@ -440,7 +440,7 @@ void UpdateGame(void)
|
||||||
midMeteorsCount ++;
|
midMeteorsCount ++;
|
||||||
}
|
}
|
||||||
//bigMeteor[a].position = (Vector2){-100, -100};
|
//bigMeteor[a].position = (Vector2){-100, -100};
|
||||||
bigMeteor[a].color = RED;
|
bigMeteor[a].color = RL_RED;
|
||||||
a = MAX_BIG_METEORS;
|
a = MAX_BIG_METEORS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -471,7 +471,7 @@ void UpdateGame(void)
|
||||||
smallMeteorsCount ++;
|
smallMeteorsCount ++;
|
||||||
}
|
}
|
||||||
//mediumMeteor[b].position = (Vector2){-100, -100};
|
//mediumMeteor[b].position = (Vector2){-100, -100};
|
||||||
mediumMeteor[b].color = GREEN;
|
mediumMeteor[b].color = RL_GREEN;
|
||||||
b = MAX_MEDIUM_METEORS;
|
b = MAX_MEDIUM_METEORS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -484,7 +484,7 @@ void UpdateGame(void)
|
||||||
shoot[i].lifeSpawn = 0;
|
shoot[i].lifeSpawn = 0;
|
||||||
smallMeteor[c].active = false;
|
smallMeteor[c].active = false;
|
||||||
destroyedMeteorsCount++;
|
destroyedMeteorsCount++;
|
||||||
smallMeteor[c].color = YELLOW;
|
smallMeteor[c].color = RL_YELLOW;
|
||||||
// smallMeteor[c].position = (Vector2){-100, -100};
|
// smallMeteor[c].position = (Vector2){-100, -100};
|
||||||
c = MAX_SMALL_METEORS;
|
c = MAX_SMALL_METEORS;
|
||||||
}
|
}
|
||||||
|
|
@ -510,7 +510,7 @@ void DrawGame(void)
|
||||||
{
|
{
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (!gameOver)
|
if (!gameOver)
|
||||||
{
|
{
|
||||||
|
|
@ -518,38 +518,38 @@ void DrawGame(void)
|
||||||
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
|
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
|
||||||
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||||
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||||
DrawTriangle(v1, v2, v3, MAROON);
|
DrawTriangle(v1, v2, v3, RL_MAROON);
|
||||||
|
|
||||||
// Draw meteors
|
// Draw meteors
|
||||||
for (int i = 0; i < MAX_BIG_METEORS; i++)
|
for (int i = 0; i < MAX_BIG_METEORS; i++)
|
||||||
{
|
{
|
||||||
if (bigMeteor[i].active) DrawCircleV(bigMeteor[i].position, bigMeteor[i].radius, DARKGRAY);
|
if (bigMeteor[i].active) DrawCircleV(bigMeteor[i].position, bigMeteor[i].radius, RL_DARKGRAY);
|
||||||
else DrawCircleV(bigMeteor[i].position, bigMeteor[i].radius, Fade(LIGHTGRAY, 0.3f));
|
else DrawCircleV(bigMeteor[i].position, bigMeteor[i].radius, Fade(RL_LIGHTGRAY, 0.3f));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
|
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
|
||||||
{
|
{
|
||||||
if (mediumMeteor[i].active) DrawCircleV(mediumMeteor[i].position, mediumMeteor[i].radius, GRAY);
|
if (mediumMeteor[i].active) DrawCircleV(mediumMeteor[i].position, mediumMeteor[i].radius, RL_GRAY);
|
||||||
else DrawCircleV(mediumMeteor[i].position, mediumMeteor[i].radius, Fade(LIGHTGRAY, 0.3f));
|
else DrawCircleV(mediumMeteor[i].position, mediumMeteor[i].radius, Fade(RL_LIGHTGRAY, 0.3f));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_SMALL_METEORS; i++)
|
for (int i = 0; i < MAX_SMALL_METEORS; i++)
|
||||||
{
|
{
|
||||||
if (smallMeteor[i].active) DrawCircleV(smallMeteor[i].position, smallMeteor[i].radius, GRAY);
|
if (smallMeteor[i].active) DrawCircleV(smallMeteor[i].position, smallMeteor[i].radius, RL_GRAY);
|
||||||
else DrawCircleV(smallMeteor[i].position, smallMeteor[i].radius, Fade(LIGHTGRAY, 0.3f));
|
else DrawCircleV(smallMeteor[i].position, smallMeteor[i].radius, Fade(RL_LIGHTGRAY, 0.3f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw shoot
|
// Draw shoot
|
||||||
for (int i = 0; i < PLAYER_MAX_SHOOTS; i++)
|
for (int i = 0; i < PLAYER_MAX_SHOOTS; i++)
|
||||||
{
|
{
|
||||||
if (shoot[i].active) DrawCircleV(shoot[i].position, shoot[i].radius, BLACK);
|
if (shoot[i].active) DrawCircleV(shoot[i].position, shoot[i].radius, RL_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (victory) DrawText("VICTORY", screenWidth/2 - MeasureText("VICTORY", 20)/2, screenHeight/2, 20, LIGHTGRAY);
|
if (victory) DrawText("VICTORY", screenWidth/2 - MeasureText("VICTORY", 20)/2, screenHeight/2, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
|
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
|
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ void InitGame(void)
|
||||||
player.acceleration = 0;
|
player.acceleration = 0;
|
||||||
player.rotation = 0;
|
player.rotation = 0;
|
||||||
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
|
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
|
||||||
player.color = LIGHTGRAY;
|
player.color = RL_LIGHTGRAY;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
|
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -177,7 +177,7 @@ void InitGame(void)
|
||||||
mediumMeteor[i].speed = (Vector2){velx, vely};
|
mediumMeteor[i].speed = (Vector2){velx, vely};
|
||||||
mediumMeteor[i].radius = 20;
|
mediumMeteor[i].radius = 20;
|
||||||
mediumMeteor[i].active = true;
|
mediumMeteor[i].active = true;
|
||||||
mediumMeteor[i].color = GREEN;
|
mediumMeteor[i].color = RL_GREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_SMALL_METEORS; i++)
|
for (int i = 0; i < MAX_SMALL_METEORS; i++)
|
||||||
|
|
@ -217,7 +217,7 @@ void InitGame(void)
|
||||||
smallMeteor[i].speed = (Vector2){velx, vely};
|
smallMeteor[i].speed = (Vector2){velx, vely};
|
||||||
smallMeteor[i].radius = 10;
|
smallMeteor[i].radius = 10;
|
||||||
smallMeteor[i].active = true;
|
smallMeteor[i].active = true;
|
||||||
smallMeteor[i].color = YELLOW;
|
smallMeteor[i].color = RL_YELLOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,7 +331,7 @@ void DrawGame(void)
|
||||||
{
|
{
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (!gameOver)
|
if (!gameOver)
|
||||||
{
|
{
|
||||||
|
|
@ -339,26 +339,26 @@ void DrawGame(void)
|
||||||
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
|
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
|
||||||
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||||
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||||
DrawTriangle(v1, v2, v3, MAROON);
|
DrawTriangle(v1, v2, v3, RL_MAROON);
|
||||||
|
|
||||||
// Draw meteor
|
// Draw meteor
|
||||||
for (int i = 0;i < MAX_MEDIUM_METEORS; i++)
|
for (int i = 0;i < MAX_MEDIUM_METEORS; i++)
|
||||||
{
|
{
|
||||||
if (mediumMeteor[i].active) DrawCircleV(mediumMeteor[i].position, mediumMeteor[i].radius, GRAY);
|
if (mediumMeteor[i].active) DrawCircleV(mediumMeteor[i].position, mediumMeteor[i].radius, RL_GRAY);
|
||||||
else DrawCircleV(mediumMeteor[i].position, mediumMeteor[i].radius, Fade(LIGHTGRAY, 0.3f));
|
else DrawCircleV(mediumMeteor[i].position, mediumMeteor[i].radius, Fade(RL_LIGHTGRAY, 0.3f));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0;i < MAX_SMALL_METEORS; i++)
|
for (int i = 0;i < MAX_SMALL_METEORS; i++)
|
||||||
{
|
{
|
||||||
if (smallMeteor[i].active) DrawCircleV(smallMeteor[i].position, smallMeteor[i].radius, DARKGRAY);
|
if (smallMeteor[i].active) DrawCircleV(smallMeteor[i].position, smallMeteor[i].radius, RL_DARKGRAY);
|
||||||
else DrawCircleV(smallMeteor[i].position, smallMeteor[i].radius, Fade(LIGHTGRAY, 0.3f));
|
else DrawCircleV(smallMeteor[i].position, smallMeteor[i].radius, Fade(RL_LIGHTGRAY, 0.3f));
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText(FormatText("TIME: %.02f", (float)framesCounter/60), 10, 10, 20, BLACK);
|
DrawText(FormatText("TIME: %.02f", (float)framesCounter/60), 10, 10, 20, RL_BLACK);
|
||||||
|
|
||||||
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
|
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
|
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -85,29 +85,29 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
switch (currentScreen)
|
switch (currentScreen)
|
||||||
{
|
{
|
||||||
case TITLE:
|
case TITLE:
|
||||||
{
|
{
|
||||||
// Draw title screen
|
// Draw title screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, GREEN);
|
DrawRectangle(0, 0, screenWidth, screenHeight, RL_GREEN);
|
||||||
DrawText("TITLE SCREEN", 20, 20, 40, DARKGREEN);
|
DrawText("TITLE SCREEN", 20, 20, 40, RL_DARKGREEN);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case GAMEPLAY:
|
case GAMEPLAY:
|
||||||
{
|
{
|
||||||
// Draw gameplay screen
|
// Draw gameplay screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, RED);
|
DrawRectangle(0, 0, screenWidth, screenHeight, RL_RED);
|
||||||
DrawText("GAMEPLAY SCREEN", 20, 20, 40, MAROON);
|
DrawText("GAMEPLAY SCREEN", 20, 20, 40, RL_MAROON);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
{
|
{
|
||||||
// Draw ending screen
|
// Draw ending screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, BLUE);
|
DrawRectangle(0, 0, screenWidth, screenHeight, RL_BLUE);
|
||||||
DrawText("ENDING SCREEN", 20, 20, 40, DARKBLUE);
|
DrawText("ENDING SCREEN", 20, 20, 40, RL_DARKBLUE);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -106,29 +106,29 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw background (common to all screens)
|
// Draw background (common to all screens)
|
||||||
DrawTexture(sky, 0, 0, WHITE);
|
DrawTexture(sky, 0, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawTexture(mountains, backScrolling, 0, WHITE);
|
DrawTexture(mountains, backScrolling, 0, RL_WHITE);
|
||||||
DrawTexture(mountains, screenWidth + backScrolling, 0, WHITE);
|
DrawTexture(mountains, screenWidth + backScrolling, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawTexture(sea, seaScrolling, 0, BLUE);
|
DrawTexture(sea, seaScrolling, 0, RL_BLUE);
|
||||||
DrawTexture(sea, screenWidth + seaScrolling, 0, BLUE);
|
DrawTexture(sea, screenWidth + seaScrolling, 0, RL_BLUE);
|
||||||
|
|
||||||
switch (currentScreen)
|
switch (currentScreen)
|
||||||
{
|
{
|
||||||
case TITLE:
|
case TITLE:
|
||||||
{
|
{
|
||||||
// Draw title screen
|
// Draw title screen
|
||||||
DrawText("PRESS ENTER", 450, 420, 40, BLACK);
|
DrawText("PRESS ENTER", 450, 420, 40, RL_BLACK);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case GAMEPLAY:
|
case GAMEPLAY:
|
||||||
{
|
{
|
||||||
// Draw gameplay screen
|
// Draw gameplay screen
|
||||||
DrawText("GAMEPLAY SCREEN", 20, 20, 40, MAROON);
|
DrawText("GAMEPLAY SCREEN", 20, 20, 40, RL_MAROON);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
|
|
@ -136,9 +136,9 @@ int main()
|
||||||
// Draw ending screen
|
// Draw ending screen
|
||||||
|
|
||||||
// Draw a transparent black rectangle that covers all screen
|
// Draw a transparent black rectangle that covers all screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
|
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(RL_BLACK, 0.4f));
|
||||||
|
|
||||||
DrawText("ENDING SCREEN", 20, 20, 40, DARKBLUE);
|
DrawText("ENDING SCREEN", 20, 20, 40, RL_DARKBLUE);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -134,23 +134,23 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw background (common to all screens)
|
// Draw background (common to all screens)
|
||||||
DrawTexture(sky, 0, 0, WHITE);
|
DrawTexture(sky, 0, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawTexture(mountains, backScrolling, 0, WHITE);
|
DrawTexture(mountains, backScrolling, 0, RL_WHITE);
|
||||||
DrawTexture(mountains, screenWidth + backScrolling, 0, WHITE);
|
DrawTexture(mountains, screenWidth + backScrolling, 0, RL_WHITE);
|
||||||
|
|
||||||
if (!gameraMode)
|
if (!gameraMode)
|
||||||
{
|
{
|
||||||
DrawTexture(sea, seaScrolling, 0, BLUE);
|
DrawTexture(sea, seaScrolling, 0, RL_BLUE);
|
||||||
DrawTexture(sea, screenWidth + seaScrolling, 0, BLUE);
|
DrawTexture(sea, screenWidth + seaScrolling, 0, RL_BLUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawTexture(sea, seaScrolling, 0, RED);
|
DrawTexture(sea, seaScrolling, 0, RL_RED);
|
||||||
DrawTexture(sea, screenWidth + seaScrolling, 0, RED);
|
DrawTexture(sea, screenWidth + seaScrolling, 0, RL_RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (currentScreen)
|
switch (currentScreen)
|
||||||
|
|
@ -158,33 +158,33 @@ int main()
|
||||||
case TITLE:
|
case TITLE:
|
||||||
{
|
{
|
||||||
// Draw title
|
// Draw title
|
||||||
//DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
|
//DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, RL_WHITE);
|
||||||
DrawRectangle(380, 140, 500, 300, GRAY);
|
DrawRectangle(380, 140, 500, 300, RL_GRAY);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawText("PRESS ENTER", 480, 480, 40, BLACK);
|
if ((framesCounter/30) % 2) DrawText("PRESS ENTER", 480, 480, 40, RL_BLACK);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case GAMEPLAY:
|
case GAMEPLAY:
|
||||||
{
|
{
|
||||||
// Draw player
|
// Draw player
|
||||||
//if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, WHITE);
|
//if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, RL_WHITE);
|
||||||
//else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, WHITE);
|
//else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, RL_WHITE);
|
||||||
|
|
||||||
// Draw player bounding box
|
// Draw player bounding box
|
||||||
if (!gameraMode) DrawRectangleRec(playerBounds, GREEN);
|
if (!gameraMode) DrawRectangleRec(playerBounds, RL_GREEN);
|
||||||
else DrawRectangleRec(playerBounds, ORANGE);
|
else DrawRectangleRec(playerBounds, RL_ORANGE);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
{
|
{
|
||||||
// Draw a transparent black rectangle that covers all screen
|
// Draw a transparent black rectangle that covers all screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
|
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(RL_BLACK, 0.4f));
|
||||||
|
|
||||||
DrawText("GAME OVER", 300, 200, 100, MAROON);
|
DrawText("GAME OVER", 300, 200, 100, RL_MAROON);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawText("PRESS ENTER to REPLAY", 400, 420, 30, LIGHTGRAY);
|
if ((framesCounter/30) % 2) DrawText("PRESS ENTER to REPLAY", 400, 420, 30, RL_LIGHTGRAY);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -268,23 +268,23 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw background (common to all screens)
|
// Draw background (common to all screens)
|
||||||
DrawTexture(sky, 0, 0, WHITE);
|
DrawTexture(sky, 0, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawTexture(mountains, backScrolling, 0, WHITE);
|
DrawTexture(mountains, backScrolling, 0, RL_WHITE);
|
||||||
DrawTexture(mountains, screenWidth + backScrolling, 0, WHITE);
|
DrawTexture(mountains, screenWidth + backScrolling, 0, RL_WHITE);
|
||||||
|
|
||||||
if (!gameraMode)
|
if (!gameraMode)
|
||||||
{
|
{
|
||||||
DrawTexture(sea, seaScrolling, 0, BLUE);
|
DrawTexture(sea, seaScrolling, 0, RL_BLUE);
|
||||||
DrawTexture(sea, screenWidth + seaScrolling, 0, BLUE);
|
DrawTexture(sea, screenWidth + seaScrolling, 0, RL_BLUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawTexture(sea, seaScrolling, 0, RED);
|
DrawTexture(sea, seaScrolling, 0, RL_RED);
|
||||||
DrawTexture(sea, screenWidth + seaScrolling, 0, RED);
|
DrawTexture(sea, screenWidth + seaScrolling, 0, RL_RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (currentScreen)
|
switch (currentScreen)
|
||||||
|
|
@ -292,24 +292,24 @@ int main()
|
||||||
case TITLE:
|
case TITLE:
|
||||||
{
|
{
|
||||||
// Draw title
|
// Draw title
|
||||||
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
|
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, RL_WHITE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawText("PRESS ENTER", 480, 480, 40, BLACK);
|
if ((framesCounter/30) % 2) DrawText("PRESS ENTER", 480, 480, 40, RL_BLACK);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case GAMEPLAY:
|
case GAMEPLAY:
|
||||||
{
|
{
|
||||||
// Draw water lines
|
// Draw water lines
|
||||||
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(SKYBLUE, 0.1f));
|
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(RL_SKYBLUE, 0.1f));
|
||||||
|
|
||||||
// Draw player
|
// Draw player
|
||||||
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, WHITE);
|
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, RL_WHITE);
|
||||||
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, WHITE);
|
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, RL_WHITE);
|
||||||
|
|
||||||
// Draw player bounding box
|
// Draw player bounding box
|
||||||
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(GREEN, 0.4f));
|
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(RL_GREEN, 0.4f));
|
||||||
//else DrawRectangleRec(playerBounds, Fade(ORANGE, 0.4f));
|
//else DrawRectangleRec(playerBounds, Fade(RL_ORANGE, 0.4f));
|
||||||
|
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
for (int i = 0; i < MAX_ENEMIES; i++)
|
for (int i = 0; i < MAX_ENEMIES; i++)
|
||||||
|
|
@ -320,10 +320,10 @@ int main()
|
||||||
/*
|
/*
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
@ -331,10 +331,10 @@ int main()
|
||||||
// Draw enemies bounding boxes
|
// Draw enemies bounding boxes
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawRectangleRec(enemyBounds[i], RED); break;
|
case 0: DrawRectangleRec(enemyBounds[i], RL_RED); break;
|
||||||
case 1: DrawRectangleRec(enemyBounds[i], RED); break;
|
case 1: DrawRectangleRec(enemyBounds[i], RL_RED); break;
|
||||||
case 2: DrawRectangleRec(enemyBounds[i], RED); break;
|
case 2: DrawRectangleRec(enemyBounds[i], RL_RED); break;
|
||||||
case 3: DrawRectangleRec(enemyBounds[i], GREEN); break;
|
case 3: DrawRectangleRec(enemyBounds[i], RL_GREEN); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -343,25 +343,25 @@ int main()
|
||||||
// Draw gameplay interface
|
// Draw gameplay interface
|
||||||
|
|
||||||
// Draw food bar
|
// Draw food bar
|
||||||
DrawRectangle(20, 20, 400, 40, Fade(GRAY, 0.4f));
|
DrawRectangle(20, 20, 400, 40, Fade(RL_GRAY, 0.4f));
|
||||||
DrawRectangle(20, 20, foodBar, 40, ORANGE);
|
DrawRectangle(20, 20, foodBar, 40, RL_ORANGE);
|
||||||
DrawRectangleLines(20, 20, 400, 40, BLACK);
|
DrawRectangleLines(20, 20, 400, 40, RL_BLACK);
|
||||||
|
|
||||||
if (gameraMode)
|
if (gameraMode)
|
||||||
{
|
{
|
||||||
DrawText("GAMERA MODE", 60, 22, 40, GRAY);
|
DrawText("GAMERA MODE", 60, 22, 40, RL_GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
{
|
{
|
||||||
// Draw a transparent black rectangle that covers all screen
|
// Draw a transparent black rectangle that covers all screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
|
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(RL_BLACK, 0.4f));
|
||||||
|
|
||||||
DrawText("GAME OVER", 300, 200, 100, MAROON);
|
DrawText("GAME OVER", 300, 200, 100, RL_MAROON);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawText("PRESS ENTER to REPLAY", 400, 420, 30, LIGHTGRAY);
|
if ((framesCounter/30) % 2) DrawText("PRESS ENTER to REPLAY", 400, 420, 30, RL_LIGHTGRAY);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -311,13 +311,13 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw background (common to all screens)
|
// Draw background (common to all screens)
|
||||||
DrawTexture(sky, 0, 0, WHITE);
|
DrawTexture(sky, 0, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawTexture(mountains, backScrolling, 0, WHITE);
|
DrawTexture(mountains, backScrolling, 0, RL_WHITE);
|
||||||
DrawTexture(mountains, screenWidth + backScrolling, 0, WHITE);
|
DrawTexture(mountains, screenWidth + backScrolling, 0, RL_WHITE);
|
||||||
|
|
||||||
if (!gameraMode)
|
if (!gameraMode)
|
||||||
{
|
{
|
||||||
|
|
@ -335,24 +335,24 @@ int main()
|
||||||
case TITLE:
|
case TITLE:
|
||||||
{
|
{
|
||||||
// Draw title
|
// Draw title
|
||||||
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
|
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, RL_WHITE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, WHITE);
|
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, RL_WHITE);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case GAMEPLAY:
|
case GAMEPLAY:
|
||||||
{
|
{
|
||||||
// Draw water lines
|
// Draw water lines
|
||||||
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(SKYBLUE, 0.1f));
|
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(RL_SKYBLUE, 0.1f));
|
||||||
|
|
||||||
// Draw player
|
// Draw player
|
||||||
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, WHITE);
|
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, RL_WHITE);
|
||||||
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, WHITE);
|
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, RL_WHITE);
|
||||||
|
|
||||||
// Draw player bounding box
|
// Draw player bounding box
|
||||||
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(GREEN, 0.4f));
|
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(RL_GREEN, 0.4f));
|
||||||
//else DrawRectangleRec(playerBounds, Fade(ORANGE, 0.4f));
|
//else DrawRectangleRec(playerBounds, Fade(RL_ORANGE, 0.4f));
|
||||||
|
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
for (int i = 0; i < MAX_ENEMIES; i++)
|
for (int i = 0; i < MAX_ENEMIES; i++)
|
||||||
|
|
@ -362,10 +362,10 @@ int main()
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -373,10 +373,10 @@ int main()
|
||||||
/*
|
/*
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 0: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 1: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 1: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 2: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 2: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 3: DrawRectangleRec(enemyBounds[i], Fade(GREEN, 0.5f)); break;
|
case 3: DrawRectangleRec(enemyBounds[i], Fade(RL_GREEN, 0.5f)); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
@ -384,34 +384,34 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw gameplay interface
|
// Draw gameplay interface
|
||||||
DrawRectangle(20, 20, 400, 40, Fade(GRAY, 0.4f));
|
DrawRectangle(20, 20, 400, 40, Fade(RL_GRAY, 0.4f));
|
||||||
DrawRectangle(20, 20, foodBar, 40, ORANGE);
|
DrawRectangle(20, 20, foodBar, 40, RL_ORANGE);
|
||||||
DrawRectangleLines(20, 20, 400, 40, BLACK);
|
DrawRectangleLines(20, 20, 400, 40, RL_BLACK);
|
||||||
|
|
||||||
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, RL_ORANGE);
|
||||||
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, RL_ORANGE);
|
||||||
|
|
||||||
if (gameraMode)
|
if (gameraMode)
|
||||||
{
|
{
|
||||||
DrawText("GAMERA MODE", 60, 22, 40, GRAY);
|
DrawText("GAMERA MODE", 60, 22, 40, RL_GRAY);
|
||||||
DrawTexture(gframe, 0, 0, Fade(WHITE, 0.5f));
|
DrawTexture(gframe, 0, 0, Fade(RL_WHITE, 0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
{
|
{
|
||||||
// Draw a transparent black rectangle that covers all screen
|
// Draw a transparent black rectangle that covers all screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
|
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(RL_BLACK, 0.4f));
|
||||||
|
|
||||||
DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, MAROON);
|
DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, RL_MAROON);
|
||||||
|
|
||||||
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, GOLD);
|
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, RL_GOLD);
|
||||||
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, GOLD);
|
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, RL_GOLD);
|
||||||
DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, RL_ORANGE);
|
||||||
DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, RL_ORANGE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, LIGHTGRAY);
|
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, RL_LIGHTGRAY);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -327,13 +327,13 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw background (common to all screens)
|
// Draw background (common to all screens)
|
||||||
DrawTexture(sky, 0, 0, WHITE);
|
DrawTexture(sky, 0, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawTexture(mountains, backScrolling, 0, WHITE);
|
DrawTexture(mountains, backScrolling, 0, RL_WHITE);
|
||||||
DrawTexture(mountains, screenWidth + backScrolling, 0, WHITE);
|
DrawTexture(mountains, screenWidth + backScrolling, 0, RL_WHITE);
|
||||||
|
|
||||||
if (!gameraMode)
|
if (!gameraMode)
|
||||||
{
|
{
|
||||||
|
|
@ -351,24 +351,24 @@ int main()
|
||||||
case TITLE:
|
case TITLE:
|
||||||
{
|
{
|
||||||
// Draw title
|
// Draw title
|
||||||
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
|
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, RL_WHITE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, WHITE);
|
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, RL_WHITE);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case GAMEPLAY:
|
case GAMEPLAY:
|
||||||
{
|
{
|
||||||
// Draw water lines
|
// Draw water lines
|
||||||
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(SKYBLUE, 0.1f));
|
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(RL_SKYBLUE, 0.1f));
|
||||||
|
|
||||||
// Draw player
|
// Draw player
|
||||||
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, WHITE);
|
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, RL_WHITE);
|
||||||
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, WHITE);
|
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, RL_WHITE);
|
||||||
|
|
||||||
// Draw player bounding box
|
// Draw player bounding box
|
||||||
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(GREEN, 0.4f));
|
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(RL_GREEN, 0.4f));
|
||||||
//else DrawRectangleRec(playerBounds, Fade(ORANGE, 0.4f));
|
//else DrawRectangleRec(playerBounds, Fade(RL_ORANGE, 0.4f));
|
||||||
|
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
for (int i = 0; i < MAX_ENEMIES; i++)
|
for (int i = 0; i < MAX_ENEMIES; i++)
|
||||||
|
|
@ -378,10 +378,10 @@ int main()
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -389,10 +389,10 @@ int main()
|
||||||
/*
|
/*
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 0: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 1: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 1: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 2: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 2: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 3: DrawRectangleRec(enemyBounds[i], Fade(GREEN, 0.5f)); break;
|
case 3: DrawRectangleRec(enemyBounds[i], Fade(RL_GREEN, 0.5f)); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
@ -400,34 +400,34 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw gameplay interface
|
// Draw gameplay interface
|
||||||
DrawRectangle(20, 20, 400, 40, Fade(GRAY, 0.4f));
|
DrawRectangle(20, 20, 400, 40, Fade(RL_GRAY, 0.4f));
|
||||||
DrawRectangle(20, 20, foodBar, 40, ORANGE);
|
DrawRectangle(20, 20, foodBar, 40, RL_ORANGE);
|
||||||
DrawRectangleLines(20, 20, 400, 40, BLACK);
|
DrawRectangleLines(20, 20, 400, 40, RL_BLACK);
|
||||||
|
|
||||||
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, RL_ORANGE);
|
||||||
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, RL_ORANGE);
|
||||||
|
|
||||||
if (gameraMode)
|
if (gameraMode)
|
||||||
{
|
{
|
||||||
DrawText("GAMERA MODE", 60, 22, 40, GRAY);
|
DrawText("GAMERA MODE", 60, 22, 40, RL_GRAY);
|
||||||
DrawTexture(gframe, 0, 0, Fade(WHITE, 0.5f));
|
DrawTexture(gframe, 0, 0, Fade(RL_WHITE, 0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
{
|
{
|
||||||
// Draw a transparent black rectangle that covers all screen
|
// Draw a transparent black rectangle that covers all screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
|
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(RL_BLACK, 0.4f));
|
||||||
|
|
||||||
DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, MAROON);
|
DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, RL_MAROON);
|
||||||
|
|
||||||
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, GOLD);
|
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, RL_GOLD);
|
||||||
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, GOLD);
|
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, RL_GOLD);
|
||||||
DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, RL_ORANGE);
|
||||||
DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, RL_ORANGE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, LIGHTGRAY);
|
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, RL_LIGHTGRAY);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -352,13 +352,13 @@ int main()
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw background (common to all screens)
|
// Draw background (common to all screens)
|
||||||
DrawTexture(sky, 0, 0, WHITE);
|
DrawTexture(sky, 0, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawTexture(mountains, backScrolling, 0, WHITE);
|
DrawTexture(mountains, backScrolling, 0, RL_WHITE);
|
||||||
DrawTexture(mountains, screenWidth + backScrolling, 0, WHITE);
|
DrawTexture(mountains, screenWidth + backScrolling, 0, RL_WHITE);
|
||||||
|
|
||||||
if (!gameraMode)
|
if (!gameraMode)
|
||||||
{
|
{
|
||||||
|
|
@ -376,24 +376,24 @@ int main()
|
||||||
case TITLE:
|
case TITLE:
|
||||||
{
|
{
|
||||||
// Draw title
|
// Draw title
|
||||||
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
|
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, RL_WHITE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, WHITE);
|
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, RL_WHITE);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case GAMEPLAY:
|
case GAMEPLAY:
|
||||||
{
|
{
|
||||||
// Draw water lines
|
// Draw water lines
|
||||||
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(SKYBLUE, 0.1f));
|
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(RL_SKYBLUE, 0.1f));
|
||||||
|
|
||||||
// Draw player
|
// Draw player
|
||||||
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, WHITE);
|
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, RL_WHITE);
|
||||||
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, WHITE);
|
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, RL_WHITE);
|
||||||
|
|
||||||
// Draw player bounding box
|
// Draw player bounding box
|
||||||
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(GREEN, 0.4f));
|
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(RL_GREEN, 0.4f));
|
||||||
//else DrawRectangleRec(playerBounds, Fade(ORANGE, 0.4f));
|
//else DrawRectangleRec(playerBounds, Fade(RL_ORANGE, 0.4f));
|
||||||
|
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
for (int i = 0; i < MAX_ENEMIES; i++)
|
for (int i = 0; i < MAX_ENEMIES; i++)
|
||||||
|
|
@ -403,10 +403,10 @@ int main()
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -414,10 +414,10 @@ int main()
|
||||||
/*
|
/*
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 0: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 1: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 1: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 2: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 2: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 3: DrawRectangleRec(enemyBounds[i], Fade(GREEN, 0.5f)); break;
|
case 3: DrawRectangleRec(enemyBounds[i], Fade(RL_GREEN, 0.5f)); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
@ -425,34 +425,34 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw gameplay interface
|
// Draw gameplay interface
|
||||||
DrawRectangle(20, 20, 400, 40, Fade(GRAY, 0.4f));
|
DrawRectangle(20, 20, 400, 40, Fade(RL_GRAY, 0.4f));
|
||||||
DrawRectangle(20, 20, foodBar, 40, ORANGE);
|
DrawRectangle(20, 20, foodBar, 40, RL_ORANGE);
|
||||||
DrawRectangleLines(20, 20, 400, 40, BLACK);
|
DrawRectangleLines(20, 20, 400, 40, RL_BLACK);
|
||||||
|
|
||||||
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, RL_ORANGE);
|
||||||
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, RL_ORANGE);
|
||||||
|
|
||||||
if (gameraMode)
|
if (gameraMode)
|
||||||
{
|
{
|
||||||
DrawText("GAMERA MODE", 60, 22, 40, GRAY);
|
DrawText("GAMERA MODE", 60, 22, 40, RL_GRAY);
|
||||||
DrawTexture(gframe, 0, 0, Fade(WHITE, 0.5f));
|
DrawTexture(gframe, 0, 0, Fade(RL_WHITE, 0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
{
|
{
|
||||||
// Draw a transparent black rectangle that covers all screen
|
// Draw a transparent black rectangle that covers all screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
|
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(RL_BLACK, 0.4f));
|
||||||
|
|
||||||
DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, MAROON);
|
DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, RL_MAROON);
|
||||||
|
|
||||||
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, GOLD);
|
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, RL_GOLD);
|
||||||
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, GOLD);
|
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, RL_GOLD);
|
||||||
DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, RL_ORANGE);
|
||||||
DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, RL_ORANGE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, LIGHTGRAY);
|
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, RL_LIGHTGRAY);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -433,13 +433,13 @@ void UpdateDrawFrame(void)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
// Draw background (common to all screens)
|
// Draw background (common to all screens)
|
||||||
DrawTexture(sky, 0, 0, WHITE);
|
DrawTexture(sky, 0, 0, RL_WHITE);
|
||||||
|
|
||||||
DrawTexture(mountains, backScrolling, 0, WHITE);
|
DrawTexture(mountains, backScrolling, 0, RL_WHITE);
|
||||||
DrawTexture(mountains, screenWidth + backScrolling, 0, WHITE);
|
DrawTexture(mountains, screenWidth + backScrolling, 0, RL_WHITE);
|
||||||
|
|
||||||
if (!gameraMode)
|
if (!gameraMode)
|
||||||
{
|
{
|
||||||
|
|
@ -457,24 +457,24 @@ void UpdateDrawFrame(void)
|
||||||
case TITLE:
|
case TITLE:
|
||||||
{
|
{
|
||||||
// Draw title
|
// Draw title
|
||||||
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
|
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, RL_WHITE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 1, WHITE);
|
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 1, RL_WHITE);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case GAMEPLAY:
|
case GAMEPLAY:
|
||||||
{
|
{
|
||||||
// Draw water lines
|
// Draw water lines
|
||||||
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(SKYBLUE, 0.1f));
|
for (int i = 0; i < 5; i++) DrawRectangle(0, i*120 + 120, screenWidth, 110, Fade(RL_SKYBLUE, 0.1f));
|
||||||
|
|
||||||
// Draw player
|
// Draw player
|
||||||
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, WHITE);
|
if (!gameraMode) DrawTexture(turtle, playerBounds.x - 14, playerBounds.y - 14, RL_WHITE);
|
||||||
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, WHITE);
|
else DrawTexture(gamera, playerBounds.x - 64, playerBounds.y - 64, RL_WHITE);
|
||||||
|
|
||||||
// Draw player bounding box
|
// Draw player bounding box
|
||||||
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(GREEN, 0.4f));
|
//if (!gameraMode) DrawRectangleRec(playerBounds, Fade(RL_GREEN, 0.4f));
|
||||||
//else DrawRectangleRec(playerBounds, Fade(ORANGE, 0.4f));
|
//else DrawRectangleRec(playerBounds, Fade(RL_ORANGE, 0.4f));
|
||||||
|
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
for (int i = 0; i < MAX_ENEMIES; i++)
|
for (int i = 0; i < MAX_ENEMIES; i++)
|
||||||
|
|
@ -484,10 +484,10 @@ void UpdateDrawFrame(void)
|
||||||
// Draw enemies
|
// Draw enemies
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 0: DrawTexture(shark, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 1: DrawTexture(orca, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 2: DrawTexture(swhale, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, WHITE); break;
|
case 3: DrawTexture(fish, enemyBounds[i].x - 14, enemyBounds[i].y - 14, RL_WHITE); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -495,10 +495,10 @@ void UpdateDrawFrame(void)
|
||||||
/*
|
/*
|
||||||
switch(enemyType[i])
|
switch(enemyType[i])
|
||||||
{
|
{
|
||||||
case 0: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 0: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 1: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 1: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 2: DrawRectangleRec(enemyBounds[i], Fade(RED, 0.5f)); break;
|
case 2: DrawRectangleRec(enemyBounds[i], Fade(RL_RED, 0.5f)); break;
|
||||||
case 3: DrawRectangleRec(enemyBounds[i], Fade(GREEN, 0.5f)); break;
|
case 3: DrawRectangleRec(enemyBounds[i], Fade(RL_GREEN, 0.5f)); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
@ -506,34 +506,34 @@ void UpdateDrawFrame(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw gameplay interface
|
// Draw gameplay interface
|
||||||
DrawRectangle(20, 20, 400, 40, Fade(GRAY, 0.4f));
|
DrawRectangle(20, 20, 400, 40, Fade(RL_GRAY, 0.4f));
|
||||||
DrawRectangle(20, 20, foodBar, 40, ORANGE);
|
DrawRectangle(20, 20, foodBar, 40, RL_ORANGE);
|
||||||
DrawRectangleLines(20, 20, 400, 40, BLACK);
|
DrawRectangleLines(20, 20, 400, 40, RL_BLACK);
|
||||||
|
|
||||||
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, RL_ORANGE);
|
||||||
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, RL_ORANGE);
|
||||||
|
|
||||||
if (gameraMode)
|
if (gameraMode)
|
||||||
{
|
{
|
||||||
DrawText("GAMERA MODE", 60, 22, 40, GRAY);
|
DrawText("GAMERA MODE", 60, 22, 40, RL_GRAY);
|
||||||
DrawTexture(gframe, 0, 0, Fade(WHITE, 0.5f));
|
DrawTexture(gframe, 0, 0, Fade(RL_WHITE, 0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
{
|
{
|
||||||
// Draw a transparent black rectangle that covers all screen
|
// Draw a transparent black rectangle that covers all screen
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
|
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(RL_BLACK, 0.4f));
|
||||||
|
|
||||||
DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, MAROON);
|
DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, RL_MAROON);
|
||||||
|
|
||||||
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, GOLD);
|
DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, RL_GOLD);
|
||||||
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, GOLD);
|
DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, RL_GOLD);
|
||||||
DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, RL_ORANGE);
|
||||||
DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, ORANGE);
|
DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, RL_ORANGE);
|
||||||
|
|
||||||
// Draw blinking text
|
// Draw blinking text
|
||||||
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, LIGHTGRAY);
|
if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, RL_LIGHTGRAY);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -196,32 +196,32 @@ void DrawGame(void)
|
||||||
{
|
{
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (!gameOver)
|
if (!gameOver)
|
||||||
{
|
{
|
||||||
DrawCircle(floppy.position.x, floppy.position.y, floppy.radius, DARKGRAY);
|
DrawCircle(floppy.position.x, floppy.position.y, floppy.radius, RL_DARKGRAY);
|
||||||
|
|
||||||
// Draw tubes
|
// Draw tubes
|
||||||
for (int i = 0; i < MAX_TUBES; i++)
|
for (int i = 0; i < MAX_TUBES; i++)
|
||||||
{
|
{
|
||||||
DrawRectangle(tubes[i*2].rec.x, tubes[i*2].rec.y, tubes[i*2].rec.width, tubes[i*2].rec.height, GRAY);
|
DrawRectangle(tubes[i*2].rec.x, tubes[i*2].rec.y, tubes[i*2].rec.width, tubes[i*2].rec.height, RL_GRAY);
|
||||||
DrawRectangle(tubes[i*2 + 1].rec.x, tubes[i*2 + 1].rec.y, tubes[i*2 + 1].rec.width, tubes[i*2 + 1].rec.height, GRAY);
|
DrawRectangle(tubes[i*2 + 1].rec.x, tubes[i*2 + 1].rec.y, tubes[i*2 + 1].rec.width, tubes[i*2 + 1].rec.height, RL_GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw flashing fx (one frame only)
|
// Draw flashing fx (one frame only)
|
||||||
if (superfx)
|
if (superfx)
|
||||||
{
|
{
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, WHITE);
|
DrawRectangle(0, 0, screenWidth, screenHeight, RL_WHITE);
|
||||||
superfx = false;
|
superfx = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText(FormatText("%04i", score), 20, 20, 40, GRAY);
|
DrawText(FormatText("%04i", score), 20, 20, 40, RL_GRAY);
|
||||||
DrawText(FormatText("HI-SCORE: %04i", hiScore), 20, 70, 20, LIGHTGRAY);
|
DrawText(FormatText("HI-SCORE: %04i", hiScore), 20, 70, 20, RL_LIGHTGRAY);
|
||||||
|
|
||||||
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
|
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
|
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -239,30 +239,30 @@ void DrawGame(void)
|
||||||
{
|
{
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (!gameOver)
|
if (!gameOver)
|
||||||
{
|
{
|
||||||
if (follow)
|
if (follow)
|
||||||
{
|
{
|
||||||
DrawRectangle(0, 0, screenWidth, screenHeight, RED);
|
DrawRectangle(0, 0, screenWidth, screenHeight, RL_RED);
|
||||||
DrawRectangle(10, 10, screenWidth - 20, screenHeight - 20, RAYWHITE);
|
DrawRectangle(10, 10, screenWidth - 20, screenHeight - 20, RL_RAYWHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRectangleLines(home.rec.x, home.rec.y, home.rec.width, home.rec.height, BLUE);
|
DrawRectangleLines(home.rec.x, home.rec.y, home.rec.width, home.rec.height, RL_BLUE);
|
||||||
|
|
||||||
DrawCircleLines(enemy.position.x, enemy.position.y, enemy.radiusBounds, RED);
|
DrawCircleLines(enemy.position.x, enemy.position.y, enemy.radiusBounds, RL_RED);
|
||||||
DrawCircleV(enemy.position, enemy.radius, MAROON);
|
DrawCircleV(enemy.position, enemy.radius, RL_MAROON);
|
||||||
|
|
||||||
DrawCircleV(player.position, player.radius, GRAY);
|
DrawCircleV(player.position, player.radius, RL_GRAY);
|
||||||
if (points.active) DrawCircleV(points.position, points.radius, GOLD);
|
if (points.active) DrawCircleV(points.position, points.radius, RL_GOLD);
|
||||||
|
|
||||||
DrawText(FormatText("SCORE: %04i", score), 20, 15, 20, GRAY);
|
DrawText(FormatText("SCORE: %04i", score), 20, 15, 20, RL_GRAY);
|
||||||
DrawText(FormatText("HI-SCORE: %04i", hiScore), 300, 15, 20, GRAY);
|
DrawText(FormatText("HI-SCORE: %04i", hiScore), 300, 15, 20, RL_GRAY);
|
||||||
|
|
||||||
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
|
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
|
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ void DrawGame(void)
|
||||||
{
|
{
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
if (!gameOver)
|
if (!gameOver)
|
||||||
{
|
{
|
||||||
|
|
@ -247,7 +247,7 @@ void DrawGame(void)
|
||||||
// Draw explosions
|
// Draw explosions
|
||||||
for (int i = 0; i < MAX_EXPLOSIONS; i++)
|
for (int i = 0; i < MAX_EXPLOSIONS; i++)
|
||||||
{
|
{
|
||||||
if (explosion[i].active) DrawCircle(explosion[i].position.x, explosion[i].position.y, explosion[i].radius, RAYWHITE);
|
if (explosion[i].active) DrawCircle(explosion[i].position.x, explosion[i].position.y, explosion[i].radius, RL_RAYWHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw players
|
// Draw players
|
||||||
|
|
@ -256,14 +256,14 @@ void DrawGame(void)
|
||||||
if (player[i].isAlive)
|
if (player[i].isAlive)
|
||||||
{
|
{
|
||||||
if (player[i].isLeftTeam) DrawRectangle(player[i].position.x - player[i].size.x/2, player[i].position.y - player[i].size.y/2,
|
if (player[i].isLeftTeam) DrawRectangle(player[i].position.x - player[i].size.x/2, player[i].position.y - player[i].size.y/2,
|
||||||
player[i].size.x, player[i].size.y, BLUE);
|
player[i].size.x, player[i].size.y, RL_BLUE);
|
||||||
else DrawRectangle(player[i].position.x - player[i].size.x/2, player[i].position.y - player[i].size.y/2,
|
else DrawRectangle(player[i].position.x - player[i].size.x/2, player[i].position.y - player[i].size.y/2,
|
||||||
player[i].size.x, player[i].size.y, RED);
|
player[i].size.x, player[i].size.y, RL_RED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw ball
|
// Draw ball
|
||||||
if (ball.active) DrawCircle(ball.position.x, ball.position.y, ball.radius, MAROON);
|
if (ball.active) DrawCircle(ball.position.x, ball.position.y, ball.radius, RL_MAROON);
|
||||||
|
|
||||||
// Draw the angle and the power of the aim, and the previous ones
|
// Draw the angle and the power of the aim, and the previous ones
|
||||||
if (!ballOnAir)
|
if (!ballOnAir)
|
||||||
|
|
@ -272,21 +272,21 @@ void DrawGame(void)
|
||||||
/*
|
/*
|
||||||
if (player[playerTurn].isLeftTeam)
|
if (player[playerTurn].isLeftTeam)
|
||||||
{
|
{
|
||||||
DrawText(FormatText("Previous Point %i, %i", (int)player[playerTurn].previousPoint.x, (int)player[playerTurn].previousPoint.y), 20, 20, 20, DARKBLUE);
|
DrawText(FormatText("Previous Point %i, %i", (int)player[playerTurn].previousPoint.x, (int)player[playerTurn].previousPoint.y), 20, 20, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Previous Angle %i", player[playerTurn].previousAngle), 20, 50, 20, DARKBLUE);
|
DrawText(FormatText("Previous Angle %i", player[playerTurn].previousAngle), 20, 50, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Previous Power %i", player[playerTurn].previousPower), 20, 80, 20, DARKBLUE);
|
DrawText(FormatText("Previous Power %i", player[playerTurn].previousPower), 20, 80, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Aiming Point %i, %i", (int)player[playerTurn].aimingPoint.x, (int)player[playerTurn].aimingPoint.y), 20, 110, 20, DARKBLUE);
|
DrawText(FormatText("Aiming Point %i, %i", (int)player[playerTurn].aimingPoint.x, (int)player[playerTurn].aimingPoint.y), 20, 110, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Aiming Angle %i", player[playerTurn].aimingAngle), 20, 140, 20, DARKBLUE);
|
DrawText(FormatText("Aiming Angle %i", player[playerTurn].aimingAngle), 20, 140, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Aiming Power %i", player[playerTurn].aimingPower), 20, 170, 20, DARKBLUE);
|
DrawText(FormatText("Aiming Power %i", player[playerTurn].aimingPower), 20, 170, 20, RL_DARKBLUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawText(FormatText("Previous Point %i, %i", (int)player[playerTurn].previousPoint.x, (int)player[playerTurn].previousPoint.y), screenWidth*3/4, 20, 20, DARKBLUE);
|
DrawText(FormatText("Previous Point %i, %i", (int)player[playerTurn].previousPoint.x, (int)player[playerTurn].previousPoint.y), screenWidth*3/4, 20, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Previous Angle %i", player[playerTurn].previousAngle), screenWidth*3/4, 50, 20, DARKBLUE);
|
DrawText(FormatText("Previous Angle %i", player[playerTurn].previousAngle), screenWidth*3/4, 50, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Previous Power %i", player[playerTurn].previousPower), screenWidth*3/4, 80, 20, DARKBLUE);
|
DrawText(FormatText("Previous Power %i", player[playerTurn].previousPower), screenWidth*3/4, 80, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Aiming Point %i, %i", (int)player[playerTurn].aimingPoint.x, (int)player[playerTurn].aimingPoint.y), screenWidth*3/4, 110, 20, DARKBLUE);
|
DrawText(FormatText("Aiming Point %i, %i", (int)player[playerTurn].aimingPoint.x, (int)player[playerTurn].aimingPoint.y), screenWidth*3/4, 110, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Aiming Angle %i", player[playerTurn].aimingAngle), screenWidth*3/4, 140, 20, DARKBLUE);
|
DrawText(FormatText("Aiming Angle %i", player[playerTurn].aimingAngle), screenWidth*3/4, 140, 20, RL_DARKBLUE);
|
||||||
DrawText(FormatText("Aiming Power %i", player[playerTurn].aimingPower), screenWidth*3/4, 170, 20, DARKBLUE);
|
DrawText(FormatText("Aiming Power %i", player[playerTurn].aimingPower), screenWidth*3/4, 170, 20, RL_DARKBLUE);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -296,30 +296,30 @@ void DrawGame(void)
|
||||||
// Previous aiming
|
// Previous aiming
|
||||||
DrawTriangle((Vector2){ player[playerTurn].position.x - player[playerTurn].size.x/4, player[playerTurn].position.y - player[playerTurn].size.y/4 },
|
DrawTriangle((Vector2){ player[playerTurn].position.x - player[playerTurn].size.x/4, player[playerTurn].position.y - player[playerTurn].size.y/4 },
|
||||||
(Vector2){ player[playerTurn].position.x + player[playerTurn].size.x/4, player[playerTurn].position.y + player[playerTurn].size.y/4 },
|
(Vector2){ player[playerTurn].position.x + player[playerTurn].size.x/4, player[playerTurn].position.y + player[playerTurn].size.y/4 },
|
||||||
player[playerTurn].previousPoint, GRAY);
|
player[playerTurn].previousPoint, RL_GRAY);
|
||||||
|
|
||||||
// Actual aiming
|
// Actual aiming
|
||||||
DrawTriangle((Vector2){ player[playerTurn].position.x - player[playerTurn].size.x/4, player[playerTurn].position.y - player[playerTurn].size.y/4 },
|
DrawTriangle((Vector2){ player[playerTurn].position.x - player[playerTurn].size.x/4, player[playerTurn].position.y - player[playerTurn].size.y/4 },
|
||||||
(Vector2){ player[playerTurn].position.x + player[playerTurn].size.x/4, player[playerTurn].position.y + player[playerTurn].size.y/4 },
|
(Vector2){ player[playerTurn].position.x + player[playerTurn].size.x/4, player[playerTurn].position.y + player[playerTurn].size.y/4 },
|
||||||
player[playerTurn].aimingPoint, DARKBLUE);
|
player[playerTurn].aimingPoint, RL_DARKBLUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Previous aiming
|
// Previous aiming
|
||||||
DrawTriangle((Vector2){ player[playerTurn].position.x - player[playerTurn].size.x/4, player[playerTurn].position.y + player[playerTurn].size.y/4 },
|
DrawTriangle((Vector2){ player[playerTurn].position.x - player[playerTurn].size.x/4, player[playerTurn].position.y + player[playerTurn].size.y/4 },
|
||||||
(Vector2){ player[playerTurn].position.x + player[playerTurn].size.x/4, player[playerTurn].position.y - player[playerTurn].size.y/4 },
|
(Vector2){ player[playerTurn].position.x + player[playerTurn].size.x/4, player[playerTurn].position.y - player[playerTurn].size.y/4 },
|
||||||
player[playerTurn].previousPoint, GRAY);
|
player[playerTurn].previousPoint, RL_GRAY);
|
||||||
|
|
||||||
// Actual aiming
|
// Actual aiming
|
||||||
DrawTriangle((Vector2){ player[playerTurn].position.x - player[playerTurn].size.x/4, player[playerTurn].position.y + player[playerTurn].size.y/4 },
|
DrawTriangle((Vector2){ player[playerTurn].position.x - player[playerTurn].size.x/4, player[playerTurn].position.y + player[playerTurn].size.y/4 },
|
||||||
(Vector2){ player[playerTurn].position.x + player[playerTurn].size.x/4, player[playerTurn].position.y - player[playerTurn].size.y/4 },
|
(Vector2){ player[playerTurn].position.x + player[playerTurn].size.x/4, player[playerTurn].position.y - player[playerTurn].size.y/4 },
|
||||||
player[playerTurn].aimingPoint, MAROON);
|
player[playerTurn].aimingPoint, RL_MAROON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
|
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
|
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, RL_GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ void UpdateTransition(void)
|
||||||
|
|
||||||
void DrawTransition(void)
|
void DrawTransition(void)
|
||||||
{
|
{
|
||||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, transAlpha));
|
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RL_RAYWHITE, transAlpha));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDrawFrame(void)
|
void UpdateDrawFrame(void)
|
||||||
|
|
@ -335,7 +335,7 @@ void UpdateDrawFrame(void)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RL_RAYWHITE);
|
||||||
|
|
||||||
switch(currentScreen)
|
switch(currentScreen)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -124,26 +124,26 @@ void UpdateLevel00Screen(void)
|
||||||
void DrawLevel00Screen(void)
|
void DrawLevel00Screen(void)
|
||||||
{
|
{
|
||||||
// Draw Level00 screen
|
// Draw Level00 screen
|
||||||
DrawText("U", boundsU.x, boundsU.y + 10, 160, GRAY);
|
DrawText("U", boundsU.x, boundsU.y + 10, 160, RL_GRAY);
|
||||||
DrawText("J", GetScreenWidth()/2 - MeasureText("JUST DO", 160)/2, GetScreenHeight()/2 - 80, 160, GRAY);
|
DrawText("J", GetScreenWidth()/2 - MeasureText("JUST DO", 160)/2, GetScreenHeight()/2 - 80, 160, RL_GRAY);
|
||||||
DrawText("ST D", GetScreenWidth()/2 - MeasureText("JUST DO", 160)/2 + 210, GetScreenHeight()/2 - 80, 160, GRAY);
|
DrawText("ST D", GetScreenWidth()/2 - MeasureText("JUST DO", 160)/2 + 210, GetScreenHeight()/2 - 80, 160, RL_GRAY);
|
||||||
DrawText("O", boundsO.x, boundsO.y + 10, 160, GRAY);
|
DrawText("O", boundsO.x, boundsO.y + 10, 160, RL_GRAY);
|
||||||
|
|
||||||
DrawText("by RAMON SANTAMARIA (@raysan5)", 370, GetScreenHeight()/2 + 100, 30, Fade(LIGHTGRAY, 0.4f));
|
DrawText("by RAMON SANTAMARIA (@raysan5)", 370, GetScreenHeight()/2 + 100, 30, Fade(RL_LIGHTGRAY, 0.4f));
|
||||||
|
|
||||||
if (mouseOverU && !placedU) DrawRectangleLines(boundsU.x - 20, boundsU.y, boundsU.width, boundsU.height, Fade(LIGHTGRAY, 0.8f));
|
if (mouseOverU && !placedU) DrawRectangleLines(boundsU.x - 20, boundsU.y, boundsU.width, boundsU.height, Fade(RL_LIGHTGRAY, 0.8f));
|
||||||
//DrawRectangleBordersRec(boundsU, -20, 0, 20, Fade(RED, 0.3f));
|
//DrawRectangleBordersRec(boundsU, -20, 0, 20, Fade(RL_RED, 0.3f));
|
||||||
|
|
||||||
if (mouseOverO && !placedO) DrawRectangleLines(boundsO.x - 20, boundsO.y, boundsO.width, boundsO.height, Fade(LIGHTGRAY, 0.8f));
|
if (mouseOverO && !placedO) DrawRectangleLines(boundsO.x - 20, boundsO.y, boundsO.width, boundsO.height, Fade(RL_LIGHTGRAY, 0.8f));
|
||||||
//DrawRectangleBordersRec(boundsO, -20, 0, 20, Fade(RED, 0.3f));
|
//DrawRectangleBordersRec(boundsO, -20, 0, 20, Fade(RL_RED, 0.3f));
|
||||||
|
|
||||||
if (levelFinished)
|
if (levelFinished)
|
||||||
{
|
{
|
||||||
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f));
|
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(RL_LIGHTGRAY, 0.6f));
|
||||||
DrawText("LEVEL 00", GetScreenWidth()/2 - MeasureText("LEVEL 00", 30)/2, 20, 30, GRAY);
|
DrawText("LEVEL 00", GetScreenWidth()/2 - MeasureText("LEVEL 00", 30)/2, 20, 30, RL_GRAY);
|
||||||
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY);
|
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("LEVEL 00", GetScreenWidth()/2 - MeasureText("LEVEL 00", 30)/2, 20, 30, LIGHTGRAY);
|
else DrawText("LEVEL 00", GetScreenWidth()/2 - MeasureText("LEVEL 00", 30)/2, 20, 30, RL_LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Level00 Screen Unload logic
|
// Level00 Screen Unload logic
|
||||||
|
|
|
||||||
|
|
@ -133,21 +133,21 @@ void UpdateLevel01Screen(void)
|
||||||
void DrawLevel01Screen(void)
|
void DrawLevel01Screen(void)
|
||||||
{
|
{
|
||||||
// Draw Level01 screen
|
// Draw Level01 screen
|
||||||
if (!levelFinished) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), LIGHTGRAY);
|
if (!levelFinished) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), RL_LIGHTGRAY);
|
||||||
else DrawRectangle(60, 60, GetScreenWidth() - 120, GetScreenHeight() - 120, LIGHTGRAY);
|
else DrawRectangle(60, 60, GetScreenWidth() - 120, GetScreenHeight() - 120, RL_LIGHTGRAY);
|
||||||
|
|
||||||
DrawRectangleRec(outerLeftRec, GRAY);
|
DrawRectangleRec(outerLeftRec, RL_GRAY);
|
||||||
DrawRectangleRec(innerLeftRec, RAYWHITE);
|
DrawRectangleRec(innerLeftRec, RL_RAYWHITE);
|
||||||
DrawRectangleRec(outerRightRec, RAYWHITE);
|
DrawRectangleRec(outerRightRec, RL_RAYWHITE);
|
||||||
DrawRectangleRec(innerRightRec, GRAY);
|
DrawRectangleRec(innerRightRec, RL_GRAY);
|
||||||
|
|
||||||
if (levelFinished)
|
if (levelFinished)
|
||||||
{
|
{
|
||||||
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f));
|
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(RL_LIGHTGRAY, 0.6f));
|
||||||
DrawText("LEVEL 01", GetScreenWidth()/2 - MeasureText("LEVEL 01", 30)/2, 20, 30, GRAY);
|
DrawText("LEVEL 01", GetScreenWidth()/2 - MeasureText("LEVEL 01", 30)/2, 20, 30, RL_GRAY);
|
||||||
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY);
|
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("LEVEL 01", GetScreenWidth()/2 - MeasureText("LEVEL 01", 30)/2, 20, 30, LIGHTGRAY);
|
else DrawText("LEVEL 01", GetScreenWidth()/2 - MeasureText("LEVEL 01", 30)/2, 20, 30, RL_LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Level01 Screen Unload logic
|
// Level01 Screen Unload logic
|
||||||
|
|
|
||||||
|
|
@ -128,20 +128,20 @@ void DrawLevel02Screen(void)
|
||||||
{
|
{
|
||||||
// Draw Level02 screen
|
// Draw Level02 screen
|
||||||
|
|
||||||
DrawCircleV(holeCirclePos, holeCircleRadius, LIGHTGRAY);
|
DrawCircleV(holeCirclePos, holeCircleRadius, RL_LIGHTGRAY);
|
||||||
DrawCircleV(bouncingBallPos, bouncingBallRadius, DARKGRAY);
|
DrawCircleV(bouncingBallPos, bouncingBallRadius, RL_DARKGRAY);
|
||||||
|
|
||||||
DrawCircleLines(bouncingBallPos.x, bouncingBallPos.y, 120, Fade(LIGHTGRAY, 0.8f));
|
DrawCircleLines(bouncingBallPos.x, bouncingBallPos.y, 120, Fade(RL_LIGHTGRAY, 0.8f));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (levelFinished)
|
if (levelFinished)
|
||||||
{
|
{
|
||||||
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f));
|
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(RL_LIGHTGRAY, 0.6f));
|
||||||
DrawText("LEVEL 02", GetScreenWidth()/2 - MeasureText("LEVEL 02", 30)/2, 20, 30, GRAY);
|
DrawText("LEVEL 02", GetScreenWidth()/2 - MeasureText("LEVEL 02", 30)/2, 20, 30, RL_GRAY);
|
||||||
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY);
|
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("LEVEL 02", GetScreenWidth()/2 - MeasureText("LEVEL 02", 30)/2, 20, 30, LIGHTGRAY);
|
else DrawText("LEVEL 02", GetScreenWidth()/2 - MeasureText("LEVEL 02", 30)/2, 20, 30, RL_LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Level02 Screen Unload logic
|
// Level02 Screen Unload logic
|
||||||
|
|
|
||||||
|
|
@ -107,18 +107,18 @@ void UpdateLevel03Screen(void)
|
||||||
void DrawLevel03Screen(void)
|
void DrawLevel03Screen(void)
|
||||||
{
|
{
|
||||||
// Draw Level03 screen
|
// Draw Level03 screen
|
||||||
DrawRectangleRec(holeRec, GRAY);
|
DrawRectangleRec(holeRec, RL_GRAY);
|
||||||
DrawRectangleRec(pieceRec, RAYWHITE);
|
DrawRectangleRec(pieceRec, RL_RAYWHITE);
|
||||||
|
|
||||||
if (showPiece) DrawRectangleLines(pieceRec.x, pieceRec.y, pieceRec.width, pieceRec.height, Fade(LIGHTGRAY, 0.8f));
|
if (showPiece) DrawRectangleLines(pieceRec.x, pieceRec.y, pieceRec.width, pieceRec.height, Fade(RL_LIGHTGRAY, 0.8f));
|
||||||
|
|
||||||
if (levelFinished)
|
if (levelFinished)
|
||||||
{
|
{
|
||||||
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f));
|
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(RL_LIGHTGRAY, 0.6f));
|
||||||
DrawText("LEVEL 03", GetScreenWidth()/2 - MeasureText("LEVEL 03", 30)/2, 20, 30, GRAY);
|
DrawText("LEVEL 03", GetScreenWidth()/2 - MeasureText("LEVEL 03", 30)/2, 20, 30, RL_GRAY);
|
||||||
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY);
|
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("LEVEL 03", GetScreenWidth()/2 - MeasureText("LEVEL 03", 30)/2, 20, 30, LIGHTGRAY);
|
else DrawText("LEVEL 03", GetScreenWidth()/2 - MeasureText("LEVEL 03", 30)/2, 20, 30, RL_LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Level03 Screen Unload logic
|
// Level03 Screen Unload logic
|
||||||
|
|
|
||||||
|
|
@ -121,17 +121,17 @@ void UpdateLevel04Screen(void)
|
||||||
void DrawLevel04Screen(void)
|
void DrawLevel04Screen(void)
|
||||||
{
|
{
|
||||||
// Draw Level04 screen here!
|
// Draw Level04 screen here!
|
||||||
//DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), GRAY);
|
//DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), RL_GRAY);
|
||||||
DrawCircleV(circlesCenter, outerCircleRadius, GRAY);
|
DrawCircleV(circlesCenter, outerCircleRadius, RL_GRAY);
|
||||||
DrawCircleV(circlesCenter, innerCircleRadius, RAYWHITE);
|
DrawCircleV(circlesCenter, innerCircleRadius, RL_RAYWHITE);
|
||||||
|
|
||||||
if (levelFinished)
|
if (levelFinished)
|
||||||
{
|
{
|
||||||
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f));
|
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(RL_LIGHTGRAY, 0.6f));
|
||||||
DrawText("LEVEL 04", GetScreenWidth()/2 - MeasureText("LEVEL 04", 30)/2, 20, 30, GRAY);
|
DrawText("LEVEL 04", GetScreenWidth()/2 - MeasureText("LEVEL 04", 30)/2, 20, 30, RL_GRAY);
|
||||||
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY);
|
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("LEVEL 04", GetScreenWidth()/2 - MeasureText("LEVEL 04", 30)/2, 20, 30, LIGHTGRAY);
|
else DrawText("LEVEL 04", GetScreenWidth()/2 - MeasureText("LEVEL 04", 30)/2, 20, 30, RL_LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Level04 Screen Unload logic
|
// Level04 Screen Unload logic
|
||||||
|
|
|
||||||
|
|
@ -66,16 +66,16 @@ void InitLevel05Screen(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// That's a dirty hack to give sonme coherence to this puzzle...
|
// That's a dirty hack to give sonme coherence to this puzzle...
|
||||||
circleColor[9] = GRAY;
|
circleColor[9] = RL_GRAY;
|
||||||
circleColor[8] = RAYWHITE;
|
circleColor[8] = RL_RAYWHITE;
|
||||||
circleColor[7] = RAYWHITE;
|
circleColor[7] = RL_RAYWHITE;
|
||||||
circleColor[6] = GRAY;
|
circleColor[6] = RL_GRAY;
|
||||||
circleColor[5] = RAYWHITE;
|
circleColor[5] = RL_RAYWHITE;
|
||||||
circleColor[4] = GRAY;
|
circleColor[4] = RL_GRAY;
|
||||||
circleColor[3] = GRAY;
|
circleColor[3] = RL_GRAY;
|
||||||
circleColor[2] = GRAY;
|
circleColor[2] = RL_GRAY;
|
||||||
circleColor[1] = RAYWHITE;
|
circleColor[1] = RL_RAYWHITE;
|
||||||
circleColor[0] = GRAY;
|
circleColor[0] = RL_GRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Level05 Screen Update logic
|
// Level05 Screen Update logic
|
||||||
|
|
@ -94,23 +94,23 @@ void UpdateLevel05Screen(void)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
if (CheckColor(circleColor[8], GRAY)) circleColor[8] = RAYWHITE;
|
if (CheckColor(circleColor[8], RL_GRAY)) circleColor[8] = RL_RAYWHITE;
|
||||||
else circleColor[8] = GRAY;
|
else circleColor[8] = RL_GRAY;
|
||||||
}
|
}
|
||||||
else if (i == 2)
|
else if (i == 2)
|
||||||
{
|
{
|
||||||
if (CheckColor(circleColor[5], GRAY)) circleColor[5] = RAYWHITE;
|
if (CheckColor(circleColor[5], RL_GRAY)) circleColor[5] = RL_RAYWHITE;
|
||||||
else circleColor[5] = GRAY;
|
else circleColor[5] = RL_GRAY;
|
||||||
}
|
}
|
||||||
else if (i == 3)
|
else if (i == 3)
|
||||||
{
|
{
|
||||||
if (CheckColor(circleColor[6], GRAY)) circleColor[6] = RAYWHITE;
|
if (CheckColor(circleColor[6], RL_GRAY)) circleColor[6] = RL_RAYWHITE;
|
||||||
else circleColor[6] = GRAY;
|
else circleColor[6] = RL_GRAY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CheckColor(circleColor[i], GRAY)) circleColor[i] = RAYWHITE;
|
if (CheckColor(circleColor[i], RL_GRAY)) circleColor[i] = RL_RAYWHITE;
|
||||||
else circleColor[i] = GRAY;
|
else circleColor[i] = RL_GRAY;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +122,7 @@ void UpdateLevel05Screen(void)
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
|
|
||||||
if (CheckColor(circleColor[i], RAYWHITE))
|
if (CheckColor(circleColor[i], RL_RAYWHITE))
|
||||||
{
|
{
|
||||||
done = false;
|
done = false;
|
||||||
return;
|
return;
|
||||||
|
|
@ -160,11 +160,11 @@ void DrawLevel05Screen(void)
|
||||||
|
|
||||||
if (levelFinished)
|
if (levelFinished)
|
||||||
{
|
{
|
||||||
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f));
|
DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(RL_LIGHTGRAY, 0.6f));
|
||||||
DrawText("LEVEL 05", GetScreenWidth()/2 - MeasureText("LEVEL 05", 30)/2, 20, 30, GRAY);
|
DrawText("LEVEL 05", GetScreenWidth()/2 - MeasureText("LEVEL 05", 30)/2, 20, 30, RL_GRAY);
|
||||||
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY);
|
DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, RL_GRAY);
|
||||||
}
|
}
|
||||||
else DrawText("LEVEL 05", GetScreenWidth()/2 - MeasureText("LEVEL 05", 30)/2, 20, 30, LIGHTGRAY);
|
else DrawText("LEVEL 05", GetScreenWidth()/2 - MeasureText("LEVEL 05", 30)/2, 20, 30, RL_LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Level05 Screen Unload logic
|
// Level05 Screen Unload logic
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user