Remove dead code from platforms

master
rexim 2020-01-26 03:08:56 +07:00
parent 4c093ee248
commit e838714ef9
2 changed files with 0 additions and 41 deletions

View File

@ -17,7 +17,6 @@ struct Platforms {
Rect *rects;
Color *colors;
int *hiding;
size_t rects_size;
};
@ -51,12 +50,6 @@ Platforms *create_platforms_from_rect_layer(const RectLayer *layer)
}
memcpy(platforms->colors, rect_layer_colors(layer), sizeof(Color) * platforms->rects_size);
platforms->hiding = PUSH_LT(lt, nth_calloc(1, sizeof(int) * platforms->rects_size), free);
if (platforms->hiding == NULL) {
RETURN_LT(lt, NULL);
}
memset(platforms->hiding, 0, sizeof(int) * platforms->rects_size);
return platforms;
}
@ -148,32 +141,3 @@ Vec2f platforms_snap_rect(const Platforms *platforms,
return result;
}
#define HIDING_SPEED 2.0f
void platforms_update(Platforms *platforms, float dt)
{
trace_assert(platforms);
for (size_t i = 0; i < platforms->rects_size; ++i) {
if (platforms->hiding[i]) {
if (platforms->colors[i].a > 0.0f) {
platforms->colors[i].a =
fmaxf(0.0f, platforms->colors[i].a - HIDING_SPEED * dt);
} else {
platforms->hiding[i] = 0;
}
}
}
}
void platforms_hide_platform_at(const Platforms *platforms,
Vec2f position)
{
trace_assert(platforms);
for (size_t i = 0; i < platforms->rects_size; ++i) {
if (rect_contains_point(platforms->rects[i], position)) {
platforms->hiding[i] = 1;
}
}
}

View File

@ -15,15 +15,10 @@ void destroy_platforms(Platforms *platforms);
int platforms_render(const Platforms *platforms,
const Camera *camera);
void platforms_update(Platforms *platforms, float dt);
void platforms_touches_rect_sides(const Platforms *platforms,
Rect object,
int sides[RECT_SIDE_N]);
Vec2f platforms_snap_rect(const Platforms *platforms,
Rect *object);
void platforms_hide_platform_at(const Platforms *platforms,
Vec2f position);
#endif // PLATFORMS_H_