From 92f864187c97aa6c0dfbfbc43a3c8eb0a6d26e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Tue, 14 Apr 2020 18:28:23 +0200 Subject: [PATCH] adding defines for the texture height and width (for isometry rendering) --- include/sfml_init.h | 14 ++++++++++++++ src/sfml_renderer/sfml_init.c | 8 +++++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 include/sfml_init.h diff --git a/include/sfml_init.h b/include/sfml_init.h new file mode 100644 index 0000000..cd07958 --- /dev/null +++ b/include/sfml_init.h @@ -0,0 +1,14 @@ +/* +** EPITECH PROJECT, 2020 +** My3D +** File description: +** sfml_init +*/ + +#ifndef MY_RPG_SFML_INIT_H +#define MY_RPG_SFML_INIT_H + +#define TEXTURE_WIDTH 16 +#define TEXTURE_HEIGHT 16 + +#endif //MY_RPG_SFML_INIT_H diff --git a/src/sfml_renderer/sfml_init.c b/src/sfml_renderer/sfml_init.c index 6fdcb59..cb25035 100644 --- a/src/sfml_renderer/sfml_init.c +++ b/src/sfml_renderer/sfml_init.c @@ -8,6 +8,7 @@ #include "components/transform_component.h" #include #include +#include "sfml_init.h" sfRenderStates *sfml_init_render_state(void) { @@ -27,9 +28,10 @@ sfVertexArray *sfml_init_verticies(void) sfVertexArray *arr = sfVertexArray_create(); sfVertex v[4] = { {.position = {0, 0}, .texCoords = {0, 0}, .color = sfWhite}, - {.position = {0, 0}, .texCoords = {64, 0}, .color = sfWhite}, - {.position = {0, 0}, .texCoords = {0, 64}, .color = sfWhite}, - {.position = {0, 0}, .texCoords = {64, 64}, .color = sfWhite} + {.position = {0, 0}, .texCoords = {TEXTURE_WIDTH, 0}, .color = sfWhite}, + {.position = {0, 0}, .texCoords = {0, TEXTURE_HEIGHT}, .color = sfWhite}, + {.position = {0, 0}, .texCoords = {TEXTURE_WIDTH, \ +TEXTURE_HEIGHT}, .color = sfWhite} }; for (int i = 0; i < 4; i++)