I figured it'd be wise to have mouse functionality when I'm making a map editor for my little RPG so I started looking at the glut mouse funcs.
Pretty easy, it seemed, but I ran into a problem pretty quickly:
The passive mouse func gives me numbers that are pretty useless as it is now... Glut thinks that the upper left corner of my program is 0,0 and the lower right corner is (the current width),(the current height) <--- Of the window. I really like having the lower left corner as 0,0 so that's how I want it, this isn't very hard to do, I could probably have it working by the time I finish writing this topic but solving scaling of the window is harder...
Is there a function similar to gluOrtho2D that sets glut to "think" the way I tell it to? Something like this
glutMouseCoordinateOrientation(0, 240, 0, 160); <----- Game Boy Advance screen size, with Lower Left as 0,0
Is this possible or do I have to set up functions to calculate and track the window size and then us division to find the "correct" mouse position?
Using Mouse with GLUT
Moderator: PC Supremacists
- Sanshin77
- Chaos Rift Regular
- Posts: 160
- Joined: Tue Mar 10, 2009 9:36 am
- Current Project: C++/SDL engine, zaActionWizardMagic game
- Favorite Gaming Platforms: Xbox 360, Playstation 2, Nintendo DS, mac and PC
- Programming Language of Choice: C++
Using Mouse with GLUT
Check out videos of my C++ games as well as my "Amateur Game Dev" series over at
My YouTube Channel: http://www.youtube.com/user/Zanchill
My YouTube Channel: http://www.youtube.com/user/Zanchill
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Using Mouse with GLUT
Personally, I think I would just rework it so that the upper left is 0,0, because I think this is pretty standard. Position coordinates for pretty much everything (windows, sprites, other displayed object, etc) are (top, left).
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.