mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-16 16:12:48 +00:00
sm::AUTO_VALUES to automatically assign option widths
This commit is contained in:
parent
5c507e58fd
commit
caa4ac5bb4
@ -394,6 +394,11 @@ EX namespace dialog {
|
|||||||
innerwidth = 0;
|
innerwidth = 0;
|
||||||
int N = items.size();
|
int N = items.size();
|
||||||
list_starts_at = list_ends_at = list_actual_size = 0;
|
list_starts_at = list_ends_at = list_actual_size = 0;
|
||||||
|
|
||||||
|
bool autoval = cmode & sm::AUTO_VALUES;
|
||||||
|
rightwidth = 0;
|
||||||
|
if(!autoval) rightwidth = textwidth(dfsize, "MMMMMMMM") + dfsize/2;
|
||||||
|
|
||||||
for(int i=0; i<N; i++) {
|
for(int i=0; i<N; i++) {
|
||||||
if(items[i].type == diListStart)
|
if(items[i].type == diListStart)
|
||||||
list_starts_at = tothei;
|
list_starts_at = tothei;
|
||||||
@ -409,13 +414,14 @@ EX namespace dialog {
|
|||||||
tothei += dfspace * items[i].scale / 100;
|
tothei += dfspace * items[i].scale / 100;
|
||||||
if(among(items[i].type, diItem, diColorItem))
|
if(among(items[i].type, diItem, diColorItem))
|
||||||
innerwidth = max(innerwidth, textwidth(dfsize * items[i].scale / 100, items[i].body));
|
innerwidth = max(innerwidth, textwidth(dfsize * items[i].scale / 100, items[i].body));
|
||||||
|
if(among(items[i].type, diItem))
|
||||||
|
rightwidth = max(rightwidth, textwidth(dfsize * items[i].scale / 100, items[i].value) + dfsize);
|
||||||
if(items[i].type == diTitle || items[i].type == diInfo || items[i].type == diBigItem)
|
if(items[i].type == diTitle || items[i].type == diInfo || items[i].type == diBigItem)
|
||||||
dialogwidth = max(dialogwidth, textwidth(dfsize * items[i].scale / 100, items[i].body) * 10/9);
|
dialogwidth = max(dialogwidth, textwidth(dfsize * items[i].scale / 100, items[i].body) * 10/9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
leftwidth = ISMOBILE ? 0 : textwidth(dfsize, "MMMMM") + dfsize/2;
|
leftwidth = ISMOBILE ? 0 : textwidth(dfsize, "MMMMM") + dfsize/2;
|
||||||
rightwidth = textwidth(dfsize, "MMMMMMMM") + dfsize/2;
|
|
||||||
|
|
||||||
fwidth = innerwidth + leftwidth + rightwidth;
|
fwidth = innerwidth + leftwidth + rightwidth;
|
||||||
if(list_actual_size) fwidth += dfsize;
|
if(list_actual_size) fwidth += dfsize;
|
||||||
|
@ -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;
|
cmode |= sm::DIALOG_STRICT_X | sm::EXPANSION | sm::AUTO_VALUES;
|
||||||
|
|
||||||
int maxlen = last_distance;
|
int maxlen = last_distance;
|
||||||
vector<bignum> qty(maxlen);
|
vector<bignum> qty(maxlen);
|
||||||
@ -753,9 +753,12 @@ void expansion_analyzer::view_distances_dialog() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog::start_list(1600, 1600);
|
dialog::start_list(1600, 1600, 'a');
|
||||||
for(int i=0; i<maxlen; i++) if(!qty[i].digits.empty())
|
for(int i=0; i<maxlen; i++) if(!qty[i].digits.empty()) {
|
||||||
dialog::addInfo(its(i) + ": " + qty[i].get_str(100), distcolors[i]);
|
dialog::addSelItem(qty[i].get_str(100), " " + its(i), dialog::list_fake_key);
|
||||||
|
auto& last = dialog::lastItem();
|
||||||
|
last.color = last.colorv = distcolors[i];
|
||||||
|
}
|
||||||
dialog::end_list();
|
dialog::end_list();
|
||||||
|
|
||||||
if(sizes_known() || bt::in()) {
|
if(sizes_known() || bt::in()) {
|
||||||
|
@ -5688,6 +5688,7 @@ namespace sm {
|
|||||||
static const int PANNING = (1<<20); // smooth scrolling works
|
static const int PANNING = (1<<20); // smooth scrolling works
|
||||||
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
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user