Bfg in das+ecs

Nodes can be stored in ecs singleton and in this case there is special function annotation bfg_ecs_node for hot reloading.

Function should take NodeHandle or NodeHandleVector as first argument and set up it.

Another arguments of function can be any other components of singleton entity and will be passed to es macro as is.

Possible arguments for bfg_ecs_node annotation itself:

  • on_appear - call function on appear of entity.

  • on_event=EventName - call function on event.

  • track=component_name - call function on change of component.

Example:

require daBfg.bfg_ecs

[bfg_ecs_node(on_appear)]
def register_some_node(var some_node : NodeHandle&)
  some_node <- root() |> registerNode("some_node") <| @(var registry : Registry)

    // Node requests, for example:
    registry |> requestRenderPass |> color([[auto[] "some_tex"]])

    return <- @ <|

      // Render code, for example:
      query() <| $ [es] (some_shader : PostFxRenderer)
        some_shader |> render()

Function annotations

bfg_ecs_node

|function_annotation-bfg_ecs-bfg_ecs_node|

Classes

BfgEcsNodeAnnotation : AstFunctionAnnotation

|class-bfg_ecs-BfgEcsNodeAnnotation|

BfgEcsNodeAnnotation.apply(self: AstFunctionAnnotation; func: FunctionPtr; group: ModuleGroup; args: AnnotationArgumentList const; errors: das_string)

apply returns bool

argument

argument type

self

ast::AstFunctionAnnotation

func

FunctionPtr

group

rtti::ModuleGroup

args

rtti::AnnotationArgumentList const

errors

builtin::das_string

|method-bfg_ecs-BfgEcsNodeAnnotation.apply|

BfgEcsNodeAnnotation.declareReloadCallback(self: BfgEcsNodeAnnotation; func: FunctionPtr; parsed: BfgEcsNodeAnnotationArgs const; args: AnnotationArgumentList const)

argument

argument type

self

bfg_ecs::BfgEcsNodeAnnotation

func

FunctionPtr

parsed

bfg_ecs::BfgEcsNodeAnnotationArgs const

args

rtti::AnnotationArgumentList const

|method-bfg_ecs-BfgEcsNodeAnnotation.declareReloadCallback|

BfgEcsNodeAnnotation.declareES(self: BfgEcsNodeAnnotation; func: FunctionPtr; parsed: BfgEcsNodeAnnotationArgs const; args: AnnotationArgumentList const)

argument

argument type

self

bfg_ecs::BfgEcsNodeAnnotation

func

FunctionPtr

parsed

bfg_ecs::BfgEcsNodeAnnotationArgs const

args

rtti::AnnotationArgumentList const

|method-bfg_ecs-BfgEcsNodeAnnotation.declareES|

BfgEcsNodeAnnotation.parseArgs(self: BfgEcsNodeAnnotation; func: FunctionPtr; args: AnnotationArgumentList const; errors: das_string)

parseArgs returns bfg_ecs::BfgEcsNodeAnnotationArgs

argument

argument type

self

bfg_ecs::BfgEcsNodeAnnotation

func

FunctionPtr

args

rtti::AnnotationArgumentList const

errors

builtin::das_string

|method-bfg_ecs-BfgEcsNodeAnnotation.parseArgs|