如何设置视口自动缩放?
我用过setViewPortInPoints, 画面缩放正常,可是按钮响应区没变,还是缩放前的区域.
求正确的代码列子
如何设置视口自动缩放?
我用过setViewPortInPoints, 画面缩放正常,可是按钮响应区没变,还是缩放前的区域.
求正确的代码列子
on win32 (in main.cpp)
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// create the application instance
AppDelegate app;
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
eglView.setViewName("Hello World");
eglView.setFrameSize(480, 320); // your window size.
// set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line.
------------------------------ uncomment next line -----------------------------
// eglView.setDesignResolutionSize(480, 320); // your designed resolution size.
return CCApplication::sharedApplication().run();
}
On android:
Please refer to Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit function in HelloWorld\proj.android\jni\helloworld\main.cpp.
On ios: not support scale, please use retina mode.
按照你的方法 问题已经解决!十分感谢:)