Posted: 27th Sep 2003 0:06
Aimed at showing people a more professional way of loading media into dark basic and how to use it.

+ Code Snippet
sync on
cls 0
sync


blue = Load_An_Image("c:\images\blue.bmp")
red = Load_An_Image("C:\images\red.bmp")

paste image blue, 100, 100
paste image red, 200, 100

sync
wait key

delete image blue
delete image red

end

Function Load_An_Image(File as string)

   count = 0
   found = 0
   repeat
      count = count + 1
      found = image exist(count)
   until found = 0

   Load image File, count

endfunction count


A realy usefull function that can be amended to load any type of media.
Posted: 30th Sep 2003 17:26
Nice clean Function! I will probably adopt this method of loading media

It could use a few comments to explain that its main purpose is to assign image numbers in a sequential order.

Will the image names need to be GLOBAL to work inside funtions?
Posted: 15th Oct 2003 19:00
I have a question,

A function always remembers a local variable once it's been executed. So all you have to do is increase the count if the file exists.

That will save you a loop that costs a bit more processing power...

check my codebase for object managment functions. I use arrays but now you gave me an idea to use local ints instead...

nice one.
Posted: 15th Oct 2003 19:03
AHA I see...

you want to delete images using the db command... I wrote a function to do that, hence the array... nice one. I will convert to your system.

Cheers.