Yesterday (day 45), I made these changes:
- Event hooks can be (de)activated by manipulating their @active attribute. This is nice if you want to temporarily turn off a hook, without removing it entirely.
- Added MouseReleaseTrigger, the counterpart to MouseClickTrigger. It fires when a mouse button is released.
- Added PreStepEvent and Sprite#pre_step, which allows the Sprite to perform an action prior to each step of the simulation. (Mostly this is useful for "slewing", which is the Chipmunk word for "updating the velocity so that the body will reach a specified position after the next simulator step".)
To try out all those changes (actually, as the motivation for making those changes), I updated the panda ball demo to allow the user to click and drag panda balls around with the mouse. You can even "throw" them by releasing the mouse button while the mouse is still moving.
Today (day 46), I fixed the math used by Camera to convert between screen coordinates and world coordinates. It now correctly accounts for the camera's position, rotation, and zoom level. Camera doesn't rotate or zoom the background yet, though.
I tried out the new camera math by adding controls to move, rotate, and zoom the camera in the panda ball demo, but I haven't checked it in yet. I'm going to do that tomorrow, after I clean up the code a little bit.
Some other things I need to do:
- Fix how sprites are undrawing themselves from the screen. They leave trails behind if they move too fast. This is generally a symptom of undrawing the sprite at the new position instead of the old; it should be an easy fix.
- Investigate slowness in updating dirty rects on the screen. I'm not sure if it's just slowness from the Ruby-implemented Rect class, or if there's something wrong in the new code.
- Make it more convenient to specify the camera mode. Right now you have to create a Screen and background surface, pack those in a RenderModeSDL, and then pass that as an argument when creating the Scene. Lots of hoops being jumped through, there.