Home > other >  O great god answer cocos2dx about touch events parameters in c + + Event * Event mean
O great god answer cocos2dx about touch events parameters in c + + Event * Event mean

Time:09-25

Not very understand the textbook written
The listener - & gt; OnTouchBegan=[] (Touch Touch * and Event * Event)
{
Auto target=static_cast & lt; Sprite * & gt; (the event - & gt; GetCurrentTarget ());
Vec2 locationInNode=target - & gt; ConvertToNodeSpace (touch - & gt; GetLocation ());
The Size s=target - & gt; GetContentSize ();
The Rect the Rect=the Rect (0, 0, s. idth and Sheldon horowitz eight);

If (the rect. ContainsPoint (locationInNode))
{
Target - & gt; RunAction (ScaleBy: : create (0.06 f to 1.06 f));
return true;
}
If you triggered this function is not mean you touch the elves why judge?
The event - & gt; GetCurrentTarget () the event in this sentence what mean? Touch this event? Or specific to the event that the elf was touch? If the latter why judge again since you touched?
Please answer

CodePudding user response:

Nasty soon come out like the laws of god
  • Related