internal void Render() { if (_renderers.Length == 0) { Debug.Error("There are no Renderers in the Scene!"); return; } // Renderers should always have those that require a RenderTarget first. They clear themselves and set themselves as // the current RenderTarget when they render. If the first Renderer wants the sceneRenderTarget we set and clear it now. if (_renderers[0].WantsToRenderToSceneRenderTarget) { GraphicsDeviceExt.SetRenderTarget(Core.GraphicsDevice, _sceneRenderTarget); Core.GraphicsDevice.Clear(ClearColor); } var lastRendererHadRenderTarget = false; for (var i = 0; i < _renderers.Length; i++) { // MonoGame follows the XNA bullshit implementation so it will clear the entire buffer if we change the render target even if null. // Because of that, we track when we are done with our RenderTargets and clear the scene at that time. if (lastRendererHadRenderTarget && _renderers.Buffer[i].WantsToRenderToSceneRenderTarget) { GraphicsDeviceExt.SetRenderTarget(Core.GraphicsDevice, _sceneRenderTarget); Core.GraphicsDevice.Clear(ClearColor); // force a Camera matrix update to account for the new Viewport size if (_renderers.Buffer[i].Camera != null) { _renderers.Buffer[i].Camera.ForceMatrixUpdate(); } Camera.ForceMatrixUpdate(); } _renderers.Buffer[i].Render(this); lastRendererHadRenderTarget = _renderers.Buffer[i].RenderTexture != null; } }
void OnButtonClicked(Button button) { if (_parameterType == null) { (_memberInfo as MethodInfo).Invoke(_target, new object[] { }); } else { // extract the param and properly cast it var parameters = new object[1]; try { if (_parameterType == typeof(float)) { parameters[0] = float.Parse(_textField.GetText()); } else if (_parameterType == typeof(int)) { parameters[0] = int.Parse(_textField.GetText()); } else if (_parameterType == typeof(bool)) { parameters[0] = bool.Parse(_textField.GetText()); } else { parameters[0] = _textField.GetText(); } (_memberInfo as MethodInfo).Invoke(_target, parameters); } catch (Exception e) { Debug.Error(e.ToString()); } } }