1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-12-16 19:18:05 +00:00

four digits shown in pen width

This commit is contained in:
Zeno Rogue
2017-12-22 21:58:09 +01:00
parent dd108cde6b
commit 04cc9300bf
2 changed files with 26 additions and 3 deletions

View File

@@ -16,6 +16,29 @@ string ftssmart(ld x) {
return buf;
}
/*
string fts_smartdisplay(ld x, int maxdisplay) {
string rv;
if(x > 1e9 || x < -1e9) retrun fts(x);
if(x<0) { rv = "-"; x = -x; }
int i = int(x);
rv += its(i);
x -= i;
bool nonzero = i;
if(x == 0) return rv;
if(x < 1e-9 && nonzero) return rv;
rv += ".";
while(maxdisplay > 0) {
x *= 10;
rv += '0' + int(x);
if(int(x)) nonzero = true;
x -= int(x);
if(x == 0) return rv;
if(x < 1e-9 && nonzero) return rv;
maxdisplay--;
}
} */
string cts(char c) { char buf[8]; buf[0] = c; buf[1] = 0; return buf; }
string llts(long long i) {
// sprintf does not work on Windows IIRC