-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experimental screen edge loc implementation #2111
base: master
Are you sure you want to change the base?
Experimental screen edge loc implementation #2111
Conversation
Vector2 iconSize = sprite.Icon.DMI == null ? Vector2.Zero : sprite.Icon.DMI.IconSize / (float)EyeManager.PixelsPerMeter; | ||
Interface.Descriptors.ControlDescriptorMap mapDescriptor = (Interface.Descriptors.ControlDescriptorMap) _interfaceManager.DefaultMap.ElementDescriptor; |
Check warning
Code scanning / InspectCode
Dereference of a possibly null reference. Warning
Vector2 iconSize = sprite.Icon.DMI == null ? Vector2.Zero : sprite.Icon.DMI.IconSize / (float)EyeManager.PixelsPerMeter; | ||
Interface.Descriptors.ControlDescriptorMap mapDescriptor = (Interface.Descriptors.ControlDescriptorMap) _interfaceManager.DefaultMap.ElementDescriptor; | ||
var viewport = _interfaceManager.DefaultMap.Viewport; | ||
float mapZoom = mapDescriptor.IconSize.Value != 0 ? EyeManager.PixelsPerMeter / (float) mapDescriptor.IconSize.Value : 1; |
Check warning
Code scanning / InspectCode
Redundant cast Warning
float mapZoom = mapDescriptor.IconSize.Value != 0 ? EyeManager.PixelsPerMeter / (float) mapDescriptor.IconSize.Value : 1; | ||
// Limit the viewport drawbox just to what's visible on-screen. | ||
var drawBox = viewport.GetDrawBox().Intersection(_interfaceManager.DefaultMap.Viewport.GlobalPixelRect.Intersection(_interfaceManager.DefaultMap.UIElement.GlobalPixelRect) ?? UIBox2i.FromDimensions(0, 0, 0, 0)) ?? UIBox2i.FromDimensions(0, 0, 0, 0); | ||
Vector2 viewportTileSize = Vector2.Min(drawBox.Size, viewport.Size) * mapZoom / (float)EyeManager.PixelsPerMeter; |
Check warning
Code scanning / InspectCode
Redundant cast Warning
@@ -6,19 +6,24 @@ | |||
using System.Linq; | |||
using System.Text; | |||
using Robust.Shared.Log; | |||
using Robust.Shared.Maths; |
Check warning
Code scanning / InspectCode
Redundant using directive Warning
I have no plans to continue this, this is just for reference purposes so wixoa can see my code and compare it to #2106.