Tuesday, September 11, 2012

DSDN 142: Mouse Toys & Learning the Basics

So, over the holidays I decided to storm ahead a little and investigate a bit of fun and play around with some mouse toys. It was easy and a little bit of good fun with some variables that I hadn't used before.

The first little one I had some fun with was a simple crosshair that simply stayed where the mouse did. Basic stuff, but I was just learning.

For this one, I investigated how to use the pmouse variables. pmouse variables are the locations for where the mouse was one frame ago. This allowed me to have these lines that swayed depending on how you moved your mouse.

Having some more fun with the crosshairs concept, I enhanced it a little. This one was a little bit of advancing on what I had already done.

For this next one I went back to nil, and started working on something new. I looked at some drawing programs on OpanProcessing, and the created my own little simplified one. This program allows the user to paint, essentially. The left mouse button paints with three lines, while the right mouse button paints with 4 lines that are split into two groups.

I've rigged it up so that pressing the spacebar resets the drawing, and pressing the "c" button changes the colour of the lines. I wrote the code so that the lines are drawn based on the pmouse X/Y function linked to the mous X/Y function.

One of the problems with this baby is that the lines it draws can come out a little jagged if the user moves the mouse very fast, as the program writes the lines on a frame-by-frame basis. To correct this I could possibly write the lines as beziers, but at present I don't know how to do that yet.



For the next little experiment, I utilised the combined knowledge of the previous ones and created a simple little experiment which allowed a little bit of play involving mouse pressing and circle movement. The central point, rather than being directly on your mouse, followed your mouse around the screen, increasing in speed as the mouse moved further away from it. When the mouse is pressed, the horizontal and vertical lines appear and the circles move away from the central one.

Learning in class how to get things to follow your mouse was a big bonus!

A little fun here and there, but ultimately it's still business as usual!

No comments:

Post a Comment