New to rabbyt, Coordinates different from PyGame

20 views
Skip to first unread message

Barack Brobama

unread,
Sep 5, 2013, 2:03:31 PM9/5/13
to rab...@googlegroups.com
Hello,

I've been having trouble trying to figure out how the projection parameter works in the set_viewport function. That being said, I am trying to create UI elements such as Text Entries and Buttons. Unfortunately, I have been having trouble figuring out how to detect if the user clicks on a rabbyt.Sprite. I tried using pygame.mouse.get_pos(), but that returns a coordinate different from what rabbyt draws on the screen. Below is my current code:


pygame.init()
size = (1000, 700)
common.DISPLAY = pygame.display.set_mode(size, pygame.OPENGL | pygame.DOUBLEBUF)
pygame.display.set_caption(getGlobalVariable('window-title'))
#
working_directory = os.path.join(os.path.dirname(__file__), "gui")
pygame.display.set_icon(pygame.image.load(os.path.join(working_directory, "icon.png")))
#
rabbyt.set_viewport(size)
rabbyt.set_default_attribs()



My question is, how can I properly display a sprite on my current mouse position so I can detect collision between the mouse sprite and my UI element sprites? Also, why isn't pygame.display.set_icon displaying my icon?
However, if there is a better way of determining if the mouse clicks on a UI element(rabbyt.Sprite), please explain how I would properly implement collision checking.
Reply all
Reply to author
Forward
0 new messages