> Just when I thought I could see the sun I was cast down again into > darkness. I've been working on this problem for several days with > limited success. > > I'm trying to implement full screen rotation in an overhead-perspective > game. The angle of the screen is locked to the angle of the player. If > the player turns then the screen also turns, meaning the player is > always facing "up". Here is an example of exactly what I'm trying to do: > http://www.youtube.com/watch?v=lX_bhygaSy0 > > These are the variables I'm working with: > > orientation ' Player/camera's angle in degrees (Rad(orientation)). > bworkspace ' Image buffer containing the original non-rotated background. > brotated ' Image buffer containing the new rotated bworkspace. > cx ' Camera's x coordinate in bworkspace. > cy ' Camera's y coordinate in bworkspace. > > brotated is larger than bworkspace because the rotation function doesn't > crop the rotated image: > > http://www.eightvirtues.com/sanctimonia/images/bworkspace.png (512x512) > http://www.eightvirtues.com/sanctimonia/images/brotated.png(725x726) > > How do I convert the camera coordinates (cx, cy) in bworkspace to the > equivalent coordinates in brotated? Essentially I need bworkspace to be > rotated around (cx,cy), but the rotate function only rotates about the > center of the image. Because of this I think I need some combination of > rotating (cx,cy) about some point and offseting it as well. Reading my > own email it sounds simple, but I've tried so many things that I can't > believe I haven't solved the problem through sheer luck.
The Rotate method is slow, and it rotates only around the image center. So you have to crop the image first, rotate it, and crop it again. The initial crop should be the size of the final display * SQR(2), so that any rotation will fit. Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user