Felhasználói eszközök

Eszközök a webhelyen


muszaki_informatika:raylib

Ez a dokumentum egy előző változata!


#include <raylib.h>

int main() {
    // Window creation
    const int screenWidth = 640;
    const int screenHeight = 480;
    InitWindow(screenWidth, screenHeight, "raylib example");

    // Initialization
    SetTargetFPS(60); // Set our game to run at 60 frames-per-second

    // Main game loop
    while (!WindowShouldClose()) { // Detect window close button or ESC key
        // Update

        // Draw
        BeginDrawing();

            ClearBackground(LIGHTGRAY); // Clear the background with a color

            int MaxX = GetScreenWidth();
            int MaxY = GetScreenHeight();

            for (int i = 1; i <= 10; i++) {
                Color lineColor = GetColor(i + 5); // Choose color
                DrawLine(0, 0, (MaxX / 10) * i, MaxY, lineColor); // Draw line

                int R = (MaxY - 10) / (2 * i); // Circle radius
                DrawCircle(MaxX - R, MaxY / 2, R, lineColor); // Draw circle

                // Draw ellipse
                DrawEllipse(MaxX / 2, MaxY / 8, MaxX / (4 * i), MaxY / 8, lineColor);
            }

        EndDrawing();
    }

    // De-Initialization
    CloseWindow(); // Close window and OpenGL context

    return 0;
}

muszaki_informatika/raylib.1706458974.txt.gz · Utolsó módosítás: 2024/01/28 16:22 szerkesztette: knehez