Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECS: Add Component instances for Unit #34

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lean/ECS/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,28 @@ instance
match mv with
| none => ExplDestroy.explDestroy st ety
| some x => ExplSet.explSet st ety x

/-- Instances for Unit.
Useful when you want to 'do nothing' in a cmap
--/
axiom ElemUnitStore : ElemFam Unit = Unit
instance : FamilyDef ElemFam Unit Unit := ⟨ElemUnitStore⟩

axiom StorageUnit : StorageFam Unit = Unit
instance : FamilyDef StorageFam Unit Unit := ⟨StorageUnit⟩

instance : @Component Unit Unit Unit _ _ where
constraint := rfl

instance : @Has w Unit Unit _ where
getStore := return ()

instance : @ExplGet Unit Unit _ where
explGet _ _ := return ()
explExists _ _ := return true

instance : @ExplSet Unit Unit _ where
explSet _ _ _ := return ()

instance : ExplDestroy Unit where
explDestroy _ _ := return ()