游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2351|回复: 1

使用盖莫游戏引擎2.1.1播放视频

[复制链接]

56

主题

94

帖子

98

积分

注册会员

Rank: 2

积分
98
发表于 2010-3-27 08:49:00 | 显示全部楼层 |阅读模式
这是使用盖莫游戏引擎播放视频的例子

当前解码器为ffmpeg.

# #include <stdio.h>  
# #include <GEngine/Gaimo.hpp>  
# using namespace core;  
# bool state = 0;  
# //! 视频播放完成后的处理工作  
# inline void IsVideoEnded(){state = 1;}   
# using namespace core;   
# int main()  
# {  
#     RefPtr<Device> device = InitDevice("视频播放");  
#     //! 获取视频播放器指针  
#     RefPtr<VideoPlayer> player = device->GetVideoPlayer();  
#     //! 不处理音频的话那么视频将会是无声的 O(∩_∩)O~   
#     core::RefPtr<core::AudioDevice> audiodevice = device->GetAudioDevice();  
#     uint16 number = audiodevice->GetAudioDeviceNumber();   
#     engine_string audiodeviceinde = audiodevice->GetDeviceByIndex(1);  
#     std::cout<<audiodevice->GetDeviceByIndex(1)<<std::endl;   
#     std::cout<<audiodevice->GetDefaultDeviceName()<<std::endl;   
#     std::cout<<"初始化音频设备"<<audiodevice->Init(audiodeviceinde,4,0)<<std::endl;   
#     player->isstoped.connect( sigc::ptr_fun(&IsVideoEnded));  
#     player-&gtlay("..\\video//1.Mp4",Rectf(-1,-1,2,2));   
#     player->SetVolume(1.0f);      
#      
#     BEGIN_LOOP(device)  
#         player->Update();  
#         BREAK_LOOP(state,1);  
#     END_LOOP(device)  
#     return 0;  
# }

可以看出当前代码使用sigc++作为插槽系统当播放结束的时候程序自动退出

截图如下:

56

主题

94

帖子

98

积分

注册会员

Rank: 2

积分
98
发表于 2010-3-27 21:51:00 | 显示全部楼层

Re:使用盖莫游戏引擎2.1.1播放视频



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2024-5-13 13:51

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表