aboutsummaryrefslogtreecommitdiff
path: root/src/platform.hpp
blob: a037b6ebbb6e66e762809b930bc090775f27144d (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
#ifndef PLATFORM_HPP_
#define PLATFORM_HPP_

#include <cstdint>
#include <bitset>

#include <SDL.h>

class Platform {
  public:
    Platform(
      const char* title, int windowWidth, int windowHeight, int textureWidth, int textureHeight
    );
    ~Platform();

  public:
    void Update(const std::bitset<2048>& bitset, int videoScale);
    bool ProcessInput(std::bitset<16>* keys);
    void StartBeep();
    void StopBeep();

  private:
    static void AudioCallback(void* userdata, uint8_t* stream, int len);
    bool beepRequested = false;

  private:
    SDL_Window* window {};
    SDL_Renderer* renderer {};
    SDL_AudioDeviceID audioDevice;
    SDL_AudioSpec audioSpec {};
};

#endif