spacebox/src/Recorder.hpp

58 lines
1.2 KiB
C++

#ifndef Recorder_h_
#define Recorder_h_
#include <sstream>
#include <string>
#include <thread>
#include <functional>
#include <cstdlib>
#include "SDL.h"
#define GLM_ENABLE_EXPERIMENTAL
#include "glm/ext.hpp"
#include "json/json.hpp"
#include "filesystem.hpp"
#include "Animation.hpp"
#include "Delegate.hpp"
#include "Display.hpp"
#include "extension.hpp"
struct Stash
{
std::vector<unsigned char*> pixel_buffers;
int frame_offset;
Stash(int frame_offset = 0) : frame_offset(frame_offset) {}
};
struct Recorder : Node
{
std::vector<Stash> in_game_stashes;
std::vector<Stash> video_stashes;
fs::path current_video_directory;
Animation animation = Animation(&Recorder::add_frame, this);
bool is_recording = false, writing_recording = false;
Recorder(Node*);
float get_frame_length();
void respond(SDL_Event&);
void capture_screen();
void start_recording();
void add_frame();
int get_memory_size();
void write_stash_frames(int);
void keep_stash();
void end_recording();
void finish_writing_video();
void write_video_frames(fs::path);
void update();
std::string get_class_name() { return "Recorder"; }
};
#endif