Page 1 of 1

independent canvas clones

PostPosted: Sun Apr 06, 2008 10:18 pm
by feral
I am not sure if this has already been suggested...

however, what i would like to see is some form of independent canvas clones.
ie: clones of a canvas that can be manipulated in an array

( or some method of manipulating an array of individual canvas's - which i know can be done with coding but it would be nice to have an easy way...)

the main reason for this is that ( unless i have it wrong)... each canvas clone contains the same graphics as the original.. I would like to manipulate an array of cloned canvases that have individual "create" coding.

This would allow me to PRERENDER the draw_from function and have automatically scaled sprites.

example: warning : PSEUDO CODE :)

create canvas actor
// then in the create_actor of this canvas

use "draw_from" a sprite and "scale to [cloneindex * SIZE REQUIRED]" //size required is a variable to set the scaling

for i=1;i<= (number of scaled sprites required) ;i++ //say about 100 canvas clones
clone actor "canvas"
next

This would give me an array of 100 canvas clones with a sprite scaled from 1 * SIZE to 100 * size - all pre-rendered.

ie:
in clone.1 draw_from would scale at 1 * size required
in clone.2 draw_from would scale at 2 * size required
.....
in clone.99 draw_from would scale at 99 * size required

note size required can be a fraction etc to scale downwards

as the code in each clone would create a scaled sprite from 1 to 100 in the "create" code, and therefore not have to use the draw_from function during runtime.

now... i know i can already do this by creating many many individual canvases, and i can manipulate them using hand made functions and things like fprint ... and i have, and it works so well that I would like to see a built in function...as it does get very messy :(

hope this makes sense

feral

Re: independent canvas clones

PostPosted: Tue Apr 08, 2008 10:08 pm
by Game A Gogo
Code: Select all
draw_from("Actor",x,y,cloneindex*Size);

I think something like that

Re: independent canvas clones

PostPosted: Sat Apr 12, 2008 12:29 am
by feral
Game A Gogo wrote:
Code: Select all
draw_from("Actor",x,y,cloneindex*Size);

I think something like that


thanks GameAGoGo, but the problem is each cloned canvas writes the draw_from to every clone :( so every clone ends up looking the same..

see example attached..
clonecanvas.zip
(6.62 KiB) Downloaded 171 times

The idea would be to have each clone have a separate image all scaled from 1 to 100... drawn in the "create" stage, and then swap canvas's to create the illusion of scaling sprites, without using the draw_from function during runtime..
this would allow me to have hundreds of scaling sprites on the screen at the same time with no "hit" on performance as the draw_from function will slow the game down when it is used on many actors at the same time.

any idea's... or am i just doing it wrong :oops: :oops:

thanks
feral

Re: independent canvas clones

PostPosted: Sun Apr 13, 2008 5:40 am
by DilloDude
I think it's a bug with canvases. I'm having the same problem. When you draw on a canvas, all clones draw the same thing.
The other problem I'm having is that my canvases are quite large, and having 16 of them seems to slow the game down.