public static int RegisterHotKey(Keys key, KeyModifiers modifiers) { WindowReadyEvent.WaitOne(); var id = Interlocked.Increment(ref _id); _wnd.Invoke(new RegisterHotKeyDelegate(RegisterHotKeyInternal), _hwnd, id, (uint)modifiers, (uint)key); return(id); }
public MessageWindow() { _wnd = this; _hwnd = Handle; WindowReadyEvent.Set(); }
protected bool _InitOgre() { lock (this) { IntPtr hWnd = IntPtr.Zero; foreach (PresentationSource source in PresentationSource.CurrentSources) { var hwndSource = (source as HwndSource); if (hwndSource != null) { hWnd = hwndSource.Handle; break; } } if (hWnd == IntPtr.Zero) { return(false); } CallResourceItemLoaded(new ResourceLoadEventArgs("Engine", 0)); WindowReadyEvent?.Invoke(this, new WindowEventArgs { WinPtr = hWnd }); GameWPF.Singleton.ExternalWindowHandle = hWnd; if (GameWPF.Singleton.getRoot() == null) { GameWPF.Singleton.initApp(); } _root = GameWPF.Singleton.getRoot(); if (_root == null) { throw new Exception("Ogre not Initialised properly, need to register WindowReadyEvent and Initialize"); } _renderWindow = GameWPF.Singleton.getRenderWindow(); this.Dispatcher.Invoke( (MethodInvoker) delegate { IsFrontBufferAvailableChanged += _isFrontBufferAvailableChanged; Initialised?.Invoke(this, new RoutedEventArgs()); GameWPF.Singleton.Game.IsEditor = true; GameWPF.Singleton.SetupGame(); var _sceneManager = GameWPF.Singleton.Game.CurrentScene.GetOgreSceneManager(); _camera = _sceneManager.createCamera("EditorCamera"); //_camera.setAutoAspectRatio(true); _camera.setNearClipDistance(5); SceneNode camnode = _sceneManager.getRootSceneNode().createChildSceneNode(/* TODO: Name Component? */); camnode.setPosition(0f, 50, 10f); camnode.yaw(new Radian(0f)); camnode.pitch(new Radian(-1.2f)); camnode.attachObject(_camera); ReInitRenderTarget(); AttachRenderTarget(true); OnFrameRateChanged(this.FrameRate); _currentThread = null; }); return(true); } }