first commit

This commit is contained in:
2024-08-24 00:47:58 -04:00
commit f6ef842a28
400 changed files with 43479 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#pragma once
#include "../../ecs_entity.h"
#include "../../../input/control.h"
static const f32 COMPONENT_PHYSICS_FRICTION_DEFAULT = 1.0f;
static const vec3 COMPONENT_PHYSICS_VELOCITY_MAX_DEFAULT = {1000.0f, 1000.0f, 1000.0f};
typedef struct ComponentPhysics
{
Component component;
vec3 position;
vec3 velocity;
vec3 velocityMax;
f32 friction;
bool isMoving;
} ComponentPhysics;
void component_physics_tick(ComponentPhysics* self, ECS* ecs);
void component_physics_next_position_get(ComponentPhysics* self, ECS* ecs, vec2 position);
f32 component_physics_next_position_distance_get(ComponentPhysics* self, ECS* ecs);
void component_physics_init
(
ComponentPhysics* self,
ECS* ecs,
const vec3 position,
const vec3 velocityMax,
f32 friction
);
static const ComponentInfo COMPONENT_PHYSICS_INFO =
{
.system =
{
.functions =
{
NULL,
NULL,
(ECSFunction)component_physics_tick,
NULL,
NULL
}
},
.type = COMPONENT_PHYSICS,
.size = sizeof(ComponentPhysics)
};