I used three buttons with different position properties as an experiment.
I checked the value of arguments with variables.
The x argument passed the mouse position on the x axis.
The y argument should pass the mouse position on the y axis, but that's not true.
I checked it with the renpy.get_mouse_pos() function.
The w and h arguments are passed to the size of the displayed object, in this example a button.
And when I use the area property, I get integers.
When I use xysize, maximum, minimum properties I get floating point numbers.
I have a question why the mouse position on x-axis is always the same, but never on y-axis.
And also on the position properties, why with some properties the values of arguments are integers in other floating point numbers.
Is it an error or I'm doing something wrong?
Here is an example in which I made a check.
Code: Select all
init python:
def modal_function(ev, x, y, w, h):
import pygame_sdl2 as mypygame_sdl2 # import pygame_sdl2 module
store.mouse_pos = renpy.get_mouse_pos()
store.mod_1 = ev #renpy.pygame_sdl2.event.event_name(ev)
store.ev_type = type(ev)
store.mod_2 = x
store.mod_3 = y
store.mod_4 = w
store.mod_5 = h
if ev is not None:
if ev.type == mypygame_sdl2.MOUSEBUTTONUP: # event when the mouse button is released
return True
else:
return False
screen modal_screen_2():
tag myscreen
#modal True
frame:
background 'bg meadow'
hbox:
spacing 2
vbox:
spacing 2
pos (-4,-4)
text 'Экран my_screen'
button id "button_1":
background "textbutton_[prefix_]"
maximum (180, 60)
minimum (180, 60)
modal modal_function
action Call("enter_label")
button:
background "textbutton_[prefix_]"
area (0,0,180,60)
modal modal_function
action ShowTransient("enter_screen", transition=dissolve)
button:
background "textbutton_[prefix_]"
xysize (180,60)
modal modal_function
action Return()