mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-23 06:20:09 +00:00
rogueviz:: presentation improvements
This commit is contained in:
parent
40d3c39cf1
commit
c49b320330
@ -83,6 +83,9 @@ void non_game_slide(presmode mode) {
|
|||||||
tour::slide_backup(mapeditor::drawplayer, false);
|
tour::slide_backup(mapeditor::drawplayer, false);
|
||||||
tour::slide_backup(no_find_player, true);
|
tour::slide_backup(no_find_player, true);
|
||||||
tour::slide_backup(playermoved, false);
|
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);
|
no_other_hud(mode);
|
||||||
}
|
}
|
||||||
@ -122,7 +125,7 @@ void slide_error(presmode mode, string s) {
|
|||||||
|
|
||||||
map<string, texture::texture_data> textures;
|
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);
|
static vector<glhr::textured_vertex> rtver(4);
|
||||||
|
|
||||||
int fs = inHighQual ? 0 : 2 * vid.fsize;
|
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};
|
ld cy[4] = {1,1,0,0};
|
||||||
rtver[i].texture[0] = (tex.base_x + (cx[i] ? tex.strx : 0.)) / tex.twidth;
|
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].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[0] = (cx[i]*2-1) * scale * tx * scale1 + dx;
|
||||||
rtver[i].coords[1] = (cy[i]*2-1) * scale * ty;
|
rtver[i].coords[1] = (cy[i]*2-1) * scale * ty * scale1 + dy;
|
||||||
rtver[i].coords[2] = 1;
|
rtver[i].coords[2] = 1;
|
||||||
rtver[i].coords[3] = 1;
|
rtver[i].coords[3] = 1;
|
||||||
}
|
}
|
||||||
@ -156,18 +159,24 @@ void draw_texture(texture::texture_data& tex) {
|
|||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_picture(presmode mode, string s) {
|
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, flagtype flags) {
|
||||||
if(mode == pmStartAll) {
|
if(mode == pmStartAll) {
|
||||||
auto& tex = textures[s];
|
auto& tex = textures[s];
|
||||||
println(hlog, "rt = ", tex.readtexture(s));
|
println(hlog, "rt = ", tex.readtexture(s));
|
||||||
println(hlog, "gl = ", tex.loadTextureGL());
|
println(hlog, "gl = ", tex.loadTextureGL());
|
||||||
}
|
}
|
||||||
add_stat(mode, [s] {
|
add_stat(mode, [s, flags] { sub_picture(s, flags); return false; });
|
||||||
auto& tex = textures[s];
|
|
||||||
flat_model_enabler fme;
|
|
||||||
draw_texture(tex);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string latex_packages =
|
string latex_packages =
|
||||||
@ -177,6 +186,8 @@ string latex_packages =
|
|||||||
"\\usepackage{varwidth}\n"
|
"\\usepackage{varwidth}\n"
|
||||||
"\\usepackage{amsfonts}\n"
|
"\\usepackage{amsfonts}\n"
|
||||||
"\\usepackage{enumitem}\n"
|
"\\usepackage{enumitem}\n"
|
||||||
|
"\\usepackage[utf8]{inputenc}\n"
|
||||||
|
"\\usepackage[T1]{fontenc}\n"
|
||||||
"\\usepackage{color}\n"
|
"\\usepackage{color}\n"
|
||||||
"\\usepackage{graphicx}\n"
|
"\\usepackage{graphicx}\n"
|
||||||
"\\definecolor{remph}{rgb}{0,0.5,0}\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);
|
tour::slide_backup(no_find_player, true);
|
||||||
if(flags & sm::SIDE) {
|
if(flags & sm::SIDE) {
|
||||||
cmode |= sm::SIDE;
|
cmode |= sm::SIDE;
|
||||||
dynamicval<bool> db(nomap, false);
|
dynamicval<bool> db(nomap, (flags & sm::NOSCR));
|
||||||
dynamicval<color_t> dc(modelcolor, 0xFF);
|
dynamicval<color_t> dc(modelcolor, nomap ? 0 : 0xFF);
|
||||||
dynamicval<color_t> dc2(bordcolor, 0);
|
dynamicval<color_t> dc2(bordcolor, 0);
|
||||||
gamescreen();
|
gamescreen();
|
||||||
|
callhooks(hooks_latex_slide);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gamescreen();
|
gamescreen();
|
||||||
|
@ -124,6 +124,12 @@ namespace rogueviz {
|
|||||||
cleanup.push_back(del);
|
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) {
|
template<class T, class U> void rv_hook(hookset<T>& m, int prio, U&& hook) {
|
||||||
int p = addHook(m, prio, hook);
|
int p = addHook(m, prio, hook);
|
||||||
auto del = [&m, p] {
|
auto del = [&m, p] {
|
||||||
@ -157,9 +163,11 @@ namespace rogueviz {
|
|||||||
inline hookset<void(string, vector<slide>&)> hooks_build_rvtour;
|
inline hookset<void(string, vector<slide>&)> hooks_build_rvtour;
|
||||||
slide *gen_rvtour();
|
slide *gen_rvtour();
|
||||||
#if CAP_TEXTURE
|
#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
|
#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) {
|
template<class T, class U> function<void(presmode)> roguevizslide(char c, const T& t, const U& f) {
|
||||||
return [c,t,f] (presmode mode) {
|
return [c,t,f] (presmode mode) {
|
||||||
f(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 non_game_slide_scroll(presmode mode);
|
||||||
void white_screen(presmode mode, color_t col = 0xFFFFFFFF);
|
void white_screen(presmode mode, color_t col = 0xFFFFFFFF);
|
||||||
void empty_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 show_animation(presmode mode, string s, int sx, int sy, int frames, int fps);
|
||||||
void use_angledir(presmode mode, bool reset);
|
void use_angledir(presmode mode, bool reset);
|
||||||
void slide_error(presmode mode, string s);
|
void slide_error(presmode mode, string s);
|
||||||
@ -246,6 +255,8 @@ function<void(presmode)> roguevizslide_action(char c, const T& t, const U& act)
|
|||||||
void uses_game(presmode mode, string name, reaction_t launcher, reaction_t restore);
|
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_slide(presmode mode, string s, flagtype flags = 0, int size = 100);
|
||||||
|
|
||||||
|
inline purehookset hooks_latex_slide;
|
||||||
|
|
||||||
inline ld angle = 0;
|
inline ld angle = 0;
|
||||||
inline int dir = -1;
|
inline int dir = -1;
|
||||||
hyperpoint p2(ld x, ld y);
|
hyperpoint p2(ld x, ld y);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user