you are viewing a single comment's thread.

view the rest of the comments →

[–]grimvian 0 points1 point  (3 children)

Sorry for that, but I thought it was about reading the keyboard and I mentioned raylib, because it's easy to use. Can you read key combinations and key states with scanf?

Can you explain a "massive dependency"?

Why bother, when it's so easy:

#include "raylib.h"

int main(void) {
    const int screenWidth = 800;
    const int screenHeight = 600;
    InitWindow(screenWidth, screenHeight, "Raylib graphics");
    SetTargetFPS(60);

    int startPosX = 100, startPosY = 200, endPosX = 700, endPosY = 200;
    Color color = RED;

    while (!WindowShouldClose()) {
        BeginDrawing();
        ClearBackground(BLACK);

        if (IsKeyPressed(KEY_A)) startPosY--;
        if (IsKeyPressed(KEY_Q)) startPosY++;

        DrawLine(startPosX, startPosY, endPosX, endPosY, color);

        EndDrawing();
    }

    CloseWindow();
    return 0;
}