Hiya,
is there a simple way to get the mouse cursor location inside a Ren'Py screen?
[SOLVED] Where is my mouse positioned?
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.
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.
-
- Regular
- Posts: 72
- Joined: Tue Jul 11, 2017 2:13 am
- Contact:
[SOLVED] Where is my mouse positioned?
Last edited by felsenstern on Tue Nov 16, 2021 5:46 am, edited 1 time in total.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it
Re: Where is my mouse positioned?
https://www.renpy.org/doc/html/other.ht ... _mouse_pos
You can find several examples using this if you search the forums as well.
You can find several examples using this if you search the forums as well.
-
- Regular
- Posts: 72
- Joined: Tue Jul 11, 2017 2:13 am
- Contact:
Re: Where is my mouse positioned?
Sometimes I wish you guys could see a log of all my search queries and pondering I've done before having to beg for information in this forum and of course getting exactly the RTF quote.
Thanks for the info anyways.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it
Re: [SOLVED] Where is my mouse positioned?
Chill, dude. I meant the documentation doesn't show you how to use it, so if you need examples, search the forum. Obviously I have no idea what you searched for, but fyi the in-forum search isn't great and I tend to find google with site:lemmasoft.renai.us turns up better results. :shrug:
Re: [SOLVED] Where is my mouse positioned?
Here's the code I use, which I of course hacked together from code elsewhere on these forums:
Alternately, if you just want to know the position of a Drag:
Code: Select all
default mousex = 0
default mousey = 0
init python:
# create a 1x1 invisible Displayable to listen for Mouse motion events
# updates store.mouse_pos every time the mouse moves
class getMousePosition(renpy.Displayable):
def __init__(self):
renpy.Displayable.__init__(self)
def event(self, ev, x, y, st):
import pygame
if ev.type == pygame.MOUSEMOTION: # Updates the position of the mouse every time the player moves it
store.mouse_pos = (x,y)
renpy.restart_interaction()
def render(self, width, height, st, at):
return renpy.Render(1, 1)
store.mousePosition= getMousePosition()
def checkEvent():
ui.add(mousePosition)
if debug:
config.overlay_functions.append(checkEvent) # This adds a 1*1 invisible displayable on every screen
Code: Select all
screen metadata_overlay():
drag:
pos start_pos
dragged caption_dragged
textbutton gallerytitle style "gallerytitle"
init python:
def caption_dragged(drags,drop):
renpy.log("dragged to %d,%d" % (drags[0].x,drags[0].y) )
return None
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM
Who is online
Users browsing this forum: No registered users