PuzzleSDK
SimpleVideoPlayerTest类 参考

#include <UIVideoPlayerTest.h>

+ 类 SimpleVideoPlayerTest 继承关系图:
+ SimpleVideoPlayerTest 的协作图:

Public 成员函数

 CREATE_FUNC (SimpleVideoPlayerTest)
 
 SimpleVideoPlayerTest ()
 
virtual bool init () override
 
void menuCloseCallback (cocos2d::Ref *sender)
 
void switchStyleCallback (cocos2d::Ref *sender)
 
void switchUserInputCallback (cocos2d::Ref *sender)
 
- Public 成员函数 继承自 UIScene
 UIScene ()
 
 ~UIScene ()
 
virtual void onEnter () override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual std::string title () const
 
virtual std::string subtitle () const
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 

Private 成员函数

void createVideo ()
 
void updateButtonsTexts ()
 

Private 属性

cocos2d::Rect _visibleRect
 
cocos2d::ui::VideoPlayer * _videoPlayer
 
cocos2d::MenuItemFont * _switchUserInputEnabled
 
cocos2d::MenuItemFont * _switchStyle
 
bool _userInputEnabled
 
cocos2d::ui::VideoPlayer::StyleType _style
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 UIScene
cocos2d::Layer * _uiLayer
 
cocos2d::ui::Layout * _widget
 
cocos2d::ui::Text * _sceneTitle
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 UIVideoPlayerTest.h67 行定义.

构造及析构函数说明

◆ SimpleVideoPlayerTest()

SimpleVideoPlayerTest::SimpleVideoPlayerTest ( )

在文件 UIVideoPlayerTest.cpp264 行定义.

265{
266 _videoPlayer = nullptr;
267 _style = cocos2d::ui::VideoPlayer::StyleType::NONE;
268 _userInputEnabled = true;
269
270 _switchUserInputEnabled = nullptr;
271 _switchStyle = nullptr;
272}
cocos2d::ui::VideoPlayer::StyleType _style
cocos2d::MenuItemFont * _switchUserInputEnabled
cocos2d::MenuItemFont * _switchStyle
cocos2d::ui::VideoPlayer * _videoPlayer

引用了 _style, _switchStyle, _switchUserInputEnabled, _userInputEnabled , 以及 _videoPlayer.

成员函数说明

◆ CREATE_FUNC()

SimpleVideoPlayerTest::CREATE_FUNC ( SimpleVideoPlayerTest  )

◆ createVideo()

void SimpleVideoPlayerTest::createVideo ( )
private

在文件 UIVideoPlayerTest.cpp381 行定义.

382{
383 if (_videoPlayer)
384 {
385 _uiLayer->removeChild(_videoPlayer);
386 }
387 auto centerPos = Vec2(_visibleRect.origin.x + _visibleRect.size.width / 2,_visibleRect.origin.y + _visibleRect.size.height /2);
388
389 auto widgetSize = _widget->getContentSize();
390
391 _videoPlayer = VideoPlayer::create();
392 _videoPlayer->setPosition(centerPos);
393 _videoPlayer->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
394 _videoPlayer->setContentSize(Size(widgetSize.width * 0.4f,widgetSize.height * 0.4f));
395 _videoPlayer->setLooping(true);
396 _videoPlayer->setStyle(_style);
397 _videoPlayer->setUserInputEnabled(_userInputEnabled);
398
399 _uiLayer->addChild(_videoPlayer);
400
401 // _videoPlayer->addEventListener(CC_CALLBACK_2(SimpleVideoPlayerTest::videoEventCallback, this));
402
403 _videoPlayer->setFileName("cocosvideo.mp4");
404 _videoPlayer->play();
405}
cocos2d::Rect _visibleRect
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

引用了 _style, UIScene::_uiLayer, _userInputEnabled, _videoPlayer, _visibleRect , 以及 UIScene::_widget.

被这些函数引用 init().

+ 这是这个函数的调用关系图:

◆ init()

bool SimpleVideoPlayerTest::init ( )
overridevirtual

重载 UIScene .

在文件 UIVideoPlayerTest.cpp305 行定义.

306{
307 if ( !UIScene::init() )
308 {
309 return false;
310 }
311
312 _visibleRect = Director::getInstance()->getOpenGLView()->getVisibleRect();
313
314 MenuItemFont::setFontSize(16);
315
316 _switchStyle = MenuItemFont::create("Switch Style", CC_CALLBACK_1(SimpleVideoPlayerTest::switchStyleCallback, this));
317 _switchStyle->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
318 _switchStyle->setPosition(Vec2(_visibleRect.origin.x + 10,_visibleRect.origin.y + 50));
319
320 _switchUserInputEnabled = MenuItemFont::create("Enable User Input", CC_CALLBACK_1(SimpleVideoPlayerTest::switchUserInputCallback, this));
321 _switchUserInputEnabled->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
322 _switchUserInputEnabled->setPosition(Vec2(_visibleRect.origin.x + 10,_visibleRect.origin.y + 100));
323
324 auto menu = Menu::create(_switchUserInputEnabled,_switchStyle,nullptr);
325 menu->setPosition(Vec2::ZERO);
326 _uiLayer->addChild(menu);
327
328 createVideo();
330
331 return true;
332}
void switchStyleCallback(cocos2d::Ref *sender)
void switchUserInputCallback(cocos2d::Ref *sender)
virtual bool init() override
Definition: UIScene.cpp:46

引用了 _switchStyle, _switchUserInputEnabled, UIScene::_uiLayer, _visibleRect, createVideo(), UIScene::init(), switchStyleCallback(), switchUserInputCallback() , 以及 updateButtonsTexts().

+ 函数调用图:

◆ menuCloseCallback()

void SimpleVideoPlayerTest::menuCloseCallback ( cocos2d::Ref *  sender)

在文件 UIVideoPlayerTest.cpp334 行定义.

335{
336 Director::getInstance()->end();
337
338#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
339 exit(0);
340#endif
341}

◆ switchStyleCallback()

void SimpleVideoPlayerTest::switchStyleCallback ( cocos2d::Ref *  sender)

在文件 UIVideoPlayerTest.cpp344 行定义.

345{
346 switch (_style) {
347 case cocos2d::ui::VideoPlayer::StyleType::NONE:
348 _style = cocos2d::ui::VideoPlayer::StyleType::DEFAULT;
349 break;
350
351 case cocos2d::ui::VideoPlayer::StyleType::DEFAULT:
352 _style = cocos2d::ui::VideoPlayer::StyleType::NONE;
353 break;
354
355 default:
356 break;
357 }
358
359 if (_videoPlayer)
360 {
361 _videoPlayer->setStyle(_style);
362 }
363
364 //createVideo();
366}

引用了 _style, _videoPlayer , 以及 updateButtonsTexts().

被这些函数引用 init().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ switchUserInputCallback()

void SimpleVideoPlayerTest::switchUserInputCallback ( cocos2d::Ref *  sender)

在文件 UIVideoPlayerTest.cpp368 行定义.

369{
371 if (_videoPlayer)
372 {
373 _videoPlayer->setUserInputEnabled(_userInputEnabled);
374 }
375
376 //createVideo();
378}

引用了 _userInputEnabled, _videoPlayer , 以及 updateButtonsTexts().

被这些函数引用 init().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ updateButtonsTexts()

void SimpleVideoPlayerTest::updateButtonsTexts ( )
private

在文件 UIVideoPlayerTest.cpp274 行定义.

275{
277 {
278 std::string str = _userInputEnabled ? "< User Input Enabled >" : "< User Input Disabled >";
279 _switchUserInputEnabled->setString(str);
280 }
281
282 if (_switchStyle)
283 {
284 std::string str = " - ";
285 switch(_style)
286 {
287 case cocos2d::ui::VideoPlayer::StyleType::NONE:
288 _switchUserInputEnabled->setVisible(false);
289 str = "< NO Sytle >";
290 break;
291
292 case cocos2d::ui::VideoPlayer::StyleType::DEFAULT:
293 str = "< Default Style >";
294 _switchUserInputEnabled->setVisible(true);
295 break;
296
297 default:
298 break;
299 }
300
301 _switchStyle->setString(str);
302 }
303}

引用了 _style, _switchStyle, _switchUserInputEnabled , 以及 _userInputEnabled.

被这些函数引用 init(), switchStyleCallback() , 以及 switchUserInputCallback().

+ 这是这个函数的调用关系图:

类成员变量说明

◆ _style

cocos2d::ui::VideoPlayer::StyleType SimpleVideoPlayerTest::_style
private

在文件 UIVideoPlayerTest.h91 行定义.

被这些函数引用 createVideo(), SimpleVideoPlayerTest(), switchStyleCallback() , 以及 updateButtonsTexts().

◆ _switchStyle

cocos2d::MenuItemFont* SimpleVideoPlayerTest::_switchStyle
private

在文件 UIVideoPlayerTest.h87 行定义.

被这些函数引用 init(), SimpleVideoPlayerTest() , 以及 updateButtonsTexts().

◆ _switchUserInputEnabled

cocos2d::MenuItemFont* SimpleVideoPlayerTest::_switchUserInputEnabled
private

在文件 UIVideoPlayerTest.h86 行定义.

被这些函数引用 init(), SimpleVideoPlayerTest() , 以及 updateButtonsTexts().

◆ _userInputEnabled

bool SimpleVideoPlayerTest::_userInputEnabled
private

◆ _videoPlayer

cocos2d::ui::VideoPlayer* SimpleVideoPlayerTest::_videoPlayer
private

◆ _visibleRect

cocos2d::Rect SimpleVideoPlayerTest::_visibleRect
private

在文件 UIVideoPlayerTest.h83 行定义.

被这些函数引用 createVideo() , 以及 init().


该类的文档由以下文件生成: