#include "cocos2d.h" int main() { auto director = cocos2d::Director::getInstance(); auto glview = director->getOpenGLView(); if (!glview) { glview = cocos2d::CCEGLView::create("My Game"); director->setOpenGLView(glview); } // ... }
auto glview = cocos2d::CCEGLView::create("My Game"); glview->setFrameSize(1280, 720); glview->setDesignResolutionSize(1280, 720, ResolutionPolicy::SHOW_ALL);This example shows how to configure the CCEGLView with a specific frame size and design resolution. The design resolution determines how the game will be scaled to fit different screen sizes and aspect ratios. Package/Library: Cocos2d-x game engine library.