Posted: 7th Feb 2004 18:49
This function was originaly written for Blitz but iv made a translation.
Works exactly the same way how it works in blitz.

Make sure not to hide mouse and set window on


The dll you can download from here.
www.studiox64.com/download.php?get=pc/blitzavi.zip

enjoy
Posted: 9th Feb 2004 17:52
I look forward to trying it out! This will save me a lot of disk space and messing around with bitmaps
Posted: 9th Feb 2004 20:28
so i can use this to make .avi's of my programs? sounds cool
answering my own question... yes i can!!! this is so cool a little slow and i think i need to play around with the frame times or something but it works very nicely thanks!!!!
Posted: 9th Feb 2004 22:57
That could be very useful.
Thanks for releasing it!
Posted: 13th Feb 2004 11:04
Have u got a working sourcecode for how to use it in DarkBASIC? Sorry for being way stupid, but I really need a small example
Posted: 13th Feb 2004 17:33
Hm ..... Try this.
Posted: 14th Feb 2004 18:20
I can't get it to work , do we have to use the grab image and save image commands for this? that's waaaaaaaaay to slow for that
Posted: 14th Feb 2004 18:57
thats what i've been using mussi, but copy and save bitmap are probably faster
Posted: 14th Feb 2004 19:35
there is no save bitmap command in DBpro
why won't my avi files play ?it always gives an error that the avi file can't be read.
Posted: 14th Feb 2004 19:59
damn sorry, i was looking at tiger's code.
i use this code:

+ Code Snippet
Set Window On
Set Window Title "AVI TEST"
Disable Escapekey

CreateAviFile("AVI TEST","example.avi",30,"output.bmp",1,0)
BOX 0,0,SCREEN WIDTH(),sCREEN hEIGHT(),RGB(255,0,0),RGB(0,255,0),RGB(255,255,0),RGB(255,0,255)

While escapekey()=0
   INK RGB(RND(255),RND(255),RND(255)),0
   BOX RND(SCREEN WIDTH()),RND(SCREEN HEIGHT()),RND(SCREEN WIDTH()),RND(SCREEN hEIGHT())
   Get Image 1,0,0,Screen Width(),Screen Height()
   Save Image "output.bmp",1
   WriteImageToAviFile()
Endwhile

CloseAviFile()

Function CreateAviFile(baviApplicationTitle$,baviNameOfAviFile$,baviFrameTime,baviImageName$,baviCompressionFlag,baviSuppressOverwrite)

   baviBankSize = 250

   rem baviBankDataIn  = CreateBank(baviBankSize)
   rem baviBankDataOut = CreateBank(baviBankSize)
   make memblock 250,250
   make memblock 251,250


   For tcount = 0 To baviBankSize-1
      rem PokeByte baviBankDataIn, tcount, 0
      rem PokeByte baviBankDataOut, tcount, 0
    write memblock byte 250,tcount,0
    write memblock byte 250,tcount,0
   Next tcount

   If Len(baviNameOfAviFile$) > 80 Then exit prompt "ERROR !","Name Of Avi File is too long, must be 80 characters or less!"     :end

   For tcount = 0 To Len(baviNameOfAviFile$)-1
     rem  PokeByte baviBankDataIn, tcount, Asc(Mid$(baviNameOfAviFile$, tcount+1, 1))
    write memblock byte 250,tcount,Asc(Mid$(baviNameOfAviFile$, tcount+1))
   Next tcount

   write memblock dword 250,80,baviFrameTime


   If Len(baviImageName$)>79 Then end

   For tcount = 0 To Len(baviImageName$)-1
     rem PokeByte baviBankDataIn, tcount+84, Asc(Mid$(baviImageName$, tcount+1, 1))
     write memblock byte 250,tcount+84,Asc(Mid$(baviImageName$, tcount+1))
   Next tcount

   If Len(baviApplicationTitle$) > 75 Then end

   For tcount = 0 To Len(baviApplicationTitle$)-1
     rem PokeByte baviBankDataIn, tcount+164, Asc(Mid$(baviApplicationTitle$, tcount+1, 1))
    write memblock byte 250,tcount+164, Asc(Mid$(baviApplicationTitle$, tcount+1))
   Next tcount

   If baviCompressionFlag = 0
      rem PokeByte baviBankDataIn, 240, False
      write memblock byte 250,240,0
   Else
      rem PokeByte baviBankDataIn, 240, True
      write memblock byte 250,240,1
   EndIf

   If baviSuppressOverwrite = 0
      rem PokeByte baviBankDataIn, 241, False
      write memblock byte 250,241,0
   Else
      rem PokeByte baviBankDataIn, 241, True
      write memblock byte 250,241,1
   EndIf

   load dll "BlitzAvi.dll",98

  show mouse
   Call DLL 98,"create_avi_file",GET MEMBLOCK PTR(250),GET MEMBLOCK PTR(251)

  hide mouse



endfunction  result

Function WriteImageToAviFile()


if dm=0 then show mouse
   Call DLL 98,"write_image_to_avi_file"

if dm=0 then hide mouse
dm=1
EndFunction result

Function CloseAviFile()
   rem FreeBank baviBankDataIn
   rem FreeBank baviBankDataOut
   delete memblock 250
   delete memblock 251
   call dll 98,"close_avi_file"
   delete dll 98
EndFunction result


with the blitzavi.dll in the same directory and it works quite well.
Posted: 14th Feb 2004 20:59
LOL, I forgot about the disable escapekey command, but now I got another problem :/

try this:

+ Code Snippet
sync on : sync rate 0

make object cube 1,1

disable escapekey

CreateAviFile("Testor","test.avi",10,"output.bmp",1,0)

do

set cursor 0,0
print screen fps()

yrotate object 1,object angle y(1)+1

if escapekey()=1 then exit

get image 1,0,0,screen width(),screen height()
save image "output.bmp",1

WriteImageToAviFile()

sync

loop

CloseAviFile()


I get this very weird avi file that looks very streched and all, and the output.bmp is also
Posted: 15th Feb 2004 12:36
You forgot to add the texture flag.
Simply add a ,1 to get image and all will be fine.
Posted: 15th Feb 2004 18:22
oke that worked nice, but I only got 12 fps with just a spinning cube