cocos2d-lua在win32平台縮小視窗的處理
1)在main.lua中處理縮小
local function main()
require("app.MyApp"):create():run()
local glview =cc.Director:getInstance():getOpenGLView()
glview:setFrameZoomFactor(0.700000)
end
經過上述處理,視窗縮小為0.7倍.但是縮小後的視窗,APP界面右邊和上面有小部分界面被截掉不能顯示。
經過實驗,如果有上述問題的,就繼續進行後面的第二步處理,
請記得1)和2)中,兩者的縮放比例要一緻,我這裡都是0.7。
如果沒有顯示問題,則無需第二步。
2)AppDelegate.cpp的如下函數添加處理
bool AppDelegate::applicationDidFinishLaunching()
{
//......
//縮小視窗/
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if (!glview) {
glview = GLViewImpl::createWithRect("Bu2", Rect(0, 0, 1334, 750));
//glview->setFrameZoomFactor(0.7f);
glview->setFrameSize(640, 480);
director->setOpenGLView(glview);
}
director->getOpenGLView()->setDesignResolutionSize(1334, 750, ResolutionPolicy::SHOW_ALL);
glview->setFrameZoomFactor(0.70f);
///
//......