mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-27 03:47:40 +00:00 
			
		
		
		
	rogueviz:: presentation improvements
This commit is contained in:
		| @@ -83,6 +83,9 @@ void non_game_slide(presmode mode) { | ||||
|     tour::slide_backup(mapeditor::drawplayer, false); | ||||
|     tour::slide_backup(no_find_player, true); | ||||
|     tour::slide_backup(playermoved, false); | ||||
|     tour::slide_backup(vid.axes, 0); | ||||
|     tour::slide_backup(vid.drawmousecircle, false); | ||||
|     tour::slide_backup(draw_centerover, false); | ||||
|     } | ||||
|   no_other_hud(mode); | ||||
|   } | ||||
| @@ -122,7 +125,7 @@ void slide_error(presmode mode, string s) { | ||||
|  | ||||
| map<string, texture::texture_data> textures; | ||||
|  | ||||
| void draw_texture(texture::texture_data& tex) { | ||||
| void draw_texture(texture::texture_data& tex, ld dx, ld dy, ld scale1) { | ||||
|   static vector<glhr::textured_vertex> rtver(4); | ||||
|    | ||||
|   int fs = inHighQual ? 0 : 2 * vid.fsize; | ||||
| @@ -139,8 +142,8 @@ void draw_texture(texture::texture_data& tex) { | ||||
|     ld cy[4] = {1,1,0,0}; | ||||
|     rtver[i].texture[0] = (tex.base_x + (cx[i] ? tex.strx : 0.)) / tex.twidth; | ||||
|     rtver[i].texture[1] = (tex.base_y + (cy[i] ? tex.stry : 0.)) / tex.theight; | ||||
|     rtver[i].coords[0] = (cx[i]*2-1) * scale * tx; | ||||
|     rtver[i].coords[1] = (cy[i]*2-1) * scale * ty; | ||||
|     rtver[i].coords[0] = (cx[i]*2-1) * scale * tx * scale1 + dx; | ||||
|     rtver[i].coords[1] = (cy[i]*2-1) * scale * ty * scale1 + dy; | ||||
|     rtver[i].coords[2] = 1; | ||||
|     rtver[i].coords[3] = 1; | ||||
|     } | ||||
| @@ -155,19 +158,25 @@ void draw_texture(texture::texture_data& tex) { | ||||
|   glhr::set_depthtest(false); | ||||
|   glDrawArrays(GL_TRIANGLE_FAN, 0, 4); | ||||
|   } | ||||
|  | ||||
| void sub_picture(string s, flagtype flags, ld dx, ld dy, ld scale) { | ||||
|   if(!textures.count(s)) { | ||||
|     auto& tex = textures[s]; | ||||
|     println(hlog, "rt = ", tex.readtexture(s)); | ||||
|     println(hlog, "gl = ", tex.loadTextureGL()); | ||||
|     } | ||||
|   auto& tex = textures[s]; | ||||
|   flat_model_enabler fme; | ||||
|   draw_texture(tex, dx, dy, scale); | ||||
|   } | ||||
|    | ||||
| void show_picture(presmode mode, string s) { | ||||
| void show_picture(presmode mode, string s, flagtype flags) { | ||||
|   if(mode == pmStartAll) { | ||||
|     auto& tex = textures[s]; | ||||
|     println(hlog, "rt = ", tex.readtexture(s)); | ||||
|     println(hlog, "gl = ", tex.loadTextureGL()); | ||||
|     } | ||||
|   add_stat(mode, [s] { | ||||
|     auto& tex = textures[s]; | ||||
|     flat_model_enabler fme;     | ||||
|     draw_texture(tex); | ||||
|     return false; | ||||
|     }); | ||||
|   add_stat(mode, [s, flags] { sub_picture(s, flags); return false; }); | ||||
|   } | ||||
|  | ||||
| string latex_packages = | ||||
| @@ -177,6 +186,8 @@ string latex_packages = | ||||
|   "\\usepackage{varwidth}\n" | ||||
|   "\\usepackage{amsfonts}\n" | ||||
|   "\\usepackage{enumitem}\n" | ||||
|   "\\usepackage[utf8]{inputenc}\n" | ||||
|   "\\usepackage[T1]{fontenc}\n" | ||||
|   "\\usepackage{color}\n" | ||||
|   "\\usepackage{graphicx}\n" | ||||
|   "\\definecolor{remph}{rgb}{0,0.5,0}\n" | ||||
| @@ -549,10 +560,11 @@ void latex_slide(presmode mode, string s, flagtype flags, int size) { | ||||
|     tour::slide_backup(no_find_player, true); | ||||
|     if(flags & sm::SIDE) { | ||||
|       cmode |= sm::SIDE; | ||||
|       dynamicval<bool> db(nomap, false); | ||||
|       dynamicval<color_t> dc(modelcolor, 0xFF); | ||||
|       dynamicval<bool> db(nomap, (flags & sm::NOSCR)); | ||||
|       dynamicval<color_t> dc(modelcolor, nomap ? 0 : 0xFF); | ||||
|       dynamicval<color_t> dc2(bordcolor, 0); | ||||
|       gamescreen(); | ||||
|       callhooks(hooks_latex_slide); | ||||
|       } | ||||
|     else | ||||
|       gamescreen(); | ||||
|   | ||||
| @@ -124,6 +124,12 @@ namespace rogueviz { | ||||
|     cleanup.push_back(del); | ||||
|     } | ||||
|  | ||||
|   template<class T> void rv_change(T& variable, const T& value) { | ||||
|     T backup = variable; | ||||
|     variable = value; | ||||
|     on_cleanup_or_next([backup, &variable] { variable = backup; }); | ||||
|     } | ||||
|  | ||||
|   template<class T, class U> void rv_hook(hookset<T>& m, int prio, U&& hook) { | ||||
|     int p = addHook(m, prio, hook); | ||||
|     auto del = [&m, p] {  | ||||
| @@ -157,9 +163,11 @@ namespace rogueviz { | ||||
|     inline hookset<void(string, vector<slide>&)> hooks_build_rvtour; | ||||
|     slide *gen_rvtour(); | ||||
|     #if CAP_TEXTURE | ||||
|     void draw_texture(texture::texture_data& tex); | ||||
|     void draw_texture(texture::texture_data& tex, ld dx = 0, ld dy = 0, ld scale = 1); | ||||
|     #endif | ||||
|  | ||||
|     extern map<string, texture::texture_data> textures; | ||||
|  | ||||
| template<class T, class U> function<void(presmode)> roguevizslide(char c, const T& t, const U& f) { | ||||
|   return [c,t,f] (presmode mode) { | ||||
|     f(mode); | ||||
| @@ -233,7 +241,8 @@ function<void(presmode)> roguevizslide_action(char c, const T& t, const U& act) | ||||
|   void non_game_slide_scroll(presmode mode); | ||||
|   void white_screen(presmode mode, color_t col = 0xFFFFFFFF); | ||||
|   void empty_screen(presmode mode, color_t col = 0xFFFFFFFF); | ||||
|   void show_picture(presmode mode, string s);     | ||||
|   void show_picture(presmode mode, string s, flagtype flags = 0); | ||||
|   void sub_picture(string s, flagtype flags = 0, ld dx = 0, ld dy = 0, ld scale = 1); | ||||
|   void show_animation(presmode mode, string s, int sx, int sy, int frames, int fps); | ||||
|   void use_angledir(presmode mode, bool reset); | ||||
|   void slide_error(presmode mode, string s); | ||||
| @@ -245,6 +254,8 @@ function<void(presmode)> 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); | ||||
|    | ||||
|   inline purehookset hooks_latex_slide; | ||||
|  | ||||
|   inline ld angle = 0; | ||||
|   inline int dir = -1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue