1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-13 17:06:52 +00:00

added a header file for RogueViz

This commit is contained in:
Zeno Rogue 2017-12-02 00:24:07 +01:00
parent eb94d229d7
commit 26878f16c3
2 changed files with 52 additions and 32 deletions

View File

@ -20,6 +20,8 @@
// hyper -tess <parameter file> -- visualize a horocyclic tesselation,
#include "rogueviz.h"
namespace rogueviz {
void init();
@ -41,22 +43,6 @@ eVizkind kind;
bool on;
struct edgeinfo {
int i, j;
double weight, weight2;
bool visible;
vector<GLfloat> prec;
cell *orig;
int lastdraw;
edgeinfo() { visible = true; orig = NULL; lastdraw = -1; }
};
struct colorpair {
int color1, color2;
char shade;
colorpair(int col = 0xC0C0C0FF) { shade = 0; color1 = col; }
};
colorpair parse(const string& s) {
colorpair cp;
cp.shade = 0; cp.color2 = 0;
@ -116,18 +102,6 @@ colorpair perturb(colorpair cp) {
return cp;
}
struct vertexdata {
vector<pair<int, edgeinfo*> > edges;
string name;
colorpair cp;
edgeinfo *virt;
bool special;
int data;
string *info;
shmup::monster *m;
vertexdata() { virt = NULL; m = NULL; info = NULL; special = false; }
};
vector<vertexdata> vdata;
transmatrix cspin(int i, int ch) {
@ -318,7 +292,7 @@ namespace anygraph {
}
}
void read(string fn, bool subdiv = true, bool doRebase = true, bool doStore = true) {
void read(string fn, bool subdiv, bool doRebase, bool doStore) {
init(); kind = kAnyGraph;
fname = fn;
FILE *f = fopen((fn + "-coordinates.txt").c_str(), "rt");
@ -363,7 +337,6 @@ namespace anygraph {
int i = readLabel(f), j = readLabel(f);
if(i == -1 || j == -1) break;
addedge(i, j, 0, subdiv);
if(qlink % 10000 == 0) printf("%d\n", qlink);
qlink++;
}
fclose(f);
@ -1559,6 +1532,7 @@ struct storydata { int s; int e; const char *text; } story[] = {
}
#endif
#if CAP_COMMANDLINE
int readArgs() {
using namespace arg;
@ -1722,6 +1696,7 @@ int readArgs() {
else return 1;
return 0;
}
#endif
void showMenu() {
dialog::init(XLAT("rogueviz configuration"));
@ -1987,9 +1962,11 @@ slide rvslides[] = {
auto hooks =
addHook(hooks_frame, 0, drawExtra) +
#if CAP_COMMANDLINE
addHook(hooks_args, 100, readArgs) +
addHook(clearmemory, 0, close) +
addHook(hooks_config, 0, [] () { tour::ss::list(rogueviz::rvtour::rvslides); });
addHook(hooks_config, 0, [] () { tour::ss::list(rogueviz::rvtour::rvslides); }) +
#endif
addHook(clearmemory, 0, close);
};

43
rogueviz.h Normal file
View File

@ -0,0 +1,43 @@
namespace rogueviz {
struct edgeinfo {
int i, j;
double weight, weight2;
bool visible;
vector<GLfloat> prec;
cell *orig;
int lastdraw;
edgeinfo() { visible = true; orig = NULL; lastdraw = -1; }
};
struct colorpair {
int color1, color2;
char shade;
colorpair(int col = 0xC0C0C0FF) { shade = 0; color1 = col; }
};
struct vertexdata {
vector<pair<int, edgeinfo*> > edges;
string name;
colorpair cp;
edgeinfo *virt;
bool special;
int data;
string *info;
shmup::monster *m;
vertexdata() { virt = NULL; m = NULL; info = NULL; special = false; }
};
extern vector<vertexdata> vdata;
namespace anygraph {
extern double R, alpha, T;
extern vector<pair<double, double> > coords;
void fixedges();
void read(string fn, bool subdiv = true, bool doRebase = true, bool doStore = true);
extern int N;
}
extern ld ggamma;
}