BCF GUI 2.07 Exemple
Blitz3D Forums/Blitz3D Programming/BCF GUI 2.07 Exemple
| ||
A very simple video viewer with BCF :) ; ************************************************************************ ; * Include : BCF Librairie (GUI pour Blitz3D) * ; * * ; * Version : V2.0 Par Philippe Agnisola et Nicolas Poursin * ; ************************************************************************ Include "../BCF 2.0 Build 2.07/Inc_bcf.bb" Type TMovie Field Id Field WinId Field Movie Field Px Field Py Field Tx Field Ty End Type Global BCF_TMovieId Graphics3D 640,480,32,2 SetBuffer BackBuffer() ; --------------------------------- ; Innitialisation de la BCF ; --------------------------------- BCF_InitBCF(1) Camera=CreateCamera() ; ----------------------------------- ; Innitialisation de la souris ; ----------------------------------- BCF_Init3DMouse(4) ; ------------------------------------ ; On définition de l'interface ; ------------------------------------ TmpTx=400 TmpTy=300 MaFenetre=BCF_CreateWindow(20,20,TmpTx,TmpTy,1,1,"BCF 2.0 : Video",True,True) Film=BCF_CreateMovie(MaFenetre,"c:\filou\Tempo.avi",0,0,TmpTx,TmpTy) Button02=BCF_CreateButton(False,20,420,150,20,"Quitter le programme") ; ------------------------- ; Boucle de gestion ; ------------------------- While Not KeyDown( 1 ) ; ----------------------------------------------------------------- ; On teste le bouton 02 et on quitte si nécessaire ; ----------------------------------------------------------------- If BCF_TestButton(Button02) Then BCF_KillBCF() End EndIf RenderWorld UpdateWorld ; ------------------------- ; Gestion de la BCF ; ------------------------- BCF_RenderBCF() ; ----------------------------------------------------------------------- ; Si fenetre ouverte on play le movie sinon on le ferme ; ----------------------------------------------------------------------- If BCF_Window( MaFenetre ) Then Proc_PlayMovie(MaFenetre) Else BCF_KillMovie( Film) EndIf Flip Wend ; --------------------------------- ; On quitte le programme ; --------------------------------- BCF_KillMovie(Film ) BCF_KillBCF() End Function BCF_CreateMovie(WinId,Name$,Px,Py,Tx,Ty) BCF_TMovieId=BCF_TMovieId+1 BCF.TMovie = New TMovie BCF\Id=BCF_TMovieId BCF\WinId=WinId BCF\Movie=OpenMovie(Name$) BCF\Px=Px BCF\Py=Py BCF\Tx=Tx BCF\Ty=Ty ; ------------------------------------ ; Test pour la fenetre virtuel ; ------------------------------------ If WinId=False Then BCF\WinId = BCF_TestVirtualParent() BCF_IdVirtualParent = BCF\WinId EndIf Return BCF_TMovieId End Function Function Proc_PlayMovie(Window) ParentWindow.TWindow = Object.TWindow( Window) For BCF.TMovie = Each TMovie ; ---------------------------------------------------------- ; Si le State de la fenetre est 0 (non réduite) ; ---------------------------------------------------------- If BCF\WinId = ParentWindow\Id And ParentWindow\State=0 Then ; ---------------------- ; Synchronisation ; ---------------------- Repeat Until MilliSecs()-time>=100 time=MilliSecs() ; ---------------------------- ; Affichage de la video ; ---------------------------- TmpX=BCF\Px+ParentWindow\Px+2 ; 2=Bordure 3D de la gauche de la fenetre TmpY=BCF\Py+ParentWindow\Py+23 ; 23=Hauteur de la barre de titre If MoviePlaying(BCF\Movie) Then DrawMovie BCF\Movie,TmpX,TmpY,BCF\Tx-4,BCF\Ty-26 Else BCF_KillMovie(BCF\Movie ) EndIf EndIf Next End Function ; -------------------------------------- ; Permet d'effacer une image ; -------------------------------------- Function BCF_KillMovie( Id ) For BCF.TMovie = Each TMovie If BCF\Id = Id Then CloseMovie BCF\Movie Delete BCF Exit EndIf Next End Function |