1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-09 15:39:55 +00:00

using new setCanvas function in RogueViz presentations

This commit is contained in:
Zeno Rogue 2024-06-16 16:16:56 +02:00
parent e76e32e214
commit 263ee56427
22 changed files with 77 additions and 113 deletions

View File

@ -1497,7 +1497,7 @@ void geodesic_screen(tour::presmode mode, int id) {
static hyperpoint start, middle, target, nlh, nlh1, nlh2;
const ld coord = 10;
setCanvas(mode, '0');
setWhiteCanvas(mode);
if(mode == pmStart) {
slide_backup(pmodel);
slide_backup(pconf.clip_min);
@ -1686,7 +1686,7 @@ slide embchess_slides[] = {
"to access various options. The next slides are slides from that video.\n\n",
[] (presmode mode) {
setCanvas(mode, '0');
setWhiteCanvas(mode);
slide_url(mode, 'y', "YouTube link", "https://youtu.be/Rhjv_PazzZE");
slide_action(mode, 'a', "activate / configure", act_or_config);
if(mode == pmKey) act_or_config();

View File

@ -469,7 +469,7 @@ auto fifteen_hook =
slide_error(mode, "file " + fname + " not found");
return;
}
setCanvas(mode, '0');
setWhiteCanvas(mode);
if(mode == pmStart) {
slide_backup(mapeditor::drawplayer, mapeditor::drawplayer);
slide_backup(vid.wallmode, 2);

View File

@ -556,7 +556,7 @@ bool drawVertex(const shiftmatrix &V, cell *c, shmup::monster *m) {
void flock_slide(tour::presmode mode, int _N, reaction_t t) {
using namespace tour;
setCanvas(mode, '0');
setWhiteCanvas(mode);
if(mode == pmStart) {
slide_backup(mapeditor::drawplayer);
t();

View File

@ -167,7 +167,7 @@ void heat_slide(vector<tour::slide>& v, string title, string desc, reaction_t t)
tour::slide{cap + title, 18, LEGAL::NONE | QUICKGEO, desc,
[t] (presmode mode) {
setCanvas(mode, '0');
setPlainCanvas(mode);
slide_backup(vid.use_smart_range, 2);
slide_backup(vid.smart_range_detail, 1);
slide_backup(vid.cells_drawn_limit, 100000);

View File

@ -131,16 +131,14 @@ auto hypcity_ah = arg::add3("-hypcity", enable)
if(mode == pmStart && dim == 2 && !vid.always3) {
geom3::switch_fpp();
}
setCanvas(mode, '0');
if(mode == pmStart) {
setWhiteCanvas(mode, [setter, dim] {
slide_backup(canvas_default_wall, waInvisibleFloor);
if(dim == 2) slide_backup(vid.camera, 0);
if(dim == 2) slide_backup(vid.depth, 0);
slide_backup(context_fog, false);
setter();
start_game();
enable();
}
});
if(mode == pmStart) enable();
non_game_slide_scroll(mode);
}});
};

View File

@ -436,7 +436,7 @@ auto msc = arg::add3("-analogs", enable)
[] (presmode mode) {
slide_url(mode, 'y', "YouTube link (with description)", "https://youtu.be/H7NKhKTjHVE");
slide_url(mode, 'm', "HyperRogue page about projections", "http://www.roguetemple.com/z/hyper/models.php");
setCanvas(mode, '0');
setWhiteCanvas(mode);
if(mode == pmStart) {
slide_backup(mapeditor::drawplayer);
slide_backup(vid.use_smart_range);

View File

@ -247,7 +247,7 @@ vector<cell*> current_list;
void mine_slide(tour::presmode mode, reaction_t set_geom, function<vector<cell*>()> celllister, function<void(cell*)> assigner) {
using namespace tour;
ccolor::plain.ctab = {0};
setCanvas(mode, '0');
setWhiteCanvas(mode);
if(mode == pmStart) {
slide_backup(mapeditor::drawplayer, false);
slide_backup(no_find_player, true);
@ -299,7 +299,7 @@ using namespace rogueviz::pres;
void wfc_slide(presmode mode, int type, int rad, int cutoff) {
static vector<pair<cell*, int>> colors;
setCanvas(mode, '0');
setWhiteCanvas(mode);
dynamic_wfc::wfctype = type;
dynamic_wfc::wfcrad = rad;
dynamic_wfc::cutoff = cutoff;
@ -419,7 +419,7 @@ slide sweeper_slides[] = {
{"Variants: HyperRogue minefield", 123, LEGAL::ANY | QUICKGEO,
"The other one is the Minefield land in HyperRogue. It is heavily modified from the original but the basic idea stays the same.",
[] (presmode mode) {
setCanvas(mode, '0');
setWhiteCanvas(mode);
if(mode == pmStart) {
stop_game();
firstland = specialland = laMinefield;
@ -509,7 +509,7 @@ slide sweeper_slides[] = {
"For creatures restricted to just this surface, they are indeed striaght lines!\n\n"
,
[] (presmode mode) {
setCanvas(mode, '0');
setWhiteCanvas(mode);
if(mode == pmStart) {
tour::slide_backup(mapeditor::drawplayer, false);
enable_earth();
@ -538,17 +538,13 @@ slide sweeper_slides[] = {
"The hyperbolic geometry is the opposite. We can have a pentagon with five right angles.\n\n"
,
[] (presmode mode) {
setCanvas(mode, 'c');
if(mode == pmStart) {
stop_game();
setCanvas(mode, &ccolor::chessboard, [] {
set_geometry(g45);
set_variation(eVariation::pure);
tour::slide_backup(ccolor::chessboard.ctab[0], 0x104010);
tour::slide_backup(ccolor::chessboard.ctab[1], 0x10F010);
tour::slide_backup(ccolor::chessboard.ctab, colortable{0x104010, 0x10F010});
tour::slide_backup(vid.use_smart_range, 2);
tour::slide_backup(vid.smart_range_detail, 1);
start_game();
}
});
// mine_slide(mode, geom_pentagos, cl_pentagons, chessboard_assigner);
non_game_slide_scroll(mode);
tour::slide_backup(draw_centerover, false);
@ -559,14 +555,12 @@ slide sweeper_slides[] = {
"The hyperbolic plane has a tree-like structure. It is best seen in the 'binary tiling'. Press '5' to show the pattern.\n\n"
,
[] (presmode mode) {
setCanvas(mode, 'g');
non_game_slide_scroll(mode);
if(mode == pmStart) {
tour::slide_backup(ccolor::plain.ctab[0], 0x10A010);
stop_game();
setCanvasColor(mode, 0x10A010, [] {
set_geometry(gBinary4);
set_variation(eVariation::pure);
start_game();
});
non_game_slide_scroll(mode);
if(mode == pmStart) {
tour::slide_backup(vid.use_smart_range, 2);
tour::slide_backup(vid.smart_range_detail, 1);
View = spin90();
@ -589,13 +583,12 @@ slide sweeper_slides[] = {
"Other hyperbolic tessellations have a similar structure, just a bit more complicated...\n\n"
,
[] (presmode mode) {
setCanvas(mode, '0');
non_game_slide_scroll(mode);
if(mode == pmStart) {
stop_game();
setWhiteCanvas(mode, [] {
set_variation(eVariation::pure);
tour::slide_backup(vid.creature_scale, 0.5);
start_game();
});
non_game_slide_scroll(mode);
if(mode == pmStart) {
tour::slide_backup(viewdists, true);
using linepatterns::patTree;
tour::slide_backup(patTree.color, 0xFFFFFFFF);
@ -837,14 +830,12 @@ slide sweeper_slides[] = {
"To see this, let's remind you of the binary tiling..."
,
[] (presmode mode) {
setCanvas(mode, 'g');
non_game_slide_scroll(mode);
if(mode == pmStart) {
tour::slide_backup(ccolor::plain.ctab[0], 0x10A010);
stop_game();
setCanvasColor(mode, 0x10A010, [] {
set_geometry(gBinary4);
set_variation(eVariation::pure);
start_game();
});
non_game_slide_scroll(mode);
if(mode == pmStart) {
tour::slide_backup(vid.use_smart_range, 2);
tour::slide_backup(vid.smart_range_detail, 1);
View = spin90();

View File

@ -284,7 +284,12 @@ auto hchook =
[] (presmode mode) {
slide_url(mode, 'y', "YouTube link", "https://youtu.be/3WejR74o6II");
setCanvas(mode, '0');
setWhiteCanvas(mode, [] {
set_geometry(gNil);
tour::on_restore(nilv::set_flags);
tour::slide_backup(nilv::nilperiod, make_array(3, 3, 3));
nilv::set_flags();
});
slidecommand = "animation";
if(mode == pmKey) {
@ -292,14 +297,8 @@ auto hchook =
}
if(mode == pmStart) {
stop_game();
set_geometry(gNil);
tour::slide_backup(mapeditor::drawplayer, false);
tour::slide_backup(smooth_scrolling, true);
tour::on_restore(nilv::set_flags);
tour::slide_backup(nilv::nilperiod, make_array(3, 3, 3));
nilv::set_flags();
start_game();
playermoved = false;
enable();
}

View File

@ -324,7 +324,7 @@ auto hook = arg::add3("-inner-map", enable)
,
[] (presmode mode) {
slide_url(mode, 't', "Twitter link (with description)", "https://twitter.com/zenorogue/status/1212408644941295619");
setCanvas(mode, 'r');
setCanvas(mode, &ccolor::random, [] { slide_backup(ccolor::rwalls, 0); });
if(mode == pmStart) {
if(!shmup::on) restart_game(rg::shmup);

View File

@ -598,7 +598,7 @@ auto hooks =
v.push_back(tour::slide{
s, 10, tour::LEGAL::NONE | tour::QUICKSKIP | tour::QUICKGEO | tour::ALWAYS_TEXT, desc,
[=] (tour::presmode mode) {
setCanvas(mode, '0');
setWhiteCanvas(mode);
if(youtube != "")
slide_url(mode, 'y', "YouTube link", youtube);
if(twitter != "")

View File

@ -12,8 +12,7 @@ bool in_special = false;
auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
using namespace tour;
return [=] (presmode mode) {
setCanvas(mode, '0');
if(mode == pmStart) {
setWhiteCanvas(mode, [&] {
set_geometry(g);
if(g == gSphere) {
set_geometry(gProduct);
@ -31,12 +30,11 @@ auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
tour::slide_backup(ccolor::jblock, jblock);
tour::slide_backup(ccolor::which, ccolor::legacy(canvas));
tour::slide_backup(vid.linewidth, vid.linewidth / 10);
start_game();
if(jblock < 0) {
pmodel = mdDisk;
sightranges[gSol] = 4;
}
}
});
rogueviz::pres::non_game_slide_scroll(mode);
if(mode == pmStop && jblock < 0)
pmodel = mdGeodesic;
@ -163,11 +161,9 @@ tour::slide *gen_noniso_demo() {
"This is a presentation of non-isotropic geometries.",
[] (presmode mode) {
slide_url(mode, 'p', "paper about non-isotropic geometries", "https://arxiv.org/abs/2002.09533");
setCanvas(mode, 'r');
if(mode == pmStart) {
setCanvas(mode, &ccolor::random, [] {
set_geometry(gCubeTiling);
start_game();
}
});
}
});

View File

@ -1443,7 +1443,7 @@ void portal_slideshow(tour::ss::slideshow_callback cb) {
portal_slides.emplace_back(
tour::slide{s, 100, LEGAL::NONE | QUICKGEO | QUICKSKIP | ALWAYS_TEXT, text,
[=] (presmode mode) {
setCanvas(mode, '0');
setPlainCanvas(mode);
if(youtube != "")
slide_url(mode, 'y', "YouTube link", youtube);
non_game_slide_scroll(mode);

View File

@ -328,7 +328,7 @@ auto xhook =
"Move the mouse nearer and further away from the X.",
[] (presmode mode) {
setCanvas(mode, '0');
setPlainCanvas(mode);
slide_url(mode, 'u', "open the URL", "http://www.roguetemple.com/z/sims/snub/");
slide_backup(rug::model_distance);
slide_backup(vid.rug_config.model);

View File

@ -526,11 +526,12 @@ auto msc =
,
[] (presmode mode) {
slide_url(mode, 't', "Twitter link (with description)", "https://twitter.com/ZenoRogue/status/1339946298460483589");
setCanvas(mode, '0');
setPlainCanvas(mode, [] {
set_geometry(gSphere);
});
if(mode == pmStart) {
enable();
set_geometry(gSphere);
slide_backup(canvas_default_wall, waInvisibleFloor);
slide_backup(pmodel, mdDisk);
slide_backup(pconf.scale, 1000);

View File

@ -827,7 +827,7 @@ auto chk = arg::add3("-platformer", enable)
slide_url(mode, 'y', "non-Euclidean platformer (YouTube)", "https://www.youtube.com/watch?v=eb2DhCcGH7U");
slide_url(mode, 't', "non-Euclidean platformer (Twitter)", "https://twitter.com/ZenoRogue/status/1467233150380089345");
slide_url(mode, 'g', "how to edit this", "https://github.com/zenorogue/hyperrogue/blob/master/rogueviz/platformer.cpp");
setCanvas(mode, '0');
setPlainCanvas(mode);
using namespace tour;
if(mode == pmStart) {
mapstream::loadMap("platformer.lev");

View File

@ -91,7 +91,7 @@ struct dmv_grapher : grapher {
void nil_screen(presmode mode, int id) {
use_angledir(mode, id == 0);
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) {
slide_backup(pmodel);
slide_backup(pconf.clip_min);
@ -287,7 +287,7 @@ void geodesic_screen(presmode mode, int id) {
use_angledir(mode, id == 0);
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) {
slide_backup(pmodel);
slide_backup(pconf.clip_min);
@ -471,7 +471,7 @@ void geodesic_screen(presmode mode, int id) {
void brick_slide(int i, presmode mode, eGeometry geom, eModel md, int anim) {
using namespace tour;
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) {
set_geometry(geom);
start_game();
@ -511,7 +511,7 @@ void ply_slide(tour::presmode mode, eGeometry geom, eModel md, bool anim) {
check_cgi();
cgi.require_shapes();
}
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) {
set_geometry(geom);
start_game();
@ -534,7 +534,7 @@ void ply_slide(tour::presmode mode, eGeometry geom, eModel md, bool anim) {
void impossible_ring_slide(tour::presmode mode) {
using namespace tour;
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) {
set_geometry(gCubeTiling);
start_game();
@ -626,20 +626,14 @@ slide dmv_slides[] = {
"The sum of angles of a triangle is 180 degrees.\n\n",
[] (presmode mode) {
if(mode == pmStartAll) enable_canvas();
setCanvas(mode, 'F');
if(mode == pmStart) {
stop_game();
slide_backup(firstland, laCanvas);
slide_backup(specialland, laCanvas);
setCanvas(mode, &ccolor::football, [] {
set_geometry(gArchimedean); arcm::current.parse("3^6");
set_variation(eVariation::pure);
slide_backup(ccolor::football.ctab[0], 0xC0FFC0);
slide_backup(ccolor::football.ctab[1], 0x80FF80);
slide_backup(ccolor::which->ctab, colortable{0xC0FFC0, 0x80FF80});
});
if(mode == pmStart) {
slide_backup(pconf.alpha, 1);
slide_backup(pconf.scale, 1);
start_game();
slide_backup(patterns::whichShape, '9');
slide_backup(vid.use_smart_range, 2);
slide_backup(mapeditor::drawplayer, false);
@ -664,7 +658,7 @@ slide dmv_slides[] = {
"For creatures restricted to just this surface, they are indeed striaght lines!\n\n"
,
[] (presmode mode) {
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) {
tour::slide_backup(mapeditor::drawplayer, false);
enable_earth();
@ -701,19 +695,15 @@ slide dmv_slides[] = {
"In hyperbolic geometry, the sum of angles of a triangle is less than 180 degrees.\n\n",
[] (presmode mode) {
if(mode == pmStartAll) enable_canvas();
setCanvas(mode, 'F');
if(mode == pmStart) {
stop_game();
slide_backup(firstland, laCanvas);
slide_backup(specialland, laCanvas);
setCanvas(mode, &ccolor::football, [] {
set_geometry(gNormal);
set_variation(eVariation::bitruncated);
slide_backup(ccolor::football.ctab[0], 0xC0FFC0);
slide_backup(ccolor::football.ctab[1], 0x80FF80);
slide_backup(ccolor::which->ctab, colortable{0xC0FFC0, 0x80FF80});
});
if(mode == pmStart) {
slide_backup(pconf.alpha, 1);
slide_backup(pconf.scale, 1);
slide_backup(rug::mouse_control_rug, true);
start_game();
slide_backup(patterns::whichShape, '9');
}
if(mode == pmStart) {
@ -759,10 +749,9 @@ slide dmv_slides[] = {
slide_backup(vid.fov, 120);
}
setCanvas(mode, '0');
setPlainCanvas(mode, [] { set_geometry(gSpace534); });
if(mode == pmStart) {
set_geometry(gSpace534);
/*
static bool solved = false;
if(!solved) {
@ -917,12 +906,10 @@ slide dmv_slides[] = {
"(press Home/End and arrow keys to move)",
[] (presmode mode) {
setCanvas(mode, '0');
setWhiteCanvas(mode, [] { set_geometry(gNil); });
slidecommand = "highlight dimensions";
if(mode == pmStart) {
tour::slide_backup(pmodel, mdGeodesic);
set_geometry(gNil);
start_game();
rogueviz::rv_hook(hooks_drawcell, 100, rogueviz::nilcompass::draw_compass);
View = Id;
shift_view(ztangent(.5));
@ -1199,22 +1186,19 @@ slide dmv_slides[] = {
"Here is how it looks in Nil. Press '5' to animate.\n",
[] (presmode mode) {
setCanvas(mode, '0');
setWhiteCanvas(mode, [] {
set_geometry(gNil);
tour::on_restore(nilv::set_flags);
tour::slide_backup(nilv::nilperiod, make_array(3, 3, 3));
nilv::set_flags();
});
slidecommand = "animation";
if(mode == pmKey) {
tour::slide_backup(rogueviz::cylon::cylanim, !rogueviz::cylon::cylanim);
}
if(mode == pmStart) {
stop_game();
set_geometry(gNil);
rogueviz::cylon::enable();
tour::on_restore(nilv::set_flags);
tour::slide_backup(nilv::nilperiod, make_array(3, 3, 3));
nilv::set_flags();
start_game();
}
if(mode == pmStart) rogueviz::cylon::enable();
non_game_slide_scroll(mode);
}},
@ -1261,13 +1245,8 @@ slide dmv_slides[] = {
[] (presmode mode) {
slide_url(mode, 'y', "YouTube link", "https://www.youtube.com/watch?v=mxvUAcgN3go");
slide_url(mode, 'n', "Nil Rider", "https://zenorogue.itch.io/nil-rider");
setCanvas(mode, '0');
setWhiteCanvas(mode, [] { set_geometry(gNil); });
if(mode == pmStart) {
stop_game();
set_geometry(gNil);
check_cgi();
cgi.require_shapes();
start_game();
rogueviz::balls::initialize(1);
rogueviz::balls::balls.resize(3);
pmodel = mdEquidistant;

View File

@ -211,7 +211,7 @@ auto hooks =
"You can also obtain a different geometry (Berger sphere) by stretching along the fibers. Press 5 to stretch."+bonus
,
[m] (presmode mode) {
setCanvas(mode, '0');
setWhiteCanvas(mode);
slide_url(mode, 't', "Twitter link", "https://twitter.com/ZenoRogue/status/1166723332840001536");
slide_url(mode, 's', "stretched Twitter link", "https://twitter.com/ZenoRogue/status/1258035231996682244");
if(mode == pmStart) {
@ -238,7 +238,7 @@ auto hooks =
"Again, press 5 to stretch."+bonus
,
[m] (presmode mode) {
setCanvas(mode, '0');
setWhiteCanvas(mode);
slide_url(mode, 's', "stretched Twitter link", "https://twitter.com/ZenoRogue/status/1259143275115687936");
if(mode == pmStart) {
set_geometry(gKleinQuartic);

View File

@ -160,7 +160,7 @@ void rw_slide(vector<tour::slide>& v, string title, string desc, reaction_t t) {
tour::slide{cap + title, 18, LEGAL::NONE | QUICKGEO, desc,
[t] (presmode mode) {
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) {
tour::slide_backup(mapeditor::drawplayer, false);

View File

@ -210,7 +210,7 @@ void snow_slide(vector<tour::slide>& v, string title, string desc, reaction_t t)
tour::slide{cap + title, 18, LEGAL::NONE | QUICKGEO, desc,
[t] (presmode mode) {
setCanvas(mode, '0');
setPlainCanvas(mode);
slidecommand = "auto-movement";
if(mode == pmKey) {

View File

@ -248,7 +248,7 @@ int phooks = arg::add3("-stair", enable)
"Press '5' to change the curvature or other parameters.",
[] (presmode mode) {
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) staircase::make_staircase();
slidecommand = "staircase menu";
if(mode == pmKey) pushScreen(staircase::showMenu);

View File

@ -332,7 +332,7 @@ auto hook = 0
[] (presmode mode) {
slide_url(mode, 'y', "YouTube link", "https://www.youtube.com/watch?v=bKzibaNqEog");
slide_url(mode, 't', "Twitter link", "https://twitter.com/ZenoRogue/status/1247900522905886723");
setCanvas(mode, '0');
setPlainCanvas(mode);
if((mode == pmStop || mode == pmGeometry) && rug::rugged) rug::close();

View File

@ -500,7 +500,7 @@ bool draw_ptriangle(cell *c, const shiftmatrix& V) {
#if CAP_RVSLIDES
void slide_itri(tour::presmode mode, int id) {
using namespace tour;
setCanvas(mode, '0');
setPlainCanvas(mode);
if(mode == pmStart) {
stop_game();