public override void Render() { if (disposing || !IsVisible()) { return; } clippingRI.Clear(DrawBackground ? CluwneLib.SystemColorToSFML(BackgroundColor) : SFML.Graphics.Color.Transparent); clippingRI.BeginDrawing(); foreach (GuiComponent component in components) { if (inner_focus != null && component == inner_focus) { continue; } Point oldPos = component.Position; component.Position = new Point(component.Position.X - (int)scrollbarH.Value, component.Position.Y - (int)scrollbarV.Value); component.Update(0); //2 Updates per frame D: component.Render(); if (CluwneLib.Debug.RenderingDelay > 0) { clippingRI.EndDrawing(); clippingRI.Blit(Position, Color.White); clippingRI.BeginDrawing(); } component.Position = oldPos; component.Update(0); } if (inner_focus != null) { Point oldPos = inner_focus.Position; inner_focus.Position = new Point(inner_focus.Position.X - (int)scrollbarH.Value, inner_focus.Position.Y - (int)scrollbarV.Value); inner_focus.Update(0); //2 Updates per frame D: inner_focus.Render(); inner_focus.Position = oldPos; inner_focus.Update(0); } clippingRI.EndDrawing(); clippingRI.Blit(Position, Color.White); // clippingRI.Blit(Position.X, Position.Y,clippingRI.Height, clippingRI.Width, Color.White, BlitterSizeMode.Crop); scrollbarH.Render(); scrollbarV.Render(); if (DrawBorder) { CluwneLib.drawHollowRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height, BorderSize, Color.Black); } }
public override void Render() { if (disposing || !IsVisible()) { return; } clippingRI.Clear((DrawBackground ? BackgroundColor : Color4.Transparent).Convert()); clippingRI.BeginDrawing(); foreach (GuiComponent component in components) { if (inner_focus != null && component == inner_focus) { continue; } var oldPos = component.Position; component.Position = new Vector2i(component.Position.X - (int)scrollbarH.Value, component.Position.Y - (int)scrollbarV.Value); component.Update(0); //2 Updates per frame D: component.Render(); component.Position = oldPos; component.Update(0); } if (inner_focus != null) { var oldPos = inner_focus.Position; inner_focus.Position = new Vector2i(inner_focus.Position.X - (int)scrollbarH.Value, inner_focus.Position.Y - (int)scrollbarV.Value); inner_focus.Update(0); //2 Updates per frame D: inner_focus.Render(); inner_focus.Position = oldPos; inner_focus.Update(0); } clippingRI.EndDrawing(); clippingRI.Blit(Position.X, Position.Y, clippingRI.Height, clippingRI.Width, Color.White, BlitterSizeMode.None); scrollbarH.Render(); scrollbarV.Render(); if (DrawBorder) { CluwneLib.drawHollowRectangle(ClientArea.Left, ClientArea.Top, ClientArea.Width, ClientArea.Height, BorderSize, Color4.Black); } clippingRI.EndDrawing(); }
public override void Render() { if (disposing || !IsVisible()) { return; } clippingRI.Clear(DrawBackground ? BackgroundColor : Color.Transparent); clippingRI.BeginDrawing(); foreach (GuiComponent component in components) { if (inner_focus != null && component == inner_focus) { continue; } Point oldPos = component.Position; component.Position = new Point(component.Position.X - (int)scrollbarH.Value, component.Position.Y - (int)scrollbarV.Value); component.Update(0); //2 Updates per frame D: component.Render(); component.Position = oldPos; component.Update(0); } if (inner_focus != null) { Point oldPos = inner_focus.Position; inner_focus.Position = new Point(inner_focus.Position.X - (int)scrollbarH.Value, inner_focus.Position.Y - (int)scrollbarV.Value); inner_focus.Update(0); //2 Updates per frame D: inner_focus.Render(); inner_focus.Position = oldPos; inner_focus.Update(0); } clippingRI.EndDrawing(); clippingRI.Blit(Position.X, Position.Y, clippingRI.Width, clippingRI.Height, Color.White, BlitterSizeMode.Crop); scrollbarH.Render(); scrollbarV.Render(); if (DrawBorder) { Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height, Color.Black); } }
protected override void OnRenderFrame(FrameEventArgs e) { GL.Viewport(0, 0, Width, Height); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); //_graphicsDevice.Camera = _graphicsDevice.DebugBatch.ScreenCamera; _guiRoot.Render(_graphicsDevice); foreach (IGuiComponent i in debugGuis) { _graphicsDevice.DebugBatch.DrawPrimitive(new Minotaur.Graphics.Primitives.Box(new Vector3(i.AbsolutePosition.X, i.AbsolutePosition.Y, 0), new Vector3(i.AbsolutePosition.X + i.AbsoluteSize.X, i.AbsolutePosition.Y + i.AbsoluteSize.Y, 0)), color: Color4.Red); } //_graphicsDevice.DebugBatch.DrawPrimitive(new Minotaur.Graphics.Primitives.Box(new Vector3(_checkBox.AbsolutePosition), new Vector3(_checkBox.AbsolutePosition + _checkBox.AbsoluteSize)), CoordinateSpace.Screen, color: Color4.Red); //_graphicsDevice.DebugBatch.DrawString("Test", world: Matrix4.CreateTranslation(500, 500, 0)); //Sprite sprite = new Sprite(_checkBoxOn, 0, 0, 0, 0); ////spriteBatch.Begin(SpriteSortMode.Deffered, BlendState.AlphaBlend); //spriteBatch.Begin(SpriteSortMode.Immediate, new RenderState() { BlendState = BlendState.AlphaBlend }, null, Shaders.FontShader); //spriteBatch.Draw(new Sprite(_font.Texture, 0, 0, 0, 0), 200, 200); //spriteBatch.End(); //_graphicsDevice.DebugBatch.DrawPrimitive(new Minotaur.Graphics.Primitives.Box( // new Vector3(200, 200, 0), // new Vector3(328, 328, 0)), // CoordinateSpace.Screen, color: Color4.Red); //_graphicsDevice.DebugBatch.DrawPrimitive(new Minotaur.Graphics.Primitives.Box( // new Vector3(200 + _font.Texture.Width * 0.5625f, 200 + _font.Texture.Height * 0.429275f, 0), // new Vector3(200 + _font.Texture.Width * 0.625f, 200 + _font.Texture.Height * 0.484375f, 0)), // CoordinateSpace.Screen, color: Color4.Red); //shader = Shaders.SpriteShader; //SlicedSprite buttonSprite = new SlicedSprite(_checkBoxOn, 0, 0, 0, 0, 12, 11, 12, 11); //ushort[] indices; //VertexPositionColorTexture[] vertices = buttonSprite.GetVertices(100, 100, 200, 200, 0, Color4.White, out indices); //VertexBuffer vb = VertexBuffer.Create(vertices[0].VertexFormat, vertices); //IndexBuffer ib = IndexBuffer.Create(indices); //VertexArray vao = new VertexArray(vb, ib); //shader.Bind(); //Sampler sampler = Sampler.Create(_checkBoxOn); //shader.BindUniforms(new Dictionary<string, IUniformValue>() { {"Texture", UniformValue.Create(sampler) } //}); //shader.Unbind(); ////_graphicsDevice.RenderState.BlendState = BlendState.AlphaBlend; //_graphicsDevice.DrawVertexArray(vao, shader); //vertices = buttonSprite.GetVertices(300, 300, 200, 200, 0, Color4.White, out indices); //vb = VertexBuffer.Create(vertices[0].VertexFormat, vertices); //ib = IndexBuffer.Create(indices); //vao = new VertexArray(vb, ib); //shader.Bind(); //sampler = Sampler.Create(_checkBoxOff); //shader.BindUniforms(new Dictionary<string, IUniformValue>() { {"Texture", UniformValue.Create(sampler) } //}); //shader.Unbind(); //_graphicsDevice.DrawVertexArray(vao, shader); //_depthTexture.Bind(); //GL.CopyTexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.DepthComponent, 0, 0, 800, 600, 0); //wireframeShader.Bind(); //wireframeShader.BindUniforms(new System.Collections.Generic.Dictionary<string, IUniformValue>() //{ // {"Texture", UniformValue.Create(Sampler.Create(_depthTexture))} //}); //_graphicsDevice.RenderState = new RenderState() { BlendState = BlendState.Opaque, DepthState = DepthState.None }; //VertexBuffer vbo = VertexBuffer.Create(VertexFormat.PositionColorTexture, new VertexPositionColorTexture[] { // new VertexPositionColorTexture(new Vector3(0, 0, 0), new Vector4(1), new Vector2(0)), // new VertexPositionColorTexture(new Vector3(0, 600, 0), new Vector4(1), new Vector2(0, 1)), // new VertexPositionColorTexture(new Vector3(800, 0, 0), new Vector4(1), new Vector2(1, 0)), // new VertexPositionColorTexture(new Vector3(800, 600, 0), new Vector4(1), new Vector2(1)) //}, beginMode: BeginMode.TriangleStrip); //VertexArray vao = new VertexArray(vbo, null); //_graphicsDevice.DrawVertexArray(vao, wireframeShader); _graphicsDevice.DrawFPS(); _graphicsDevice.DrawStatitics(0, 550); _graphicsDevice.Display((float)e.Time); }