mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-02 21:40:34 +00:00
grid improvements: changeable color, straight lines drawn correctly, angles shown relative to coldcenter
This commit is contained in:
parent
4bee0c85a7
commit
6234be507b
@ -459,3 +459,6 @@ transmatrix mzscale(const transmatrix& t, double fac) {
|
|||||||
|
|
||||||
transmatrix pushone() { return euclid ? eupush(1, 0) : xpush(sphere?.5 : 1); }
|
transmatrix pushone() { return euclid ? eupush(1, 0) : xpush(sphere?.5 : 1); }
|
||||||
|
|
||||||
|
bool operator == (hyperpoint h1, hyperpoint h2) {
|
||||||
|
return h1[0] == h2[0] && h1[1] == h2[1] && h1[2] == h2[2];
|
||||||
|
}
|
||||||
|
@ -855,26 +855,23 @@ namespace mapeditor {
|
|||||||
hyperpoint ccenter = C0;
|
hyperpoint ccenter = C0;
|
||||||
hyperpoint coldcenter = C0;
|
hyperpoint coldcenter = C0;
|
||||||
|
|
||||||
|
unsigned gridcolor = 0xC0C0C040;
|
||||||
|
|
||||||
void drawGrid() {
|
void drawGrid() {
|
||||||
for(int d=0; d<84; d++) {
|
for(int d=0; d<S84; d++) {
|
||||||
transmatrix d2 = drawtrans * rgpushxto0(ccenter);
|
transmatrix d2 = drawtrans * rgpushxto0(ccenter) * rspintox(inverse(drawtrans * rgpushxto0(ccenter)) * coldcenter);
|
||||||
int lalpha;
|
unsigned lightgrid = gridcolor;
|
||||||
if(d % (84/drawcell->type) == 0)
|
lightgrid -= (lightgrid & 0xFF) / 2;
|
||||||
lalpha = 0x40;
|
unsigned col = (d % (S84/drawcell->type) == 0) ? gridcolor : lightgrid;
|
||||||
else
|
queueline(d2 * C0, d2 * spin(M_PI*d/S42)* xpush(1) * C0, col, 4);
|
||||||
lalpha = 0x20;
|
|
||||||
int col = darkena(0xC0C0C0, 0, lalpha);
|
|
||||||
queueline(d2 * C0, d2 * spin(M_PI*d/42)* xpush(1) * C0, col);
|
|
||||||
for(int u=2; u<=20; u++) {
|
for(int u=2; u<=20; u++) {
|
||||||
if(u % 5 == 0) lalpha = 0x40;
|
|
||||||
else lalpha = 0x20;
|
|
||||||
queueline(
|
queueline(
|
||||||
d2 * spin(M_PI*d/42)* xpush(u/20.) * C0,
|
d2 * spin(M_PI*d/S42)* xpush(u/20.) * C0,
|
||||||
d2 * spin(M_PI*(d+1)/42)* xpush(u/20.) * C0,
|
d2 * spin(M_PI*(d+1)/S42)* xpush(u/20.) * C0,
|
||||||
darkena(0xC0C0C0, 0, lalpha));
|
(u%5==0) ? gridcolor : lightgrid, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
queueline(drawtrans*ccenter, drawtrans*coldcenter, darkena(0xC0C0C0, 0, 0x20));
|
queueline(drawtrans*ccenter, drawtrans*coldcenter, gridcolor, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawHandleKey(int sym, int uni);
|
void drawHandleKey(int sym, int uni);
|
||||||
@ -968,7 +965,10 @@ namespace mapeditor {
|
|||||||
|
|
||||||
displayfr(8, 8+fs*14, 2, vid.fsize, XLAT("t = shift"), 0xC0C0C0, 0);
|
displayfr(8, 8+fs*14, 2, vid.fsize, XLAT("t = shift"), 0xC0C0C0, 0);
|
||||||
displayfr(8, 8+fs*15, 2, vid.fsize, XLAT("y = spin"), 0xC0C0C0, 0);
|
displayfr(8, 8+fs*15, 2, vid.fsize, XLAT("y = spin"), 0xC0C0C0, 0);
|
||||||
displayButton(8, 8+fs*16, XLAT("p = paint"), 'p', 0);
|
if(mousekey == 'g')
|
||||||
|
displayButton(8, 8+fs*16, XLAT("p = grid color"), 'p', 0);
|
||||||
|
else
|
||||||
|
displayButton(8, 8+fs*16, XLAT("p = paint"), 'p', 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
#if CAP_TEXTURE
|
#if CAP_TEXTURE
|
||||||
@ -995,7 +995,7 @@ namespace mapeditor {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!mouseout()) {
|
if(!mouseout()) {
|
||||||
hyperpoint mh = inverse(drawtrans * rgpushxto0(ccenter)) * mouseh;
|
hyperpoint mh = inverse(drawtrans * rgpushxto0(ccenter) * rspintox(inverse(drawtrans * rgpushxto0(ccenter)) * coldcenter)) * mouseh;
|
||||||
displayfr(vid.xres-8, vid.yres-8-fs*6, 2, vid.fsize, XLAT("x: %1", fts4(mh[0])), 0xC0C0C0, 16);
|
displayfr(vid.xres-8, vid.yres-8-fs*6, 2, vid.fsize, XLAT("x: %1", fts4(mh[0])), 0xC0C0C0, 16);
|
||||||
displayfr(vid.xres-8, vid.yres-8-fs*5, 2, vid.fsize, XLAT("y: %1", fts4(mh[1])), 0xC0C0C0, 16);
|
displayfr(vid.xres-8, vid.yres-8-fs*5, 2, vid.fsize, XLAT("y: %1", fts4(mh[1])), 0xC0C0C0, 16);
|
||||||
displayfr(vid.xres-8, vid.yres-8-fs*4, 2, vid.fsize, XLAT("z: %1", fts4(mh[2])), 0xC0C0C0, 16);
|
displayfr(vid.xres-8, vid.yres-8-fs*4, 2, vid.fsize, XLAT("z: %1", fts4(mh[2])), 0xC0C0C0, 16);
|
||||||
@ -1284,7 +1284,12 @@ namespace mapeditor {
|
|||||||
|
|
||||||
handlePanning(sym, uni);
|
handlePanning(sym, uni);
|
||||||
|
|
||||||
if(uni == SETMOUSEKEY) mousekey = newmousekey;
|
if(uni == SETMOUSEKEY) {
|
||||||
|
if(mousekey == 'g' && newmousekey == 'g')
|
||||||
|
mousekey = '-';
|
||||||
|
else
|
||||||
|
mousekey = newmousekey;
|
||||||
|
}
|
||||||
|
|
||||||
if(uni == 'r') {
|
if(uni == 'r') {
|
||||||
pushScreen(patterns::showPattern);
|
pushScreen(patterns::showPattern);
|
||||||
@ -1293,7 +1298,24 @@ namespace mapeditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hyperpoint mh = inverse(drawtrans) * mouseh;
|
hyperpoint mh = inverse(drawtrans) * mouseh;
|
||||||
if(uni == 'g') coldcenter = ccenter, ccenter = mh;
|
|
||||||
|
if((uni == 'p' && mousekey == 'g') || (uni == 'g' && coldcenter == ccenter && ccenter == mh)) {
|
||||||
|
static unsigned grid_colors[] = {
|
||||||
|
8,
|
||||||
|
0x00000040,
|
||||||
|
0xFFFFFF40,
|
||||||
|
0xFF000040,
|
||||||
|
0x0000F040,
|
||||||
|
0x00000080,
|
||||||
|
0xFFFFFF80,
|
||||||
|
0xFF000080,
|
||||||
|
0x0000F080,
|
||||||
|
};
|
||||||
|
dialog::openColorDialog(gridcolor, grid_colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(uni == 'g' || (uni == '-' && mousekey == 'g'))
|
||||||
|
coldcenter = ccenter, ccenter = mh;
|
||||||
|
|
||||||
if(uni == 'z') {
|
if(uni == 'z') {
|
||||||
vid.scale *= 2;
|
vid.scale *= 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user