DavidNorgren

Untitled

Apr 7th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// Game start
  2.  
  3. path_movie = "movie.dll"
  4. lib_movie_init = external_define(path_movie, "movie_init", dll_cdecl, ty_real, 0)
  5. lib_movie_set = external_define(path_movie, "movie_set", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
  6. lib_movie_start = external_define(path_movie, "movie_start", dll_cdecl, ty_real, 2, ty_string, ty_string)
  7. lib_movie_audio_file_decode = external_define(path_movie, "movie_audio_file_decode", dll_cdecl, ty_real, 2, ty_string, ty_string)
  8. lib_movie_audio_file_add = external_define(path_movie, "movie_audio_file_add", dll_cdecl, ty_real, 1, ty_string)
  9. lib_movie_audio_sound_add = external_define(path_movie, "movie_audio_sound_add", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
  10. lib_movie_frame = external_define(path_movie, "movie_frame", dll_cdecl, ty_real, 1, ty_string)
  11. lib_movie_done = external_define(path_movie, "movie_done", dll_cdecl, ty_real, 0)
  12.  
  13.  
  14. /// movie_set(width, height, bitrate, framerate, audio)
  15. /// Sets the movie properties, sets the width and height of the movie.
  16. /// bitrate defines the quality, a good value is 2500000
  17. /// framerate is the number of frames per second, 24 is a good start
  18. /// audio is whether to include audio in the output
  19.  
  20. return external_call(lib_movie_set, argument0, argument1, argument2, argument3, argument4)
  21.  
  22.  
  23. /// movie_start(filename, format)
  24. /// Starts writing a movie file into the given filename.
  25. /// format defines the codec/format. Accepted values are mp4, mov or wmv.
  26.  
  27. return external_call(lib_movie_start, argument0, argument1)
  28.  
  29.  
  30. /// movie_audio_file_add(filename)
  31. /// Loads a file of raw audio into memory. Returns its ID.
  32.  
  33. return external_call(lib_movie_audio_file_add, argument0)
  34.  
  35.  
  36. /// movie_audio_file_decode(source, dest)
  37. /// Decodes a sound file into raw format.
  38.  
  39. return external_call(lib_movie_audio_file_decode, argument0, argument1)
  40.  
  41.  
  42. /// movie_audio_sound_add(file, play, volume, start, end)
  43. /// Adds a sound to the movie from a audio file ID (as returned by movie_audio_file_add).
  44. /// play is the amount of seconds in the movie to play the sound.
  45. /// volume from 0-1.
  46. /// start is the offset in the audio file to start playing (0 to start at the beginning).
  47. /// end is the offset from the end of the audio file to stop playing (0 to stop at the end).
  48.  
  49. return external_call(lib_movie_audio_sound_add, argument0, argument1, argument2, argument3, argument4)
  50.  
  51.  
  52. /// movie_frame(filename)
  53. /// Adds a single frame from a file of raw pixels. This can be generated using buffer_get_surface().
  54.  
  55. return external_call(lib_movie_frame, argument0)
  56.  
  57.  
  58. /// movie_done()
  59. /// Finishes the movie file.
  60.  
  61. return external_call(lib_movie_done)
  62.  
  63.  
  64. /// Example use
  65. movie_set(...)
  66. movie_start(...)
  67.  
  68. foreach audio file
  69.     movie_audio_file_decode(...)
  70.     id = movie_audio_file_add(...)
  71.  
  72. foreach sound effect
  73.     movie_audio_sound_add(audio file id, ...)
  74.  
  75. foreach frame
  76.     generate frame...
  77.     export frame...
  78.     movie_frame(...)
  79.  
  80. movie_done()
Advertisement
Add Comment
Please, Sign In to add comment