public ScrollableContainer(string uniqueName, Vector2i size, IResourceManager resourceManager) { _resourceManager = resourceManager; name = uniqueName; Size = size; //if (RenderTargetCache.Targets.Contains(uniqueName)) // //Now this is an ugly hack to work around duplicate RenderImages. Have to fix this later. // uniqueName = uniqueName + Guid.NewGuid(); clippingRI = new RenderImage(uniqueName, (uint)Size.X, (uint)Size.Y); //clippingRI.SourceBlend = AlphaBlendOperation.SourceAlpha; //clippingRI.DestinationBlend = AlphaBlendOperation.InverseSourceAlpha; //clippingRI.SourceBlendAlpha = AlphaBlendOperation.SourceAlpha; //clippingRI.DestinationBlendAlpha = AlphaBlendOperation.InverseSourceAlpha; clippingRI.BlendSettings.ColorSrcFactor = BlendMode.Factor.SrcAlpha; clippingRI.BlendSettings.ColorDstFactor = BlendMode.Factor.OneMinusSrcAlpha; clippingRI.BlendSettings.AlphaSrcFactor = BlendMode.Factor.SrcAlpha; clippingRI.BlendSettings.AlphaDstFactor = BlendMode.Factor.OneMinusSrcAlpha; scrollbarH = new Scrollbar(true, _resourceManager); scrollbarV = new Scrollbar(false, _resourceManager); scrollbarV.size = Size.Y; scrollbarH.Update(0); scrollbarV.Update(0); Update(0); }
public ScrollableContainer(string uniqueName, Size size, IResourceManager resourceManager) { _resourceManager = resourceManager; Size = size; //if (RenderTargetCache.Targets.Contains(uniqueName)) // //Now this is an ugly hack to work around duplicate RenderImages. Have to fix this later. // uniqueName = uniqueName + Guid.NewGuid(); clippingRI = new RenderImage((uint)Size.Width,(uint) Size.Height); clippingRI.setName = uniqueName; clippingRI.setImageBuffer = ImageBufferFormats.BufferRGB888A8; scrollbarH = new Scrollbar(true, _resourceManager); scrollbarV = new Scrollbar(false, _resourceManager); scrollbarV.size = Size.Height; scrollbarH.Update(0); scrollbarV.Update(0); //clippingRI.SourceBlend = AlphaBlendOperation.SourceAlpha; //clippingRI.DestinationBlend = AlphaBlendOperation.InverseSourceAlpha; //clippingRI.SourceBlendAlpha = AlphaBlendOperation.SourceAlpha; //clippingRI.DestinationBlendAlpha = AlphaBlendOperation.InverseSourceAlpha; Update(0); }
public ScrollableContainer(string uniqueName, Vector2i size, IResourceManager resourceManager) { _resourceManager = resourceManager; Size = size; //if (RenderTargetCache.Targets.Contains(uniqueName)) // //Now this is an ugly hack to work around duplicate RenderImages. Have to fix this later. // uniqueName = uniqueName + Guid.NewGuid(); clippingRI = new RenderImage(uniqueName,(uint)Size.X,(uint) Size.Y); //clippingRI.SourceBlend = AlphaBlendOperation.SourceAlpha; //clippingRI.DestinationBlend = AlphaBlendOperation.InverseSourceAlpha; //clippingRI.SourceBlendAlpha = AlphaBlendOperation.SourceAlpha; //clippingRI.DestinationBlendAlpha = AlphaBlendOperation.InverseSourceAlpha; clippingRI.BlendSettings.ColorSrcFactor = BlendMode.Factor.SrcAlpha; clippingRI.BlendSettings.ColorDstFactor = BlendMode.Factor.OneMinusSrcAlpha; clippingRI.BlendSettings.AlphaSrcFactor = BlendMode.Factor.SrcAlpha; clippingRI.BlendSettings.AlphaDstFactor = BlendMode.Factor.OneMinusSrcAlpha; scrollbarH = new Scrollbar(true, _resourceManager); scrollbarV = new Scrollbar(false, _resourceManager); scrollbarV.size = Size.Y; scrollbarH.Update(0); scrollbarV.Update(0); Update(0); }
public ScrollableContainer(string uniqueName, Size size, IResourceManager resourceManager) { _resourceManager = resourceManager; Size = size; if (RenderTargetCache.Targets.Contains(uniqueName)) { //Now this is an ugly hack to work around duplicate RenderImages. Have to fix this later. uniqueName = uniqueName + Guid.NewGuid(); } clippingRI = new RenderImage(uniqueName, Size.Width, Size.Height, ImageBufferFormats.BufferRGB888A8); scrollbarH = new Scrollbar(true, _resourceManager); scrollbarV = new Scrollbar(false, _resourceManager); scrollbarV.size = Size.Height; scrollbarH.Update(0); scrollbarV.Update(0); clippingRI.SourceBlend = AlphaBlendOperation.SourceAlpha; clippingRI.DestinationBlend = AlphaBlendOperation.InverseSourceAlpha; clippingRI.SourceBlendAlpha = AlphaBlendOperation.SourceAlpha; clippingRI.DestinationBlendAlpha = AlphaBlendOperation.InverseSourceAlpha; Update(0); }
public override void Update(float frameTime) { if (disposing || !IsVisible()) { return; } ClientArea = new IntRect(Position, new Vector2i((int)clippingRI.Width, (int)clippingRI.Height)); if (inner_focus != null && !components.Contains((GuiComponent)inner_focus)) { ClearFocus(); } scrollbarH.Position = new Vector2i(ClientArea.Left, ClientArea.Bottom() - scrollbarH.ClientArea.Height); scrollbarV.Position = new Vector2i(ClientArea.Right() - scrollbarV.ClientArea.Width, ClientArea.Top); if (scrollbarV.IsVisible()) { scrollbarH.size = Size.X - scrollbarV.ClientArea.Width; } else { scrollbarH.size = Size.X; } if (scrollbarH.IsVisible()) { scrollbarV.size = Size.Y - scrollbarH.ClientArea.Height; } else { scrollbarV.size = Size.Y; } max_x = 0; max_y = 0; foreach (GuiComponent component in components) { if (component.Position.X + component.ClientArea.Width > max_x) { max_x = component.Position.X + component.ClientArea.Width; } if (component.Position.Y + component.ClientArea.Height > max_y) { max_y = component.Position.Y + component.ClientArea.Height; } } scrollbarH.max = (int)max_x - ClientArea.Width + (max_y > clippingRI.Height ? scrollbarV.ClientArea.Width : 0); if (max_x > clippingRI.Height) { scrollbarH.SetVisible(true); } else { scrollbarH.SetVisible(false); } scrollbarV.max = (int)max_y - ClientArea.Height + (max_x > clippingRI.Height ? scrollbarH.ClientArea.Height : 0); if (max_y > clippingRI.Height) { scrollbarV.SetVisible(true); } else { scrollbarV.SetVisible(false); } scrollbarH.Update(frameTime); scrollbarV.Update(frameTime); }