Renderer is now more standalone and doesn't try to protect against small maps, that's the GUI's job.

This commit is contained in:
Zed A. Shaw 2024-11-21 15:51:22 -05:00
parent 19b8bf1850
commit 15a302d133
11 changed files with 65 additions and 90 deletions

View file

@ -81,11 +81,10 @@ int main(int argc, char *argv[]) {
// divide the image into cells
auto size = image.getSize();
const int cell = 10;
const int cell = 3;
// create a grid panel to hold the cells
Panel panel(0, 0, GAME_MAP_POS, 0, true);
Point view_port{0,0};
Panel panel(0, 0, 0, 0, true);
println("IMAGE SIZE {},{}", size.x, size.y);
RGBColor avg{0,0,0};
@ -124,16 +123,11 @@ int main(int argc, char *argv[]) {
SFMLRender renderer;
// NEED TO RESIZE FOR IT TO SHOW
// this shows that I need more refinement on the renderer
// for example, this won't let me do arbitrary resize and
// is still locked to the map, but I need arbitrary for the
// scenes
if(renderer.resize_grid(50, view_port)) {
println("RESIZED: {},{}", view_port.x, view_port.y);
if(renderer.resize_grid(10, panel)) {
println("RESIZED: {},{}", panel.width, panel.height);
// set canvas to best size
drawing = Canvas(view_port.x * 2, view_port.y * 4);
panel.resize(view_port.x, view_port.y);
drawing = Canvas(panel.width * 2, panel.height * 4);
}
panel.set_renderer(Renderer([&]{