rogueviz:: used args::add and made hypcity and hypocycloid enablable

This commit is contained in:
Zeno Rogue 2021-03-31 03:18:36 +02:00
parent ceb79290ae
commit 8a836fd1ea
10 changed files with 44 additions and 111 deletions

View File

@ -33,19 +33,12 @@ void drawExtra() {
canmove = true; items[itOrbAether] = true; canmove = true; items[itOrbAether] = true;
} }
auto hooks = auto hooks = arg::add3("-net", [] {
addHook(hooks_args, 100, [] {
using namespace arg;
if(argis("-net")) {
PHASE(3);
init(0); init(0);
rv_hook(hooks_frame, 0, drawExtra); rv_hook(hooks_frame, 0, drawExtra);
linepatterns::patTriTree.color = 0x30; linepatterns::patTriTree.color = 0x30;
linepatterns::patTriOther.color = 0x10; linepatterns::patTriOther.color = 0x10;
linepatterns::patTriRings.color = 0xFF; linepatterns::patTriRings.color = 0xFF;
return 0; });
}
return 1;
});
}} }}

View File

@ -6,15 +6,16 @@
// see the results posted here: // see the results posted here:
// https://twitter.com/ZenoRogue/status/1375750351391981570 // https://twitter.com/ZenoRogue/status/1375750351391981570
// -noplayer -geo 4x5 -gp 1 1 -unrectified -switch-fpp -canvas 303030 camera=0 depth=0 -sr 3 -PM 0 -alpha 1 -zoom .95 // -hypcity -noplayer -geo 4x5 -gp 1 1 -unrectified -switch-fpp -canvas 303030 camera=0 depth=0 -sr 3 -PM 0 -alpha 1 -zoom .95
// https://twitter.com/ZenoRogue/status/1375748835046215682 // https://twitter.com/ZenoRogue/status/1375748835046215682
// -noplayer -geo nil -canvas 303030 -back 44e4 -sight3 3 // -hypcity -noplayer -geo nil -canvas 303030 -back 44e4 -sight3 3
// https://twitter.com/ZenoRogue/status/1375754422752575488 // https://twitter.com/ZenoRogue/status/1375754422752575488
// add -PM 0 -alpha 1 // add -PM 0 -alpha 1
namespace hr { namespace hr {
namespace hypcity {
using namespace rogueviz::objmodels; using namespace rogueviz::objmodels;
@ -89,6 +90,8 @@ bool draw_city_at(cell *c, const shiftmatrix& V) {
return false; return false;
} }
auto hypcity_ah = addHook(hooks_drawcell, 100, draw_city_at); void enable() { rogueviz::rv_hook(hooks_drawcell, 100, draw_city_at); }
} auto hypcity_ah = arg::add3("-hypcity", enable);
}}

View File

@ -1,22 +1,24 @@
// compile with mymake rogueviz/hypocycloid // compile with mymake rogueviz/hypocycloid
// for https://twitter.com/ZenoRogue/status/1358464890978127875 : // for https://twitter.com/ZenoRogue/status/1358464890978127875 :
// hyper -shot-1000 -noscr -canvas i -noplayer -geo 1 circ1=1 circ2=2 show=.05 lw=20 -zoom .9 -animvideo 360 cycloid-2-euc.mp4 // -hypocyc -shot-1000 -noscr -canvas i -noplayer -geo 1 circ1=1 circ2=2 show=.05 lw=20 -zoom .9 -animvideo 360 cycloid-2-euc.mp4
// for https://twitter.com/ZenoRogue/status/1358464962088337410 : // for https://twitter.com/ZenoRogue/status/1358464962088337410 :
// hyper -shot-1000 -noscr -canvas i -noplayer -geo 0 "circ1=0../0..4../0..|4../0..0../0" "circ2=0../0..8../0..|8../0..0../0" show=.05 lw=3 loops=10 -zoom .9 -animvideo 3600 cycloid-2-hyp.mp4 // -hypocyc -shot-1000 -noscr -canvas i -noplayer -geo 0 "circ1=0../0..4../0..|4../0..0../0" "circ2=0../0..8../0..|8../0..0../0" show=.05 lw=3 loops=10 -zoom .9 -animvideo 3600 cycloid-2-hyp.mp4
// for https://twitter.com/ZenoRogue/status/1358465029876690948 : // for https://twitter.com/ZenoRogue/status/1358465029876690948 :
// hyper -shot-1000 -noscr -canvas i -noplayer -geo 0 "circ1=0../0..8../0..|8../0..0../0" "circ2=0../0..32../0..|32../0..0../0" prec=3600 show=.05 lw=3 loops=10 -zoom .9 -animvideo 3600 cycloid-4-hyp.mp4 // -hypocyc -shot-1000 -noscr -canvas i -noplayer -geo 0 "circ1=0../0..8../0..|8../0..0../0" "circ2=0../0..32../0..|32../0..0../0" prec=3600 show=.05 lw=3 loops=10 -zoom .9 -animvideo 3600 cycloid-4-hyp.mp4
// for https://twitter.com/ZenoRogue/status/1358506225990828033 : // for https://twitter.com/ZenoRogue/status/1358506225990828033 :
// hyper -shot-1000 -noscr -canvas i -noplayer -geo 2 "circ1=0../0...5../0..|.5../0..0../0" "circ2=0../0..1../0..|1../0..0../0" show=.05 lw=3 loops=10 -zoom .9 -animvideo 1200 cycloid-2-sph.mp4 // -hypocyc -shot-1000 -noscr -canvas i -noplayer -geo 2 "circ1=0../0...5../0..|.5../0..0../0" "circ2=0../0..1../0..|1../0..0../0" show=.05 lw=3 loops=10 -zoom .9 -animvideo 1200 cycloid-2-sph.mp4
// for https://twitter.com/ZenoRogue/status/1358505146553159682 : // for https://twitter.com/ZenoRogue/status/1358505146553159682 :
// hyper -shot-1000 -noscr -canvas i -noplayer -geo 0 circ1=1 circ2=2 show=.1 lw=5 -zoom .9 "ratio=2../0..8../0..|8../0..2../0" prec=3600 -animvideo 3600 half-radius.mp4 // -hypocyc -shot-1000 -noscr -canvas i -noplayer -geo 0 circ1=1 circ2=2 show=.1 lw=5 -zoom .9 "ratio=2../0..8../0..|8../0..2../0" prec=3600 -animvideo 3600 half-radius.mp4
#include "../hyper.h" #include "../hyper.h"
namespace hr { namespace hr {
namespace hypocyc {
/* what to roll on: 0 = circle, 1 = horocycle, 2 = straight line, 3 = equidistant */ /* what to roll on: 0 = circle, 1 = horocycle, 2 = straight line, 3 = equidistant */
int shape = 0; int shape = 0;
@ -143,7 +145,11 @@ void circ_frame() {
vid.linewidth /= lw; vid.linewidth /= lw;
} }
auto shot_hooks = addHook(hooks_frame, 100, circ_frame) void enable() {
addHook(hooks_frame, 100, circ_frame);
}
auto shot_hooks = arg::add2("-hypocyc", enable)
+ addHook(hooks_configfile, 100, [] { + addHook(hooks_configfile, 100, [] {
param_f(circ1, "circ1"); param_f(circ1, "circ1");
param_f(circ2, "circ2"); param_f(circ2, "circ2");
@ -159,3 +165,4 @@ auto shot_hooks = addHook(hooks_frame, 100, circ_frame)
}); });
} }
}

View File

@ -132,14 +132,8 @@ void create_janko() {
gi.menu_displayed_name = "Janko group J1"; gi.menu_displayed_name = "Janko group J1";
} }
auto shot_hooks = addHook(hooks_args, 100, [] { auto shot_hooks = arg::add3("-janko1x", [] { build(); experiment(); })
if(arg::argis("-janko1x")) { + addHook(hooks_initialize, 100, create_janko);
build();
experiment();
}
else return true;
return false;
}) + addHook(hooks_initialize, 100, create_janko);
} }

View File

@ -156,23 +156,7 @@ void magic(int sides) {
rv_hook(hooks_handleKey, 150, magic_rugkey); rv_hook(hooks_handleKey, 150, magic_rugkey);
} }
int readArgs() { auto magichook = arg::add2("-magic3", [] { magic(-1); }) + arg::add2("-magic", [] { magic(arg::shift_argi()); });
using namespace arg;
if(0) ;
else if(argis("-magic")) {
PHASEFROM(2);
shift(); magic(argi());
}
else if(argis("-magic3")) {
PHASEFROM(2);
magic(-1);
}
else return 1;
return 0;
}
auto magichook = addHook(hooks_args, 100, readArgs);
} }
#endif #endif

View File

@ -281,26 +281,6 @@ void create_model() {
} }
#if CAP_COMMANDLINE
int readArgs() {
using namespace arg;
if(0) ;
else if(argis("-snub")) {
PHASE(3);
shift();
run_snub(argi(), 3);
}
else if(argis("-snub4")) {
PHASE(3);
shift();
run_snub(argi(), 4);
}
else return 1;
return 0;
}
#endif
bool frame() { bool frame() {
if(snubon && rug::rugged) { if(snubon && rug::rugged) {
create_model(); create_model();
@ -343,7 +323,9 @@ bool handleKey(int sym, int uni) {
} }
auto xhook = addHook(hooks_args, 100, readArgs) auto xhook =
arg::add3("-snub", [] { run_snub(arg::shift_argi(), 3); })
+ arg::add3("-snub4", [] { run_snub(arg::shift_argi(), 4); })
+ addHook(hooks_handleKey, 0, handleKey) + addHook(hooks_handleKey, 0, handleKey)
+ addHook(hooks_prestats, 0, frame) + addHook(hooks_prestats, 0, frame)
+ addHook(hooks_clearmemory, 40, [] () { snubon = false; } ) + addHook(hooks_clearmemory, 40, [] () { snubon = false; } )

View File

@ -1,4 +1,4 @@
#include "../hyper.h" #include "rogueviz.h"
// implementation of this demo: https://twitter.com/ZenoRogue/status/1304130700870901761 // implementation of this demo: https://twitter.com/ZenoRogue/status/1304130700870901761
@ -12,9 +12,9 @@ namespace hr {
namespace pentaroll { namespace pentaroll {
bool animated; void animate();
void create_pentaroll() { void create_pentaroll(bool animated) {
start_game(); start_game();
/* get the list of all close cells */ /* get the list of all close cells */
cell *c0 = currentmap->gamestart(); cell *c0 = currentmap->gamestart();
@ -54,22 +54,8 @@ void create_pentaroll() {
cw1.peek()->landparam = hrand(0x1000000) | 0x808080; cw1.peek()->landparam = hrand(0x1000000) | 0x808080;
} }
} }
} if(animated)
rogueviz::rv_hook(anims::hooks_anim, 100, animate);
int args() {
using namespace arg;
if(0) ;
else if(argis("-pentaroll")) {
PHASEFROM(3);
/* 1 = animated, 0 = not animated */
shift(); animated = argi();
}
else return 1;
return 0;
} }
/* currently not configurable */ /* currently not configurable */
@ -79,12 +65,8 @@ ld how_far = 1;
ld orig_distance = 1; ld orig_distance = 1;
ld far_distance = 1; ld far_distance = 1;
auto hooks = void animate() {
addHook(hooks_args, 100, args)
+ addHook(hooks_clearmemory, 40, [] () { animated = false; })
+ addHook(anims::hooks_anim, 100, [] {
if(!animated) return;
centerover = currentmap->gamestart(); centerover = currentmap->gamestart();
ld t = ticks * 20. / anims::period; ld t = ticks * 20. / anims::period;
@ -141,7 +123,9 @@ auto hooks =
View = spin((angle-M_PI) * int(t)) * View; View = spin((angle-M_PI) * int(t)) * View;
anims::moved(); anims::moved();
}); }
auto hooks = arg::add3("-pentaroll", [] { create_pentaroll(arg::shift_argi()); });
} }

View File

@ -39,8 +39,7 @@ namespace bricks {
} }
namespace pentaroll { namespace pentaroll {
extern bool animated; extern void create_pentaroll(bool);
extern void create_pentaroll();
} }
namespace ply { namespace ply {
@ -656,8 +655,7 @@ slide dmv_slides[] = {
set_geometry(gFieldQuotient); set_geometry(gFieldQuotient);
*/ */
start_game(); start_game();
pentaroll::create_pentaroll(); pentaroll::create_pentaroll(true);
pentaroll::animated = true;
tour::slide_backup(anims::period, 30000.); tour::slide_backup(anims::period, 30000.);
tour::slide_backup(sightranges[geometry], 4); tour::slide_backup(sightranges[geometry], 4);
start_game(); start_game();

View File

@ -33,6 +33,9 @@
#include "fifteen.cpp" #include "fifteen.cpp"
#include "crystal-sokoban.cpp" #include "crystal-sokoban.cpp"
#include "hypcity.cpp"
#include "hypocycloid.cpp"
#include "simple-impossible.cpp" #include "simple-impossible.cpp"
#include "ascending-descending.cpp" #include "ascending-descending.cpp"
#include "balls.cpp" #include "balls.cpp"

View File

@ -105,21 +105,7 @@ namespace tree {
storeall(); storeall();
} }
#if CAP_COMMANDLINE int ah = arg::add3("-tree", [] { tree::read(arg::shift_args()); })
int readArgs() {
using namespace arg;
if(0) ;
else if(argis("-tree")) {
PHASE(3); shift(); tree::read(args());
}
else return 1;
return 0;
}
int ah = addHook(hooks_args, 120, readArgs)
+ addHook(pres::hooks_build_rvtour, 120, [] (string s, vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 120, [] (string s, vector<tour::slide>& v) {
if(s != "data") return; if(s != "data") return;
using namespace pres; using namespace pres;
@ -142,7 +128,6 @@ int ah = addHook(hooks_args, 120, readArgs)
})} })}
); );
}); });
#endif
} }
} }