slowdown when drawing lines for >100objects in canvas

Get help using Construct 2

Post » Mon Jan 18, 2016 7:42 am

Glad it helped the performance.

Changing the position and size of the canvas wouldn't affect the performance. What would affect it, I imagine, is the "resize canvas" action, which changes the texture size. If you can i'd leave the texture size be, and just change the object size. The only issue is the positions would be off when you zoom in and out because the line draw commands are relative to the texture, not the object. This doesn't apply for the "paste" action though, it will paste in place regardless.

Typically when the texture size is the same as the object size you can do this to map layout positions to the canvas:

When the sizes are different you can do this instead:

I didn't seem to include a way to read the texture width and height so you'll want to save them to variables. Just note when the canvas object is created the texture size will be the same as the object size. Then you if you ever use the "resize canvas" action you'll want to update those variables with the new size.
Posts: 5,523
Reputation: 84,009

Post » Tue Jan 19, 2016 11:49 pm

@R0j0hound avoiding canvas resize didn't help unfortunately. Or it wasn't noticeable anyway, and the cost was that the code became a lot less readable with all the coordinate transformations.

But I did realize, I don't need continuous canvas redraws when I'm zooming! So I'm now only requesting a resize+redraw when layout scale is 1, 0.75 and 0.5. As you can imagine performance is stellar.

Thanks for everything <3
Posts: 196
Reputation: 4,737


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests