public override void OnInit() { base.OnInit(); InputProcessor.UpdateActionBinding("Left", Key.D, Key.Left); InputProcessor.UpdateActionBinding("Right", Key.A, Key.Right); InputProcessor.UpdateActionBinding("Up", Key.W, Key.Up); InputProcessor.UpdateActionBinding("Down", Key.S, Key.Down); ResourcePtr Font = new ResourcePtr("font:Fonts/Work_Sans/WorkSans-Regular.ttf"); Text = new Text("Hello World", Font.Get <Font>()); Text.CharacterSize = 24; Text.FillColor = Color.Red; World newWorld = LoadWorld(World.Get <WorldScript>()); var actor = newWorld.CreateActor <Actor>(TestActor.Get <ActorScript>()); actor.Location = new Vector3(100, 100, 0); Actor secondACtor = newWorld.CreateActor <Actor>(SecondActor.Get <ActorScript>()); secondACtor.Location = new Vector3(500, 100, 0); }
private Shader GetShader(ResourcePtr ptr, Shader.Stage stage) { if (ptr.Loaded) { return(ptr.Get <Shader>()); } Shader s = IEngine.Instance.Renderer.MaterialFactory.CreateShader(stage, FileSystem.GetFileStream(ptr)); s.ShaderFormat = Shader.SPIRV; FileSystem.EmplaceInMemoryResource(ptr, s); return(s); }
public void Render(Renderer renderer) { Flow.Render(); DrawData drawData = Flow.DrawData; for (int i = 0; i < drawData.DrawLists.Count; i++) { DrawList drawList = drawData.DrawLists[i]; IVertexBuffer vertexBuffer = BindVertexBuffer(drawList); int IndexOffset = 0; for (int cmdi = 0; cmdi < drawList.CommandBuffer.Count; cmdi++) { DrawList.DrawCmd DrawCommand = drawList.CommandBuffer.ElementAt(cmdi); using (RenderingCommand cmd = renderer.RendererResourceFactory.CreateRenderCommand()) { cmd.WithVertexBuffer(vertexBuffer) .WithMaterial(FlowMaterialPtr.Get <Material>()) .WithCamera(UICamera); //TODO: Textures cmd.WithStartIndex(IndexOffset) .WithPrimitveCount((int)DrawCommand.Elements / 3) .WithDebugName("Flow UI Rendering"); renderer.ExecuteRenderCommand(cmd); } IndexOffset += (int)DrawCommand.IndexOffset; } } }