sprites, types, and loading?
BlitzMax Forums/MiniB3D Module/sprites, types, and loading?| 
 | ||
| hi. i'm making particles w/mini b3d. i have a "type" called particle, and the particle has a sprite field. it is loaded like this: Field sprite=LoadSprite("fire.png") The problem with this is that everytime I generate a new particle (Local p:particle=new particle), I believe that the type re-loads fire.png from the harddrive. Thus with around 50 particles, I am experiencing significant slowdown. Anyone have tips or know a way around loading this way? Thanks! | 
| 
 | ||
| Try global sprite=LoadSprite("fire.png") in your type. I think it will work but don't have Blitz here to be sure. | 
| 
 | ||
| Everytime you create a new type you are loading the image from the harddrive. Just have a global in your type which loads the image, then do a field sprite = copyimage(Global_sprite) | 
| 
 | ||
| . Redundant post | 
| 
 | ||
| . | 
| 
 | ||
| thanks guys. and could anyone tell me what the commands are for doing the same w/a mesh and texture? | 
| 
 | ||
| oh duh its probably copymesh...but also i just checked. copyimage doesn't exist? | 
| 
 | ||
| global particle_tex = loadtexture("blah.jpg") Sprite = createsprite() entitytexture sprite , particle_tex this way, you only load the texture once. | 
| 
 | ||
| thanks...i'm having a huge memory leak though. to free the memory...do i just do FreeEntity sprite ? or sprite = null ? GC looks like it hasn't been cleaning something up lately. I can post code later if need be. |