public static void Initialize() { SetProcessDPIAware(); NetFrameworkShim.SetShimImpl(new Shim.FullNetFrameworkShim()); new WindowsRuntimePlatformInfo(); //Make sure the paths are setup correctly on windows to find 32/64 bit binaries. try { //Check bitness and determine path String executionPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); String nativeLibPath; if (Environment.Is64BitProcess) { nativeLibPath = Path.Combine(executionPath, "x64"); } else { nativeLibPath = Path.Combine(executionPath, "x86"); } if (Directory.Exists(nativeLibPath)) { RuntimePlatformInfo.addPath(nativeLibPath); } } catch (Exception) { } //Find tabtip, this has a lot of combos since we have to run the 64 bit version on 64 bit oses even if the current process is 32 bit String tabTipLoc = null; if (Environment.Is64BitOperatingSystem) { tabTipLoc = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles), "Microsoft Shared\\ink\\TabTip.exe"); if (!Environment.Is64BitProcess) { //Hacky, but should help find the 64 bit tabtip when running as 32 bit on a 64 bit os tabTipLoc = tabTipLoc.Replace(" (x86)", ""); } } else { tabTipLoc = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles), "Microsoft Shared\\ink\\TabTip32.exe"); } if (File.Exists(tabTipLoc)) { Win32Window_setKeyboardPathAndWindow(tabTipLoc, "IPTip_Main_Window"); } }
public OgreModelEditorController(App app, String defaultModel) { this.app = app; //Create the log. logListener = new LogFileListener(); logListener.openLogFile(OgreModelEditorConfig.DocRoot + "/log.log"); Log.Default.addLogListener(logListener); //Main window mainWindow = new NativeOSWindow("Ogre Model Editor", new IntVector2(-1, -1), new IntSize2(OgreModelEditorConfig.EngineConfig.HorizontalRes, OgreModelEditorConfig.EngineConfig.VerticalRes)); mainWindow.Closed += mainWindow_Closed; //Setup DPI ScaleHelper._setScaleFactor(mainWindow.WindowScaling); //Initailize plugins MyGUIInterface.EventLayerKey = EventLayers.Main; GuiFrameworkCamerasInterface.MoveCameraEventLayer = EventLayers.Cameras; GuiFrameworkCamerasInterface.SelectWindowEventLayer = EventLayers.AfterMain; GuiFrameworkCamerasInterface.ShortcutEventLayer = EventLayers.Main; GuiFrameworkEditorInterface.ToolsEventLayers = EventLayers.Tools; //Setup microcode cache load OgreInterface.MicrocodeCachePath = Path.Combine(OgreModelEditorConfig.DocRoot, "ShaderCache.mcc"); OgreInterface.AllowMicrocodeCacheLoad = OgreModelEditorConfig.LastShaderVersion == UnifiedMaterialBuilder.Version; OgreModelEditorConfig.LastShaderVersion = UnifiedMaterialBuilder.Version; OgreInterface.TrackMemoryLeaks = true; OgreInterface.CompressedTextureSupport = OgreModelEditorConfig.CompressedTextureSupport; RuntimePlatformInfo.addPath(OgreModelEditorConfig.OpenGLESEmulatorPath); pluginManager = new PluginManager(OgreModelEditorConfig.ConfigFile, new ServiceCollection()); pluginManager.OnConfigureDefaultWindow = createWindow; pluginManager.addPluginAssembly(typeof(OgreInterface).Assembly); pluginManager.addPluginAssembly(typeof(NativePlatformPlugin).Assembly); pluginManager.addPluginAssembly(typeof(MyGUIInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkCamerasInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkEditorInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkDebuggingInterface).Assembly); pluginManager.initializePlugins(); frameClearManager = new FrameClearManager(OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget, new Color(0.2f, 0.2f, 0.2f)); lightManager = pluginManager.RendererPlugin.createSceneViewLightManager(); //Core resources MyGUIInterface.Instance.CommonResourceGroup.addResource(this.GetType().AssemblyQualifiedName, "EmbeddedResource", true); OgreResourceGroupManager.getInstance().addResourceLocation(GetType().AssemblyQualifiedName, "EmbeddedResource", "DebugShaders", true); OgreResourceGroupManager.getInstance().initializeAllResourceGroups(); //Intialize the platform systemTimer = new NativeSystemTimer(); mainTimer = new NativeUpdateTimer(systemTimer); mainTimer.FramerateCap = OgreModelEditorConfig.EngineConfig.MaxFPS; idleHandler = new IdleHandler(mainTimer.OnIdle); inputHandler = new NativeInputHandler(mainWindow, false); eventManager = new EventManager(inputHandler, Enum.GetValues(typeof(EventLayers))); eventUpdate = new EventUpdateListener(eventManager); mainTimer.addUpdateListener(eventUpdate); mainTimer.addUpdateListener(updateEventListener); pluginManager.setPlatformInfo(mainTimer, eventManager); GuiFrameworkInterface.Instance.handleCursors(mainWindow); //Layout Chain mdiLayout = new MDILayoutManager(); //Scene views sceneViewController = new SceneViewController(mdiLayout, eventManager, mainTimer, pluginManager.RendererPlugin.PrimaryWindow, MyGUIInterface.Instance.OgrePlatform.RenderManager, null); sceneStatsDisplayManager = new SceneStatsDisplayManager(sceneViewController, OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget); sceneStatsDisplayManager.StatsVisible = true; sceneViewController.createWindow("Camera 1", OgreModelEditorConfig.CameraConfig.MainCameraPosition, OgreModelEditorConfig.CameraConfig.MainCameraLookAt, Vector3.Min, Vector3.Max, 0.0f, float.MaxValue, 100); virtualTextureLink = new VirtualTextureSceneViewLink(this); materialController = new MaterialController(this); //Tools objectMover = new SimObjectMover("ModelMover", PluginManager.Instance.RendererPlugin, eventManager, sceneViewController); mainForm = new OgreModelEditorMain(this); LayoutChain layoutChain = new LayoutChain(); layoutChain.addLink(new SingleChildChainLink(GUILocationNames.Taskbar, mainForm.LayoutContainer), true); layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.FullscreenPopup), true); layoutChain.SuppressLayout = true; layoutChain.addLink(new MDIChainLink(GUILocationNames.MDI, mdiLayout), true); layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.ContentAreaPopup), true); layoutChain.addLink(new FinalChainLink("SceneViews", mdiLayout.DocumentArea), true); layoutChain.SuppressLayout = false; guiManager = new GUIManager(mdiLayout, mainWindow); guiManager.createGUILayout(layoutChain); layoutChain.layout(); splashScreen = new SplashScreen(mainWindow, 100, "OgreModelEditor.GUI.SplashScreen.SplashScreen.layout", "OgreModelEditor.GUI.SplashScreen.SplashScreen.xml"); splashScreen.Hidden += splashScreen_Hidden; splashScreen.StatusUpdated += splashScreen_StatusUpdated; splashScreen.updateStatus(0, "Loading..."); idleHandler.runTemporaryIdle(finishInitialization(defaultModel)); }
public MedicalController(NativeOSWindow mainWindow) { //Create the log. logListener = new LogFileListener(); logListener.openLogFile(MedicalConfig.LogFile); Log.Default.addLogListener(logListener); Log.ImportantInfo("Running from directory {0}", FolderFinder.ExecutableFolder); //Create pluginmanager pluginManager = new PluginManager(MedicalConfig.ConfigFile, services); //Configure the filesystem VirtualFileSystem archive = VirtualFileSystem.Instance; //Setup microcode cache load OgreInterface.MicrocodeCachePath = Path.Combine(FolderFinder.LocalPrivateDataFolder, "ShaderCache.mcc"); OgreInterface.AllowMicrocodeCacheLoad = MedicalConfig.LastShaderVersion == UnifiedMaterialBuilder.Version; OgreInterface.TrackMemoryLeaks = MedicalConfig.TrackMemoryLeaks; MedicalConfig.LastShaderVersion = UnifiedMaterialBuilder.Version; MyGUIInterface.EventLayerKey = EventLayers.Gui; MyGUIInterface.CreateGuiGestures = MedicalConfig.EnableMultitouch && PlatformConfig.TouchType == TouchType.Screen; MyGUIInterface.TrackMemoryLeaks = MedicalConfig.TrackMemoryLeaks; RuntimePlatformInfo.addPath(MedicalConfig.OpenGLESEmulatorPath); //Configure plugins pluginManager.OnConfigureDefaultWindow = delegate(out WindowInfo defaultWindow) { //Setup main window defaultWindow = new WindowInfo(mainWindow, "Primary"); defaultWindow.Fullscreen = MedicalConfig.EngineConfig.Fullscreen; defaultWindow.MonitorIndex = 0; if (MedicalConfig.EngineConfig.Fullscreen) { mainWindow.setSize(MedicalConfig.EngineConfig.HorizontalRes, MedicalConfig.EngineConfig.VerticalRes); mainWindow.ExclusiveFullscreen = true; defaultWindow.Width = MedicalConfig.EngineConfig.HorizontalRes; defaultWindow.Height = MedicalConfig.EngineConfig.VerticalRes; } else { mainWindow.Maximized = true; } mainWindow.show(); }; GuiFrameworkCamerasInterface.CameraTransitionTime = MedicalConfig.CameraTransitionTime; GuiFrameworkCamerasInterface.DefaultCameraButton = MedicalConfig.CameraMouseButton; GuiFrameworkCamerasInterface.MoveCameraEventLayer = EventLayers.Cameras; GuiFrameworkCamerasInterface.SelectWindowEventLayer = EventLayers.AfterGui; GuiFrameworkCamerasInterface.ShortcutEventLayer = EventLayers.Gui; GuiFrameworkCamerasInterface.TouchType = PlatformConfig.TouchType; GuiFrameworkCamerasInterface.PanKey = PlatformConfig.PanKey; GuiFrameworkEditorInterface.ToolsEventLayers = EventLayers.Tools; pluginManager.addPluginAssembly(typeof(OgreInterface).Assembly); pluginManager.addPluginAssembly(typeof(BulletInterface).Assembly); pluginManager.addPluginAssembly(typeof(NativePlatformPlugin).Assembly); pluginManager.addPluginAssembly(typeof(MyGUIInterface).Assembly); pluginManager.addPluginAssembly(typeof(RocketInterface).Assembly); pluginManager.addPluginAssembly(typeof(SoundPluginInterface).Assembly); pluginManager.addPluginAssembly(typeof(BEPUikInterface).Assembly); pluginManager.addPluginAssembly(typeof(SimulationPlugin).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkInterface).Assembly); pluginManager.addPluginAssembly(typeof(RocketWidgetInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkCamerasInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkEditorInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkDebuggingInterface).Assembly); pluginManager.initializePlugins(); performanceMetricTimer = new NativeSystemTimer(); PerformanceMonitor.setupEnabledState(performanceMetricTimer); //Intialize the platform BulletInterface.Instance.ShapeMargin = 0.005f; systemTimer = new NativeSystemTimer(); mainTimer = new NativeUpdateTimer(systemTimer); if (OgreConfig.VSync && MedicalConfig.EngineConfig.FPSCap < 300) { //Use a really high framerate cap if vsync is on since it will cap our //framerate for us. If the user has requested a higher rate use it anyway. mainTimer.FramerateCap = 300; } else { mainTimer.FramerateCap = MedicalConfig.EngineConfig.FPSCap; } inputHandler = new NativeInputHandler(mainWindow, MedicalConfig.EnableMultitouch); eventManager = new EventManager(inputHandler, Enum.GetValues(typeof(EventLayers))); eventUpdate = new EventUpdateListener(eventManager); mainTimer.addUpdateListener(eventUpdate); pluginManager.setPlatformInfo(mainTimer, eventManager); medicalUpdate = new MedicalUpdate(this); mainTimer.addUpdateListener(medicalUpdate); //Initialize controllers medicalScene = new MedicalSceneController(pluginManager); frameClearManager = new FrameClearManager(OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget); SoundConfig.initialize(MedicalConfig.ConfigFile); GuiFrameworkInterface.Instance.handleCursors(mainWindow); SoundPluginInterface.Instance.setResourceWindow(mainWindow); TouchMouseGuiForwarder = new TouchMouseGuiForwarder(eventManager, inputHandler, systemTimer, mainWindow, EventLayers.Last); TouchMouseGuiForwarder.ForwardTouchesAsMouse = PlatformConfig.ForwardTouchAsMouse; var myGuiKeyboard = new MyGUIOnscreenKeyboardManager(TouchMouseGuiForwarder); var rocketKeyboard = new RocketWidgetOnscreenKeyboardManager(TouchMouseGuiForwarder); }