Вот два однотипных кода : Первый для Blitz3d , Второй для Xors3d .
Первый работает как надо , а при запуске второго (Xors3d) глюк кокой-то
;№1
Type Music
Field FileName$
Field Sel
End Type
Graphics3D 1024,768,32,2
folder$="Music"
If FileType(folder$) = 2
musDir = ReadDir(folder$)
Repeat
musfile$=NextFile$(musDir)
If Right(musfile$,4)=".mp3" Or Right(musfile$,4)=".ogg"
m.Music = New Music
m\FileName = musfile$
EndIf
Until musfile$ = ""
CloseDir musDir
EndIf
m.Music = First Music
m\Sel=1
play=1
While Not KeyHit(1)
Flip
Cls
y=0
kL=KeyHit(208 )
kR=KeyHit(200)
sp=KeyHit(57)
If sp Then play=Not play
For m.Music = Each Music
y=y+1
If kL And m\Sel =1
m=After m
If m <> Null
m\Sel=1
StopChannel(chMus)
m=Before m
m\Sel=0
kL=0
EndIf
ElseIf kR And m\Sel =1
m=Before m
If m <> Null
m\Sel=1
StopChannel(chMus)
m=After m
m\Sel=0
EndIf
EndIf
If m <> Null
If m\Sel = 0
Color 255,255,255
Text 10,y*10,m\Filename
Else
Color 255,0,0
Text 10,y*10,m\Filename
EndIf
Else
Exit
EndIf
If play And m\Sel
chMus=PlayMusic(m\Filename)
EndIf
Next
Wend
End
;№2
Include "xors3d.bb"
Type Music
Field FileName$
Field Sel
End Type
xGraphics3d 1024,768,32,0
folder$="Music"
If FileType(folder$) = 2
musDir = ReadDir(folder$)
Repeat
musfile$=NextFile$(musDir)
If Right(musfile$,4)=".mp3" Or Right(musfile$,4)=".ogg"
m.Music = New Music
m\FileName = musfile$
EndIf
Until musfile$ = ""
CloseDir musDir
EndIf
m.Music = First Music
m\Sel=1
play=1
While Not xKeyHit(1)
xFlip
xCls
y=0
kL=xKeyHit(208 )
kR=xKeyHit(200 )
sp=xKeyHit(57)
If sp Then play=Not play
For m.Music = Each Music
y=y+1
If kL And m\Sel =1
m=After m
If m <> Null
m\Sel=1
xStopChannel(chMus)
m=Before m
m\Sel=0
kL=0
EndIf
ElseIf kR And m\Sel =1
m=Before m
If m <> Null
m\Sel=1
xStopChannel(chMus)
m=After m
m\Sel=0
EndIf
EndIf
If m <> Null
If m\Sel = 0
xColor 255,255,255
xText 10,y*10,m\Filename
Else
xColor 255,0,0
xText 10,y*10,m\Filename
EndIf
Else
Exit
EndIf
If play And m\Sel
chMus=xPlayMusic(m\Filename)
EndIf
Next
Wend
End
|