twn_rendering -> twn_draw

This commit is contained in:
2024-10-07 17:53:09 +03:00
parent 9353999a30
commit ade1af12ca
22 changed files with 238 additions and 186 deletions

View File

@ -55,7 +55,7 @@ static void ingame_tick(State *state) {
input_set_mouse_captured(&ctx.input, !input_is_mouse_captured(&ctx.input));
}
set_camera(&scn->cam);
draw_camera(&scn->cam);
#define TERRAIN_FREQUENCY 0.1f
@ -69,7 +69,7 @@ static void ingame_tick(State *state) {
float d2 = stb_perlin_noise3((float)(x + 1) * TERRAIN_FREQUENCY, (float)(y - 1) * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 6;
float d3 = stb_perlin_noise3((float)x * TERRAIN_FREQUENCY, (float)(y - 1) * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 6;
unfurl_triangle("/assets/grass.png",
draw_triangle("/assets/grass.png",
(Vec3){ (float)x, d0, (float)y },
(Vec3){ (float)x + 1, d1, (float)y },
(Vec3){ (float)x, d3, (float)y - 1 },
@ -77,7 +77,7 @@ static void ingame_tick(State *state) {
(Vec2){ 128, 0 },
(Vec2){ 0, 128 });
unfurl_triangle("/assets/grass.png",
draw_triangle("/assets/grass.png",
(Vec3){ (float)x + 1, d1, (float)y },
(Vec3){ (float)x + 1, d2, (float)y - 1 },
(Vec3){ (float)x, d3, (float)y - 1 },
@ -87,8 +87,8 @@ static void ingame_tick(State *state) {
}
}
push_skybox("/assets/miramar/miramar_*.tga");
push_fog(0.9, 1.0, 0.05, (Color){ 140, 147, 160, 255 });
draw_skybox("/assets/miramar/miramar_*.tga");
draw_fog(0.9, 1.0, 0.05, (Color){ 140, 147, 160, 255 });
}

View File

@ -27,9 +27,9 @@ static void title_tick(State *state) {
const char *font = "/fonts/kenney-pixel.ttf";
int text_h = 32;
int text_w = text_get_width(text_str, text_h, font);
int text_w = draw_text_width(text_str, text_h, font);
push_rectangle(
draw_rectangle(
(Rect) {
.x = 0,
.y = 0,
@ -38,7 +38,7 @@ static void title_tick(State *state) {
},
(Color) { 0, 0, 0, 255 }
);
push_text(text_str, (Vec2){ 0, 0 }, text_h, (Color) { 255, 255, 255, 255 }, font);
draw_text(text_str, (Vec2){ 0, 0 }, text_h, (Color) { 255, 255, 255, 255 }, font);
free(text_str);
}