mirror of
https://github.com/glest/glest-source.git
synced 2025-08-17 21:51:17 +02:00
- when intro video stops playing continue to main menu
This commit is contained in:
@@ -100,6 +100,7 @@ Intro::Intro(Program *program):
|
|||||||
mouseX = 0;
|
mouseX = 0;
|
||||||
mouseY = 0;
|
mouseY = 0;
|
||||||
mouse2d = 0;
|
mouse2d = 0;
|
||||||
|
exitAfterIntroVideo = false;
|
||||||
|
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
//renderer.init3dListMenu(NULL);
|
//renderer.init3dListMenu(NULL);
|
||||||
@@ -509,6 +510,7 @@ Intro::Intro(Program *program):
|
|||||||
vlcPluginsPath,
|
vlcPluginsPath,
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED);
|
SystemFlags::VERBOSE_MODE_ENABLED);
|
||||||
player.PlayVideo();
|
player.PlayVideo();
|
||||||
|
exitAfterIntroVideo = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -530,6 +532,10 @@ Intro::~Intro() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Intro::update() {
|
void Intro::update() {
|
||||||
|
if(exitAfterIntroVideo == true) {
|
||||||
|
mouseUpLeft(0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
timer++;
|
timer++;
|
||||||
if(timer > introTime * GameConstants::updateFps / 1000){
|
if(timer > introTime * GameConstants::updateFps / 1000){
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@@ -110,6 +110,7 @@ private:
|
|||||||
//GLMmodel* test;
|
//GLMmodel* test;
|
||||||
//Shared::Graphics::md5::Md5Object *md5Test;
|
//Shared::Graphics::md5::Md5Object *md5Test;
|
||||||
|
|
||||||
|
bool exitAfterIntroVideo;
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void renderModelBackground();
|
void renderModelBackground();
|
||||||
|
|
||||||
|
@@ -73,6 +73,7 @@ struct ctx {
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
void *rawData;
|
void *rawData;
|
||||||
|
bool isPlaying;
|
||||||
bool verboseEnabled;
|
bool verboseEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -137,6 +138,32 @@ static void catchError(libvlc_exception_t *ex) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAS_LIBVLC)
|
||||||
|
void trapPlayingEvent(const libvlc_event_t *evt, void *data) {
|
||||||
|
struct ctx *ctx = (struct ctx *)data;
|
||||||
|
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||||
|
ctx->isPlaying = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void trapEndReachedEvent(const libvlc_event_t *evt, void *data) {
|
||||||
|
struct ctx *ctx = (struct ctx *)data;
|
||||||
|
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||||
|
ctx->isPlaying = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void trapBufferingEvent(const libvlc_event_t *evt, void *data) {
|
||||||
|
struct ctx *ctx = (struct ctx *)data;
|
||||||
|
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||||
|
ctx->isPlaying = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void trapErrorEvent(const libvlc_event_t *evt, void *data) {
|
||||||
|
struct ctx *ctx = (struct ctx *)data;
|
||||||
|
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||||
|
ctx->isPlaying = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
VideoPlayer::VideoPlayer(string filename, SDL_Surface *surface,
|
VideoPlayer::VideoPlayer(string filename, SDL_Surface *surface,
|
||||||
int width, int height,int colorBits,string pluginsPath,
|
int width, int height,int colorBits,string pluginsPath,
|
||||||
bool verboseEnabled) {
|
bool verboseEnabled) {
|
||||||
@@ -348,6 +375,20 @@ void VideoPlayer::PlayVideo() {
|
|||||||
#if !defined(LIBVLC_VERSION_PRE_2) && !defined(LIBVLC_VERSION_PRE_1_1_13)
|
#if !defined(LIBVLC_VERSION_PRE_2) && !defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||||
libvlc_video_set_callbacks(mp, lock, unlock, display, &ctx);
|
libvlc_video_set_callbacks(mp, lock, unlock, display, &ctx);
|
||||||
libvlc_video_set_format(mp, "RV16", width, height, this->surface->pitch);
|
libvlc_video_set_format(mp, "RV16", width, height, this->surface->pitch);
|
||||||
|
|
||||||
|
// Get an event manager for the media player.
|
||||||
|
//libvlc_event_manager_t *eventManager = libvlc_media_player_event_manager(mp, &ex);
|
||||||
|
libvlc_event_manager_t *eventManager = libvlc_media_player_event_manager(mp);
|
||||||
|
if(eventManager) {
|
||||||
|
// libvlc_event_attach(eventManager, libvlc_MediaPlayerPlaying, (libvlc_callback_t)trapPlayingEvent, NULL, &ex);
|
||||||
|
// libvlc_event_attach(eventManager, libvlc_MediaPlayerEndReached, (libvlc_callback_t)trapEndReachedEvent, NULL, &ex);
|
||||||
|
// libvlc_event_attach(eventManager, libvlc_MediaPlayerBuffering, (libvlc_callback_t)trapBufferingEvent, NULL, &ex);
|
||||||
|
// libvlc_event_attach(eventManager, libvlc_MediaPlayerEncounteredError, (libvlc_callback_t)trapErrorEvent, NULL, &ex);
|
||||||
|
libvlc_event_attach(eventManager, libvlc_MediaPlayerPlaying, (libvlc_callback_t)trapPlayingEvent, &ctx);
|
||||||
|
libvlc_event_attach(eventManager, libvlc_MediaPlayerEndReached, (libvlc_callback_t)trapEndReachedEvent, &ctx);
|
||||||
|
libvlc_event_attach(eventManager, libvlc_MediaPlayerBuffering, (libvlc_callback_t)trapBufferingEvent, &ctx);
|
||||||
|
libvlc_event_attach(eventManager, libvlc_MediaPlayerEncounteredError, (libvlc_callback_t)trapErrorEvent, &ctx);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||||
@@ -367,7 +408,8 @@ void VideoPlayer::PlayVideo() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
bool needToQuit = false;
|
bool needToQuit = false;
|
||||||
while(successLoadingVLC == true && !done && stop == false) {
|
while(successLoadingVLC == true && ctx.isPlaying == true &&
|
||||||
|
done == 0 && stop == false) {
|
||||||
action = 0;
|
action = 0;
|
||||||
|
|
||||||
/* Keys: enter (fullscreen), space (pause), escape (quit) */
|
/* Keys: enter (fullscreen), space (pause), escape (quit) */
|
||||||
|
Reference in New Issue
Block a user