public override void Initialize() { base.Initialize(); SubscribeNetworkEvent <GasOverlayMessage>(HandleGasOverlayMessage); _mapManager.OnGridRemoved += OnGridRemoved; _atmosphereSystem = Get <AtmosphereSystem>(); for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++) { var overlay = _atmosphereSystem.GetOverlay(i); switch (overlay) { case SpriteSpecifier.Rsi animated: var rsi = _resourceCache.GetResource <RSIResource>(animated.RsiPath).RSI; var stateId = animated.RsiState; if (!rsi.TryGetState(stateId, out var state)) { continue; } _frames[i] = state.GetFrames(RSI.State.Direction.South); _frameDelays[i] = state.GetDelays(); _frameCounter[i] = 0; break; case SpriteSpecifier.Texture texture: _frames[i] = new[] { texture.Frame0() }; _frameDelays[i] = Array.Empty <float>(); break; case null: _frames[i] = Array.Empty <Texture>(); _frameDelays[i] = Array.Empty <float>(); break; } } var fire = _resourceCache.GetResource <RSIResource>(FireRsiPath).RSI; for (var i = 0; i < FireStates; i++) { if (!fire.TryGetState((i + 1).ToString(), out var state)) { throw new ArgumentOutOfRangeException($"Fire RSI doesn't have state \"{i}\"!"); } _fireFrames[i] = state.GetFrames(RSI.State.Direction.South); _fireFrameDelays[i] = state.GetDelays(); _fireFrameCounter[i] = 0; } var overlayManager = IoCManager.Resolve <IOverlayManager>(); if (!overlayManager.HasOverlay(nameof(GasTileOverlay))) { overlayManager.AddOverlay(new GasTileOverlay()); } }
public ConnectingControl(IResourceCache resCache, IConfigurationManager configMan) { RobustXamlLoader.Load(this); Panel.PanelOverride = new StyleBoxFlat(Color.Black); ConnectingLabel.FontOverride = new VectorFont(resCache.GetResource <FontResource>("/Fonts/NotoSans-Regular.ttf"), 24); WIPLabel.FontOverride = new VectorFont(resCache.GetResource <FontResource>("/Fonts/NotoSans-Bold.ttf"), 32); LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide); LayoutContainer.SetAnchorPreset(VBox, LayoutContainer.LayoutPreset.Center); LayoutContainer.SetGrowHorizontal(VBox, LayoutContainer.GrowDirection.Both); LayoutContainer.SetGrowVertical(VBox, LayoutContainer.GrowDirection.Both); LayoutContainer.SetAnchorPreset(ConnectingLabel, LayoutContainer.LayoutPreset.Center); LayoutContainer.SetGrowHorizontal(ConnectingLabel, LayoutContainer.GrowDirection.Both); LayoutContainer.SetGrowVertical(ConnectingLabel, LayoutContainer.GrowDirection.Both); LayoutContainer.SetAnchorPreset(WIP, LayoutContainer.LayoutPreset.VerticalCenterWide); LayoutContainer.SetGrowHorizontal(WIP, LayoutContainer.GrowDirection.Both); LayoutContainer.SetGrowVertical(WIP, LayoutContainer.GrowDirection.Both); var logoTexture = resCache.GetResource <TextureResource>("/OpenDream/Logo/logo.png"); Logo.Texture = logoTexture; }
public override void Initialize() { base.Initialize(); SubscribeNetworkEvent(new EntityEventHandler <GasTileOverlayMessage>(OnTileOverlayMessage)); for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++) { var gas = Atmospherics.GetGas(i); switch (gas.GasOverlay) { case SpriteSpecifier.Rsi animated: var rsi = _resourceCache.GetResource <RSIResource>(animated.RsiPath).RSI; var stateId = animated.RsiState; if (!rsi.TryGetState(stateId, out var state)) { continue; } _frames[i] = state.GetFrames(RSI.State.Direction.South); _frameDelays[i] = state.GetDelays(); _frameCounter[i] = 0; break; case SpriteSpecifier.Texture texture: _frames[i] = new[] { texture.Frame0() }; _frameDelays[i] = Array.Empty <float>(); break; case null: _frames[i] = Array.Empty <Texture>(); _frameDelays[i] = Array.Empty <float>(); break; } } var fire = _resourceCache.GetResource <RSIResource>(FireRsiPath).RSI; for (var i = 0; i < FireStates; i++) { if (!fire.TryGetState((i + 1).ToString(), out var state)) { throw new ArgumentOutOfRangeException($"Fire RSI doesn't have state \"{i}\"!"); } _fireFrames[i] = state.GetFrames(RSI.State.Direction.South); _fireFrameDelays[i] = state.GetDelays(); _fireFrameCounter[i] = 0; } }
private void PerformLayout() { MouseFilter = MouseFilterMode.Stop; ToolTip = "Click to expand"; CustomMinimumSize = new Vector2(0, 25); VBox = new VBoxContainer { SeparationOverride = 0 }; AddChild(VBox); TopContainer = new HBoxContainer { SizeFlagsVertical = SizeFlags.FillExpand }; VBox.AddChild(TopContainer); BottomContainer = new HBoxContainer { Visible = false }; VBox.AddChild(BottomContainer); var smallFont = new VectorFont(_resourceCache.GetResource <FontResource>("/Fonts/CALIBRI.TTF"), 10); _bottomLabel = new Label { FontOverride = smallFont, FontColorOverride = Color.DarkGray }; BottomContainer.AddChild(_bottomLabel); NameLabel = new Label(); TopContainer.AddChild(NameLabel); }
public override void Draw(SpriteBatch spriteBatch, IResourceCache<Texture2D> cache, Matrix globalTransform) { var texture = cache.GetResource(TextureKey); Vector2 origin; if (SrcRectangle.HasValue) origin = new Vector2(SrcRectangle.Value.Width / 2, SrcRectangle.Value.Height / 2); else origin = new Vector2(texture.Width / 2, texture.Height / 2); spriteBatch.Begin( SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, globalTransform); spriteBatch.Draw( texture, Position, SrcRectangle, tintColor, Rotation, origin, Scale, SpriteEffects.None, 0 ); spriteBatch.End(); }
public MainMenuControl(IResourceCache resCache, IConfigurationManager configMan) { RobustXamlLoader.Load(this); LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide); LayoutContainer.SetAnchorPreset(VBox, LayoutContainer.LayoutPreset.TopRight); LayoutContainer.SetMarginRight(VBox, -25); LayoutContainer.SetMarginTop(VBox, 30); LayoutContainer.SetGrowHorizontal(VBox, LayoutContainer.GrowDirection.Begin); var logoTexture = resCache.GetResource <TextureResource>("/Textures/Logo/logo.png"); Logo.Texture = logoTexture; var currentUserName = configMan.GetCVar(CVars.PlayerName); UserNameBox.Text = currentUserName; #if !FULL_RELEASE JoinPublicServerButton.Disabled = true; JoinPublicServerButton.ToolTip = Loc.GetString("main-menu-join-public-server-button-tooltip"); #endif LayoutContainer.SetAnchorPreset(VersionLabel, LayoutContainer.LayoutPreset.BottomRight); LayoutContainer.SetGrowHorizontal(VersionLabel, LayoutContainer.GrowDirection.Begin); LayoutContainer.SetGrowVertical(VersionLabel, LayoutContainer.GrowDirection.Begin); }
private void BuildTileList(string searchStr = null) { TileList.Clear(); IEnumerable <ITileDefinition> tileDefs = __tileDefinitionManager; if (!string.IsNullOrEmpty(searchStr)) { tileDefs = tileDefs.Where(s => s.DisplayName.IndexOf(searchStr, StringComparison.InvariantCultureIgnoreCase) >= 0 || s.Name.IndexOf(searchStr, StringComparison.OrdinalIgnoreCase) >= 0); } tileDefs = tileDefs.OrderBy(d => d.DisplayName); _shownItems = tileDefs.ToList(); foreach (var entry in _shownItems) { Texture texture = null; if (!string.IsNullOrEmpty(entry.SpriteName)) { texture = _resourceCache.GetResource <TextureResource>($"/Textures/Tiles/{entry.SpriteName}.png"); } TileList.AddItem(entry.DisplayName, texture); } }
private void PreparePlacement(string templateName) { var prototype = _prototypeManager.Index <EntityPrototype>(templateName); ComponentParameter spriteParam = prototype.GetBaseSpriteParameters().FirstOrDefault(); //Will break if states not ordered correctly. var spriteName = spriteParam == null ? "" : spriteParam.GetValue <string>(); var sprite = ResourceCache.GetResource <TextureResource>("Textures/" + spriteName); CurrentBaseSprite = sprite; CurrentBaseSpriteKey = spriteName; CurrentPrototype = prototype; IsActive = true; }
public PaletteColorPicker() { RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); _tex = _resourceCache.GetResource <TextureResource>("/Textures/Interface/Nano/button.svg.96dpi.png"); var i = 0; foreach (var palette in _prototypeManager.EnumeratePrototypes <ColorPalettePrototype>()) { Palettes.AddItem(palette.Name); Palettes.SetItemMetadata(i, palette); // ew i += 1; } Palettes.OnItemSelected += args => { Palettes.SelectId(args.Id); SetupList(); }; Palettes.Select(0); SetupList(); }
public Listbox(int dropDownLength, int width, IResourceCache resourceCache, List <string> initialOptions = null) { _resourceCache = resourceCache; _width = width; _listboxLeft = _resourceCache.GetSprite("button_left"); _listboxMain = _resourceCache.GetSprite("button_middle"); _listboxRight = _resourceCache.GetSprite("button_right"); _selectedLabel = new TextSprite("ListboxLabel", "", _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF").Font) { Color = Color4.Black }; _dropDown = new ScrollableContainer("ListboxContents", new Vector2i(width, dropDownLength), _resourceCache); _dropDown.SetVisible(false); if (initialOptions != null) { _contentStrings = initialOptions; RebuildList(); } Update(0); }
private void _displaySplash(IRenderHandle handle) { var texture = _resourceCache.GetResource <TextureResource>("/Textures/Logo/logo.png").Texture; var drawHandle = handle.CreateHandleScreen(); drawHandle.DrawTexture(texture, (ScreenSize - texture.Size) / 2); }
public Label(string text, string font, IResourceCache resourceCache) { _resourceCache = resourceCache; Text = new TextSprite("Label" + text, text, _resourceCache.GetResource <FontResource>($"Fonts/{font}.TTF").Font) { Color = Color4.Black }; Update(0); }
public AdminNameOverlay(AdminSystem system, IEntityManager entityManager, IEyeManager eyeManager, IResourceCache resourceCache, EntityLookupSystem entityLookup) { _system = system; _entityManager = entityManager; _eyeManager = eyeManager; _entityLookup = entityLookup; ZIndex = 200; _font = new VectorFont(resourceCache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10); }
public Label(string text, string font, uint size, IResourceCache resourceCache) { _resourceCache = resourceCache; Text = new TextSprite("Label" + text, text, _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF").Font) { Color = Color.Black }; Update(0); }
public virtual void Populate() { var humanHairRSIPath = SharedSpriteComponent.TextureRoot / "Mob/human_hair.rsi"; var humanHairRSI = ResourceCache.GetResource <RSIResource>(humanHairRSIPath).RSI; foreach (var(styleName, styleState) in HairStyles.HairStylesMap) { Items.AddItem(styleName, humanHairRSI[styleState].Frame0); } }
public TraitorOverlay( IEntityManager entityManager, IPlayerManager playerManager, IResourceCache resourceCache) { _playerManager = playerManager; _entityManager = entityManager; _font = new VectorFont(resourceCache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10); }
public static Font GetFont(this IResourceCache cache, ResourcePath[] path, int size) { var fs = new Font[path.Length]; for (var i = 0; i < path.Length; i++) { fs[i] = new VectorFont(cache.GetResource <FontResource>(path[i]), size); } return(new StackedFont(fs)); }
internal void UpdateMask(PointLightComponent component) { if (component._maskPath is not null) { component.Mask = _resourceCache.GetResource <TextureResource>(component._maskPath); } else { component.Mask = null; } }
public TraitorOverlay( IEntityManager entityManager, IResourceCache resourceCache, IEyeManager eyeManager) { _playerManager = IoCManager.Resolve <IPlayerManager>(); _entityManager = entityManager; _eyeManager = eyeManager; _font = new VectorFont(resourceCache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10); }
public Effect(EffectSystemMessage effectcreation, IResourceCache resourceCache, IMapManager mapManager, IEntityManager entityManager) { if (effectcreation.RsiState != null) { var rsi = resourceCache .GetResource <RSIResource>(new ResourcePath("/Textures/") / effectcreation.EffectSprite) .RSI; RsiState = rsi[effectcreation.RsiState]; EffectSprite = RsiState.Frame0; } else { EffectSprite = resourceCache .GetResource <TextureResource>(new ResourcePath("/Textures/") / effectcreation.EffectSprite) .Texture; } AnimationLoops = effectcreation.AnimationLoops; AttachedEntityUid = effectcreation.AttachedEntityUid; AttachedOffset = effectcreation.AttachedOffset; Coordinates = effectcreation.Coordinates; EmitterCoordinates = effectcreation.EmitterCoordinates; Velocity = effectcreation.Velocity; Acceleration = effectcreation.Acceleration; RadialVelocity = effectcreation.RadialVelocity; RadialAcceleration = effectcreation.RadialAcceleration; TangentialVelocity = effectcreation.TangentialVelocity; TangentialAcceleration = effectcreation.TangentialAcceleration; Age = effectcreation.Born; Deathtime = effectcreation.DeathTime; Rotation = effectcreation.Rotation; RotationRate = effectcreation.RotationRate; Size = effectcreation.Size; SizeDelta = effectcreation.SizeDelta; Color = effectcreation.Color; ColorDelta = effectcreation.ColorDelta; Shaded = effectcreation.Shaded; _mapManager = mapManager; _entityManager = entityManager; }
public Progress_Bar(Vector2i size, IResourceCache resourceCache) { _resourceCache = resourceCache; Text = new TextSprite("ProgressBarText", "", _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF").Font); Text.Color = Color4.Black; Text.ShadowColor = new Color4(105, 105, 105, 255); Text.ShadowOffset = new Vector2(1, 1); Text.Shadowed = true; Size = size; Update(0); }
public Button(string buttonText, IResourceCache resourceCache) { _resourceCache = resourceCache; _buttonLeft = _resourceCache.GetSprite("button_left"); _buttonMain = _resourceCache.GetSprite("button_middle"); _buttonRight = _resourceCache.GetSprite("button_right"); Label = new TextSprite("ButtonLabel" + buttonText, buttonText, _resourceCache.GetResource <FontResource>("Fonts/CALIBRI.TTF").Font) { Color = Color4.Black }; Update(0); }
public override ushort Register(ITileDefinition tileDef) { var ret = base.Register(tileDef); TileSet.CreateTile(ret); if (!string.IsNullOrEmpty(tileDef.SpriteName)) { var texture = resourceCache.GetResource <TextureResource>($@"/Textures/Tiles/{tileDef.SpriteName}.png"); TileSet.TileSetTexture(ret, texture.Texture.GodotTexture); Textures[ret] = texture; } return(ret); }
public MainMenuControl(IResourceCache resCache, IConfigurationManager configMan) { RobustXamlLoader.Load(this); Panel.PanelOverride = new StyleBoxFlat(Color.Black); WIPLabel.FontOverride = new VectorFont(resCache.GetResource <FontResource>("/Fonts/NotoSans-Bold.ttf"), 32); LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide); LayoutContainer.SetAnchorPreset(VBox, LayoutContainer.LayoutPreset.Center); LayoutContainer.SetGrowHorizontal(VBox, LayoutContainer.GrowDirection.Both); LayoutContainer.SetGrowVertical(VBox, LayoutContainer.GrowDirection.Both); var logoTexture = resCache.GetResource <TextureResource>("/OpenDream/Logo/logo.png"); Logo.Texture = logoTexture; var currentUserName = configMan.GetCVar(CVars.PlayerName); UserNameBox.Text = currentUserName; AddressBoxProtected.Text = "127.0.0.1:25566"; }
public SpeechBubble(string mobname) { _resourceCache = IoCManager.Resolve <IResourceCache>(); _mobName = mobname; _buildTime = DateTime.Now; _textSprite = new Text(String.Empty, _resourceCache.GetResource <FontResource>("Fonts/CALIBRI.TTF").Font); _textSprite.FillColor = Color.Black; // TODO Word wrap! _textSprite.Position = new Vector2f(5, 3); _stringBuilder = new StringBuilder(); _bubbleRender = new RenderImage("bubble ", 1, 1); _bubbleSprite = new Sprite(_bubbleRender.Texture); }
public TraitorOverlay( IEntity user, IEntityManager entityManager, IResourceCache resourceCache, IEyeManager eyeManager) : base(nameof(TraitorOverlay)) { _entityManager = entityManager; _eyeManager = eyeManager; _font = new VectorFont(resourceCache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10); _user = user; }
private void UpdateLobbyBackground() { if (_lobby == null) { return; } if (_gameTicker.LobbyBackground != null) { _lobby.Background.Texture = _resourceCache.GetResource <TextureResource>(_gameTicker.LobbyBackground); } else { _lobby.Background.Texture = null; } }
private void BuildEntityList(string searchStr = null) { PrototypeList.DisposeAllChildren(); SelectedButton = null; if (searchStr != null) { searchStr = searchStr.ToLower(); } foreach (var prototype in prototypeManager.EnumeratePrototypes <EntityPrototype>()) { if (searchStr != null && !prototype.ID.ToLower().Contains(searchStr)) { continue; } var button = new EntitySpawnButton() { Prototype = prototype, }; var container = button.GetChild("HBoxContainer"); button.ActualButton.OnToggled += OnItemButtonToggled; container.GetChild <Label>("Label").Text = prototype.Name; var spriteNameParam = prototype.GetBaseSpriteParameters().FirstOrDefault(); var spriteName = ""; if (spriteNameParam != null) { spriteName = spriteNameParam.GetValue <string>(); } var tex = resourceCache.GetResource <TextureResource>("Textures/" + spriteName); var rect = container.GetChild("TextureWrap").GetChild <TextureRect>("TextureRect"); if (tex != null) { rect.Texture = tex.Texture; // Ok I can't find a way to make this TextureRect scale down sanely so let's do this. var scale = (float)TARGET_ICON_HEIGHT / tex.Texture.Height; rect.Scale = new Vector2(scale, scale); } else { rect.Dispose(); } PrototypeList.AddChild(button); } }
public Textbox(int width, IResourceCache resourceCache) { _resourceCache = resourceCache; _textboxLeft = _resourceCache.GetSprite("text_left"); _textboxMain = _resourceCache.GetSprite("text_middle"); _textboxRight = _resourceCache.GetSprite("text_right"); Width = width; Label = new TextSprite("Textbox", "", _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF").Font) { Color = Color4.Black }; Update(0); }
public static void DrawCircle(this SpriteBatch spriteBatch, IResourceCache<Texture2D> cache, Vector2 center, Vector2 size, Color color) { var texture = cache.GetResource("Textures/circle"); var textureSize = new Vector2(texture.Width, texture.Height); spriteBatch.Draw( texture, center, null, color, 0, textureSize / 2, size / textureSize, SpriteEffects.None, 0 ); }
public override void Register(ITileDefinition tileDef) { base.Register(tileDef); var id = tileDef.TileId; TileSet.CreateTile(id); if (string.IsNullOrEmpty(tileDef.SpriteName)) { return; } var texture = resourceCache.GetResource <TextureResource>( new ResourcePath("/Textures/Tiles/") / $@"{tileDef.SpriteName}.png"); TileSet.TileSetTexture(id, texture.Texture.GodotTexture); Textures[id] = texture; }
public int size = 300; //Graphical length of the bar. public Scrollbar(bool horizontal, IResourceCache resourceCache) { _resourceCache = resourceCache; Horizontal = horizontal; if (Horizontal) { scrollbarButton = _resourceCache.GetSprite("scrollbutton_h"); } else { scrollbarButton = _resourceCache.GetSprite("scrollbutton_v"); } DEBUG = new TextSprite("DEBUGSLIDER", "Position:", _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF").Font); DEBUG.Color = new Color4(255, 128, 0, 255); DEBUG.ShadowColor = new Color4(0, 0, 128, 255); DEBUG.Shadowed = true; Update(0); }
public bool Contains(Vector2 point, IResourceCache<Texture2D> cache, Matrix transform) { var texture = cache.GetResource(textureKey); var relativeTransform = Matrix.CreateScale(new Vector3(scale.X, scale.Y, 1)) * Matrix.CreateRotationZ(Rotation) * Matrix.CreateTranslation(new Vector3(Position.X, Position.Y, 0)) * transform; var pointInRenderCoordinates = Vector2.Transform(point, Matrix.Invert(relativeTransform)); return (pointInRenderCoordinates.X >= -texture.Width / 2) && (pointInRenderCoordinates.X <= texture.Width / 2) && (pointInRenderCoordinates.Y >= -texture.Height / 2) && (pointInRenderCoordinates.Y <= texture.Height / 2); }
protected virtual Texture2D GetTexture(IResourceCache<Texture2D> textureCache) { return textureCache.GetResource(DUMMY_TEXTURE); }
protected override Texture2D GetTexture(IResourceCache<Texture2D> textureCache) { return textureCache.GetResource(CENTIPEDE_WALK_LEFT); }
protected override Texture2D GetTexture(IResourceCache<Texture2D> textureCache) { return textureCache.GetResource(CENTIPEDE_TEXTURE); }
public virtual void Draw(SpriteBatch spriteBatch, IResourceCache<Texture2D> cache, Matrix globalTransform) { var texture = cache.GetResource(textureKey); Vector2 origin; if (srcRectangle.HasValue) origin = new Vector2(srcRectangle.Value.Width / 2, srcRectangle.Value.Height / 2); else origin = new Vector2(texture.Width / 2, 0); //origin = new Vector2(texture.Width / 2, texture.Height / 2); if (InputManager.Instance.Pressed(Keys.B)) { //Debugger.Break(); } spriteBatch.Begin( SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, globalTransform); spriteBatch.Draw( texture, Position - new Vector2(0, texture.Height / 4), srcRectangle, Color.White, (float)Rotation, origin, scale, SpriteEffects.None, 0 ); spriteBatch.End(); }
public void Expand(IResourceCache<Texture2D> cache, Vector2 dragOffset, Vector2 origScale, Matrix transform) { var tex = cache.GetResource(Texture); var size = origScale * new Vector2(tex.Width / 2, tex.Height / 2) * 2; var relativeTransform = Matrix.CreateRotationZ(Rotation) * transform; var offsetInMeshFrame = Vector2.Transform(dragOffset, relativeTransform); Scale += (2 * offsetInMeshFrame) / size; }
public Vector2 GetCenter(IResourceCache<Texture2D> cache, Matrix transform) { var texture = cache.GetResource(textureKey); return Vector2.Transform(Position, transform); }
public NonAxisAlignedBoundingBox GetNonAxisAlignedBoundingBox(IResourceCache<Texture2D> cache, Matrix globalTransform) { var texture = cache.GetResource(textureKey); var relativeTransform = Matrix.CreateScale(new Vector3(scale.X, scale.Y, 1)) * Matrix.CreateRotationZ(Rotation) * Matrix.CreateTranslation(new Vector3(Position.X, Position.Y, 0)) * globalTransform; var topLeft = Vector2.Transform( new Vector2(-texture.Width / 2, -texture.Height / 2), relativeTransform); var topRight = Vector2.Transform( new Vector2(texture.Width / 2, -texture.Height / 2), relativeTransform); var botLeft = Vector2.Transform( new Vector2(-texture.Width / 2, texture.Height / 2), relativeTransform); var botRight = Vector2.Transform( new Vector2(texture.Width / 2, texture.Height / 2), relativeTransform); if (InputManager.Instance.Pressed(Keys.N)) { Debugger.Break(); } return new NonAxisAlignedBoundingBox(topLeft, topRight, botLeft, botRight); }
public static Vector2 CreateScaleFromSize(int width, int height, string textureKey, IResourceCache<Texture2D> cache) { var texture = cache.GetResource(textureKey); return new Vector2((float)width / texture.Width, (float)height / texture.Height); }