• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] How to fake the cursor dragging an item?

Status
Not open for further replies.
Level 25
Joined
Feb 2, 2006
Messages
1,683
Hi,
I was wondering if it is possible to fake the drag effect when right clicking and releasing an item in the inventory.
It changes the cursor and adds the icon of the item. I was just wondering if it is possible to retrieve the framehandle of the cursor and change it.
The following thread did not receive any real answer: Change cursor at runtime
Is it a frame or not?

Reading this tutorial: The Big UI-Frame Tutorial
I only found something like CursorSprite.

My idea is to add icon of the item as a frame and move the frame to the cursor position using
JASS:
BlzGetTriggerPlayerMousePosition
and
JASS:
EVENT_PLAYER_MOUSE_MOVE
. Maybe I can somehow make it overlay the actual cursor?
However, in Warcraft III the cursor changes its texture when taking an item. I will have to create two frames: one with the item icon and one with the changed cursor.

Any better ideas/solutions? Maybe some systems do already exist which do already provide this?
 
Last edited:
Level 20
Joined
Jul 10, 2009
Messages
477
BlzGetTriggerPlayerMousePosition returns map coordinates, not screen coordinates.

But you wouldn't need that function anyway, when you can access the original cursor frame, right?

Using BlzFrameSetPoint to connect the desired item frame with the cursor frame should automatically move the one with the other.

Not sure about performance and whether you can access the cursor frame at all, though...
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,496
Every custom inventory system out there that's using the frame natives doesn't have drag functionality, at least not the 5 or so examples I've seen. Eikonium's suggestion may work, @Tasyen could probably confirm or deny, but I think you'll have to rely on an alternate system.
 
As far as I know the UI-frame API does not provide direct access to the Mouse Cursor only to it's parent or something like that which is the last child of GameUI (when one didn't play around with BlzFrameSetLevel/prio).

CursorSprite:
Changes the MouseCursor while it is in the Frame's controled space. Unsure how exactly it works, was only able to get the confirm target texture from the default cursors.

As there is no built in Mouse on Screen pos you need to do some workaround either use the world coords + camera view + resolution + advanced 3D math or cluster the screen with frames which tell you the current position. I once wrote something to fill the screen with frames. But I think both options are bad.
Screw the draging.

According to the datamined game.dll data BlacklightsC shared, there is a DRAG feature in fdf but I had no success in using it. FrameDefinedFile Keyword.xlsx
 
Status
Not open for further replies.
Top