Ooops
November 24, 2020, 06:58:46 AM

Author Topic: [bb] Quick Media Viewer by jfk EO-11110 [ 1+ years ago ]  (Read 989 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Quick Media Viewer by jfk EO-11110 [ 1+ years ago ]
« on: June 29, 2017, 12:28:38 AM »
Title : Quick  Media Viewer
Author : jfk EO-11110
Posted : 1+ years ago

Description : This is a very simple, but noless quick and useful media viewer for the following formats:
3ds, x, b3d, md2, bsp (q3), wav, mp3, ogg, mid, mod, it, s3m, bmp, jpg, pcx, tga, png.
See description in the sourcecode.


Code :
Code: BlitzBasic
  1. ;
  2. ; Simple and quick multimedia viewer, provided by CSP Games
  3. ;
  4. ; What is it good for?
  5. ;
  6. ; This viewer can quickly preview (or "prehear") several formats such as:
  7. ; 3ds,x,b3d,md2,bsp (q3),wav,mp3,ogg,mid,mod,it,s3m,bmp,jpg,pcx,tga,png.
  8. ; The viewer provides no controls (such as pause, rewind etc.), but a simple and quick "what is it"
  9. ; functionality.
  10. ;
  11. ; Unlike windows preview this viewer will also eat pictures with an incorrect
  12. ; extension (eg. a *.jpg that was renamed to *.bmp, or a *.ogg that was renamed to a *.wav)
  13. ; Simply compile this to an exe using Blitz3D, then make a link to it in a corner of your desktop.
  14. ; Now simply drag mediafiles to this link icon. To end the preview simply click the window,
  15. ; or hit a key. Multiple viewer windows are possible.
  16. ;
  17. ; Movies are not supported by now, but they usually are no problem. Feel free to add more formats.
  18. ;
  19.  
  20. app$="CSP simple media viewer"
  21. ex$="Hit ESC or LMB to exit"
  22. cmd$=Lower$(CommandLine$())
  23.  
  24. If cmd$="" Then End
  25. If FileType(cmd$)<>1 Then End
  26.  
  27.  
  28.  
  29. mi$=""
  30. l=Len(cmd$)-1
  31. While (l>0) And mi$<>"."
  32.  mi$=Mid$(cmd$,l,1)
  33.  f$=Right$(cmd$,Len(cmd$)-l)
  34.  l=l-1
  35. Wend
  36.  
  37.  
  38.  
  39.  
  40. If f$="3ds" Or f$="x" Or f$="b3d"
  41.  Graphics3D 640,480,32,2
  42.  SetBuffer BackBuffer()
  43.  AppTitle app$
  44.  m=LoadMesh(cmd$)
  45.  surfs=CountSurfaces(m)
  46.  If m<>0
  47.   light=CreateLight()
  48.   RotateEntity light,45,45,45
  49.   camera=CreateCamera()
  50.   CameraRange camera,0.1,16000
  51.   TranslateEntity camera,0,MeshHeight(m)*2.0,-(MeshDepth(m)+MeshWidth(m))
  52.   PointEntity camera,m
  53.   While KeyDown(1)=0 And MouseDown(1)=0
  54.    TurnEntity m,0,1,0
  55.    sp#=MouseYSpeed()
  56.    If MouseDown(2) Then TurnEntity m,sp#/10.0,0,0
  57.    RenderWorld()
  58.    Text 0, 0,cmd$
  59.    Text 0,16,"Surfaces: "+surfs
  60.    Text 0,32,"Tris rendered: "+TrisRendered()
  61.    Text 0,48,ex$
  62.    Flip
  63.   Wend
  64.   End
  65.  EndIf
  66. EndIf
  67.  
  68.  
  69.  
  70. If f$="md2"
  71.  Graphics3D 640,480,32,2
  72.  SetBuffer BackBuffer()
  73.  AppTitle app$
  74.  m=LoadMD2(cmd$)
  75.  If m<>0
  76.   AnimateMD2 m,1,0.1
  77.   light=CreateLight()
  78.   RotateEntity light,45,45,45
  79.   camera=CreateCamera()
  80.   CameraRange camera,0.1,16000
  81.   PointEntity camera,m
  82.   While KeyDown(1)=0 And MouseDown(1)=0
  83.    PositionEntity camera,0,MouseY(),-MouseY()
  84.    PointEntity camera,m
  85.    TurnEntity m,0,1,0
  86.    UpdateWorld()
  87.    RenderWorld()
  88.    Text 0, 0,cmd$
  89.    Text 0,16,"Tris rendered: "+TrisRendered()
  90.    Text 0,32,ex$
  91.    Flip
  92.   Wend
  93.   End
  94.  EndIf
  95. EndIf
  96.  
  97.  
  98. If f$="bsp"
  99. Print "loading bsp"
  100.  Graphics3D 640,480,32,2
  101.  SetBuffer BackBuffer()
  102.  AppTitle app$
  103.  m=LoadBSP(cmd$)
  104.  If m<>0
  105.   light=CreateLight()
  106.   RotateEntity light,45,45,45
  107.   camera=CreateCamera()
  108.   CameraRange camera,0.1,16000
  109.   PointEntity camera,m
  110.   While KeyDown(1)=0 And MouseDown(1)=0
  111.    PositionEntity camera,0,MouseY()*10.0,-MouseY()*10.0
  112.    PointEntity camera,m
  113.    TurnEntity m,0,1,0
  114.    UpdateWorld()
  115.    RenderWorld()
  116.    Text 0, 0,cmd$
  117.    Text 0,16,"Tris rendered: "+TrisRendered()
  118.    Text 0,32,ex$
  119.    Flip
  120.   Wend
  121.   End
  122.  EndIf
  123.  Print "failure."
  124. EndIf
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132. If f$="wav" Or f$="mp3" Or f$="ogg"
  133.  Graphics 640,200,32,2
  134.  AppTitle app$
  135.  SetBuffer BackBuffer()
  136.  s=LoadSound(cmd$)
  137.  If s<>0
  138.   LoopSound s
  139.   chn=PlaySound(s)
  140.   Print "Playing: "+cmd$
  141.   Print ex$
  142.   While KeyDown(1)=0 And MouseDown(1)=0
  143.    Delay 10
  144.   Wend
  145.   FreeSound s
  146.  EndIf
  147.  End
  148. EndIf
  149.  
  150.  
  151.  
  152. If f$="mid" Or f$="mod" Or f$="it" Or f$="s3m"
  153.  Graphics 640,200,32,2
  154.  AppTitle app$
  155.  Print "Playing: "+cmd$
  156.  Print ex$
  157.  SetBuffer BackBuffer()
  158.  s=PlayMusic(cmd$)
  159.  If s<>0
  160.   While KeyDown(1)=0 And MouseDown(1)=0
  161.    Delay 10
  162.   Wend
  163.  EndIf
  164.  End
  165. EndIf
  166.  
  167.  
  168. If f$="bmp" Or f$="jpg" Or f$="pcx" Or f$="tga" Or f$="png"
  169.  b=LoadImage(cmd$)
  170.  If b<>0
  171.   w=ImageWidth(b)
  172.   h=ImageHeight(b)
  173.   Graphics w,h,32,2
  174.   AppTitle app$
  175.   SetBuffer BackBuffer()
  176.   b=LoadImage(cmd$)
  177.   DrawBlock b,0,0
  178.   Text 0, 0,cmd$
  179.   Text 0,16,""+ImageWidth(b)+" * "+ImageHeight(b)+" Pixels"
  180.   Text 0,32,ex$
  181.   Flip
  182.   While KeyDown(1)=0 And MouseDown(1)=0
  183.    Delay 10
  184.   Wend
  185.   EndIf
  186.  End
  187. EndIf
  188.  
  189.  
  190.  
  191.  
  192.  
  193. WaitKey()
  194. End


Comments :


Reans(Posted 1+ years ago)

 I can't say it is not what I simple need around inhurry ever BlG smlle thank you


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal