fixing norm issues

This commit is contained in:
Clément Le Bihan
2020-05-03 18:43:31 +02:00
parent 61eb6a5af8
commit bb88cf8809
2 changed files with 16 additions and 15 deletions
+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);
}
}
}