Separate input component
This commit is contained in:
parent
29e7b5e499
commit
705f498daa
9 changed files with 318 additions and 178 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package ecs
|
||||
|
||||
import sa "../sokol/app"
|
||||
import sg "../sokol/gfx"
|
||||
|
||||
Mat4 :: matrix[4, 4]f32
|
||||
|
|
@ -8,38 +9,51 @@ Vec2 :: [2]f32
|
|||
Vec3 :: [3]f32
|
||||
Vec4 :: [4]f32
|
||||
|
||||
Gravity :: struct {
|
||||
GravityComponent :: struct {
|
||||
force: Vec3
|
||||
}
|
||||
|
||||
RigidBody :: struct {
|
||||
RigidBodyComponent :: struct {
|
||||
velocity: Vec3,
|
||||
acceleration: Vec3,
|
||||
}
|
||||
|
||||
Transform :: struct {
|
||||
TransformComponent :: struct {
|
||||
position: Vec3,
|
||||
rotation: Vec3,
|
||||
scale: Vec3,
|
||||
}
|
||||
|
||||
Color :: struct {
|
||||
ColorComponent :: struct {
|
||||
color: Vec4,
|
||||
}
|
||||
|
||||
Mesh :: struct {
|
||||
vertex_buffer: sg.Buffer,
|
||||
index_buffer: sg.Buffer,
|
||||
MeshID :: enum {
|
||||
CubeMesh,
|
||||
}
|
||||
|
||||
Material :: struct {
|
||||
shader: sg.Shader,
|
||||
image: sg.Image,
|
||||
sampler: sg.Sampler,
|
||||
MeshComponent :: struct {
|
||||
mesh_id: MeshID
|
||||
}
|
||||
|
||||
Camera :: struct {
|
||||
MaterialID :: enum {
|
||||
GridTexture,
|
||||
}
|
||||
|
||||
MaterialComponent :: struct {
|
||||
material_id: MaterialID
|
||||
}
|
||||
|
||||
CameraComponent :: struct {
|
||||
position: Vec3,
|
||||
target: Vec3,
|
||||
look: Vec2
|
||||
look: Vec2,
|
||||
|
||||
look_sensitivity: f32,
|
||||
movement_speed: f32,
|
||||
}
|
||||
|
||||
InputComponent :: struct {
|
||||
mouse_movement: Vec2,
|
||||
key_down: #sparse[sa.Keycode]bool,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue