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

Support a hand cursor #193

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Support a hand cursor #193

wants to merge 2 commits into from

Conversation

bd339
Copy link
Collaborator

@bd339 bd339 commented Jan 24, 2017

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 with cursor.setHandCursor - not the Image object itself. This decision was made because of use-cases like cursor.setHandCursor(Image("some_item.png")) where the developer doesn't have an Image object to compare the return value of cursor.getHandCursor() to. So for code like

i = Image("some_item.png")
cursor.setHandCursor(i)

You will have to do either cursor.getHandCursor() == "some_item.png" or cursor.getHandCursor() == i:name() to check which item the player is holding.

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) {
Copy link
Collaborator Author

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).
@agustincordes
Copy link
Member

Err, I just realized I never merged this one! 😮

Should I...?

@bd339
Copy link
Collaborator Author

bd339 commented Sep 1, 2017

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.

@civanT
Copy link
Collaborator

civanT commented Sep 1, 2017

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.

@bd339
Copy link
Collaborator Author

bd339 commented Sep 1, 2017

Okay, so let's keep it around unmerged.

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.

3 participants