add option to record to PNGs (inc background threadpool for encoding)

This commit is contained in:
Nick Fisher
2023-11-20 15:28:55 +08:00
parent a96309bd77
commit 5c1be3d047
9 changed files with 112 additions and 27 deletions

View File

@@ -53,6 +53,7 @@ class ExampleWidgetState extends State<ExampleWidget> {
// these are all the options that can be set via the menu
// we store them here
static bool rendering = false;
static bool recording = false;
static int framerate = 60;
static bool postProcessing = true;
static bool frustumCulling = true;

View File

@@ -38,7 +38,7 @@ class _RenderingSubmenuState extends State<RenderingSubmenu> {
widget.controller.setFrameRate(ExampleWidgetState.framerate);
},
child: Text(
"Toggle framerate (currently $ExampleWidgetState.framerate) "),
"Toggle framerate (currently ${ExampleWidgetState.framerate}) "),
),
MenuItemButton(
onPressed: () {
@@ -56,6 +56,14 @@ class _RenderingSubmenuState extends State<RenderingSubmenu> {
child: Text(
"${ExampleWidgetState.postProcessing ? "Disable" : "Enable"} postprocessing"),
),
MenuItemButton(
onPressed: () {
ExampleWidgetState.recording = !ExampleWidgetState.recording;
widget.controller.setRecording(ExampleWidgetState.recording);
},
child: Text(
"Turn recording ${ExampleWidgetState.recording ? "OFF" : "ON"}) "),
),
],
child: const Text("Rendering"),
);