Merge branch 'master' of github.com:AnonymusRaccoon/Gamacon

This commit is contained in:
Anonymus Raccoon
2020-05-03 19:27:55 +02:00
3 changed files with 19 additions and 15 deletions
+3
View File
@@ -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:
+5 -4
View File
@@ -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)));
}
+11 -11
View File
@@ -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);
}
}
}