diff --git a/hyper.cpp b/hyper.cpp index e668f104..5b36186b 100644 --- a/hyper.cpp +++ b/hyper.cpp @@ -121,7 +121,7 @@ #include "dpgen.cpp" #if CAP_ROGUEVIZ -#include "rogueviz/rogueviz.cpp" +#include "rogueviz/rogueviz-all.cpp" #endif #if CAP_DAILY diff --git a/rogueviz/banachtarski.cpp b/rogueviz/banachtarski.cpp index 05289c23..c4286ddd 100644 --- a/rogueviz/banachtarski.cpp +++ b/rogueviz/banachtarski.cpp @@ -4,6 +4,8 @@ // good parameters: -fixx 10 -W Cros -bantar_anim // use -bantar_map to see how it works +#include "rogueviz.h" + namespace rogueviz { namespace banachtarski { bool on; diff --git a/rogueviz/collatz.cpp b/rogueviz/collatz.cpp index 7a0d3b39..862cfbc1 100644 --- a/rogueviz/collatz.cpp +++ b/rogueviz/collatz.cpp @@ -251,6 +251,16 @@ struct storydata { int s; int e; const char *text; } story[] = { string its05(int i) { char buf[64]; sprintf(buf, "%05d", i); return buf; } +int dimid(char x) { + if(x >= 'a' && x < 'a' + GDIM) return x - 'a'; + else if(x >= '0' && x < '0' + GDIM) return x - '0'; + else if(x >= 'x' && x < 'x' + GDIM) return x - 'x'; + else { + println(hlog, "incorrect dimension ID"); + throw hr_exception(); + } + } + int readArgs() { #if CAP_COMMANDLINE using namespace arg; diff --git a/rogueviz/flocking.cpp b/rogueviz/flocking.cpp index 126ca212..cf1aa322 100644 --- a/rogueviz/flocking.cpp +++ b/rogueviz/flocking.cpp @@ -40,6 +40,8 @@ template auto parallelize(long long N, T action) -> decltype(action(0,0 #endif } +#include "rogueviz.h" + namespace rogueviz { namespace flocking { diff --git a/rogueviz/functions.cpp b/rogueviz/functions.cpp index 285ee9df..49742f5e 100644 --- a/rogueviz/functions.cpp +++ b/rogueviz/functions.cpp @@ -1,3 +1,5 @@ +#include "rogueviz.h" + namespace rogueviz { namespace graph { diff --git a/rogueviz/fundamental.cpp b/rogueviz/fundamental.cpp index 3d7e0703..aba11cbf 100644 --- a/rogueviz/fundamental.cpp +++ b/rogueviz/fundamental.cpp @@ -1,6 +1,8 @@ // show the fundamental domain for quotient spaces // Copyright (C) 2018 Zeno and Tehora Rogue, see 'hyper.cpp' for details +#include "rogueviz.h" + namespace hr { namespace fundamental { diff --git a/rogueviz/kohonen.cpp b/rogueviz/kohonen.cpp index a3b01354..92046a9c 100644 --- a/rogueviz/kohonen.cpp +++ b/rogueviz/kohonen.cpp @@ -4,6 +4,8 @@ // Kohonen's self-organizing maps. // This is a part of RogueViz, not a part of HyperRogue. +#include "rogueviz.h" + namespace rogueviz { namespace kohonen { int kohonen_id; diff --git a/rogueviz/rogueviz-all.cpp b/rogueviz/rogueviz-all.cpp new file mode 100644 index 00000000..13d2c1f8 --- /dev/null +++ b/rogueviz/rogueviz-all.cpp @@ -0,0 +1,21 @@ +// include all RogueViz vizualizations + +#include "rogueviz.cpp" +#include "kohonen.cpp" +#include "staircase.cpp" +#include "banachtarski.cpp" +#include "pentagonal.cpp" +#include "functions.cpp" +#include "fundamental.cpp" +#include "sunflower.cpp" +#include "flocking.cpp" +#include "magiccube.cpp" +#include "cvl.cpp" +#include "newconf.cpp" +#include "grigorchuk.cpp" +#include "qtm.cpp" +#include "rewriting.cpp" +#include "sag.cpp" +#include "collatz.cpp" +#include "tree.cpp" +#include "fullnet.cpp" diff --git a/rogueviz/rogueviz.cpp b/rogueviz/rogueviz.cpp index a2df14e4..4b6185cc 100644 --- a/rogueviz/rogueviz.cpp +++ b/rogueviz/rogueviz.cpp @@ -21,6 +21,8 @@ namespace rogueviz { +string weight_label; + ld fat_edges = 0; ld ggamma = 1; @@ -795,8 +797,6 @@ bool rogueviz_hud() { return true; } -inline hookset *hooks_readcolor; - void readcolor(const string& cfname) { FILE *f = fopen(cfname.c_str(), "rt"); if(!f) { printf("color file missing\n"); exit(1); } @@ -901,8 +901,6 @@ void init(void *_vizid, flagtype _vizflags) { int search_for = -1; -purehookset hooks_close; - void close() { search_for = -1; for(int i=0; i= 'a' && x < 'a' + GDIM) return x - 'a'; - else if(x >= '0' && x < '0' + GDIM) return x - '0'; - else if(x >= 'x' && x < 'x' + GDIM) return x - 'x'; - else { - println(hlog, "incorrect dimension ID"); - throw hr_exception(); - } - } - #if CAP_COMMANDLINE int readArgs() { using namespace arg; @@ -1112,10 +1100,6 @@ void showVertexSearch() { } -purehookset hooks_rvmenu; - -hookset *hooks_rvmenu_replace; - void showMenu() { if(callhandlers(false, hooks_rvmenu_replace)) return; cmode = sm::SIDE | sm::MAYDARK | sm::DIALOG_STRICT_X; @@ -1161,45 +1145,6 @@ namespace rvtour { using namespace tour; -template function roguevizslide(char c, const T& t) { - return [c,t] (presmode mode) { - patterns::canvasback = 0x101010; - setCanvas(mode, c); - if(mode == 1 || mode == pmGeometryStart) t(); - - if(mode == 3 || mode == pmGeometry || mode == pmGeometryReset) { - rogueviz::close(); - shmup::clearMonsters(); - if(mode == pmGeometryReset) t(); - } - - slidecommand = "toggle the player"; - if(mode == 4) - mapeditor::drawplayer = !mapeditor::drawplayer; - pd_from = NULL; - }; - } - -template -function roguevizslide_action(char c, const T& t, const U& act) { - return [c,t,act] (presmode mode) { - patterns::canvasback = 0x101010; - setCanvas(mode, c); - if(mode == pmStart || mode == pmGeometryStart) t(); - - act(mode); - - if(mode == pmStop || mode == pmGeometry || mode == pmGeometryReset) { - rogueviz::close(); - shmup::clearMonsters(); - if(mode == pmGeometryReset) t(); - } - - }; - } - -#define RVPATH HYPERPATH "rogueviz/" - vector rvslides; extern vector rvslides_default; @@ -1333,22 +1278,3 @@ auto hooks = 0; } - -#include "kohonen.cpp" -#include "staircase.cpp" -#include "banachtarski.cpp" -#include "pentagonal.cpp" -#include "functions.cpp" -#include "fundamental.cpp" -#include "sunflower.cpp" -#include "flocking.cpp" -#include "magiccube.cpp" -#include "cvl.cpp" -#include "newconf.cpp" -#include "grigorchuk.cpp" -#include "qtm.cpp" -#include "rewriting.cpp" -#include "sag.cpp" -#include "collatz.cpp" -#include "tree.cpp" -#include "fullnet.cpp" diff --git a/rogueviz/sag.cpp b/rogueviz/sag.cpp index 5280eb03..f87982ba 100644 --- a/rogueviz/sag.cpp +++ b/rogueviz/sag.cpp @@ -1,4 +1,3 @@ -#include "../hyper.h" #include "rogueviz.h" // SAG visualizer (e.g. Reddit roguelikes, GitHub languages) diff --git a/rogueviz/staircase.cpp b/rogueviz/staircase.cpp index a420bf9d..dad73227 100644 --- a/rogueviz/staircase.cpp +++ b/rogueviz/staircase.cpp @@ -4,6 +4,8 @@ // Kohonen's self-organizing networks. // This is a part of RogueViz, not a part of HyperRogue. +#include "rogueviz.h" + namespace rogueviz { namespace staircase { ld scurvature = 0; diff --git a/rogueviz/sunflower.cpp b/rogueviz/sunflower.cpp index bbc97ded..4e06d9b2 100644 --- a/rogueviz/sunflower.cpp +++ b/rogueviz/sunflower.cpp @@ -6,6 +6,8 @@ // for spherical geometry, density is set automatically to cover the whole sphere +#include "rogueviz.h" + namespace hr { namespace sunflower {