Blame view

ios/Runner/Wowgame/Classes/game_food/ScalingUtils.h 1.84 KB
cb213901   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
52
53
54
55
56
57
58
59
60
61
  //
  //  ScalingUtils.h
  //  SteveMaggieCpp
  //
  //  Created by Katarzyna Kalinowska-Górska on 18.05.2017.
  //
  //
  
  #ifndef ScalingUtils_h
  #define ScalingUtils_h
  
  #include "cocos2d.h"
  
  class ScalingUtils //TODO make a singleton
  {
      public:
      
          static ScalingUtils& getInstance()
          {
              static ScalingUtils instance;
              return instance;
          }
      
      static float getAdjustedContentScaleFactor();
      
          static bool isSmallDevice();
          static bool isElementTooSmallForSmallDevice(int elementWidth);
          static float getScaleForSmallDevice();
          static float getAspectRatioBasedModifierForVelocity();
          static cocos2d::Size getDesignSize();
          static float getDesignDpi();
          void setScaledScreenSurplusSize(float width, float height);
          float getScaledScreenSurplusWidth();
          float getScaledScreenSurplusHeight();
          cocos2d::Point configurePoint(cocos2d::Point point);
          cocos2d::Rect configureRect(cocos2d::Rect rect);
          static float widthScale();
          static float heightScale();
          static float scaleAspectFitToDesignIpadProSize();
          static float scaleAspectFillToDesignIpadProSize();
          static float getScaleForFont();
          static float imageAspectFillGetScale(cocos2d::Size nodeSize, cocos2d::Size targetSize);
          static float imageAspectFitGetScale(cocos2d::Size nodeSize, cocos2d::Size targetSize);
          static float configureNodeDimension(float originalDimension);
          static float getDeviceAspectRatio();
      
      private:
      
          ScalingUtils(){
              this->_scaledScreenSurplusWidth = 0;
              this->_scaledScreenSurplusHeight = 0;
          };
      
          DISALLOW_COPY_AND_ASSIGN(ScalingUtils);
      
          float _scaledScreenSurplusWidth;
          float _scaledScreenSurplusHeight;
      
  };
  
  #endif /* ScalingUtils_h */