protected void Initialize() { // --------------------------------------------------------- // Add common GameSystems - Adding order is important // (Unless overriden by gameSystem.UpdateOrder) // --------------------------------------------------------- // Initialize the systems GameSystems.Initialize(); Content.Serializer.LowLevelSerializerSelector = ParameterContainerExtensions.DefaultSceneSerializerSelector; // Add the scheduler system // - Must be after Input, so that scripts are able to get latest input // - Must be before Entities/Camera/Audio/UI, so that scripts can apply // changes in the same frame they will be applied GameSystems.Add(Script); GameSystems.Add(Streaming); GameSystems.Add(SceneSystem); // TODO: data-driven? Content.Serializer.RegisterSerializer(new ImageSerializer()); OnGameStarted(this); }
/// <summary>Called after the Game and GraphicsDevice are created, but before LoadContent. Reference page contains code sample.</summary> protected virtual void Initialize() { // Setup the graphics device if it was not already setup. SetupGraphicsDeviceEvents(); GameSystems.Initialize(); }
static void Main(string[] args) { GameSystems.Initialize(new GameStartInfo() { WindowName = "WindowTestUnit", GameName = "WindowTestUnit", IconName = "", WindowSize = new Size <int>(1920, 1080) }); InitializeWindowEvent(); GameSystems.RunLoop(); }
static void Main(string[] args) { const int width = 1920; const int height = 1080; var adapters = GalEngine.Runtime.Graphics.GpuAdapter.EnumerateGraphicsAdapter(); GameSystems.Initialize(new GameStartInfo() { WindowName = "Bezier Render System", GameName = "Bezier Render System", IconName = null, WindowSize = new Size <int>(width, height), Adapter = adapters[1] }); BezierRender bezierRender = new BezierRender(GameSystems.GpuDevice); GameSystems.AddBehaviorSystem( new BezierFillSystem(bezierRender, new Rectangle <int>(0, 0, width, height))); /*GameSystems.AddBehaviorSystem( * new BezierDrawSystem(bezierRender, * new Rectangle<int>(0, 0, width, height)));*/ GameSystems.MainScene = new GameScene("Main"); Random random = new Random(0); Flower[] flowers = new Flower[500]; for (int i = 0; i < flowers.Length; i++) { flowers[i] = new Flower( new Position <float>(random.Next(0, width), random.Next(0, height)), random.Next(100, 200)); foreach (var leaf in flowers[i].Leaves) { GameSystems.MainScene.AddGameObject(leaf); } } GameSystems.RunLoop(); }
static void Main(string[] args) { GameSystems.Initialize(new GameStartInfo() { GameName = "GuiSystemTestUnit", WindowName = "GuiSystemTestUnit", IconName = "", WindowSize = new Size <int>(1920, 1080) }); var guiText = new GuiText("This is a test text!", new Font(20), new Color <float>(0, 0, 0, 1)); var guiButton = new GuiButton(); var guiInputText = new GuiInputText("input", 100, DefaultInputTextProperty.Background, DefaultInputTextProperty.Frontground, new Font(30)); //guiInputText.GetComponent<InputTextGuiComponent>().Content = "2333"; guiInputText.GetComponent <InputTextGuiComponent>().CursorLocation = 1; guiInputText.GetComponent <TransformGuiComponent>().Position = new Position <float>(100, 100); (guiButton.GetComponent <ButtonGuiComponent>().Shape as RectangleShape).Size = new Size <float>(80, 40); //guiButton.GetComponent<TransformGuiComponent>().Position = new Position<float>(100, 100); guiButton.GetComponent <LogicGuiComponent>().EventParts.Get(GuiComponentSupportEvent.MouseClick) .Solver += (x, y) => { var eventArg = y as GuiComponentMouseClickEvent; if (eventArg.IsDown && eventArg.Button == MouseButton.Left) { Console.WriteLine(1); } }; GameSystems.SystemScene.Root.AddChild(guiButton); //GameSystems.SystemScene.Root.AddChild(guiText); GameSystems.SystemScene.Root.AddChild(guiInputText); GameSystems.VisualGuiSystem.GuiRenderDebugProperty = new GuiRenderDebugProperty() { //ShapeProperty = new ShapeDebugProperty(2.0f, new Color<float>(1, 0, 0, 1)) }; GameSystems.RunLoop(); }
static void Main(string[] args) { GameSystems.Initialize(new GameStartInfo() { WindowName = "AssetSystemTestUnit", GameName = "AssetSystemTestUnit", IconName = "", WindowSize = new Size <int>(1920, 1080) }); InitializePackage(); LoadAsset(); foreach (var asset in mAssets) { Console.WriteLine(asset.Instance); } UnLoadAsset(); GameSystems.RunLoop(); }
protected override void OnInitialize() { if (Settings != null) { _streamingManager.System.SetStreamingSettings(Settings.Configurations.Get <StreamingSettings>()); } _sceneSystem.System.InitialSceneUrl = Settings?.DefaultSceneUrl; // Add the input manager // Add it first so that it can obtained by the UI system //Input = new InputManager(Services); //Services.AddOrOverwriteService(Input); //GameSystems.Add(Input); // Initialize the systems GameSystems.Initialize(); Services.AddOrOverwriteService <IGameSystemCollection>(GameSystems); //GameSystems.Add(_scriptSystem.System); //GameSystems.Add(gameFontSystem); //GameSystems.Add(Audio); //var dynamicNavigationMeshSystem = new Stride.Navigation.DynamicNavigationMeshSystem(_services); //GameSystems.Add(dynamicNavigationMeshSystem); Services.AddOrOverwriteService(_scenePreUpdateSystem.System); GameSystems.Add(_scenePreUpdateSystem.System); Services.AddOrOverwriteService(_sceneSystem.System); GameSystems.Add(_sceneSystem.System); Services.AddOrOverwriteService(_scenePostUpdateSystem.System); GameSystems.Add(_scenePostUpdateSystem.System); Services.AddOrOverwriteService <IPhysicsSystem>(_physicsSystem.System); GameSystems.Add(_physicsSystem.System); GameSystems.Add(_networkSystem.System); // Make sure this is added AFTER _sceneSystem due to dependency on it }
static void Main(string[] args) { ///窗体初始化 var adps = GalEngine.Runtime.Graphics.GpuAdapter.EnumerateGraphicsAdapter(); GameSystems.Initialize(new GameStartInfo() { Name = "CAG", Window = new WindowInfo() { Icon = "", Name = "打牌吧!歌姬", Size = new Size(totalWidth, totalHeight) }, Adapter = adps[1]//使用GTX 1050跑 }); //------------------------------------------------------- //------------启动--------- Gui.Add(AllSceneToTakeIn.ClientWindow); GameSystems.RunLoop(); }
static void Main(string[] args) { GameSystems.Initialize(new GameStartInfo { Window = new WindowInfo() { Name = "TestUnit", Size = new Size(1920, 1080) } }); var stream0 = new AudioStream(@"C:\Users\LinkC\source\love.mp3"); var stream1 = new AudioStream(@"C:\Users\LinkC\source\free.wav"); AudioQueue audioQueue0 = new AudioQueue(); AudioQueue audioQueue1 = new AudioQueue(); audioQueue0.Add(stream0, 0, stream0.Length); audioQueue1.Add(stream1, 0, stream1.Length); AudioSource audioSource0 = new AudioSource(stream0.WaveFormat); AudioSource audioSource1 = new AudioSource(stream1.WaveFormat); audioSource0.SubmitAudioQueue(audioQueue0); audioSource1.SubmitAudioQueue(audioQueue1); audioSource0.Start(); audioSource1.Start(); GameSystems.RunLoop(); AudioDevice.Terminate(); }
/// <summary>Called after the Game and GraphicsDevice are created, but before LoadContent. Reference page contains code sample.</summary> protected virtual void Initialize() { GameSystems.Initialize(); }
private void Start() { // 初始化系统 _gameSystems.Initialize(); }
private void Start() { _systems = new GameSystems(Contexts.sharedInstance); _systems.Initialize(); }
/// <summary>Called after the Game is created, but before GraphicsDevice is available and before LoadContent(). Reference page contains code sample.</summary> protected virtual void Initialize() { RenderingThread = Thread.CurrentThread; GameSystems.Initialize(); }
// Use this for initialization void Start() { contexts = Contexts.sharedInstance; gameSystems = new GameSystems(contexts); gameSystems.Initialize(); }