Add path debug drawing, resources fields
This commit is contained in:
@@ -93,3 +93,20 @@ void startPath(ecs_iter_t *it) {
|
||||
path[i].curWaypoint++;
|
||||
}
|
||||
}
|
||||
void drawDebugPath(ecs_iter_t *it) {
|
||||
Path *path = ecs_field(it, Path, 1);
|
||||
|
||||
for (i32 i = 0; i < it->count; i++) {
|
||||
for (i32 iPath = 0; iPath < path[i].numWaypoints; iPath++) {
|
||||
Color color = RED;
|
||||
if (iPath < path[i].curWaypoint - 1)
|
||||
color = GREEN;
|
||||
else if (iPath == path[i].curWaypoint - 1)
|
||||
color = ORANGE;
|
||||
color.a = 180;
|
||||
|
||||
Position pos = path[i].waypoints[iPath];
|
||||
DrawCircle(pos.x, pos.y, 3, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,8 @@ void updateAnimations(ecs_iter_t *it);
|
||||
void updatePos(ecs_iter_t *it);
|
||||
void targetFinish(ecs_iter_t *it);
|
||||
void startPath(ecs_iter_t *it);
|
||||
void drawDebugPath(ecs_iter_t *it);
|
||||
|
||||
void uiTask(ecs_iter_t *it);
|
||||
|
||||
#endif //PIXELDEFENSE_SYSTEMS_H
|
||||
|
||||
14
game/systems/ui_systems.c
Normal file
14
game/systems/ui_systems.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "systems.h"
|
||||
|
||||
#include "../game_state.h"
|
||||
|
||||
void uiTask(ecs_iter_t *it) {
|
||||
Vector2 mousePos = GetMousePosition();
|
||||
Vector2 worldPos = GetScreenToWorld2D(mousePos, GAME->camera);
|
||||
|
||||
BzTileMap *map = &GAME->map;
|
||||
|
||||
i32 tileX = (i32) worldPos.x / map->tileWidth;
|
||||
i32 tileY = (i32) worldPos.y / map->tileHeight;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user