Monday, October 3, 2011

Mouse Control this is Major Tom

We decided that since this new project is going to be for windows that we would like to use a mouse as a controller. I figured that that would be simple, but it ended up being a big pain. First, you need to make the mouse visible, easy. Now you need to make it so it can detect objects and influence what they do and that they can tell if they have been clicked. Not as simple. You do have a MouseState provided for you, but it just tels you if there is click on one of the buttons. I decided that since I had to write a bunch of code for detecting if the mouse button is being held, and if the click counts as a double click that I would just write a new mouse class or object. so that is what I did. The cool thing about ti is that we can now have a custom cursor for our game, and I understand how it works, because I coded it.

To go with the Mouse object I ended up writing a new object class for clickable objects. That is, this class is for any items on the screen that we want to click and have interact with the mouse. things such as buttons and scroll bars.

I made up our menus and went a ahead and applied the clickable object code to them and it's working pretty good. Now to make scroll bars. Yay!

No comments:

Post a Comment