diff options
Diffstat (limited to 'gfx-iso/src')
| -rw-r--r-- | gfx-iso/src/isogfx.c | 21 | 
1 files changed, 21 insertions, 0 deletions
diff --git a/gfx-iso/src/isogfx.c b/gfx-iso/src/isogfx.c index 17b88b2..ee33cad 100644 --- a/gfx-iso/src/isogfx.c +++ b/gfx-iso/src/isogfx.c  | |||
| @@ -603,6 +603,27 @@ void isogfx_draw_tile(IsoGfx* iso, int x, int y, Tile tile) { | |||
| 603 | draw_tile(iso, so, tile); | 603 | draw_tile(iso, so, tile); | 
| 604 | } | 604 | } | 
| 605 | 605 | ||
| 606 | bool isogfx_resize(IsoGfx* iso, int screen_width, int screen_height) { | ||
| 607 | assert(iso); | ||
| 608 | assert(iso->screen); | ||
| 609 | |||
| 610 | const int current_size = iso->screen_width * iso->screen_height; | ||
| 611 | const int new_size = screen_width * screen_height; | ||
| 612 | |||
| 613 | if (new_size > current_size) { | ||
| 614 | Pixel* new_screen = calloc(new_size, sizeof(Pixel)); | ||
| 615 | if (new_screen) { | ||
| 616 | free(iso->screen); | ||
| 617 | iso->screen = new_screen; | ||
| 618 | } else { | ||
| 619 | return false; | ||
| 620 | } | ||
| 621 | } | ||
| 622 | iso->screen_width = screen_width; | ||
| 623 | iso->screen_height = screen_height; | ||
| 624 | return true; | ||
| 625 | } | ||
| 626 | |||
| 606 | const Pixel* isogfx_get_screen_buffer(const IsoGfx* iso) { | 627 | const Pixel* isogfx_get_screen_buffer(const IsoGfx* iso) { | 
| 607 | assert(iso); | 628 | assert(iso); | 
| 608 | return iso->screen; | 629 | return iso->screen; | 
