2012-07-01 20.00.05

That’s my cat. She’s a princess.

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:


Done. My transparency code works perfectly now. Hell’s bells. It just seemed to me that something as fundamentally useful as transparency or interpreting alpha values might be enabled by, you know, default. Silly me.

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:

if(wheelDelta != 0){
cameraPos.translate(xDelta, yDelta, .01f * (float)wheelDelta);

And I kept wondering why it would always detect and register a change in the mouse wheel, but never a change in x and y values. When you see it….

It really does feel good when you figure something like this out, though. All sorts of good chemicals in my brain right now.

C’est la vie.