aboutsummaryrefslogtreecommitdiff
path: root/src/display.c
blob: 9ecb6cb2df4ac47a21efc4bbd6d8b3f91012b040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifdef PLATFORM_WEB
  #include RAYLIB_SRC
#else
  #include <raylib.h>
#endif

#include "display.h"

static dspl_createinfo info;

void dspl_create(dspl_createinfo createinfo)
{
    info = createinfo;
}
void dspl_start(void)
{
    InitWindow(info.width, info.height, info.name);
    SetTargetFPS(info.fps);

    while(!WindowShouldClose())
    {
        BeginDrawing();
        ClearBackground(RAYWHITE);
        DrawFPS(10, 10);
        info.update_func();
        EndDrawing();
    }
}

void dspl_destroy(void)
{
    CloseWindow();
}

void dspl_draw_circle(int cx, int cy, int r)
{
    DrawCircle(OFFSETX + cx, OFFSETY + cy, r, RED);
}

void dspl_draw_line(int x1, int y1, int x2, int y2, int c)
{
    DrawLine(OFFSETX + x1, OFFSETY + y1, OFFSETX + x2, OFFSETY + y2 , (c == 0) ? BLUE : RED);
}