-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support a hand cursor #193
base: master
Are you sure you want to change the base?
Conversation
A cursor shown behind the existing cursor.
@@ -1056,5 +1056,28 @@ void Script::_registerGlobals() { | |||
luaL_register(_L, NULL, globalLibs); | |||
lua_pop(_L, 1); | |||
} | |||
|
|||
int CursorLibSetHandCursor(lua_State *L) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird to not put this and CursorLibSetHandCursor
in CursorLib.h, but it solves a problem of cyclic dependencies. This function needs DGCheckProxy
and ProxyToImage
from Proxy.h, but Proxy.h includes CursorLib.h and removing that dependency is not straight forward because Script.cpp depends on both CursorLib.h and Proxy.h. So declaring these functions as extern in CursorLib.h and implementing them in Script.cpp was just the easiest solution I could think of.
Error message in case of unexpected parameter type (not Image or nil).
Err, I just realized I never merged this one! 😮 Should I...? |
I never merged it because it was more like a prototype feature that could turn out useful or "meh, not so much". @civanT was talking about it today, so maybe it is useful for Seclusion? If so, I'm all for merging. |
It's not being used in Seclusion. If it turns out good enough when I have time to do proper tests I might use it. But currently, it's not on the high priority list. |
Okay, so let's keep it around unmerged. |
Implements the suggestion described in #192 . It's basically a separate image that can be displayed behind the existing cursor. The programming interface is as described in #192 , with the exception that
cursor.getHandCursor()
returns the name of the Image object used withcursor.setHandCursor
- not the Image object itself. This decision was made because of use-cases likecursor.setHandCursor(Image("some_item.png"))
where the developer doesn't have an Image object to compare the return value ofcursor.getHandCursor()
to. So for code likeYou will have to do either
cursor.getHandCursor() == "some_item.png"
orcursor.getHandCursor() == i:name()
to check which item the player is holding.