Blame view

ios/Runner/Wowgame/Classes/game_animal/AniGeometryUtils.h 1.89 KB
5daad4bc   xiaoyu   游戏源码添加编译(现存问题:游戏内...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  //
  //  AniGeometryUtils.h
  //  SteveMaggieCpp
  //
  //  Created by Katarzyna Kalinowska-Górska on 20.05.2017.
  //
  //
  
  #ifndef AniGeometryUtils_h
  #define AniGeometryUtils_h
  
  #include "cocos2d.h"
  
  
  class AniGeometryUtils
  {
      public:
      
          struct ThickSegment
          {
              cocos2d::Point point1;
              cocos2d::Point point2;
              float thickness;
              
              ThickSegment(){
                  point1 = cocos2d::Point(0,0);
                  point2 = cocos2d::Point(0,0);
                  thickness = 0;
              }
              
              ThickSegment(cocos2d::Point p1, cocos2d::Point p2, float pThickness){
                  point1 = p1;
                  point2 = p2;
                  thickness = pThickness;
              }
          };
      
          static void flipChildX(cocos2d::Node* flippedParent, cocos2d::Node* child);
          static cocos2d::Rect flippedXRect(cocos2d::Node* flippedParent, cocos2d::Rect rect);
          static cocos2d::Point flippedXPoint(cocos2d::Node* flippedParent, cocos2d::Point point);
          static cocos2d::Rect getBoundingBoxToWorld(cocos2d::Node* node, bool ignoreTransformations = true);
          static cocos2d::Rect getBoundingBoxToWorldForSubrect(cocos2d::Node* node, cocos2d::Rect subrect);
          static cocos2d::Rect getRectIntersection(cocos2d::Rect rect1, cocos2d::Rect rect2);
          static bool segmentIntersectsRect(cocos2d::Rect rect, cocos2d::Point lineP1, cocos2d::Point lineP2);
          static cocos2d::Point addPoints(std::vector<cocos2d::Point> points);
          static void getLineABCFromPoints(cocos2d::Point pointA, cocos2d::Point pointB, float (&line)[3]);
          static bool segmentCrossesLine(cocos2d::Point sPointA, cocos2d::Point sPointB, float lineA, float lineB, float lineC);
          static float calculateIntersectionPercentage(cocos2d::Rect rect1, cocos2d::Rect rect2, int percentageOfWhichRect = 0);
  };
  
  #endif /* AniGeometryUtils_h */