public static void WebPlayer_Message(EngineApp.WebPlayerMessages message, IntPtr data) { try { switch (message) { case EngineApp.WebPlayerMessages.Init: unsafe { EngineApp.WebPlayerInitData *initData = (EngineApp.WebPlayerInitData *)data; if (!VirtualFileSystem.Init("user:Logs/WebPlayer.log", false, initData->ExecutableDirectoryPath, null, null)) { return; } Log.DumpToFile(string.Format("WebPlayer {0}\r\n", EngineVersionInformation.Version)); //set render settings //RendererWorld.InitializationOptions.MaxPixelShadersVersion = RendererWorld.MaxPixelShadersVersions.PS0; //RendererWorld.InitializationOptions.MaxVertexShadersVersion = RendererWorld.MaxVertexShadersVersions.VS0; //RendererWorld.InitializationOptions.FullSceneAntialiasing = 0; //RendererWorld.InitializationOptions.FilteringMode = RendererWorld.FilteringModes.Trilinear; EngineApp.Init(new GameEngineApp()); EngineApp.WebPlayer_Message(message, data); EngineConsole.Init(); EngineApp.Instance.Config.RegisterClassParameters(typeof(GameEngineApp)); EngineApp.Instance.Create(); } break; case EngineApp.WebPlayerMessages.Shutdown: EngineApp.WebPlayer_Message(message, data); EngineApp.Shutdown(); Log.DumpToFile("Program END\r\n"); VirtualFileSystem.Shutdown(); break; case EngineApp.WebPlayerMessages.WindowMessage: EngineApp.WebPlayer_Message(message, data); break; } } catch (Exception e) { Log.FatalAsException(e.ToString()); } }
static void Main2() { //initialize file sytem of the engine if (!VirtualFileSystem.Init("user:Logs/Game.log", true, null, null, null, null)) { return; } //configure general settings EngineApp.ConfigName = "user:Configs/Game.config"; if (PlatformInfo.Platform == PlatformInfo.Platforms.Windows) { EngineApp.UseDirectInputForMouseRelativeMode = true; } EngineApp.AllowJoysticksAndCustomInputDevices = true; EngineApp.AllowWriteEngineConfigFile = true; EngineApp.AllowChangeVideoMode = true; //Change Floating Point Model for FPU math calculations. Default is Strict53Bits. //FloatingPointModel.Model = FloatingPointModel.Models.Strict53Bits; //init engine application EngineApp.Init(new GameEngineApp()); //enable support field and properties serialization for GameEngineApp class. EngineApp.Instance.Config.RegisterClassParameters(typeof(GameEngineApp)); //update window EngineApp.Instance.WindowTitle = "Game"; if (PlatformInfo.Platform == PlatformInfo.Platforms.Windows) { EngineApp.Instance.Icon = Game.Properties.Resources.Logo; } //create game console EngineConsole.Init(); //EngineApp.Instance.SuspendWorkingWhenApplicationIsNotActive = false; //create and run application loop. if (EngineApp.Instance.Create()) { EngineApp.Instance.Run(); } EngineApp.Shutdown(); Log.DumpToFile("Program END\r\n"); VirtualFileSystem.Shutdown(); if (needRestartApplication) { Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location, ""); } }
static void Main2() { if (!VirtualFileSystem.Init("user:Logs/Game.log", true, null, Directory.GetCurrentDirectory() + "\\..\\Data", Directory.GetCurrentDirectory() + "\\..\\UserSettings")) { return; } EngineApp.ConfigName = "user:Configs/Game.config"; if (PlatformInfo.Platform == PlatformInfo.Platforms.Windows) { EngineApp.UseDirectInputForMouseRelativeMode = true; } EngineApp.AllowJoysticksAndCustomInputDevices = true; EngineApp.AllowWriteEngineConfigFile = true; EngineApp.AllowChangeVideoMode = true; // enable vsync. should no have verticalSync option in the Engine.config //RendererWorld.InitializationOptions.VerticalSync = true; //Change Floating Point Model for FPU math calculations. Default is Strict53Bits. //FloatingPointModel.Model = FloatingPointModel.Models.Strict53Bits; EngineApp.Init(new GameEngineApp()); EngineApp.Instance.WindowTitle = "AOT"; if (PlatformInfo.Platform == PlatformInfo.Platforms.Windows) { EngineApp.Instance.Icon = AOT.Properties.Resources.Logo; } EngineConsole.Init(); EngineApp.Instance.Config.RegisterClassParameters(typeof(GameEngineApp)); //EngineApp.Instance.SuspendWorkingWhenApplicationIsNotActive = false; if (EngineApp.Instance.Create()) { EngineApp.Instance.Run(); } EngineApp.Shutdown(); Log.DumpToFile("Program END\r\n"); VirtualFileSystem.Shutdown(); }
static void Main2() { if (!VirtualFileSystem.Init("user:Logs/Game.log", true, null, null, null)) { return; } Log.DumpToFile(string.Format("Game {0}\r\n", EngineVersionInformation.Version)); EngineApp.ConfigName = "user:Configs/Game.config"; EngineApp.UseSystemMouseDeviceForRelativeMode = true; EngineApp.AllowJoysticksAndCustomInputDevices = true; EngineApp.AllowWriteEngineConfigFile = true; EngineApp.AllowChangeVideoMode = true; EngineApp.Init(new GameEngineApp()); EngineApp.Instance.WindowTitle = "Game"; if (PlatformInfo.Platform == PlatformInfo.Platforms.Windows) { EngineApp.Instance.Icon = Game.Properties.Resources.Logo; } EngineConsole.Init(); EngineApp.Instance.Config.RegisterClassParameters(typeof(GameEngineApp)); if (EngineApp.Instance.Create()) { EngineApp.Instance.Run(); } EngineApp.Shutdown(); Log.DumpToFile("Program END\r\n"); VirtualFileSystem.Shutdown(); }
public static void EngineApp_AppCreateAfter() { Log.Handlers.InvisibleInfoHandler += InvisibleLog_Handlers_InfoHandler; Log.Handlers.InfoHandler += Log_Handlers_InfoHandler; Log.Handlers.WarningHandler += Log_Handlers_WarningHandler; Log.Handlers.ErrorHandler += Log_Handlers_ErrorHandler; Log.Handlers.FatalHandler += Log_Handlers_FatalHandler; EngineApp.RegisterConfigParameter += EngineApp_RegisterConfigParameter; EngineConsole.Init(); //!!!! //GameControlsManager.Init(); //UIControl engineLoadingWindow = ResourceManager.LoadSeparateInstance<UIControl>( "Base\\UI\\Windows\\EngineLoadingWindow.ui", false, null ); //if( engineLoadingWindow != null ) // MainViewport.UIContainer.AddComponent( engineLoadingWindow ); ////Subcribe to callbacks during engine loading. We will render scene from callback. //LongOperationCallbackManager.Subscribe( LongOperationCallbackManager_LoadingCallback, programLoadingWindow ); EngineApp.Tick += EngineApp_Tick; ////finish initialization of materials and hide loading window. ////!!!!!! ////LongOperationCallbackManager.Unsubscribe(); //if( engineLoadingWindow != null ) // engineLoadingWindow.RemoveFromParent( true ); //subscribe to main viewport events { MainViewport.KeyDown += MainViewport_KeyDown; MainViewport.KeyPress += MainViewport_KeyPress; MainViewport.KeyUp += MainViewport_KeyUp; MainViewport.MouseDown += MainViewport_MouseDown; MainViewport.MouseUp += MainViewport_MouseUp; MainViewport.MouseDoubleClick += MainViewport_MouseDoubleClick; MainViewport.MouseMove += MainViewport_MouseMove; MainViewport.MouseWheel += MainViewport_MouseWheel; MainViewport.JoystickEvent += MainViewport_JoystickEvent; MainViewport.SpecialInputDeviceEvent += MainViewport_SpecialInputDeviceEvent; //!!!!!Tick += MainViewport.UpdateBegin += MainViewport_UpdateBegin; MainViewport.UpdateBeforeOutput += MainViewport_UpdateBeforeOutput; MainViewport.UpdateEnd += MainViewport_UpdateEnd; } //change application title if (EngineApp.CreatedInsideEngineWindow != null) { EngineApp.CreatedInsideEngineWindow.Title = ProjectSettings.Get.ProjectName; } //update sound volume if (EngineApp.DefaultSoundChannelGroup != null) { EngineApp.DefaultSoundChannelGroup.Volume = soundVolume; } //create music channel group musicChannelGroup = SoundWorld.CreateChannelGroup("Music"); if (musicChannelGroup != null) { SoundWorld.MasterChannelGroup.AddGroup(musicChannelGroup); musicChannelGroup.Volume = musicVolume; } PlayerInv.Name = "PlayerInv"; PlayerInv.InitialItems.Add("Water, 20"); PlayerInv.InitialItems.Add("Seed, 4"); PlayerInv.InitialItems.Add("Empty, 0"); PlayerInv.InitialItems.Add("Empty, 0"); PlayerInv.InitialItems.Add("Empty, 0"); PlayerInv.CalcInitialItems(); PlayerInv.CalcImagePaths(); }