home *** CD-ROM | disk | FTP | other *** search
/ DarkBasic Professional / DarkBasicPro.iso / data1.cab / Lang_Files_(English) / Help / examples / system / system1-example.dba < prev    next >
Encoding:
Text File  |  2004-09-22  |  3.1 KB  |  101 lines

  1. rem System Showcase
  2.  
  3. ` This demo showcases the db2dwipes.dll functions
  4. ` Please note that the transition library supports:
  5. ` * Screen resolutions of 640x480, 800x600, and 1024x768
  6. ` * Screen bit depths of 16, 24, or 32 bits.
  7. `
  8. ` Copyright ⌐ 2001
  9. ` Dark Basic Software Limited
  10. ` All Rights Reserved
  11. `
  12. ` TRANSITIONS BY NUMBER
  13. `      1 : TransitionProc := BumpDown;
  14. `      2 : TransitionProc := BumpUp;
  15. `      3 : TransitionProc := BumpLeft;
  16. `      4 : TransitionProc := BumpRight;
  17. `      5 : TransitionProc := TransitionDown;
  18. `      6 : TransitionProc := TransitionUp;
  19. `      7 : TransitionProc := TransitionLeft;
  20. `      8 : TransitionProc := TransitionRight;
  21. `      9 : TransitionProc := SpiralClockUL;
  22. `      10 : TransitionProc := SpiralClockBR;
  23. `      11 : TransitionProc := SpiralCounterClockUL;
  24. `      12 : TransitionProc := SpiralCounterClockBR;
  25. `      13 : TransitionPRoc := RandomBlocks;
  26. `      14 : TransitionProc := HorizontalBlocksDown;
  27. `      15 : TransitionProc := HorizontalBlocksUp;
  28. `      16 : TransitionProc := VerticalBlocksLeft;
  29. `      17 : TransitionProc := VerticalBlocksRight;
  30. `      18 : TransitionProc := CrossFade;
  31. `      99 : TransitionProc := CustomBlocks;
  32. `      100 : TransitionProc := CustomBlocksReverse;
  33. `
  34.  
  35. rem You can change the bit depth here, if you like. Be sure your video adapter supports it.
  36. bitdepth = screen depth()
  37.  
  38. rem this is the transition speed
  39. framecount = 90
  40.  
  41. sync rate 60
  42. sync on
  43. backdrop off
  44.  
  45. rem Load Ripple DLL
  46. load dll "db2dwipes.dll",1
  47.  
  48. rem these are the two images we will use for the demo. Please note that we need three bitmaps:
  49. rem image 1, image 2, and the display bitmap, to show the current transition
  50.  
  51. load bitmap "screen1.jpg",0
  52. make memblock from bitmap 1,0
  53. make memblock from bitmap 2,0
  54. load bitmap "screen2.jpg",0
  55. make memblock from bitmap 3,0
  56.  
  57. s1 = get memblock ptr(1)+12
  58. s2 = get memblock ptr(2)+12
  59. s3 = get memblock ptr(3)+12
  60.  
  61. rem we are going to flip-flop the source and final bitmap pointers, so we can have smooth transitions from
  62. rem one to another.
  63.  
  64. StartImagePtr=s3
  65. FinalImagePtr=s2
  66.  
  67. for TNum = 1 to 18: rem 18
  68.   ` flip the source and final image pointers, so the transitions won't reset on us - this looks nicer.
  69.  
  70.    TempPtr=StartImagePtr
  71.    StartImagePtr=FinalImagePtr
  72.    FinalImagePtr=TempPtr
  73.  
  74.    ` When we get to #18, the last in this loop, we are going to speed it up.
  75.    ` #18 is the crossfade function, and in 16 bit, there is a max number of
  76.    ` shade transitions of 32, so why waste CPU time? It is also the slowest
  77.    ` transition because EVERY pixel is averaged against another for EVERY
  78.    ` frame. BIG Data throughput!!!
  79.  
  80.    if TNum = 18 then FrameCount = 32
  81.  
  82.    ` tell the DLL what we want to do, and with what images
  83.    call dll 1, "Init_Transition",TNum,640,480,bitdepth,framecount,StartImagePtr,FinalImagePtr
  84.  
  85.    ` the transition happens here
  86.    for i = 1 to framecount
  87.       call dll 1,"Next_Transition_Frame",s1
  88.       make bitmap from memblock 0,1
  89.       sync
  90.    next i
  91. Next TNum
  92.  
  93. delete memblock 1
  94. delete memblock 2
  95. delete memblock 3
  96.  
  97. call dll 1,"Free_Screens"
  98. delete dll 1
  99.  
  100. end
  101.