public RadialButton(Game game, GameObject owner, CommandButton commandButton, bool isHeroButton = false) { _game = game; _owner = owner; CommandButton = commandButton; _objectDefinition = commandButton.Object?.Value ?? null; IsRecruitHeroButton = isHeroButton; _background = commandButton.ButtonImage.Value; _border = _game.GetMappedImage("RadialBorder"); _hover = _game.GetMappedImage("RadialOver"); _down = _game.GetMappedImage("RadialPush"); _width = _border.Coords.Width; _fontColor = new ColorRgbaF(0, 0, 0, 1); // _game.AssetStore.InGameUI.Current.DrawableCaptionColor.ToColorRgbaF(); -> this is white -> conflicts with the progress clock _fontSize = _game.AssetStore.InGameUI.Current.DrawableCaptionPointSize; var fontWeight = _game.AssetStore.InGameUI.Current.DrawableCaptionBold ? FontWeight.Bold : FontWeight.Normal; _font = _game.ContentManager.FontManager.GetOrCreateFont(_game.AssetStore.InGameUI.Current.DrawableCaptionFont, _fontSize, fontWeight); _alphaMask = MappedImageUtility.CreateTexture(_game.GraphicsLoadContext, _game.GetMappedImage("RadialClockOverlay1")); //_scheme = game.AssetStore.ControlBarSchemes.FindBySide(game.Scene3D.LocalPlayer.Side); }
public void SurfaceFactory_CreatesSurfaceFromTextureSucceeds_ComponentsAreNotNull() { var messenger = Substitute.For <IFrameworkMessenger>(); var components = new FakeComponents(); IGpuSurfaceFactory factory = new GpuSurfaceFactory(messenger, components); Veldrid.Texture texture = components.Factory.CreateTexture(new Veldrid.TextureDescription { Width = 64, Height = 64, ArrayLayers = 1, Depth = 1, Format = Veldrid.PixelFormat.R32_G32_B32_A32_Float, MipLevels = 1, SampleCount = Veldrid.TextureSampleCount.Count1, Type = Veldrid.TextureType.Texture2D, Usage = Veldrid.TextureUsage.Sampled }); var surface = factory.CreateGpuSurfaceFromTexture(texture, false, false, SamplerType.Anisotropic); Assert.Equal(texture, surface.Texture); Assert.NotNull(surface.TextureView); Assert.NotNull(surface.ResourceSet_TexMirror); Assert.NotNull(surface.ResourceSet_TexWrap); components.ReleaseResources(); }
public Texture(Veldrid.GraphicsDevice graphicsDevice, TextureFormat textureFormat, DataBuffer textureBuffer) { _texture = graphicsDevice.ResourceFactory.CreateTexture(Veldrid.TextureDescription.Texture2D(textureFormat.Width, textureFormat.Height, 1, 1, Veldrid.PixelFormat.R8_G8_B8_A8_UNorm, Veldrid.TextureUsage.Sampled)); _textureBuffer = textureBuffer; graphicsDevice.UpdateTexture(_texture, textureBuffer.GetIntPtr(), textureBuffer.GetSize(), 0, 0, 0, textureFormat.Width, textureFormat.Height, 1, 0, 0); }
public Image(Veldrid.GraphicsDevice graphicsDevice, TextureFormat textureFormat, DataBuffer textureBuffer) { // Perhaps create this somewhere else...? // Texture begin _texture = graphicsDevice.ResourceFactory.CreateTexture(Veldrid.TextureDescription.Texture2D(textureFormat.Width, textureFormat.Height, 1, 1, Veldrid.PixelFormat.R8_G8_B8_A8_UNorm, Veldrid.TextureUsage.Sampled)); _textureBuffer = textureBuffer; graphicsDevice.UpdateTexture(_texture, textureBuffer.GetIntPtr(), textureBuffer.GetSize(), 0, 0, 0, textureFormat.Width, textureFormat.Height, 1, 0, 0); // Texture end CreateVertexBuffer(graphicsDevice); CreateIndexBuffer(graphicsDevice); CreateResourceSet(graphicsDevice); CreateShaders(graphicsDevice); CreatePipeline(graphicsDevice); }