|
|
@@ -1,4 +1,5 @@
|
|
|
#include <stdio.h>
|
|
|
+#include <unistd.h>
|
|
|
|
|
|
#include "cglm/vec4.h"
|
|
|
#include "cglm/vec3.h"
|
|
|
@@ -102,3 +103,38 @@ void GameShapes_render(
|
|
|
GLM_VEC3_ONE
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+void win_lose_render(
|
|
|
+ const bool win,
|
|
|
+ const unsigned int screen_w,
|
|
|
+ const unsigned int screen_h
|
|
|
+) {
|
|
|
+ const char *text_str = win ? "You Win!" : "You Lose!";
|
|
|
+ SEMesh text = SEMesh_string_alloc(
|
|
|
+ text_str,
|
|
|
+ 1.0f,
|
|
|
+ (vec3) { 1.0f, 1.0f, 1.0f }
|
|
|
+ );
|
|
|
+ text.transform.pos[0] = screen_w / 2.0f;
|
|
|
+ text.transform.pos[1] = screen_h / 2.0f;
|
|
|
+
|
|
|
+ vec2 text_dims;
|
|
|
+ SEMesh_rect_dims_get(&text, text_dims);
|
|
|
+ SEMesh bg = SEMesh_rect_color_alloc((vec4) {
|
|
|
+ 0.2f, 0.2f, 0.2f, 1.0f });
|
|
|
+ bg.transform.pos[0] = screen_w / 2.0f;
|
|
|
+ bg.transform.pos[1] = screen_h / 2.0f;
|
|
|
+ bg.transform.scale[0] = text_dims[0] * 2.0f;
|
|
|
+ bg.transform.scale[1] = text_dims[1] * 2.0f;
|
|
|
+
|
|
|
+ SEMesh *const meshes[] = {
|
|
|
+ &bg,
|
|
|
+ &text,
|
|
|
+ };
|
|
|
+
|
|
|
+ SEMesh_render_multiple_2d(meshes, sizeof(meshes) / sizeof(meshes[0]));
|
|
|
+ se_swap_buffers();
|
|
|
+ sleep(2);
|
|
|
+
|
|
|
+ SEMesh_free(&text);
|
|
|
+}
|