root/Player.h

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
#pragma once
#include <time.h>

struct Progress {
    int duration;
    int current;
    time_t lastUpdate;
};

struct Player {
    const char* baseUrl;
    WINDOW* window;

    bool paused;
    struct Progress progress;
};

void Player_init(struct Player* this);
void Player_destroyMembers(struct Player* this);
void Player_fetch(struct Player* this, const char* url);
bool Player_handleInput(struct Player* this, int event);

void Player_draw(struct Player* this);

void Player_stop(const char* baseUrl);
void Player_togglePause(const char* baseUrl);
void Player_moveBackwards(const char* baseUrl);
void Player_moveForwards(const char* baseUrl);

void Player_onServerEvent(const char* event, const char* data, void* userdata);