1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +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, // hyper -tess <parameter file> -- visualize a horocyclic tesselation,
#include "rogueviz.h"
namespace rogueviz { namespace rogueviz {
void init(); void init();
@ -41,22 +43,6 @@ eVizkind kind;
bool on; 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 parse(const string& s) {
colorpair cp; colorpair cp;
cp.shade = 0; cp.color2 = 0; cp.shade = 0; cp.color2 = 0;
@ -116,18 +102,6 @@ colorpair perturb(colorpair cp) {
return 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; vector<vertexdata> vdata;
transmatrix cspin(int i, int ch) { 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; init(); kind = kAnyGraph;
fname = fn; fname = fn;
FILE *f = fopen((fn + "-coordinates.txt").c_str(), "rt"); FILE *f = fopen((fn + "-coordinates.txt").c_str(), "rt");
@ -363,7 +337,6 @@ namespace anygraph {
int i = readLabel(f), j = readLabel(f); int i = readLabel(f), j = readLabel(f);
if(i == -1 || j == -1) break; if(i == -1 || j == -1) break;
addedge(i, j, 0, subdiv); addedge(i, j, 0, subdiv);
if(qlink % 10000 == 0) printf("%d\n", qlink);
qlink++; qlink++;
} }
fclose(f); fclose(f);
@ -1559,6 +1532,7 @@ struct storydata { int s; int e; const char *text; } story[] = {
} }
#endif #endif
#if CAP_COMMANDLINE
int readArgs() { int readArgs() {
using namespace arg; using namespace arg;
@ -1722,6 +1696,7 @@ int readArgs() {
else return 1; else return 1;
return 0; return 0;
} }
#endif
void showMenu() { void showMenu() {
dialog::init(XLAT("rogueviz configuration")); dialog::init(XLAT("rogueviz configuration"));
@ -1987,9 +1962,11 @@ slide rvslides[] = {
auto hooks = auto hooks =
addHook(hooks_frame, 0, drawExtra) + addHook(hooks_frame, 0, drawExtra) +
#if CAP_COMMANDLINE
addHook(hooks_args, 100, readArgs) + 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;
}