Hi.
I wrote a code for show splash screen before play video. and I call Game() function that contain a video after fade Splash screen.but video don't play.
for sure, I removed splash screen and called Game() directly and video played correctly. anyone know where is the problem?
this is my splash screen code:
global SplashImage
global SplashSpr
global alpha = 255
global fps# = 0.0
global Timer# = 0.0
Function CreateSplashScreen()
CreateSplashImage()
fps# = 1.0 / 60.0
do
Timer# = Timer# + fps#
if GetSpriteExists(SplashSpr) = 1
if Round(Timer#) >= 3
if (alpha > 0)
alpha = alpha - 2
SetSpriteColorAlpha(SplashSpr,alpha)
endif
if (alpha <= 0)
alpha = 0
DeleteSplashImage()
Timer# = 0.0
Game()
exit
endif
endif
endif
sync()
loop
EndFunction
Function CreateSplashImage()
//Load Images
SetFolder("\media\sprites")
if GetImageExists(SplashImage) = 0
SplashImage = LoadImage("nplogo.png")
endif
//Create Sprite
if GetSpriteExists(SplashSpr) = 0
SplashSpr = CreateSprite(0)
SetSpriteImage(SplashSpr, SplashImage)
SetSpriteSize(SplashSpr, 62.5, -1)
SetSpritePositionByOffset(SplashSpr,50,50)
endif
EndFunction
Function DeleteSplashImage()
DeleteImage(SplashImage)
DeleteSprite(SplashSpr)
EndFunction
and this is my Game code:
#include "SplashScreen.agc"
#include "Menu.agc"
//global variables
global seek
global px#,py#
global SeekLine
global duration#
global dim ProgressImg[2]
global dim ProgressSpr[2]
global SeekImg
global ProgressColor_Img
global ProgressColor_Spr
CreateSplashScreen()
Function Game()
SetWindowSize(1280, 800, 0)
SetDisplayAspect ( -1 )
CreateVideo()
do
Sync()
loop
EndFunction
//=========================================================== Functions ===========================================================
Function CreateVideo()
//Load Video
LoadVideo("video.mp4")
SetVideoDimensions(0,0,100,93)
PlayVideo()
duration# = GetVideoDuration()
EndFunction
NOTE: when I print video, result is 0 and according to LoadVideo() help file,
there was an error, but I don't know what is problem.
Thanks.