-
Notifications
You must be signed in to change notification settings - Fork 121
Implement custom & default mouse cursors #2403
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
base: master
Are you sure you want to change the base?
Conversation
[Dependency] private readonly ClientAppearanceSystem _appearanceSystem = default!; | ||
[Dependency] private readonly IClyde _clyde = default!; | ||
|
||
public bool IsDragging { get => _selectedEntity?.IsDrag ?? false; } |
Check notice
Code scanning / InspectCode
Use preferred body style: Convert into property, indexer, or event with preferred body style Note
} else | ||
_mouseInput?.SetCursorFromDefine(0, 0); | ||
|
||
} |
Check warning
Code scanning / InspectCode
Incorrect blank lines: Incorrect number of blank lines near braces Warning
_mouseInput?.HandleAtomMouseMove(Viewport, relativePos, atom.Value, iconPos); | ||
} | ||
_mouseInput?.HandleAtomMouseMove(Viewport, relativePos, atom.Value, iconPos); | ||
} |
Check notice
Code scanning / InspectCode
Incorrect indent: Around statement braces Note
using SixLabors.ImageSharp; | ||
using System.Linq; | ||
using Robust.Shared.Map; | ||
using SixLabors.ImageSharp.PixelFormats; |
Check warning
Code scanning / InspectCode
Redundant using directive Warning
using System.Linq; | ||
using Robust.Shared.Map; | ||
using SixLabors.ImageSharp.PixelFormats; | ||
using OpenToolkit.GraphicsLibraryFramework; |
Check warning
Code scanning / InspectCode
Redundant using directive Warning
public readonly ClientVerbsList ClientVerbs; | ||
public ViewRange View { get; private set; } | ||
public bool ShowPopupMenus { get; private set; } = true; | ||
public IconResource? CursorIcon = null; |
Check warning
Code scanning / InspectCode
Redundant member initializer Warning
break; | ||
case "mouse_pointer_icon": | ||
//resolve the value to an icon file | ||
if (value.TryGetValueAsDreamResource(out var iconResource) && iconResource is IconResource) |
Check notice
Code scanning / InspectCode
Type check and casts can be merged Note
buffer.Write((byte)IconAppearanceProperty.MouseDragPointer); | ||
buffer.WriteVariableInt32(MouseDragPointer); | ||
} | ||
if (MouseDropZone) { |
Check warning
Code scanning / InspectCode
Incorrect blank lines: Blank lines are missing elsewhere Warning
if (MouseDropZone) { | ||
buffer.Write((byte)IconAppearanceProperty.MouseDropZone); | ||
} | ||
if (MouseOverPointer != MutableAppearance.Default.MouseOverPointer) { |
Check warning
Code scanning / InspectCode
Incorrect blank lines: Blank lines are missing elsewhere Warning
buffer.Write((byte)IconAppearanceProperty.MouseOverPointer); | ||
buffer.WriteVariableInt32(MouseOverPointer); | ||
} | ||
if (MouseDropPointer != MutableAppearance.Default.MouseDropPointer) { |
Check warning
Code scanning / InspectCode
Incorrect blank lines: Blank lines are missing elsewhere Warning
_clyde.SetCursor(_dreamInterfaceManager.Cursors.BaseCursor); | ||
return; | ||
} | ||
switch (define) { |
Check warning
Code scanning / InspectCode
Incorrect blank lines: Blank lines are missing elsewhere Warning
_dreamResource.LoadResourceAsync<DMIResource>(msg.CursorResource, resource => { | ||
var allState = resource.GetStateAsImage("all", AtomDirection.South); | ||
if (allState is not null) { //all overrides all possible states | ||
Cursors.BaseCursor = _clyde.CreateCursor(allState!, new(32, 32)); |
Check warning
Code scanning / InspectCode
Redundant nullable warning suppression expression Warning
public ICursor? DragCursor; | ||
public ICursor? OverCursor; | ||
public ICursor? DropCursor; | ||
public bool AllStateSet = false; |
Check warning
Code scanning / InspectCode
Redundant member initializer Warning
public ICursor? DropCursor; | ||
public bool AllStateSet = false; | ||
|
||
public CursorHolder() {} |
Check warning
Code scanning / InspectCode
Empty constructor Warning
using OpenDreamClient.Interface.Controls; | ||
using OpenDreamShared.Dream; | ||
using OpenDreamShared.Network.Messages; | ||
using Robust.Client.Graphics; |
Check warning
Code scanning / InspectCode
Redundant using directive Warning
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Implements:
/atom/mouse_drag_pointer
/atom/mouse_drop_pointer
/atom/mouse_drop_zone
/atom/mouse_over_pointer
/client/mouse_pointer_icon
Requires space-wizards/RobustToolbox#6226