@@ -30,23 +30,25 @@ use crate::core::{
3030} ;
3131
3232pub struct LambdaKernelBuilder {
33- name : String ,
33+ app_name : String ,
3434 render_api : RenderContextBuilder ,
3535 window_size : ( u32 , u32 ) ,
36+ components : Vec < Box < dyn RenderableComponent < Events > > > ,
3637}
3738
3839impl LambdaKernelBuilder {
39- pub fn new ( name : & str ) -> Self {
40+ pub fn new ( app_name : & str ) -> Self {
4041 return Self {
41- name : name . to_string ( ) ,
42- render_api : RenderContextBuilder :: new ( name ) ,
42+ app_name : app_name . to_string ( ) ,
43+ render_api : RenderContextBuilder :: new ( app_name ) ,
4344 window_size : ( 800 , 600 ) ,
45+ components : Vec :: new ( ) ,
4446 } ;
4547 }
4648
4749 /// Update the name of the LambdaKernel.
48- pub fn with_name ( mut self , name : & str ) -> Self {
49- self . name = name. to_string ( ) ;
50+ pub fn with_app_name ( mut self , name : & str ) -> Self {
51+ self . app_name = name. to_string ( ) ;
5052 return self ;
5153 }
5254
@@ -64,12 +66,23 @@ impl LambdaKernelBuilder {
6466 self . render_api = configure ( self . render_api ) ;
6567 return self ;
6668 }
69+ /// Jjk
70+ /// Attach a component to the current runnable.
71+ pub fn with_component < T : Default + RenderableComponent < Events > + ' static > (
72+ self ,
73+ configure_component : impl FnOnce ( Self , T ) -> ( Self , T ) ,
74+ ) -> Self {
75+ let ( mut kernel_builder, component) =
76+ configure_component ( self , T :: default ( ) ) ;
77+ kernel_builder. components . push ( Box :: new ( component) ) ;
78+ return kernel_builder;
79+ }
6780
6881 /// Builds a LambdaKernel equipped with Windowing, an event loop, and a
6982 /// component stack that allows components to be dynamically pushed into the
7083 /// Kernel to receive events & render access.
7184 pub fn build ( self ) -> LambdaKernel {
72- let name = self . name ;
85+ let name = self . app_name ;
7386 let mut event_loop = create_event_loop :: < Events > ( ) ;
7487 let ( width, height) = self . window_size ;
7588
@@ -101,17 +114,7 @@ pub struct LambdaKernel {
101114 render_api : RenderContext ,
102115}
103116
104- impl LambdaKernel {
105- /// Attach a component to the current runnable.
106- pub fn with_component < T : Default + RenderableComponent < Events > + ' static > (
107- self ,
108- configure_component : impl FnOnce ( Self , T ) -> ( Self , T ) ,
109- ) -> Self {
110- let ( mut kernel, component) = configure_component ( self , T :: default ( ) ) ;
111- kernel. component_stack . push ( Box :: new ( component) ) ;
112- return kernel;
113- }
114- }
117+ impl LambdaKernel { }
115118
116119impl Kernel for LambdaKernel {
117120 /// Initiates an event loop that captures the context of the LambdaKernel
0 commit comments