2024-03-04 14:20:50 +08:00
|
|
|
|
2024-03-05 11:40:42 +08:00
|
|
|
#include "app.h"
|
2024-03-08 14:51:29 +08:00
|
|
|
#include "camera.h"
|
2024-03-05 11:40:42 +08:00
|
|
|
#include "physics.h"
|
2024-03-04 16:13:43 +08:00
|
|
|
#include "easyx.h"
|
|
|
|
#include "util/tree.h"
|
|
|
|
#include <math.h>
|
2024-03-04 14:20:50 +08:00
|
|
|
#include <graphics.h>
|
|
|
|
|
|
|
|
|
2024-03-04 15:05:21 +08:00
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
2024-03-04 16:13:43 +08:00
|
|
|
void app_Render(App *app) {
|
|
|
|
for (tree_Node *i = tree_FirstNode(app->entity->entities);
|
|
|
|
i != NULL;
|
|
|
|
i = tree_Node_Next(i)) {
|
|
|
|
Entity *e = (Entity *)(i->data);
|
|
|
|
if (e->hitbox) {
|
|
|
|
if (e->hitbox->fixed)
|
|
|
|
setlinecolor(RGB(0, 255, 0));
|
|
|
|
else
|
|
|
|
setlinecolor(RGB(255, 255, 0));
|
|
|
|
|
2024-03-08 14:51:29 +08:00
|
|
|
Box2 box = camera_TransformBox2(app->camera, physics_HitboxAbsolute(e->hitbox));
|
2024-03-04 16:13:43 +08:00
|
|
|
rectangle(
|
|
|
|
(int)round(box.lefttop.x),
|
|
|
|
(int)round(box.lefttop.y),
|
|
|
|
(int)round(box.lefttop.x + box.size.x),
|
|
|
|
(int)round(box.lefttop.y + box.size.y));
|
|
|
|
}
|
|
|
|
}
|
2024-03-04 14:20:50 +08:00
|
|
|
}
|
2024-03-04 15:05:21 +08:00
|
|
|
}
|