How to show mouse position on screen with Raylib in C

1 Answer

0 votes
#include "raylib.h"
#include "rlgl.h"
#include "raymath.h"

#define WIDTH 800
#define HEIGHT 600

int main()
{
    InitWindow(WIDTH, HEIGHT, "Raylib Draw Grid");

    Camera2D camera = { 0 };
    camera.zoom = 1.0f;

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

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

        ClearBackground(RAYWHITE);

        BeginMode2D(camera);

        // Draw grid
        rlPushMatrix();
        rlTranslatef(0, 25 * 50, 0);
        rlRotatef(90, 1, 0, 0);

        // DrawGrid(int slices, float spacing);  
        DrawGrid(100, 50);
        rlPopMatrix();

        EndMode2D();

        EndDrawing();
    }

    CloseWindow(); // Close window and OpenGL context

    return 0;
}


/*
run:


*/

 



answered Jan 11, 2025 by avibootz
edited Jan 11, 2025 by avibootz
...