1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-05-21 05:22:07 +00:00

SVG links no longer use an additional field in polytodraw -- they are a new type of polyunion now

This commit is contained in:
Zeno Rogue
2018-07-09 20:40:05 +02:00
parent f721c243d2
commit 6e4e9e0a46
3 changed files with 32 additions and 19 deletions
+14 -7
View File
@@ -845,13 +845,13 @@ bool keep_curvedata = false;
hookset<void(polytodraw&)> *hooks_specialdraw;
void drawqueueitem(polytodraw& ptd) {
#if CAP_ROGUEVIZ
svg::info = ptd.info;
#endif
// if(ptd.prio == 46) printf("eye size %d\n", polyi);
switch(ptd.kind) {
case pkLink:
svg::link = ptd.u.link.link;
break;
case pkSpecial:
callhooks(hooks_specialdraw, ptd);
break;
@@ -2338,6 +2338,13 @@ void queuecurve(int linecol, int fillcol, int prio) {
curvestart = isize(curvedata);
}
void queuelink(const string *link, int prio) {
polytodraw& ptd = nextptd();
ptd.kind = pkLink;
ptd.prio = prio << PSHIFT;
ptd.u.link.link = link;
}
void queueline(const hyperpoint& H1, const hyperpoint& H2, int col, int prf, int prio) {
polytodraw& ptd = nextptd();
ptd.kind = pkLine;
@@ -2465,14 +2472,14 @@ namespace svg {
coord(x), coord(y), coord(size), stylestr(ba, col));
}
string *info;
const string *link;
void startstring() {
if(info) fprintf(f, "<a xlink:href=\"%s\" xlink:show=\"replace\">", info->c_str());
if(link) fprintf(f, "<a xlink:href=\"%s\" xlink:show=\"replace\">", link->c_str());
}
void stopstring() {
if(info) fprintf(f, "</a>");
if(link) fprintf(f, "</a>");
}
string font = "Times";