mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
new quick projection menu
This commit is contained in:
parent
31a050b79d
commit
3886b81caa
@ -2672,7 +2672,7 @@ EX void showSettings() {
|
|||||||
dialog::add_action_push(showGraphQuickKeys);
|
dialog::add_action_push(showGraphQuickKeys);
|
||||||
|
|
||||||
dialog::addItem(XLAT("models & projections"), 'p');
|
dialog::addItem(XLAT("models & projections"), 'p');
|
||||||
dialog::add_action_push(models::model_menu);
|
dialog::add_action_push(models::quick_model);
|
||||||
|
|
||||||
dialog::addItem(XLAT("colors & aura"), 'c');
|
dialog::addItem(XLAT("colors & aura"), 'c');
|
||||||
dialog::add_action_push(show_color_dialog);
|
dialog::add_action_push(show_color_dialog);
|
||||||
|
31
control.cpp
31
control.cpp
@ -1192,28 +1192,11 @@ EX bool gmodekeys(int sym, int uni) {
|
|||||||
if(NUMBERKEY == '6') { vid.grid = !vid.grid; return true; }
|
if(NUMBERKEY == '6') { vid.grid = !vid.grid; return true; }
|
||||||
if(NUMBERKEY == '7') { vid.darkhepta = !vid.darkhepta; return true; }
|
if(NUMBERKEY == '7') { vid.darkhepta = !vid.darkhepta; return true; }
|
||||||
|
|
||||||
|
if(NUMBERKEY == '1')
|
||||||
|
pushScreen(models::quick_model);
|
||||||
|
|
||||||
if(GDIM == 2) {
|
if(GDIM == 2) {
|
||||||
if(among(NUMBERKEY, '1', '2', '3') && !rug::rugged && euclid && WDIM == 2) {
|
if(NUMBERKEY == '5') { vid.wallmode += 60 + (shiftmul > 0 ? 1 : -1); vid.wallmode %= 7; }
|
||||||
pconf.xposition = pconf.yposition = 0;
|
|
||||||
ld maxs = 0;
|
|
||||||
auto& cd = current_display;
|
|
||||||
for(auto& p: gmatrix) for(int i=0; i<p.first->type; i++) {
|
|
||||||
shiftpoint h = tC0(p.second * currentmap->adj(p.first, i));
|
|
||||||
hyperpoint onscreen;
|
|
||||||
applymodel(h, onscreen);
|
|
||||||
maxs = max(maxs, onscreen[0] / cd->xsize);
|
|
||||||
maxs = max(maxs, onscreen[1] / cd->ysize);
|
|
||||||
}
|
|
||||||
pconf.alpha = 1;
|
|
||||||
pconf.scale = pconf.scale / 2 / maxs / cd->radius;
|
|
||||||
if(NUMBERKEY == '3') pconf.scale *= 2;
|
|
||||||
if(NUMBERKEY == '1') pconf.scale /= 2;
|
|
||||||
}
|
|
||||||
else if(NUMBERKEY == '1' && !rug::rugged) { pconf.alpha = 999; pconf.scale = 998; pconf.xposition = pconf.yposition = 0; }
|
|
||||||
else if(NUMBERKEY == '2' && !rug::rugged) { pconf.alpha = 1; pconf.scale = 0.4; pconf.xposition = pconf.yposition = 0; }
|
|
||||||
else if(NUMBERKEY == '3' && !rug::rugged) { pconf.alpha = 1; pconf.scale = 1; pconf.xposition = pconf.yposition = 0; }
|
|
||||||
else if(NUMBERKEY == '4' && !rug::rugged) { pconf.alpha = 0; pconf.scale = 1; pconf.xposition = pconf.yposition = 0; }
|
|
||||||
else if(NUMBERKEY == '5') { vid.wallmode += 60 + (shiftmul > 0 ? 1 : -1); vid.wallmode %= 7; }
|
|
||||||
else if((NUMBERKEY == '8' && hiliteclick) || NUMBERKEY == 508) {
|
else if((NUMBERKEY == '8' && hiliteclick) || NUMBERKEY == 508) {
|
||||||
vid.highlightmode += 60 + (shiftmul > 0 ? 1 : -1); vid.highlightmode %= 3;
|
vid.highlightmode += 60 + (shiftmul > 0 ? 1 : -1); vid.highlightmode %= 3;
|
||||||
}
|
}
|
||||||
@ -1229,11 +1212,7 @@ EX bool gmodekeys(int sym, int uni) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
auto& ysh = (WDIM == 2 ? vid.camera : vid.yshift);
|
if(NUMBERKEY == '5') { vid.wallmode = vid.wallmode == 5 ? 4 : 5; }
|
||||||
if(NUMBERKEY == '1') { ysh = 0; vid.sspeed = 0; }
|
|
||||||
else if(NUMBERKEY == '2') { ysh = 0; vid.sspeed = -10; }
|
|
||||||
else if(NUMBERKEY == '3') { ysh = 1; vid.sspeed = 0; }
|
|
||||||
else if(NUMBERKEY == '5') { vid.wallmode = vid.wallmode == 5 ? 4 : 5; }
|
|
||||||
else return false;
|
else return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
12
menus.cpp
12
menus.cpp
@ -334,17 +334,7 @@ EX void showGraphQuickKeys() {
|
|||||||
|
|
||||||
dialog::init(XLAT("quick options"));
|
dialog::init(XLAT("quick options"));
|
||||||
|
|
||||||
if(GDIM == 2) {
|
dialog::addItem("quick projection", '1');
|
||||||
dialog::addBoolItem(XLAT("orthogonal projection"), vpconf.alpha >= 500, '1');
|
|
||||||
dialog::addBoolItem(XLAT(sphere ? "stereographic projection" : euclid ? "zoomed out" : "small Poincaré model"), vpconf.alpha == 1 && vpconf.scale < 1, '2');
|
|
||||||
dialog::addBoolItem(XLAT(sphere ? "zoomed stereographic projection" : euclid ? "zoomed in" : "big Poincaré model"), vpconf.alpha == 1 && vpconf.scale >= 1, '3');
|
|
||||||
dialog::addBoolItem(XLAT((sphere || euclid) ? "gnomonic projection" : "Klein-Beltrami model"), vpconf.alpha == 0, '4');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dialog::addBoolItem(XLAT("first person perspective"), vid.yshift == 0 && vid.sspeed > -5, '1');
|
|
||||||
dialog::addBoolItem(XLAT("fixed point of view"), vid.sspeed <= -5, '2');
|
|
||||||
dialog::addBoolItem(XLAT("third person perspective"), vid.yshift > 0 && vid.sspeed > -5, '3');
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *wdmodes[7] = {"ASCII", "black", "plain", "Escher", "plain/3D", "Escher/3D", "ASCII/3D"};
|
const char *wdmodes[7] = {"ASCII", "black", "plain", "Escher", "plain/3D", "Escher/3D", "ASCII/3D"};
|
||||||
dialog::addSelItem(XLAT("wall display mode"), XLAT(wdmodes[vid.wallmode]), '5');
|
dialog::addSelItem(XLAT("wall display mode"), XLAT(wdmodes[vid.wallmode]), '5');
|
||||||
|
66
models.cpp
66
models.cpp
@ -798,6 +798,72 @@ EX namespace models {
|
|||||||
mouseovers = XLAT("see http://www.roguetemple.com/z/hyper/models.php");
|
mouseovers = XLAT("see http://www.roguetemple.com/z/hyper/models.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX void quick_model() {
|
||||||
|
cmode = sm::CENTER;
|
||||||
|
gamescreen(1);
|
||||||
|
dialog::init("models & projections");
|
||||||
|
|
||||||
|
if(WDIM == 2 && !euclid) {
|
||||||
|
dialog::addItem(XLAT(hyperbolic ? "Gans model" : "orthographic projection"), '1');
|
||||||
|
dialog::add_action([] { if(rug::rugged) rug::close(); pconf.alpha = 999; pconf.scale = 998; pconf.xposition = pconf.yposition = 0; popScreen(); });
|
||||||
|
dialog::addItem(XLAT(hyperbolic ? "Poincaré model" : "stereographic projection"), '2');
|
||||||
|
dialog::add_action([] { if(rug::rugged) rug::close(); pconf.alpha = 1; pconf.scale = 1; pconf.xposition = pconf.yposition = 0; popScreen(); });
|
||||||
|
dialog::addItem(XLAT(hyperbolic ? "Beltrami-Klein model" : "gnomonic projection"), '3');
|
||||||
|
dialog::add_action([] { if(rug::rugged) rug::close(); pconf.alpha = 0; pconf.scale = 1; pconf.xposition = pconf.yposition = 0; popScreen(); });
|
||||||
|
if(sphere) {
|
||||||
|
dialog::addItem(XLAT("stereographic projection") + " " + XLAT("(zoomed out)"), '4');
|
||||||
|
dialog::add_action([] { if(rug::rugged) rug::close(); pconf.alpha = 1; pconf.scale = 0.4; pconf.xposition = pconf.yposition = 0; popScreen(); });
|
||||||
|
}
|
||||||
|
if(hyperbolic) {
|
||||||
|
dialog::addItem(XLAT("Gans model") + " " + XLAT("(zoomed out)"), '4');
|
||||||
|
dialog::add_action([] { if(rug::rugged) rug::close(); pconf.alpha = 999; pconf.scale = 499; pconf.xposition = pconf.yposition = 0; popScreen(); });
|
||||||
|
dialog::addItem(XLAT("Hypersian rug"), 'u');
|
||||||
|
dialog::add_action([] {
|
||||||
|
if(rug::rugged) pushScreen(rug::show);
|
||||||
|
else {
|
||||||
|
pconf.alpha = 1, pconf.scale = 1; if(!rug::rugged) rug::init(); popScreen();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(WDIM == 2 && euclid) {
|
||||||
|
auto zoom_to = [] (ld s) {
|
||||||
|
pconf.xposition = pconf.yposition = 0;
|
||||||
|
ld maxs = 0;
|
||||||
|
auto& cd = current_display;
|
||||||
|
for(auto& p: gmatrix) for(int i=0; i<p.first->type; i++) {
|
||||||
|
shiftpoint h = tC0(p.second * currentmap->adj(p.first, i));
|
||||||
|
hyperpoint onscreen;
|
||||||
|
applymodel(h, onscreen);
|
||||||
|
maxs = max(maxs, onscreen[0] / cd->xsize);
|
||||||
|
maxs = max(maxs, onscreen[1] / cd->ysize);
|
||||||
|
}
|
||||||
|
pconf.alpha = 1;
|
||||||
|
pconf.scale = s * pconf.scale / 2 / maxs / cd->radius;
|
||||||
|
popScreen();
|
||||||
|
};
|
||||||
|
dialog::addItem(XLAT("zoom 2x"), '1');
|
||||||
|
dialog::add_action([zoom_to] { zoom_to(2); });
|
||||||
|
dialog::addItem(XLAT("zoom 1x"), '2');
|
||||||
|
dialog::add_action([zoom_to] { zoom_to(1); });
|
||||||
|
dialog::addItem(XLAT("zoom 0.5x"), '3');
|
||||||
|
dialog::add_action([zoom_to] { zoom_to(.5); });
|
||||||
|
}
|
||||||
|
else if(WDIM == 3) {
|
||||||
|
auto& ysh = (WDIM == 2 ? vid.camera : vid.yshift);
|
||||||
|
dialog::addItem(XLAT("first-person perspective"), '1');
|
||||||
|
dialog::add_action([&ysh] { ysh = 0; vid.sspeed = 0; popScreen(); } );
|
||||||
|
dialog::addItem(XLAT("fixed point of view"), '2');
|
||||||
|
dialog::add_action([&ysh] { ysh = 0; vid.sspeed = -10; popScreen(); } );
|
||||||
|
dialog::addItem(XLAT("third-person perspective"), '3');
|
||||||
|
dialog::add_action([&ysh] { ysh = 1; vid.sspeed = 0; popScreen(); } );
|
||||||
|
}
|
||||||
|
dialog::addItem(XLAT("advanced projections"), 'a');
|
||||||
|
dialog::add_action_push(model_menu);
|
||||||
|
dialog::addBack();
|
||||||
|
dialog::display();
|
||||||
|
}
|
||||||
|
|
||||||
#if CAP_COMMANDLINE
|
#if CAP_COMMANDLINE
|
||||||
|
|
||||||
eModel read_model(const string& ss) {
|
eModel read_model(const string& ss) {
|
||||||
|
6
rug.cpp
6
rug.cpp
@ -1222,7 +1222,7 @@ ld protractor = 0;
|
|||||||
|
|
||||||
EX bool handlekeys(int sym, int uni) {
|
EX bool handlekeys(int sym, int uni) {
|
||||||
USING_NATIVE_GEOMETRY;
|
USING_NATIVE_GEOMETRY;
|
||||||
if(NUMBERKEY == '1') {
|
if(NUMBERKEY == '2') {
|
||||||
ld bdist = 1e12;
|
ld bdist = 1e12;
|
||||||
if(finger_center)
|
if(finger_center)
|
||||||
finger_center = NULL;
|
finger_center = NULL;
|
||||||
@ -1236,7 +1236,7 @@ EX bool handlekeys(int sym, int uni) {
|
|||||||
if(renderonce) renderlate+=10;
|
if(renderonce) renderlate+=10;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(NUMBERKEY == '2') {
|
else if(NUMBERKEY == '3') {
|
||||||
#if CAP_CRYSTAL
|
#if CAP_CRYSTAL
|
||||||
if(in_crystal())
|
if(in_crystal())
|
||||||
crystal::switch_z_coordinate();
|
crystal::switch_z_coordinate();
|
||||||
@ -1245,7 +1245,7 @@ EX bool handlekeys(int sym, int uni) {
|
|||||||
rotate_view(cspin(0, 2, M_PI));
|
rotate_view(cspin(0, 2, M_PI));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(NUMBERKEY == '3') {
|
else if(NUMBERKEY == '4') {
|
||||||
#if CAP_CRYSTAL
|
#if CAP_CRYSTAL
|
||||||
if(in_crystal())
|
if(in_crystal())
|
||||||
crystal::flip_z();
|
crystal::flip_z();
|
||||||
|
Loading…
Reference in New Issue
Block a user