Entirely expanded upon existing proof-of-concept
This commit is contained in:
38
src/render.c
Normal file
38
src/render.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "render.h"
|
||||
#include "world.h"
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
void DrawEntities(void)
|
||||
{
|
||||
for (int i = 0; i < MAX_ENTITIES; i++)
|
||||
{
|
||||
Entity *e = &entities[i];
|
||||
|
||||
if (!e->active)
|
||||
continue;
|
||||
|
||||
Rectangle rect =
|
||||
{
|
||||
e->position.x - e->size * 0.5f,
|
||||
e->position.y - e->size * 0.5f,
|
||||
e->size,
|
||||
e->size
|
||||
};
|
||||
|
||||
DrawRectangleRec(rect, e->color);
|
||||
DrawRectangleLinesEx(rect, 2, BLACK);
|
||||
|
||||
Vector2 velEnd =
|
||||
{
|
||||
e->position.x + e->velocity.x * 0.10f,
|
||||
e->position.y + e->velocity.y * 0.10f
|
||||
};
|
||||
|
||||
DrawLineEx(
|
||||
e->position,
|
||||
velEnd,
|
||||
2,
|
||||
DARKBLUE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user