zenorogue / hyperrogue

A SDL roguelike in a non-euclidean world
GNU General Public License v2.0
554 stars 66 forks source link

Make option to show turns on the main screen. #375

Closed jlmjlm closed 2 months ago

jlmjlm commented 2 months ago

"Liberal" version that shows the turncount unguarded by nomenukey and ISMOBILE. Hopefully this means that it'll display properly on mobile, outside the map region's "DRAG" area. But this display mode is only used by the mobile builds which I don't have toolchains for, so can't test it. :(

zenorogue commented 2 months ago

Thanks!

For testing the mobile-style interface, there is fake-mobile, compiled with e.g. g++ fake-mobile.cpp -o fake-mobile -I/usr/include/SDL -lSDL -lSDL_gfx -lGL -lSDL_ttf -lz

jlmjlm commented 2 months ago

Neat! Unfortunately, I persistently get an immediate segfault when I try to run fake-mobile:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7e58740 in TTF_SizeUNICODE () from /lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0
(gdb) bt
#0  0x00007ffff7e58740 in TTF_SizeUNICODE ()
   from /lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0
#1  0x00007ffff7e58af5 in TTF_SizeUTF8 ()
   from /lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0
#2  0x0000555555a9b982 in hr::textwidth(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#3  0x0000555555901041 in hr::displayfr(int, int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, int) ()
#4  0x00005555559d5216 in hr::displayabutton(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int) ()
#5  0x0000555555a40f3f in hr::gamescreen() ()
#6  0x0000555555a41897 in hr::normalscreen() ()
#7  0x0000555555ec19dd in hr::function_state<void (*)(), void>::call() const ()
#8  0x0000555555be36cb in hr::function<void ()>::operator()() const ()
#9  0x0000555555a41e71 in hr::drawscreen() ()
#10 0x0000555555a9a5e5 in hr::mobile_draw(int) ()
#11 0x0000555555a9bbc9 in main ()

This persists even if I change the guard on the turncount condition to show_turns && false, which makes sense because gamescreen() is called shortly before the turncount would be displayed.

zenorogue commented 1 month ago

(For the record: this was caused by incorrect font file.)

I am going to replace this with a programmable display, so the player can choose the parameter to be displayed there.