public override void eventOccured() { switch (EventType) { case KnownRenderSystemEvents.DeviceLost: break; case KnownRenderSystemEvents.DeviceRestored: RocketWidgetManager.deviceRestored(); break; } }
public void Dispose() { RocketInterface.Instance.TextureLoaded -= renderOnNextFrame; if (RocketWidgetDisposing != null) { RocketWidgetDisposing.Invoke(this); } RocketWidgetManager.rocketWidgetDisposed(name); imageBox.MouseButtonPressed -= imageBox_MouseButtonPressed; imageBox.MouseButtonReleased -= imageBox_MouseButtonReleased; imageBox.MouseMove -= imageBox_MouseMove; imageBox.MouseDrag -= imageBox_MouseMove; imageBox.MouseWheel -= imageBox_MouseWheel; imageBox.KeyButtonPressed -= imageBox_KeyButtonPressed; imageBox.KeyButtonReleased -= imageBox_KeyButtonReleased; imageBox.EventScrollGesture -= imageBox_EventScrollGesture; //In mygui lost/got focus is mouse entered / left imageBox.MouseSetFocus -= imageBox_MouseSetFocus; imageBox.MouseLostFocus -= imageBox_MouseLostFocus; imageBox.RootKeyChangeFocus -= imageBox_RootKeyChangeFocus; if (context != null) { context.Dispose(); } if (vp != null) { renderTexture.destroyViewport(vp); } if (pixelBuffer != null) { pixelBuffer.Dispose(); } if (texture != null) { texture.Dispose(); RenderManager.Instance.destroyTexture(textureName); } if (camera != null) { sceneManager.destroyCamera(camera); } if (sceneManager != null) { Root.getSingleton().destroySceneManager(sceneManager); } }
public RocketWidget(ImageBox imageBox, bool transparent, bool autoCreateTexture = true) { this.imageBox = imageBox; if (transparent) { ogreTextureFormat = OgrePlugin.PixelFormat.PF_A8R8G8B8; } this.name = RocketWidgetManager.generateRocketWidgetName(this); //Create ogre stuff sceneManager = Root.getSingleton().createSceneManager(SceneType.ST_GENERIC, "__libRocketScene_" + name); camera = sceneManager.createCamera("libRocketCamera"); //Create context context = Core.CreateContext(name, new Vector2i(imageBox.Width, imageBox.Height)); context.GetRootElement().AddEventListener("focus", new ElementFocusListener(this), false); context.GetRootElement().AddEventListener("blur", new ElementBlurredListener(this), false); renderQueueListener = new RocketRenderQueueListener(context, (RenderInterfaceOgre3D)Core.GetRenderInterface()); renderQueueListener.FrameCompleted += new Action(renderQueueListener_FrameCompleted); sceneManager.addRenderQueueListener(renderQueueListener); imageBox.NeedKeyFocus = true; imageBox.NeedMouseFocus = true; imageBox.MouseButtonPressed += imageBox_MouseButtonPressed; imageBox.MouseButtonReleased += imageBox_MouseButtonReleased; imageBox.MouseMove += imageBox_MouseMove; imageBox.MouseDrag += imageBox_MouseMove; imageBox.MouseWheel += imageBox_MouseWheel; imageBox.KeyButtonPressed += imageBox_KeyButtonPressed; imageBox.KeyButtonReleased += imageBox_KeyButtonReleased; imageBox.EventScrollGesture += imageBox_EventScrollGesture; //In mygui lost/got focus is mouse entered / left imageBox.MouseSetFocus += imageBox_MouseSetFocus; imageBox.MouseLostFocus += imageBox_MouseLostFocus; imageBox.RootKeyChangeFocus += imageBox_RootKeyChangeFocus; RocketInterface.Instance.TextureLoaded += renderOnNextFrame; if (autoCreateTexture) { resized(); } determineRenderingActive(); }