finally compiling and running, text still needs rework

This commit is contained in:
2024-09-16 16:17:00 +03:00
parent 551d60ef85
commit 16c96010dc
43 changed files with 299 additions and 309 deletions

View File

@@ -1,10 +1,7 @@
#include "twn_rendering_c.h"
#include "townengine/twn_rendering.h"
#include "townengine/textures/internal_api.h"
#include "townengine/context.h"
#include "townengine/camera.h"
#include "twn_rendering_platform.h"
#include "twn_rendering.h"
#include "twn_engine_context_c.h"
#include "twn_camera.h"
#include <SDL2/SDL.h>
#include <stb_ds.h>
@@ -114,23 +111,23 @@ void render(void) {
textures_update_atlas(&ctx.texture_cache);
/* fit rendering context onto the resizable screen */
if (ctx.window_size_has_changed) {
if ((float)ctx.window_w / (float)ctx.window_h > RENDER_BASE_RATIO) {
float ratio = (float)ctx.window_h / (float)RENDER_BASE_HEIGHT;
if (ctx.game.window_size_has_changed) {
if ((float)ctx.game.window_w / (float)ctx.game.window_h > RENDER_BASE_RATIO) {
float ratio = (float)ctx.game.window_h / (float)RENDER_BASE_HEIGHT;
int w = (int)((float)RENDER_BASE_WIDTH * ratio);
setup_viewport(
ctx.window_w / 2 - w / 2,
ctx.game.window_w / 2 - w / 2,
0,
w,
ctx.window_h
ctx.game.window_h
);
} else {
float ratio = (float)ctx.window_w / (float)RENDER_BASE_WIDTH;
float ratio = (float)ctx.game.window_w / (float)RENDER_BASE_WIDTH;
int h = (int)((float)RENDER_BASE_HEIGHT * ratio);
setup_viewport(
0,
ctx.window_h / 2 - h / 2,
ctx.window_w,
ctx.game.window_h / 2 - h / 2,
ctx.game.window_w,
h
);
}