From 64e212cd421520b5bc0c14132979a5f0325fd440 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 7 Aug 2019 19:41:35 +0200 Subject: [PATCH] compass in Nil/Sol --- hud.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hud.cpp b/hud.cpp index c3776934..e68f44a0 100644 --- a/hud.cpp +++ b/hud.cpp @@ -358,6 +358,7 @@ void draw_radar(bool cornermode) { bool d3 = WDIM == 3; bool hyp = hyperbolic; bool sph = sphere; + bool scompass = nonisotropic; dynamicval g(geometry, gEuclid); dynamicval pm(pmodel, mdUnchanged); @@ -397,6 +398,21 @@ void draw_radar(bool cornermode) { if(d3) for(auto& r: radarpoints) { queueline(atscreenpos(cx+rad * r.h[0], cy - rad * r.h[2] * si + rad * r.h[1] * co, 0)*C0, atscreenpos(cx+rad*r.h[0], cy - rad*r.h[2] * si, 0)*C0, r.line, -1); } + + if(scompass) { + auto compassdir = [&] (char dirname, hyperpoint h) { + using namespace hyperpoint_vec; + h = nisot::local_perspective * h * .8; + queueline(atscreenpos(cx+rad * h[0], cy - rad * h[2] * si + rad * h[1] * co, 0)*C0, atscreenpos(cx+rad*h[0], cy - rad*h[2] * si, 0)*C0, 0x80400020, -1); + displaychr(int(cx+rad * h[0]), int(cy - rad * h[2] * si + rad * h[1] * co), 0, 8, dirname, 0x804000); + }; + compassdir('E', point3(+1, 0, 0)); + compassdir('N', point3(0, +1, 0)); + compassdir('W', point3(-1, 0, 0)); + compassdir('S', point3(0, -1, 0)); + compassdir('U', point3(0, 0,+1)); + compassdir('D', point3(0, 0,-1)); + } auto locate = [&] (hyperpoint h) { if(sph)