Resource slot in das

Storing in das+ecs is more convenient.

However, we can store NodeHandleWithSlotsAccess outside ecs with daBfg.resource_slot module.

Unfortunately, NodeHandleWithSlotsAccess can’t be stored in local das variable, because das doesn’t call destructors for local types. If you really need to store handle outside ecs, you have to store handle in heap or make binding for storing it on cpp-side.

Also hot-reload will work automatically for nodes inside ecs.

require daBfg.resource_slot

some_cpp_binding <| $(var handle : NodeHandleWithSlotsAccess &)
  some_struct.handle <- root() |> registerAccess("node_name", [[SlotActions update <- [{auto Update("slot_name", "texture_name", 100)}] ]]) <| @(slots_state; var registry : Registry)

    return <- @ <|
      // some render code

Constants

DEFAULT_READ_PRIORITY = 2147483647

|variable-resource_slot-DEFAULT_READ_PRIORITY|

Create

Create fields are

slot

string

resource

string

|structure-resource_slot-Create|

Update

Update fields are

slot

string

resource

string

priority

int

|structure-resource_slot-Update|

Read

Read fields are

slot

string

priority

int

|structure-resource_slot-Read|

SlotActions

SlotActions fields are

create

array< resource_slot::Create >

update

array< resource_slot::Update >

read

array< resource_slot::Read >

|structure-resource_slot-SlotActions|

Register access

registerAccess(self: NameSpace; name: string const; slot_decl: SlotActions const; declaration_callback: lambda<(slots_state:ResourceSlotCore::State const;var reg:daBfg::Registry -const):lambda<void>>)

registerAccess returns ResourceSlotCore::NodeHandleWithSlotsAccess

argument

argument type

self

daBfg::NameSpace

name

string const

slot_decl

resource_slot::SlotActions const

declaration_callback

lambda<(slots_state: ResourceSlotCore::State const;reg: daBfg::Registry ):lambda<>>

|function-resource_slot-registerAccess|