mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 16:02:50 +02:00
- try to make video performance a little better
This commit is contained in:
@@ -451,7 +451,8 @@ void BattleEnd::render() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(menuBackgroundVideo != NULL) {
|
if(menuBackgroundVideo != NULL) {
|
||||||
initBackgroundVideo();
|
//initBackgroundVideo();
|
||||||
|
menuBackgroundVideo->RestartVideo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -177,6 +177,9 @@ void MainMenu::render() {
|
|||||||
if(menuBackgroundVideo->isPlaying() == true) {
|
if(menuBackgroundVideo->isPlaying() == true) {
|
||||||
menuBackgroundVideo->playFrame(false);
|
menuBackgroundVideo->playFrame(false);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
menuBackgroundVideo->RestartVideo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state->render();
|
state->render();
|
||||||
|
@@ -77,6 +77,8 @@ public:
|
|||||||
bool isPlaying() const;
|
bool isPlaying() const;
|
||||||
|
|
||||||
static bool hasBackEndVideoPlayer();
|
static bool hasBackEndVideoPlayer();
|
||||||
|
|
||||||
|
void RestartVideo();
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
@@ -436,6 +436,7 @@ void VideoPlayer::init() {
|
|||||||
if(VideoPlayer::disabled == true) {
|
if(VideoPlayer::disabled == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
cleanupPlayer();
|
||||||
ctxPtr = new ctx();
|
ctxPtr = new ctx();
|
||||||
ctxPtr->loadingCB = loadingCB;
|
ctxPtr->loadingCB = loadingCB;
|
||||||
ctxPtr->x = x;
|
ctxPtr->x = x;
|
||||||
@@ -949,7 +950,7 @@ bool VideoPlayer::initPlayer() {
|
|||||||
int progress = ((difftime(time(NULL),waitStart) / MAX_VIDEO_START_MILLISECONDS) * 100.0);
|
int progress = ((difftime(time(NULL),waitStart) / MAX_VIDEO_START_MILLISECONDS) * 100.0);
|
||||||
this->loadingCB->renderVideoLoading(progress);
|
this->loadingCB->renderVideoLoading(progress);
|
||||||
}
|
}
|
||||||
SDL_Delay(1);
|
SDL_Delay(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -973,7 +974,7 @@ bool VideoPlayer::initPlayer() {
|
|||||||
int progress = ((difftime(time(NULL),waitStart) / MAX_VIDEO_START_MILLISECONDS) * 100.0);
|
int progress = ((difftime(time(NULL),waitStart) / MAX_VIDEO_START_MILLISECONDS) * 100.0);
|
||||||
this->loadingCB->renderVideoLoading(progress);
|
this->loadingCB->renderVideoLoading(progress);
|
||||||
}
|
}
|
||||||
SDL_Delay(1);
|
SDL_Delay(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1309,7 +1310,8 @@ bool VideoPlayer::playFrame(bool swapBuffers) {
|
|||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
/* Keys: enter (fullscreen), space (pause), escape (quit) */
|
/* Keys: enter (fullscreen), space (pause), escape (quit) */
|
||||||
while( SDL_PollEvent( &event ) ) {
|
//while( SDL_PollEvent( &event ) ) {
|
||||||
|
if( SDL_PollEvent( &event ) ) {
|
||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
finished = true;
|
finished = true;
|
||||||
@@ -1446,4 +1448,12 @@ bool VideoPlayer::playFrame(bool swapBuffers) {
|
|||||||
return ctxPtr->needToQuit;
|
return ctxPtr->needToQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoPlayer::RestartVideo() {
|
||||||
|
this->stop = false;
|
||||||
|
this->finished = false;
|
||||||
|
this->successLoadingLib = false;
|
||||||
|
|
||||||
|
this->initPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
Reference in New Issue
Block a user