#include "ViewAutoScale.h"
using
namespace
cocos2d;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
int
ViewAutoScale(cocos2d::CCEGLView* view,
int
defaultHeight)
{
if
(view == NULL)
{
return
-1;
}
for
(
int
i=0; i < displays; i++)
{
if
(IsMatchDisplay(width,height,supportDisplay[i]))
{
view->Create((
LPCTSTR
)title,width,height);
return
i+1;
}
}
view->Create((
LPCTSTR
)title,defaultWidth,defaultHeight);
view->setScreenScale(min((
float
)width/ defaultWidth,(
float
)height/ defaultHeight));
view->resize(width,height);
view->centerWindow();
return
0;
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
int
ViewAutoScale(cocos2d::CCEGLView* view,
void
* title,
int
width,
int
height,
cocos2d::CCSize* supportDisplay,
int
displays,
int
defaultWidth,
int
defaultHeight)
{
if
(view == NULL)
{
return
-1;
}
for
(
int
i=0; i < displays; i++)
{
if
(IsMatchDisplay(width,supportDisplay[i]))
{
return
i+1;
}
}
view->create(defaultWidth,defaultHeight);
return
0;
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
int
ViewAutoScale(cocos2d::CCEGLView* view,
void
* title,
int
width,
int
height,
cocos2d::CCSize* supportDisplay,
int
displays,
int
defaultWidth,
int
defaultHeight)
{
return
0;
}
#endif