summaryrefslogtreecommitdiff
path: root/src/screen.h
blob: 1b601d820c37ba33e5697c0b1ccc99d4dd49d3ac (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
#pragma once

#define _POSIX_C_SOURCE 200809L
#include <SDL2/SDL.h>
#include <stdbool.h>

typedef struct {
    uint16_t width;
    uint16_t height;
    SDL_Window* window;
    SDL_Renderer* renderer;
    SDL_Texture* texture;
    uint32_t* pixels;
    const uint8_t* key_state;
    bool open;
    float delta;
} Screen;

void init_screen(Screen* screen, const char* title, uint16_t width, uint16_t height);
void draw_screen(Screen* screen);
void poll_screen(Screen* screen);
void free_screen(Screen* screen);

bool key_pressed(Screen* screen, SDL_Scancode code);