AppleWin/source/frontends/libretro/game.h
Andrea Odetti 7b09bacb01 Initialisation: some fixes.
Ensure log file is created before it is used the first time.
Only close the log file once at the end.

https://github.com/audetto/AppleWin/issues/30

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
2021-05-23 20:06:36 +01:00

52 lines
1.1 KiB
C++

#pragma once
#include "frontends/common2/speed.h"
#include "frontends/libretro/environment.h"
#include "linux/context.h"
#include <string>
#include <vector>
namespace ra2
{
class RetroFrame;
class Game
{
public:
Game();
~Game();
bool loadGame(const std::string & path);
bool loadSnapshot(const std::string & path);
void executeOneFrame();
void processInputEvents();
void drawVideoBuffer();
static void keyboardCallback(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers);
static void frameTimeCallback(retro_usec_t usec);
static constexpr size_t FPS = 60;
static unsigned ourInputDevices[MAX_PADS];
static retro_usec_t ourFrameTime;
private:
const Logger myLogger;
const std::shared_ptr<RetroFrame> myFrame;
common2::Speed mySpeed; // fixed speed
std::vector<int> myButtonStates;
bool checkButtonPressed(unsigned id);
void keyboardEmulation();
static void processKeyDown(unsigned keycode, uint32_t character, uint16_t key_modifiers);
static void processKeyUp(unsigned keycode, uint32_t character, uint16_t key_modifiers);
};
}