mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 09:00:34 +00:00
number editor now accepts hex numbers, and uses hex as default when editing Tortoises
This commit is contained in:
parent
35043b5528
commit
730e7b5b99
10
dialogs.cpp
10
dialogs.cpp
@ -600,7 +600,10 @@ namespace dialog {
|
||||
else return int(x-.5);
|
||||
}
|
||||
|
||||
string disp(ld x) { if(ne.intval) return its(ldtoint(x)); else if(ne.vmax-ne.vmin < 1) return fts4(x); else return fts(x); }
|
||||
string disp(ld x) {
|
||||
if(dialogflags & sm::HEXEDIT) return "0x" + itsh(x);
|
||||
else if(ne.intval) return its(ldtoint(x));
|
||||
else if(ne.vmax-ne.vmin < 1) return fts4(x); else return fts(x); }
|
||||
|
||||
reaction_t reaction;
|
||||
reaction_t reaction_final;
|
||||
@ -615,6 +618,11 @@ namespace dialog {
|
||||
anims::deanimate(*ne.editwhat);
|
||||
}
|
||||
|
||||
void use_hexeditor() {
|
||||
dialogflags |= sm::HEXEDIT;
|
||||
ne.s = disp(*ne.editwhat);
|
||||
}
|
||||
|
||||
void apply_edit() {
|
||||
exp_parser ep;
|
||||
ep.s = ne.s;
|
||||
|
2
hyper.h
2
hyper.h
@ -1822,6 +1822,7 @@ namespace dialog {
|
||||
|
||||
void editNumber(ld& x, ld vmin, ld vmax, ld step, ld dft, string title, string help);
|
||||
void editNumber(int& x, int vmin, int vmax, int step, int dft, string title, string help);
|
||||
void use_hexeditor();
|
||||
inline void scaleLog() { ne.sc = logarithmic; }
|
||||
inline void scaleSinh() { ne.sc = asinhic; }
|
||||
void bound_low(ld val);
|
||||
@ -2287,6 +2288,7 @@ namespace sm {
|
||||
static const int MAYDARK = 16384;
|
||||
static const int DIALOG_STRICT_X = 32768; // do not interpret dialog clicks outside of the X region
|
||||
static const int EXPANSION = (1<<16);
|
||||
static const int HEXEDIT = (1<<17);
|
||||
};
|
||||
|
||||
namespace linepatterns {
|
||||
|
1
util.cpp
1
util.cpp
@ -221,6 +221,7 @@ cld exp_parser::parse(int prio) {
|
||||
else if(number == "") at = -1;
|
||||
else if(number == "s") res = ticks / 1000.;
|
||||
else if(number == "ms") res = ticks;
|
||||
else if(number[0] == '0' && number[1] == 'x') res = strtoll(number.c_str()+2, NULL, 16);
|
||||
else if(number == "mousex") res = mousex;
|
||||
else if(number == "mousey") res = mousey;
|
||||
else if(number == "mousez") res = cld(mousex - current_display->xcenter, mousey - current_display->ycenter) / cld(current_display->radius, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user