背景和头像缺失
This commit is contained in:
36
cocos2d/tests/cpp-tests/Classes/OpenURLTest/OpenURLTest.cpp
Normal file
36
cocos2d/tests/cpp-tests/Classes/OpenURLTest/OpenURLTest.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "OpenURLTest.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
OpenURLTests::OpenURLTests()
|
||||
{
|
||||
ADD_TEST_CASE(OpenURLTest);
|
||||
}
|
||||
|
||||
OpenURLTest::OpenURLTest()
|
||||
{
|
||||
auto label = Label::createWithTTF("Open URL Test", "fonts/arial.ttf", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition(VisibleRect::center().x, VisibleRect::top().y - 50);
|
||||
|
||||
auto listener = EventListenerTouchAllAtOnce::create();
|
||||
listener->onTouchesEnded = CC_CALLBACK_2(OpenURLTest::onTouchesEnded, this);
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
// create a label to display the tip string
|
||||
_label = Label::createWithTTF("Touch the screen to open\nthe cocos2d-x home page", "fonts/arial.ttf", 22);
|
||||
_label->setPosition(VisibleRect::center());
|
||||
addChild(_label, 0);
|
||||
|
||||
_label->retain();
|
||||
}
|
||||
|
||||
void OpenURLTest::onTouchesEnded(const std::vector<Touch*>& touches, Event *event)
|
||||
{
|
||||
Application::getInstance()->openURL("http://www.cocos2d-x.org/");
|
||||
}
|
||||
|
||||
OpenURLTest::~OpenURLTest()
|
||||
{
|
||||
_label->release();
|
||||
}
|
||||
Reference in New Issue
Block a user