28#include "../testResource.h"
38#define kStatusBarHeight 0.0f
46TouchesTests::TouchesTests()
60 auto pongLayer = PongLayer::create();
82 auto paddleTexture = Director::getInstance()->getTextureCache()->addImage(
s_Paddle);
84 Vector<Paddle*> paddlesM(4);
90 paddlesM.pushBack( paddle );
94 paddlesM.pushBack( paddle );
98 paddlesM.pushBack( paddle );
102 paddlesM.pushBack( paddle );
142const char *
_Info_Formatter =
"Current force value : %0.02f, maximum possible force : %0.02f";
147 auto s = Director::getInstance()->getWinSize();
149 _infoLabel = Label::createWithTTF(TTFConfig(
"fonts/arial.ttf"),
"Current force value : 0.00, maximum possible force : 0.00");
150 _infoLabel->setPosition(s.width / 2, s.height / 2);
153 auto listener = EventListenerTouchAllAtOnce::create();
157 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener,
this);
166 return std::string(
"3D Touch Test");
171 return std::string(
"Touch with force to see info label changes\nOnly work on iPhone6s / iPhone6s Plus");
180 for(
auto& t : touches)
182 float currentForce = t->getCurrentForce();
183 float maxForce = t->getMaxForce();
#define ADD_TEST_CASE(__className__)
const char * _Info_Formatter
enum tagPlayer PlayerTouches
void collideWithPaddle(Paddle *paddle)
void setVelocity(cocos2d::Vec2 velocity)
static Ball * ballWithTexture(cocos2d::Texture2D *aTexture)
virtual ~ForceTouchTest()
virtual std::string title() const override
void onTouchesMoved(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
cocos2d::Label * _infoLabel
void onTouchesBegan(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
virtual std::string subtitle() const override
void onTouchesEnded(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
static Paddle * createWithTexture(cocos2d::Texture2D *aTexture)
cocos2d::Vec2 _ballStartingVelocity
void resetAndScoreBallForPlayer(int player)
cocos2d::Vector< Paddle * > _paddles
virtual bool init() override
static cocos2d::Vec2 top()
static cocos2d::Rect getVisibleRect()
static cocos2d::Vec2 center()
static cocos2d::Vec2 bottom()
static const char s_Paddle[]
static const char s_Ball[]