Skip to content

feat: add widget.get_X and widget.get_Y#27

Merged
Orden4 merged 3 commits into
Orden4:masterfrom
alrun3:get-widget-coords
Jan 17, 2026
Merged

feat: add widget.get_X and widget.get_Y#27
Orden4 merged 3 commits into
Orden4:masterfrom
alrun3:get-widget-coords

Conversation

@alrun3

@alrun3 alrun3 commented Jan 17, 2026

Copy link
Copy Markdown
Contributor

Also adjusts unit.X and unit.Y to use GetWidget{X,Y} to align native calls. You may prefer the unit/item specific calls for jassdoc, in which case I'll happily update

Comment thread WCSharp.Api/widget.cs Outdated
@alrun3
alrun3 force-pushed the get-widget-coords branch from 56640a8 to 91c2800 Compare January 17, 2026 10:27
@Orden4

Orden4 commented Jan 17, 2026

Copy link
Copy Markdown
Owner

Replacing GetUnitX with GetWidgetX is no good. The widget variant has been benchmarked to just be straight slower, and 99% of the time you're going to be working with units, not widgets.

The approach I initially coded was actually to just duplicate the properties and hide the widget one via the new keyword, but at the time I'm fairly certain it caused compiler issues, but now it seems to be fine actually.

Lastly, I noticed that despite knowing about the GetWidgetX vs GetItemX performance difference, I'm not actually using it in item.cs currently for some reason...

So to summarize what this PR should do:

  1. (Done) Add a get-only X/Y GetWidgetX/GetWidgetY to widget.cs
  2. (Done) Remove the corresponding properties from destructable.cs
  3. (To do) Change get X/Y of unit.cs to use GetUnitX/GetUnitY and add the new keyword
  4. (To do) Change get+set X/Y of item.cs to use GetItemX/GetItemY and add the new keyword

@alrun3

alrun3 commented Jan 17, 2026

Copy link
Copy Markdown
Contributor Author

Cool, so exactly what I asked, but for performance and not UX 😁

@alrun3
alrun3 force-pushed the get-widget-coords branch from 91c2800 to dc7a2c5 Compare January 17, 2026 11:19
@Orden4
Orden4 merged commit 9d92b21 into Orden4:master Jan 17, 2026
@alrun3
alrun3 deleted the get-widget-coords branch January 17, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants