1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-28 11:00:34 +00:00

nilrider:: recording if CAP_VIDEO is available

This commit is contained in:
Zeno Rogue 2022-05-09 14:45:57 +02:00
parent da5a17f8df
commit 0f1f4ce99b
2 changed files with 32 additions and 2 deletions

View File

@ -459,6 +459,32 @@ void main_menu() {
dialog::addItem("change settings", 'o');
dialog::add_action_push(settings);
#if CAP_VIDEO
dialog::addItem("record video", 'v');
dialog::add_action([] {
dialog::openFileDialog(anims::videofile, XLAT("record to video file"),
".mp4", [] {
anims::period = isize(curlev->history);
anims::noframes = anims::period * 60 / 1000;
int a = addHook(anims::hooks_anim, 100, [] {
int ttick = ticks % isize(curlev->history);
curlev->current = curlev->history[ttick];
curlev->current.centerview(curlev);
anims::moved();
});
int af = addHook(hooks_frame, 100, [] {
int ttick = ticks % isize(curlev->history);
curlev->current = curlev->history[ttick];
if(planning_mode && !view_replay) curlev->draw_planning_screen();
});
bool b = anims::record_video_std();
delHook(anims::hooks_anim, a);
delHook(hooks_frame, af);
return b;
});
});
#endif
dialog::addItem("quit", 'q');
dialog::add_action([] {
on_quit();

View File

@ -95,6 +95,10 @@ void level::compute_plan_transform() {
void level::draw_planning_screen() {
if(just_refreshing) return;
if(inHighQual) {
new_levellines_for = mousept = current.where;
}
curlev->init_textures();
dynamicval<eGeometry> g(geometry, gEuclid);
dynamicval<eModel> pm(pmodel, mdDisk);
@ -119,9 +123,9 @@ void level::draw_planning_screen() {
return h;
};
mousept = scr_to_map(hpxy(mousex, mousey));
if(!inHighQual) mousept = scr_to_map(hpxy(mousex, mousey));
box = scr_to_map(hpxy(mousex + 5, mousey))[0] - mousept[0];
box = inHighQual ? scr_to_map(hpxy(10, 0))[0] - scr_to_map(hpxy(0,0))[0] : scr_to_map(hpxy(mousex + 5, mousey))[0] - mousept[0];
/* draw the map */
auto& p = queuepolyat(T, shPlanFloor, 0xFFFFFFFF, PPR::FLOOR);