2020-10-11 16:34:19 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
#include <memory>
|
|
|
|
|
2020-11-20 15:32:35 +00:00
|
|
|
#include "frontends/common2/speed.h"
|
|
|
|
|
2020-10-11 16:34:19 +01:00
|
|
|
class Emulator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Emulator(
|
|
|
|
const std::shared_ptr<SDL_Window> & window,
|
|
|
|
const std::shared_ptr<SDL_Renderer> & renderer,
|
2020-11-21 15:07:31 +00:00
|
|
|
const std::shared_ptr<SDL_Texture> & texture,
|
|
|
|
const bool fixedSpeed
|
2020-10-11 16:34:19 +01:00
|
|
|
);
|
|
|
|
|
2020-11-20 15:32:35 +00:00
|
|
|
void execute(const size_t milliseconds);
|
2020-11-30 13:38:56 +00:00
|
|
|
|
|
|
|
void updateTexture();
|
2020-11-12 19:31:35 +00:00
|
|
|
void refreshVideo();
|
2020-11-12 19:51:45 +00:00
|
|
|
|
2020-10-11 16:34:19 +01:00
|
|
|
void processEvents(bool & quit);
|
|
|
|
|
|
|
|
private:
|
2020-10-11 20:10:37 +01:00
|
|
|
void processKeyDown(const SDL_KeyboardEvent & key, bool & quit);
|
|
|
|
void processKeyUp(const SDL_KeyboardEvent & key);
|
|
|
|
void processText(const SDL_TextInputEvent & text);
|
2020-10-11 16:34:19 +01:00
|
|
|
|
|
|
|
const std::shared_ptr<SDL_Window> myWindow;
|
|
|
|
const std::shared_ptr<SDL_Renderer> myRenderer;
|
|
|
|
const std::shared_ptr<SDL_Texture> myTexture;
|
|
|
|
|
|
|
|
int myMultiplier;
|
|
|
|
bool myFullscreen;
|
2020-11-20 15:32:35 +00:00
|
|
|
|
|
|
|
Speed mySpeed;
|
2020-11-30 13:38:56 +00:00
|
|
|
|
|
|
|
SDL_Rect myRect;
|
|
|
|
int myPitch;
|
2020-12-28 19:42:04 +00:00
|
|
|
uint8_t* myFrameBuffer;
|
2020-10-11 16:34:19 +01:00
|
|
|
};
|