1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-05-08 02:04:06 +00:00

dialog:: sm::NARROW_LINES

This commit is contained in:
Zeno Rogue 2022-10-21 19:03:03 +02:00
parent caa4ac5bb4
commit 8294246449
3 changed files with 10 additions and 5 deletions

View File

@ -380,7 +380,7 @@ EX namespace dialog {
return y; return y;
} }
EX int tothei, dialogwidth, dfsize, dfspace, leftwidth, rightwidth, innerwidth, itemx, keyx, valuex, top, list_starts_at, list_ends_at, list_full_size, list_actual_size, list_skip, fwidth; EX int tothei, dialogwidth, dfsize, dfspace, odfspace, leftwidth, rightwidth, innerwidth, itemx, keyx, valuex, top, list_starts_at, list_ends_at, list_full_size, list_actual_size, list_skip, fwidth;
EX string highlight_text; EX string highlight_text;
EX int highlight_key; EX int highlight_key;
@ -404,7 +404,7 @@ EX namespace dialog {
list_starts_at = tothei; list_starts_at = tothei;
else if(items[i].type == diListEnd) { else if(items[i].type == diListEnd) {
list_full_size = tothei - list_starts_at; list_full_size = tothei - list_starts_at;
list_actual_size = min(dfspace * list_size_max / 100, max(dfsize * list_size_min / 100, list_full_size)); list_actual_size = min(odfspace * list_size_max / 100, max(odfspace * list_size_min / 100, list_full_size));
if(list_full_size < list_actual_size) list_full_size = list_actual_size; if(list_full_size < list_actual_size) list_full_size = list_actual_size;
tothei = list_ends_at = list_starts_at + list_actual_size; tothei = list_ends_at = list_starts_at + list_actual_size;
} }
@ -552,6 +552,7 @@ EX namespace dialog {
dfsize *= 3; dfsize *= 3;
#endif #endif
dfspace = dfsize * 5/4; dfspace = dfsize * 5/4;
odfspace = dfspace;
dcenter = vid.xres/2; dcenter = vid.xres/2;
dwidth = vid.xres; dwidth = vid.xres;
@ -567,13 +568,16 @@ EX namespace dialog {
int adfsize = int(dfsize * sqrt((vid.yres - 5. * vid.fsize) / tothei)); int adfsize = int(dfsize * sqrt((vid.yres - 5. * vid.fsize) / tothei));
if(adfsize < dfsize-1) dfsize = adfsize + 1; if(adfsize < dfsize-1) dfsize = adfsize + 1;
else dfsize--; else dfsize--;
dfspace = dfsize * 5/4; odfspace = dfspace = dfsize * 5/4;
measure(); measure();
} }
while(dialogwidth > dwidth) { while(dialogwidth > dwidth) {
int adfsize = int(dfsize * sqrt(vid.xres * 1. / dialogwidth)); int adfsize = int(dfsize * sqrt(vid.xres * 1. / dialogwidth));
if(adfsize < dfsize-1) dfsize = adfsize + 1; if(adfsize < dfsize-1) dfsize = adfsize + 1;
else dfsize--; // keep dfspace else dfsize--;
// usually we want to keep dfspace, but with NARROW_LINES, just odfspace
if(cmode & sm::NARROW_LINES)
dfspace = (dfsize + 3) * 5 / 4;
measure(); measure();
} }

View File

@ -711,7 +711,7 @@ void expansion_analyzer::view_distances_dialog() {
dynamicval<color_t> dv(distcolors[0], forecolor); dynamicval<color_t> dv(distcolors[0], forecolor);
dialog::init(""); dialog::init("");
cmode |= sm::DIALOG_STRICT_X | sm::EXPANSION | sm::AUTO_VALUES; cmode |= sm::DIALOG_STRICT_X | sm::EXPANSION | sm::AUTO_VALUES | sm::NARROW_LINES;
int maxlen = last_distance; int maxlen = last_distance;
vector<bignum> qty(maxlen); vector<bignum> qty(maxlen);

View File

@ -5689,6 +5689,7 @@ namespace sm {
static const int DARKEN = (1<<21); // darken the game background static const int DARKEN = (1<<21); // darken the game background
static const int NOSCR = (1<<22); // do not show the game background static const int NOSCR = (1<<22); // do not show the game background
static const int AUTO_VALUES = (1<<23); // automatic place for values static const int AUTO_VALUES = (1<<23); // automatic place for values
static const int NARROW_LINES = (1<<24); // do make the lines narrower if we needed to reduce width
} }
#endif #endif