Totally a pile of garbage with a bunch of debug prints because I'm going to have to rewrite the renderer resizing to allow for any size image, not just the map. But this does display an image using averaged squares.
This commit is contained in:
parent
3bb3b654e7
commit
19b8bf1850
7 changed files with 262 additions and 98 deletions
13
render.cpp
13
render.cpp
|
@ -57,13 +57,21 @@ inline bool base_glyph_check(sf::Font &font, sf::Glyph &base_glyph, Point &view_
|
|||
font_size = new_size;
|
||||
return true;
|
||||
} else {
|
||||
println("VIEW TOO BIG, view={},{} MAP={},{}", view_x, view_y,
|
||||
GAME_MAP_X, GAME_MAP_Y);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SFMLRender::resize_map(int new_size, Point &view_port) {
|
||||
if($map_font_size == new_size || new_size < MIN_FONT_SIZE || new_size > MAX_FONT_SIZE) return false;
|
||||
bool SFMLRender::resize_grid(int new_size, Point &view_port) {
|
||||
if($map_font_size == new_size || new_size < MIN_FONT_SIZE || new_size > MAX_FONT_SIZE) {
|
||||
println("invalid map font size {}, =={}, min={}, max={}",
|
||||
new_size, $map_font_size, MIN_FONT_SIZE, MAX_FONT_SIZE);
|
||||
return false;
|
||||
} else {
|
||||
println("NEW SIZE SELECTED {}", new_size);
|
||||
}
|
||||
|
||||
if(base_glyph_check($font, $base_glyph, view_port, $map_font_size, new_size)) {
|
||||
$sprites.clear(); // need to reset the sprites for the new size
|
||||
|
@ -72,6 +80,7 @@ bool SFMLRender::resize_map(int new_size, Point &view_port) {
|
|||
$bg_bounds = $bg_sprite.getLocalBounds();
|
||||
return true;
|
||||
} else {
|
||||
println("BASE GLYPH FAILED!");
|
||||
// something else here
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue