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

Add new rotor concept: entity_compatible_with(MyEntity.value) and it's ptr variant #8

Open
Andre-LA opened this issue Dec 18, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Andre-LA
Copy link
Owner

Andre-LA commented Dec 18, 2022

This eases development with derived entities.

Usage example:

local rotor_concepts = require 'rotor.concepts'

local SpriteEntity = @entity(@record{
  entity_data: EntityData,
  sprite: Sprite,
  painter: Painter,
})

local an_sprite_entity_ptr = #[rotor_concepts.value.entity_ptr_compatible_with(SpriteEntity.value)]#

local Inputs = @record{ --[[...]] }

function SpriteEntity.derived_init(sprite_entity: an_sprite_entity_ptr, inputs: Inputs)
  sprite_entity.entity_data = {
    id = inputs.sprite.id,
    mask = inputs.sprite.mask,
  }

  -- ...
end
@Andre-LA Andre-LA added the enhancement New feature or request label Dec 18, 2022
@Andre-LA Andre-LA changed the title Add new rotor concept: entity_subset_of(MyEntity.value) Add new rotor concept: entity_compatible_with(MyEntity.value) Dec 18, 2022
@Andre-LA Andre-LA changed the title Add new rotor concept: entity_compatible_with(MyEntity.value) Add new rotor concept: entity_compatible_with(MyEntity.value) and it's ptr variant Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant