mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-22 23:17:04 +00:00
WASD keys and VI keys as help for keyboard users options
This commit is contained in:
parent
f9c6638b95
commit
9c676d082a
@ -437,10 +437,9 @@ bool handleTune(int sym, int uni) {
|
||||
|
||||
EX purehookset hooks_fixticks;
|
||||
|
||||
array<int, 8>
|
||||
keys_vi = {'l', 'n', 'j', 'b', 'h', 'y', 'k', 'u'},
|
||||
keys_wasd = {'d', 'c', 'x', 'z', 'a', 'q', 'w', 'e'},
|
||||
keys_numpad = {SDLK_KP6, SDLK_KP3, SDLK_KP2, SDLK_KP1, SDLK_KP4, SDLK_KP7, SDLK_KP8, SDLK_KP9};
|
||||
EX array<int, 8> keys_vi = {'l', 'n', 'j', 'b', 'h', 'y', 'k', 'u'};
|
||||
EX array<int, 8> keys_wasd = {'d', 'c', 'x', 'z', 'a', 'q', 'w', 'e'};
|
||||
EX array<int, 8> keys_numpad = {SDLK_KP6, SDLK_KP3, SDLK_KP2, SDLK_KP1, SDLK_KP4, SDLK_KP7, SDLK_KP8, SDLK_KP9};
|
||||
|
||||
EX void handleKeyNormal(int sym, int uni) {
|
||||
|
||||
|
29
graph.cpp
29
graph.cpp
@ -3116,6 +3116,11 @@ void draw_movement_arrows(cell *c, const transmatrix& V, int df) {
|
||||
|
||||
if(viewdists) return;
|
||||
|
||||
string keylist = "";
|
||||
const ld keysize = .6;
|
||||
|
||||
color_t col = getcs().uicolor;
|
||||
|
||||
for(int d=0; d<8; d++) {
|
||||
|
||||
movedir md = vectodir(spin(-d * M_PI/4) * smalltangent());
|
||||
@ -3125,19 +3130,33 @@ void draw_movement_arrows(cell *c, const transmatrix& V, int df) {
|
||||
if(xc.at == c) {
|
||||
transmatrix fixrot = sphereflip * rgpushxto0(sphereflip * tC0(V));
|
||||
// make it more transparent
|
||||
color_t col = getcs().uicolor;
|
||||
col -= (col & 0xFF) >> 1;
|
||||
poly_outline = OUTLINE_DEFAULT;
|
||||
|
||||
char key = 0;
|
||||
if(vid.axes >= 5)
|
||||
key = (vid.axes == 5 ? keys_wasd : keys_vi)[d];
|
||||
|
||||
if(vid.axes >= 5) keylist += key;
|
||||
else
|
||||
queuepoly(fixrot * spin(-d * M_PI/4), cgi.shArrow, col);
|
||||
|
||||
if((c->type & 1) && (isStunnable(c->monst) || isPushable(c->wall))) {
|
||||
transmatrix Centered = rgpushxto0(tC0(cwtV));
|
||||
int sd = md.subdir;
|
||||
queuepoly(inverse(Centered) * rgpushxto0(Centered * tC0(V)) * rspintox(Centered*tC0(V)) * spin(-sd * M_PI/S7) * xpush(0.2), cgi.shArrow, col);
|
||||
|
||||
transmatrix T = inverse(Centered) * rgpushxto0(Centered * tC0(V)) * rspintox(Centered*tC0(V)) * spin(-sd * M_PI/S7) * xpush(0.2);
|
||||
|
||||
if(vid.axes >= 5)
|
||||
queuestr(T, keysize, s0 + key, col >> 8, 1);
|
||||
|
||||
else
|
||||
queuepoly(T, cgi.shArrow, col);
|
||||
}
|
||||
else if(!confusingGeometry()) break;
|
||||
}
|
||||
}
|
||||
if(keylist != "") queuestr(V, keysize, keylist, col >> 8, 1);
|
||||
}
|
||||
|
||||
EX int celldistAltPlus(cell *c) { return 1000000 + celldistAlt(c); }
|
||||
@ -4168,12 +4187,12 @@ EX void drawMarkers() {
|
||||
|
||||
// process mouse
|
||||
#if CAP_SHAPES
|
||||
if((vid.axes == 4 || (vid.axes == 1 && !mousing)) && !shmup::on && GDIM == 2) {
|
||||
if((vid.axes >= 4 || (vid.axes == 1 && !mousing)) && !shmup::on && GDIM == 2) {
|
||||
if(multi::players == 1) {
|
||||
forCellIdAll(c2, d, cwt.at) if(gmatrix.count(cwt.at)) draw_movement_arrows(c2, gmatrix[cwt.at] * currentmap->adj(cwt.at, d), d);
|
||||
}
|
||||
else if(multi::players > 1) for(int p=0; p<multi::players; p++) {
|
||||
if(multi::playerActive(p) && (vid.axes == 4 || !drawstaratvec(multi::mdx[p], multi::mdy[p])))
|
||||
if(multi::playerActive(p) && (vid.axes >= 4 || !drawstaratvec(multi::mdx[p], multi::mdy[p])))
|
||||
forCellIdAll(c2, d, multi::player[p].at) if(gmatrix.count(cwt.at)) {
|
||||
multi::cpid = p;
|
||||
dynamicval<transmatrix> ttm(cwtV, multi::whereis[p]);
|
||||
@ -4715,7 +4734,7 @@ EX void drawmovestar(double dx, double dy) {
|
||||
int rax = vid.axes;
|
||||
if(rax == 1) rax = drawstaratvec(dx, dy) ? 2 : 0;
|
||||
|
||||
if(rax == 0 || vid.axes == 4) return;
|
||||
if(rax == 0 || vid.axes >= 4) return;
|
||||
|
||||
int starcol = getcs().uicolor;
|
||||
ignore(starcol);
|
||||
|
@ -407,9 +407,9 @@ struct shmup_configurer {
|
||||
dialog::addItem(XLAT("configure player 5"), '5');
|
||||
else if(!shmup::on && !multi::alwaysuse) {
|
||||
if(GDIM == 2) {
|
||||
const char *axmodes[5] = {"OFF", "auto", "light", "heavy", "arrows"};
|
||||
const char *axmodes[7] = {"OFF", "auto", "light", "heavy", "arrows", "WASD keys", "VI keys"};
|
||||
dialog::addSelItem(XLAT("help for keyboard users"), XLAT(axmodes[vid.axes]), 'h');
|
||||
dialog::add_action([] {vid.axes += 60 + (shiftmul > 0 ? 1 : -1); vid.axes %= 5; } );
|
||||
dialog::add_action([] {vid.axes += 70 + (shiftmul > 0 ? 1 : -1); vid.axes %= 7; } );
|
||||
}
|
||||
else dialog::addBreak(100);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user