Custom Game Cursor

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Vict0r1994
Newbie
Posts: 19
Joined: Mon Apr 08, 2013 10:46 pm
Contact:

Custom Game Cursor

#1 Post by Vict0r1994 »

I had an idea about customizing the game cursor, and I found this information about configuration variables on the ren'py wiki:


config.mouse = None

This variable controls the use of user-defined mouse cursors. If None, the system mouse is used, which is usually a black-and-white mouse cursor.

Otherwise, this should be a dictionary giving the mouse animations for various mouse types. Keys used by the default library include "default", "say", "with", "menu", "prompt", "imagemap", "pause", "mainmenu", and "gamemenu". The "default" key should always be present, as it is used when a more specific key is absent.

Each value in the dictionary should be a list of (image, xoffset, offset) tuples, representing frames.

image
The mouse cursor image.
xoffset
The offset of the hotspot pixel from the left side of the cursor.
yoffset
The offset of the hotspot pixel from the top of the cursor.

The frames are played back at 20hz, and the animation loops after all frames have been shown.


However, I'm new to ren'py and I don't know how I could write the aforementioned list in code. To be honest, I don't know at all how lists should be defined or how they work, but I want to learn and I really want to implement a custom cursor. I've tried some codes, but I always get a parsing error. Can somebody help me?

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Custom Game Cursor

#2 Post by apricotorange »

A quick search of this forum brings up this example of the syntax: http://lemmasoft.renai.us/forums/viewto ... e+#p247818 .

pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Custom Game Cursor

#3 Post by pwisaguacate »

If you're simply changing the mouse cursor for the whole game, then this should work:

Code: Select all

init:
    $ config.mouse = { "default": [ ('mouse.png', 0, 0) ] }

Vict0r1994
Newbie
Posts: 19
Joined: Mon Apr 08, 2013 10:46 pm
Contact:

Re: Custom Game Cursor

#4 Post by Vict0r1994 »

Thank you both! :D I used the latter suggestion for starters, but I'll probably customize my cursor further now that I know how to do it.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Custom Game Cursor

#5 Post by PyTom »

I don't recommend using config.mouse anymore. Changes in how video drivers work cause unacceptable lag on some computers. (Notably, the default Nvidia driver configuration lags a lot.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
mugenjohncel
Hentai Poofter
Posts: 2121
Joined: Sat Feb 04, 2006 11:13 pm
Organization: Studio Mugenjohncel
Location: Philippines
Contact:

Re: Custom Game Cursor

#6 Post by mugenjohncel »

PyTom wrote:I don't recommend using config.mouse anymore. Changes in how video drivers work cause unacceptable lag on some computers. (Notably, the default Nvidia driver configuration lags a lot.)
So umm.... what would be the new prefered way to do config.mouse... specifically, changing the way the cursor looks...

"POOF" (Disappears)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Custom Game Cursor

#7 Post by PyTom »

There isn't one, at the moment.

(I have vague plans, but they're months away at best.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Google [Bot]