File tree 3 files changed +17
-0
lines changed
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ namespace Engine.Entities
5
5
{
6
6
public static class EntityFactory
7
7
{
8
+ /// <summary>
9
+ /// Create a new <see cref="Entity"/> containing only a single given <see cref="Component"/> instance.
10
+ /// </summary>
11
+ /// <param name="component"></param>
12
+ /// <returns></returns>
13
+ public static Entity Create ( Component component ) => new Entity ( new [ ] { component } ) ;
14
+
8
15
/// <summary>
9
16
/// Create a new <see cref="Entity"/> containing only a single <see cref="Component"/> instance.
10
17
/// </summary>
Original file line number Diff line number Diff line change
1
+ namespace Game . Content
2
+ {
3
+ // TODO: Generate these constants via build script
4
+ public static class Shaders
5
+ {
6
+ public const string Flat = "flat.hlsl" ;
7
+ }
8
+ }
Original file line number Diff line number Diff line change 6
6
using Engine . Assets ;
7
7
using Engine . Components ;
8
8
using Engine . Entities ;
9
+ using Game . Content ;
9
10
using Veldrid ;
10
11
using Veldrid . OpenGL ;
11
12
using Veldrid . Sdl2 ;
@@ -58,6 +59,7 @@ protected override void Initialize()
58
59
AssetDirectoryPaths . Add ( AssetType . Shader , "Game.Content.Shaders" ) ;
59
60
60
61
World . Add ( EntityFactory . Create < Camera > ( ) ) ;
62
+ World . Add ( EntityFactory . Create ( new Material ( "TestMaterial" , Shaders . Flat ) ) ) ;
61
63
62
64
_commandList = ResourceFactory . CreateCommandList ( ) ;
63
65
}
You can’t perform that action at this time.
0 commit comments