ScalingUtils.h 1.84 KB
//
//  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 */