How to draw a line with Raylib in C

1 Answer

0 votes
#include "raylib.h"

#define WIDTH 800
#define HEIGHT 600

int main()
{
    InitWindow(WIDTH, HEIGHT, "Raylib Draw Line");
    
    SetTargetFPS(60); // Set game to run at 60 frames-per-second

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

        ClearBackground(RAYWHITE);

        // Draw a line
        // void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color);                
        DrawLine(20, 40, WIDTH - 20, 40, BLACK);

        EndDrawing();
    }

    CloseWindow(); // Close window and OpenGL context

    return 0;
}


/*
run:


*/

 



answered Jan 12 by avibootz
edited Jan 13 by avibootz
...