jdf / peasycam

Dead-simple mouse-driven camera for Processing
http://MrFeinberg.com/peasycam/
Apache License 2.0
116 stars 35 forks source link

Added support for using PeasyCam on offscreen PGraphics objects #13

Closed additv closed 10 years ago

additv commented 10 years ago

Hey, I often find myself needing to use PeasyCam on offscreen PGraphics objects rather than the main PApplet. This change makes that possible while retaining backwards compatibility.

additv commented 10 years ago

Makes sense, I just did those changes.

additv commented 10 years ago

This is true, but I think it's the sensible way of handling things for the moment without getting overly complex. (though I'm open to suggestions)

I tend to use full-screen PGraphics surfaces for compositing and applying shaders. This works fine with that use case.

If we want to acommodate placing different sized PGraphics in different locations in the main PApplet context, we would have to add a mapping of window coordinates to PGraphics coordinates. I think there's enough edge cases here that it might not be worth it though (what if the pgraphics is moving, or completely offscreen?).

jdf commented 10 years ago

Well, since the PApplet is the control surface, maybe the mouse position should continue to be compared to the width of the PApplet, not the width of the graphics, I think.

additv commented 10 years ago

You're right of course. I just reverted those as well as the white space.

jdf commented 10 years ago

Many thanks!