How to draw a pixel with Raylib in C

1 Answer

0 votes
#include "raylib.h"

#define WIDTH 800
#define HEIGHT 600

int main()
{
    InitWindow(WIDTH, HEIGHT, "Raylib Draw Pixel");
    
    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(BLACK);

        // Draw a pixel using geometry [Can be slow, use with care]
        // void DrawPixel(int posX, int posY, Color color); 

        DrawPixel(30, 50, YELLOW);
        DrawPixel(60, 70, YELLOW);

        EndDrawing();
    }

    CloseWindow(); // Close window and OpenGL context

    return 0;
}


/*
run:


*/

 



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