mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
added a header file for RogueViz
This commit is contained in:
parent
eb94d229d7
commit
26878f16c3
41
rogueviz.cpp
41
rogueviz.cpp
@ -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
43
rogueviz.h
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user