Refactor rendering to use an SFML view for placing the main UI within the overall interface
This commit is contained in:
@@ -17,8 +17,6 @@
|
||||
|
||||
sf::Shader maskShader;
|
||||
extern fs::path progDir;
|
||||
// TODO: Shouldn't need this
|
||||
extern sf::RenderWindow mainPtr;
|
||||
|
||||
void init_shaders() {
|
||||
fs::path shaderPath = progDir/"data"/"shaders";
|
||||
@@ -90,11 +88,6 @@ void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::Re
|
||||
targ_gworld.draw(tile, mode);
|
||||
}
|
||||
|
||||
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,rectangle targ_rect,location offset, sf::BlendMode mode) {
|
||||
targ_rect.offset(offset);
|
||||
rect_draw_some_item(src_gworld,src_rect,mainPtr,targ_rect,mode);
|
||||
}
|
||||
|
||||
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,const sf::Texture& mask_gworld,sf::RenderTarget& targ_gworld,rectangle targ_rect) {
|
||||
static sf::RenderTexture src;
|
||||
static bool inited = false;
|
||||
|
@@ -21,7 +21,6 @@
|
||||
void init_shaders();
|
||||
void rect_draw_some_item(sf::RenderTarget& targ_gworld,rectangle targ_rect);
|
||||
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::BlendMode mode = sf::BlendNone);
|
||||
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,rectangle targ_rect,location offset,sf::BlendMode mode = sf::BlendNone);
|
||||
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,const sf::Texture& mask_gworld,sf::RenderTarget& targ_gworld,rectangle targ_rect);
|
||||
void draw_splash(const sf::Texture& splash, sf::RenderWindow& targ, rectangle dest_rect);
|
||||
|
||||
|
@@ -215,8 +215,11 @@ void clip_rect(sf::RenderTarget& where, rectangle rect) {
|
||||
rect &= rectangle(where); // Make sure we don't draw out of bounds
|
||||
// TODO: Make sure this works for the scissor test...
|
||||
setActiveRenderTarget(where);
|
||||
rectangle winRect(where);
|
||||
location pivot = rect.bottomLeft();
|
||||
pivot = where.mapCoordsToPixel(pivot);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(rect.left, rectangle(where).height() - rect.bottom, rect.width(), rect.height());
|
||||
glScissor(pivot.x, rectangle(where).height() - pivot.y, rect.width(), rect.height());
|
||||
}
|
||||
|
||||
void clip_region(sf::RenderWindow& where, Region& region) {
|
||||
|
@@ -38,7 +38,6 @@ struct text_params_t {
|
||||
TextStyle style;
|
||||
eTextMode mode;
|
||||
bool showBreaks = false;
|
||||
location offset = {0,0};
|
||||
// Hilite ranges are, like the STL, of the form [first, last).
|
||||
std::vector<hilite_t> hilite_ranges;
|
||||
sf::Color hilite_fg, hilite_bg = sf::Color::Transparent;
|
||||
@@ -95,8 +94,6 @@ static void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,st
|
||||
short total_width = 0;
|
||||
short adjust_x = 0,adjust_y = 0;
|
||||
|
||||
adjust_x = options.offset.x;
|
||||
adjust_y = options.offset.y;
|
||||
str_to_draw.setString("fj"); // Something that has both an ascender and a descender
|
||||
adjust_y -= str_to_draw.getLocalBounds().height;
|
||||
|
||||
@@ -188,11 +185,10 @@ static void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,st
|
||||
}
|
||||
}
|
||||
|
||||
void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,std::string str,eTextMode mode,TextStyle style, location offset) {
|
||||
void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,std::string str,eTextMode mode,TextStyle style) {
|
||||
text_params_t params;
|
||||
params.mode = mode;
|
||||
params.style = style;
|
||||
params.offset = offset;
|
||||
win_draw_string(dest_window, dest_rect, str, params);
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ enum class eTextMode {
|
||||
|
||||
std::vector<rectangle> draw_string_hilite(sf::RenderTarget& dest_window,rectangle dest_rect,std::string str,TextStyle style,std::vector<hilite_t> hilites,sf::Color hiliteClr);
|
||||
std::vector<snippet_t> draw_string_sel(sf::RenderTarget& dest_window,rectangle dest_rect,std::string str,TextStyle style,std::vector<hilite_t> hilites,sf::Color hiliteClr);
|
||||
void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,std::string str,eTextMode mode,TextStyle style, location offset = {0,0});
|
||||
void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,std::string str,eTextMode mode,TextStyle style);
|
||||
size_t string_length(std::string str, TextStyle style, short* height = nullptr);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user