[PLUGIN] Paster

Post your completed addons to share with the community

Post » Sat Jan 10, 2015 7:26 pm

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!
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Jan 12, 2015 8:35 am

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):

Image

and

Image

Which results in this:

Image

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:

Image

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.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Jan 12, 2015 10:51 am

@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)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Mon Jan 12, 2015 10:55 am

@Aphrodite - superb, cheers, now I just need it to not crash in strange ways :)
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Jan 12, 2015 8:19 pm

@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.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Mon Jan 12, 2015 8:29 pm

R0J0hound wrote:@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 :oops: ).
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Jan 12, 2015 9:31 pm

@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.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Tue Jan 13, 2015 12:38 am

@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.
You do not have the required permissions to view the files attached to this post.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Tue Jan 13, 2015 2:48 am

Wow, that was quick! Thanks, R0J0hound. :D

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.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Tue Jan 13, 2015 5:57 am

@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.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: unicornspitfire and 0 guests