JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
VideoRecorder.hpp
1// Copyright 2025 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
3#pragma once
4
5#include "../job.hpp"
6
7namespace jngl {
8
48class VideoRecorder : public jngl::Job {
49public:
63 explicit VideoRecorder(std::string_view filename);
64
69 ~VideoRecorder() override;
70
71 VideoRecorder(const VideoRecorder&) = delete;
72 VideoRecorder& operator=(const VideoRecorder&) = delete;
73 VideoRecorder(VideoRecorder&&) = delete;
74 VideoRecorder& operator=(VideoRecorder&&) = delete;
75
78 void fillAudioBuffer(std::unique_ptr<float[]> samples);
79
80 void step() override;
81 void draw() const override;
82
83private:
84 struct Impl;
86};
87
88} // namespace jngl
Background job which stays part of the main loop independent of the active jngl::Scene.
Definition job.hpp:62
Records video and audio output to a file.
~VideoRecorder() override
Finalizes and closes the video file.
void draw() const override
Draw the game state.
VideoRecorder(std::string_view filename)
Creates a new video recorder that writes to the specified file (saved in your data/ directory).
void fillAudioBuffer(std::unique_ptr< float[]> samples)
Assumes 44.1 kHz, stereo audio input and getting called exactly getStepsPerSecond() times per second.
void step() override
Advance the game logic.
Contains jngl::Job class and related functions.
JNGL's main namespace.