JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
VideoRecorder.hpp
Go to the documentation of this file.
1// Copyright 2025 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include "../job.hpp"
8
9namespace jngl {
10
78class VideoRecorder : public jngl::Job {
79public:
93 explicit VideoRecorder(std::string_view filename, bool lossless = false);
94
99 ~VideoRecorder() override;
100
101 VideoRecorder(const VideoRecorder&) = delete;
102 VideoRecorder& operator=(const VideoRecorder&) = delete;
103 VideoRecorder(VideoRecorder&&) = delete;
104 VideoRecorder& operator=(VideoRecorder&&) = delete;
105
108 void fillAudioBuffer(std::unique_ptr<float[]> samples);
109
110 void step() override;
111 void draw() const override;
112
113private:
114 struct Impl;
116};
117
118} // 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(std::string_view filename, bool lossless=false)
Creates a new video recorder that writes to the specified file (saved in your data/ directory).
~VideoRecorder() override
Finalizes and closes the video file.
void draw() const override
Draw the game state.
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.