From 61eb6a5af801ccbaac95f41bd78234cb135b9ab3 Mon Sep 17 00:00:00 2001 From: Anonymus Raccoon Date: Sun, 3 May 2020 16:25:58 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c3589de..b3ec4b3 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ Gamacon also has a UI handler to ease development of graphical interfaces. For e To look at a read usage of prefabs or scene, take a look at [ForecastingVillage](https://github.com/AnonymusRaccoon/ForecastingVillage) which is the more complete project you can find created with this library. +## Build +To build the library, simple run ``make``. + ## Dependencies Gamacon needs four others libraries: From bb88cf88094cb821ebded311af5b04b66cf8476c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Sun, 3 May 2020 18:43:31 +0200 Subject: [PATCH 2/2] fixing norm issues --- src/isometry/map_utils.c | 9 +++++---- src/sfml_renderer/sfml_vertex.c | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/isometry/map_utils.c b/src/isometry/map_utils.c index 910c271..e31d09e 100644 --- a/src/isometry/map_utils.c +++ b/src/isometry/map_utils.c @@ -70,9 +70,10 @@ sel->corners[i]->y, sel->corners[i]->z); struct tile*get_selected_tile(struct sfml_renderer_system *this, \ struct vertex_component *info, gc_vector2 pos) { - sfVector2i v = sfMouse_getPosition((const sfWindow *) this->window); - sfVector2f w = sfRenderWindow_mapPixelToCoords(this->window, v, this->view); + sfVector2i v = sfMouse_getPosition((const sfWindow *) this->window); + sfVector2f w = sfRenderWindow_mapPixelToCoords(this->window, \ +v, this->view); - w.y *= -1; - return (get_tile_from_pos(info, gc_vector2_add(pos, *(gc_vector2 *)&w))); + w.y *= -1; + return (get_tile_from_pos(info, gc_vector2_add(pos, *(gc_vector2 *)&w))); } \ No newline at end of file diff --git a/src/sfml_renderer/sfml_vertex.c b/src/sfml_renderer/sfml_vertex.c index f3845ce..4c37350 100644 --- a/src/sfml_renderer/sfml_vertex.c +++ b/src/sfml_renderer/sfml_vertex.c @@ -94,15 +94,15 @@ struct vertex_component *info, float dt) if (!info || !info->map) return; tl = get_selected_tile(this, info, tra->position); - for (width = 0; info->vertices[0][width].z != INT32_MIN; width++); - for (length = 0; info->map[length].corners[0]; length++); - width--; - end_diagonal = length + width - 1; - for (int i = length - 1; i >= 0; i -= (i > length - width) ? 1 : width) { - end_diagonal -= (end_diagonal <= width) ? 1 : width; - for (int j = i; j >= end_diagonal; j -= width - 1) { - sfmlrenderer_manage_hovered_tile(this, &info->map[j] == tl); - sfmlrenderer_draw_tile(engine, tra->position, &info->map[j], dt); - } - } + for (width = 0; info->vertices[0][width].z != INT32_MIN; width++); + for (length = 0; info->map[length].corners[0]; length++); + width--; + end_diagonal = length + width - 1; + for (int i = length - 1; i >= 0; i -= (i > length - width) ? 1 : width) { + end_diagonal -= (end_diagonal <= width) ? 1 : width; + for (int j = i; j >= end_diagonal; j -= width - 1) { + sfmlrenderer_manage_hovered_tile(this, &info->map[j] == tl); + sfmlrenderer_draw_tile(engine, tra->position, &info->map[j], dt); + } + } } \ No newline at end of file