1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-07 10:52:23 +00:00

line/circle tools added to the texture editor; grid color changing in texture editor

This commit is contained in:
Zeno Rogue
2018-01-04 12:25:02 +01:00
parent 454e1909d1
commit 3412a50b3d
6 changed files with 136 additions and 21 deletions

View File

@@ -1171,6 +1171,40 @@ void drawPixel(cell *c, hyperpoint h, int col) {
pixels_to_draw.emplace_back(c, h, col);
}
cell *where;
void drawPixel(hyperpoint h, int col) {
try {
again:
transmatrix g0 = gmatrix[where];
ld cdist0 = hdist(tC0(g0), h);
forCellEx(c, where)
try {
transmatrix g = gmatrix[c];
ld cdist = hdist(tC0(g), h);
if(cdist < cdist0) {
cdist0 = cdist;
where = c; g0 = g;
goto again;
}
}
catch(out_of_range) {}
drawPixel(where, h, col);
}
catch(out_of_range) {}
}
void drawLine(hyperpoint h1, hyperpoint h2, int col, int steps) {
if(steps > 0 && hdist(h1, h2) > penwidth / 3) {
hyperpoint h3 = mid(h1, h2);
drawLine(h1, h3, col, steps-1);
drawLine(h3, h2, col, steps-1);
}
else
drawPixel(h2, col);
}
void remap(eTextureState old_tstate, eTextureState old_tstate_max) {
texture_map.clear();
if(old_tstate == tsActive && patterns::compatible(texture::cgroup, patterns::cgroup)) {