diff options
| author | 3gg <3gg@shellblade.net> | 2023-07-08 15:03:05 -0700 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2023-07-08 15:03:05 -0700 |
| commit | 4fd6b58064bd26df93b05e39438dab649a65633c (patch) | |
| tree | 4f7394f204933bdd6816d6dc5a38a2c16407c6d7 /gfx-iso/app/main.c | |
| parent | 21a0d0c1c424f7db90c3282aad4bf6ad4ef809b7 (diff) | |
Add pixel scaling.
Diffstat (limited to 'gfx-iso/app/main.c')
| -rw-r--r-- | gfx-iso/app/main.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gfx-iso/app/main.c b/gfx-iso/app/main.c index fa5a76b..5b441d3 100644 --- a/gfx-iso/app/main.c +++ b/gfx-iso/app/main.c | |||
| @@ -43,6 +43,18 @@ static bool init(const GfxAppDesc* desc, void** app_state) { | |||
| 43 | if (!make_demo_app(state->iso, &state->app)) { | 43 | if (!make_demo_app(state->iso, &state->app)) { |
| 44 | goto cleanup; | 44 | goto cleanup; |
| 45 | } | 45 | } |
| 46 | |||
| 47 | // Apply pixel scaling if requested by the app. | ||
| 48 | int texture_width, texture_height; | ||
| 49 | if (state->app.pixel_scale > 1) { | ||
| 50 | texture_width = SCREEN_WIDTH / state->app.pixel_scale; | ||
| 51 | texture_height = SCREEN_HEIGHT / state->app.pixel_scale; | ||
| 52 | isogfx_resize(state->iso, texture_width, texture_height); | ||
| 53 | } else { | ||
| 54 | texture_width = SCREEN_WIDTH; | ||
| 55 | texture_height = SCREEN_HEIGHT; | ||
| 56 | } | ||
| 57 | |||
| 46 | if (!(state->gfx = gfx_init())) { | 58 | if (!(state->gfx = gfx_init())) { |
| 47 | goto cleanup; | 59 | goto cleanup; |
| 48 | } | 60 | } |
| @@ -50,8 +62,8 @@ static bool init(const GfxAppDesc* desc, void** app_state) { | |||
| 50 | 62 | ||
| 51 | if (!(state->screen_texture = gfx_make_texture( | 63 | if (!(state->screen_texture = gfx_make_texture( |
| 52 | render_backend, &(TextureDesc){ | 64 | render_backend, &(TextureDesc){ |
| 53 | .width = SCREEN_WIDTH, | 65 | .width = texture_width, |
| 54 | .height = SCREEN_HEIGHT, | 66 | .height = texture_height, |
| 55 | .dimension = Texture2D, | 67 | .dimension = Texture2D, |
| 56 | .format = TextureSRGBA8, | 68 | .format = TextureSRGBA8, |
| 57 | .filtering = NearestFiltering, | 69 | .filtering = NearestFiltering, |
