diff --git a/rogueviz/presentation.cpp b/rogueviz/presentation.cpp index 4f3f71d9..07b15d03 100644 --- a/rogueviz/presentation.cpp +++ b/rogueviz/presentation.cpp @@ -76,6 +76,11 @@ void no_other_hud(presmode mode) { clearMessages(); } +void replace_hud(presmode mode, reaction_t f) { + add_temporary_hook(mode, hooks_prestats, 300, [f] { f(); return true; }); + clearMessages(); + } + /** disable all the HyperRogue game stuff */ void non_game_slide(presmode mode) { if(mode == pmStart) { @@ -309,6 +314,47 @@ void dialog_may_latex(string latex, string normal, color_t col, int size, flagty } } +map finf_of; +void latex_in_space(const shiftmatrix& V, ld scale, string s, color_t col, flagtype flags) { + string fn = gen_latex(pmStart, s, 600, flags); + if(!textures.count(fn)) { + gen_latex(pmStartAll, s, 600, flags); + auto& tex = textures[fn]; + tex.original = true; + tex.twidth = 4096; + println(hlog, "rt = ", tex.readtexture(fn)); + if(!(flags & LATEX_COLOR)) + for(int y=0; y= tex.base_y + tex.stry || x <= tex.base_x || x >= tex.base_x + tex.strx) { pix = 0; continue; } + int dark = 255 - part(pix, 1); + pix = 0xFFFFFF + (dark << 24); + } + println(hlog, "gl = ", tex.loadTextureGL()); + println(hlog, "fn is ", fn); + } + auto& finf = finf_of[fn]; + auto& tex = textures[fn]; + finf.texture_id = tex.textureid; + finf.tvertices.clear(); + static vector rtver(4); + ld tx = tex.tx; + ld ty = tex.ty; + for(int i=0; i<6; i++) { + ld cx[6] = {1,0,0,1,1,0}; + ld cy[6] = {1,1,0,1,0,0}; + finf.tvertices.push_back(glhr::makevertex((tex.base_x + (cx[i] ? tex.strx : 0.)) / tex.twidth, (tex.base_y + (cy[i] ? tex.stry : 0.)) / tex.theight, 0)); + curvedata.push_back(glhr::pointtogl(point31((cx[i]*2-1) * tx * scale, (cy[i]*2-1) * ty * scale, 0))); + } + auto &res = queuetable(V, curvedata, isize(curvedata)-curvestart, col, col, PPR::LINE); + res.offset = curvestart; + res.offset_texture = 0; + res.tinf = &finf; + res.flags |= POLY_TRIANGLES; + curvestart = isize(curvedata); + } + int video_start = 0; void read_all(int fd, void *buf, int cnt) { diff --git a/rogueviz/rogueviz.h b/rogueviz/rogueviz.h index e3d2e487..d8462297 100644 --- a/rogueviz/rogueviz.h +++ b/rogueviz/rogueviz.h @@ -257,6 +257,7 @@ function roguevizslide_action(char c, const T& t, const U& act) void add_stat(presmode mode, const bool_reaction_t& stat); void compare_projections(presmode mode, eModel a, eModel b); void no_other_hud(presmode mode); + void replace_hud(presmode mode, reaction_t f); void non_game_slide(presmode mode); void non_game_slide_scroll(presmode mode); void white_screen(presmode mode, color_t col = 0xFFFFFFFF); @@ -274,6 +275,7 @@ function roguevizslide_action(char c, const T& t, const U& act) void dialog_may_latex(string latex, string normal, color_t col = dialog::dialogcolor, int size = 100, flagtype flag = 0); void uses_game(presmode mode, string name, reaction_t launcher, reaction_t restore); void latex_slide(presmode mode, string s, flagtype flags = 0, int size = 100); + void latex_in_space(const shiftmatrix& V, ld scale, string s, color_t col, flagtype flags); inline purehookset hooks_latex_slide;