-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copying a FlxCamera's pixels to a FlxSprite doesn't keep zoom, scroll, etc. of the camera #2145
Comments
Does it work with Lime 2.9.1 + OpenFL 3.6.1? |
No, I get the exact same result with 2.9.1 and 3.6.1. |
I assume that a FlxCamera's pixels represent the state of the camera's view before any transforms are applied for camera zoom, etc. Do I perhaps need to apply a matrix to the |
You shouldn't need to make adjustments. I think I had this working
previously. I'll check later today.
…On Sat, 28 Apr 2018, 11:34 Kevin Purcell, ***@***.***> wrote:
I assume that a FlxCamera's pixels represent the state of the camera's
view before any transforms are applied for camera zoom, etc. Do I perhaps
need to apply a matrix to the copyPixels() or draw() calls to apply these
transforms manually? Is there a way of accessing the relevant matrix from
the FlxCamera, as the internal matrices seem to be private?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2145 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACbEvDvitj424G5TBcj-xUD6C1tTmnu-ks5ttEWhgaJpZM4TrVOm>
.
|
So I've got this sort of working on cpp targets, using a transform matrix built using public properties of the camera:
The translation calculation is based on those done in |
So this works. I have no idea why though. 😁
|
Code snippet reproducing the issue:
Observed behavior:
I'm trying to copy the contents of a camera to a sprite so that I can apply effects to that sprite, such as applying an alpha mask by using
copyChannel()
on the resultingBitmapData
(e.g. https://stackoverflow.com/questions/48075991/is-there-a-way-to-apply-an-alpha-mask-to-a-flxcamera?rq=1). Before getting to the point of applying effects however, I'm having difficulty getting the camera pixels to copy over 1:1 while observing camera zoom, scroll, etc. The above example creates a single sprite containing a red circle, which is placed in the source camera. That camera's zoom is then set to3
, resulting in the circle being rendered at 300% of its original size. When I copy the pixels from this camera to a new sprite, which is displayed in a second camera, it seems that the current zoom of the source camera is not observed and this results in the circle displaying at its original size in the target sprite.Expected behavior:
I would expect the target sprite to be a 1:1 copy of the source camera's current view, including zoom, scroll, etc.
The text was updated successfully, but these errors were encountered: