Science, technology and media commentary for people who like to know things.

Main menu

Tag Archives: cat

You’ve all had those “I’m an idiot” moments. Well, I had a couple of them. The two issues I was having involved the alpha blending (making the box cover fade into view upon loading the program) and I was having some trouble dragging the camera around. I could make the camera zoom in and out on the image, but not drag the image around on the screen.

Okay, so the alpha blending involved actually knowing that something called alpha blending exists. Silly me. Two lines of code:

The other thing involved the fact that I could zoom in but not drag the camera about. Consider that I had the camera’s position stored in a vector called “cameraPos” containing three floating point values, x, y, and z.

I had a little function to detect any changes in the mouse wheel state (for zooming) and a little bit of code to detect whether the mouse button was clicked or dragged around and to record any changes in the position of the mouse and feed them into my camera, which would then be fed into this little “if” statement: