[PLUGIN] Paster

From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • I see, I was also hoping to use it for the optimization approach, thus having a single family of sprites and pasters, but if that isn't available... hmmm... more workarounds inbound.

    Thanks for the send behind function!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Me again...

    So I'm trying to do a simple thing, or a seemingly simple thing - paste my objects onto a paster object (I wasn't sure if it would paste all available objects or if a For each had to be done so I tried both):

    and

    Which results in this:

    The whole canvas then becomes a small, like 64x64 pixel square at the bottom left of the screen until screen size is changed and then it does this:

    That background is the Paster object. It becomes like that. It's size at that moment is 512x512px.

    Can anything be extrapolated from this?

    Also - can the Paster object's contents be saved as an image (or such an option added)? That would be mega-useful.

  • Somebody

    "Also - can the Paster object's contents be saved as an image (or such an option added)? That would be mega-useful."

    you can use the browser object invoke download to download the paster content (not sure of the name, it is an expression of the paster object, paster.imageurl I think)

  • Aphrodite - superb, cheers, now I just need it to not crash in strange ways

  • Somebody

    The only way you could get that error should be if you paste a paster object to itself, since that's not allowed in C2's renderer. I can't reproduce it with your events but I can by pasting the object to itself. I don't think I can fix it in the second case since that's a requirement of the renderer, but I might if you're doing something else.

    You need to use the "set resolution" action to set the image size. If you place the paster objects in the layout editor they will automatically use a image size the same as the object's size, but if you set the object size in events the image size remains the same.

    I did notice the line numbers in the error is off and it looks like I forgot to upload some updates, so you can now re-download the c2addon and see if that helps. The main change was it fixed pasting when the paster object has a negative width.

  • Somebody

    You need to use the "set resolution" action to set the image size. If you place the paster objects in the layout editor they will automatically use a image size the same as the object's size, but if you set the object size in events the image size remains the same.

    I did notice the line numbers in the error is off and it looks like I forgot to upload some updates, so you can now re-download the c2addon and see if that helps. The main change was it fixed pasting when the paster object has a negative width.

    Ah, "set resolution" - will do! And will check the latest version as well. Super close to being feature-complete with my editor, if this works out then that's another thing off the list. Now if only that HSL problem could also be fixed... (shame on me ).

  • R0J0hound

    Is there any way to enable Paster to grab a canvas snapshot directly? I ask because the internal command (CanvasSnapshot) hangs the runtime for a handful of frames when capturing. CanvasSnapshot compresses the captured data to a png/jpeg, which then has to be decompressed to load it into a sprite. I imagine this is the bottleneck.

  • TiAm

    Re-download the c2addon, I added a "Load from canvas" action that copies the canvas to the paster's texture. The resulting resolution will be WindowWidth x WindowHeight. Not sure if it's faster, but you can do everything on the same tick you load.

    Somebody

    This may be useful for you for saving part of the window at any size image you want.

  • Wow, that was quick! Thanks, R0J0hound.

    It certainly is faster. I see no lag or dropped frames with this method, even on my underpowered android phone.

    There is one problem though: capturing the canvas gives me an image that is both mirrored and upside down. I'm seeing this on my desktop (all browsers) and on my mobile, both with my own project and your example (turn off the pixilize effect and you can see it). If I disable WebGL, the image pastes correctly.

    Hopefully this is a minor fix.

  • TiAm

    Well that's not very encouraging that it's mirrored and flipped, but you say it's the same across all the browsers IE, FF and Chrome with webgl on? I'm using chrome since that's the last browser that still supports my graphics card. What graphics card do you have? Maybe it's graphics card related (I have an Ati)

    If it's flipped or mirrored for anyone else let me know which browsers and graphics card if you could.

  • Okay, this is just freaking odd.

    To sum up: I have a 3570k w/ HD4000 graphics. This is only happening in chrome canary and firefox. Here is the tally (triple checked this time):

    Android:

    The latest chrome, v39, works fine. Firefox doesn't capture anything, just gives me a blank paster object (big surprise).

    PC - Chrome:

    Chrome Stable v39 works fine. Unbeknownst to me, I was testing in Canary before (it comes up when I select chrome in C2).

    Canary v41 is doing the odd mirror and flip trick, plus I can see thru the paster object slightly, as if it had an opacity of ~96 or so.

    PC - Other:

    Firefox does the exact same thing canary does...sometimes. Other times, the paster object remains blank. Odd, considering Firefox is a separate code base.

    IE 11 doesn't do anything; the paster object remains blank.

    Node-Webkit 0.10.5 works fine as well. Not sure about the newer versions (though who would want to use them, anyway).

    See any of this on your end?

  • TiAm

    I appreciate testing it. I'm currently limited to only being able to use webgl in chrome 33 (probably should upgrade). Every other browser either on my laptop either never worked with webgl or somehow now won't work with webgl. I have another pc that I don't have access to atm that I'll test on if I need to.

    I did another tweak to do something that is used elsewhere in the plugins. Does it give better results?

  • Somebody

    This may be useful for you for saving part of the window at any size image you want.

    Wow! This is simply beastly - I suspect it also enables a feature I was kinda going to mention as a slim possibility - supersampling (in a way) - i.e. punching a higher res image into a lover res canvas and thus improving the quality of the result.

    Speaking of which - can I set the resolution to beyond object size? Would the pasted objects then be, for example, pasted at a higher res. And can I change the res and thus downsize that image before saving?

  • Somebody

    The resolution can be set to anything from 1x1 up to the largest texture size your graphics card supports, whatever that may be. And yes you can do just that. In the example the canvas is copied to the screen object and a portion of that is pasted to the paster object which has a resolution of 32x32. So then if you saved Paster.imageUrl you'd get a 32x32 pixel image.

  • Ok, another sub-question: Can I capture things off-screen (but on canvas) or will only screen-visible objects be pasted?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)