Skip to content
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

Closed

Conversation

out-of-phaze
Copy link
Contributor

I have no plans to continue this, this is just for reference purposes so wixoa can see my code and compare it to #2106.

@boring-cyborg boring-cyborg bot added Client Involves the OpenDream client Runtime Involves the OpenDream server/runtime labels Nov 28, 2024
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

Dereference of a possibly null reference
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

Type cast is redundant
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

Type cast is redundant
@@ -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

Using directive is not required by the code and can be safely removed
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@wixoaGit wixoaGit closed this Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client Involves the OpenDream client Merge Conflict Runtime Involves the OpenDream server/runtime size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants