[PLUGIN] Canvas

Post your completed addons to share with the community

Post » Mon Jul 13, 2015 7:36 pm

Thank you, I will try that.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
20
S
9
G
1
Posts: 785
Reputation: 3,725

Post » Sun Jul 19, 2015 11:55 pm

I cant seem to get the paste layer action to work. I turned webgl off which fixed an error that was popping up about invalid image. Now when I run the action it just seems to silently fail.
B
68
S
21
G
15
Posts: 701
Reputation: 15,604

Post » Mon Jul 20, 2015 12:16 am

nevermind I figured it out. :) I thought that the load layer action loaded a layer onto the little canvas box. I realize now that the canvas box is what is loaded from the canvas into the imageurl expression. Once I moved the whole box over the canvas I was able to pull the whole canvas and paste it into a sprite. :) Awesome plugin.
B
68
S
21
G
15
Posts: 701
Reputation: 15,604

Post » Tue Jul 21, 2015 1:44 am

@r0j0hound check this out

http://jonobr1.github.io/two.js/

It's alternative solution for your plugin and it can draw in svg, canvas and webgl, there a note about to fix memory leak, there an excerpt:


Refactor of renderers and scenegraph for performance optimization and lower memory footprint

Relinquished internal events for flags
Prototypical declaration of Object.defineProperty
Added _update and flagReset methods to Two.Shape, Two.Group, and Two.Polygon
Decoupled canvas and webgl renderers and are now independent
Added _matrix.manual to override the default behavior of a Two.Polygon transformation
Localized variables per file as much as possible to reduce Garbage Collection on runtime


What do you think?
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Tue Jul 21, 2015 2:14 am

@joannesalfa
It's interesting but not really usable for this. It's not a matter of using something that can use webgl or canvas2d, it's a matter of getting something to work with c2's renderer.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Tue Jul 21, 2015 3:50 am

@R0J0hound I see, c2 renderer is a limit. I was using canvas transitions between the layouts caused memory leak, I guess we have no solution.
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Tue Jul 21, 2015 7:07 am

@Joannesalfa
Not really a limit but the result needs to be put in a texture so C2 can render it. With canvas2d it's simple, just directly modify the canvas which can be drawn like any other image. With webgl it's trickier. The image needs to be copied into a texture. What's currently done is a whole new texture is made instead of just replacing the current pixels. If it was changed it would be faster I suppose, and perhaps could help with the memory leak, but I've been avoiding most coding lately.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sun Jul 26, 2015 9:38 pm

How to use this Plugin?

When i say "Draw a Line from Sprite X/Y to Mouse X/Y" it will not working
B
8
S
2
Posts: 53
Reputation: 687

Post » Sun Jul 26, 2015 11:24 pm

@edelplastic
Positions are relative to the canvas itself. So you have to subtract the canvas' position.

For example
(sprite.x-canvas.x, sprite.y-canvas.y)
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Mon Jul 27, 2015 1:43 am

Thank you, i will try

Edit: I have try it, but it won´t work

Here my Settings: http://prntscr.com/7xe780

Line.X / Y is the Canvas Object --- I also have test the Objects in different ways (Line.X/Y in upper fields and Mouse in below fields)
B
8
S
2
Posts: 53
Reputation: 687

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest