@@ -78,9 +78,25 @@ void AppDelegate::onGLFWwindowSizeCallback(GLFWwindow*, int w, int h)
7878 auto glView = director->getOpenGLView ();
7979
8080 glView->setFrameSize (w, h);
81+
8182
82- glView->setDesignResolutionSize (569 , 320 ,
83- ResolutionPolicy::NO_BORDER );
83+ // uhh stuff to make different aspect ratios work ig?
84+ if (w > 1280 )
85+ glView->setDesignResolutionSize (569 + (w - 1280 ), 320 ,
86+ ResolutionPolicy::FIXED_HEIGHT );
87+ else
88+ glView->setDesignResolutionSize (569 , 320 - (w - 1280 ),
89+ ResolutionPolicy::FIXED_WIDTH );
90+
91+ if (h > 720 )
92+ glView->setDesignResolutionSize (569 , 320 + (h - 720 ),
93+ ResolutionPolicy::FIXED_WIDTH );
94+ else
95+ glView->setDesignResolutionSize (569 - (h - 720 ), 320 ,
96+ ResolutionPolicy::FIXED_HEIGHT );
97+
98+ // glView->setDesignResolutionSize(569, 320,
99+ // ResolutionPolicy::SHOW_ALL);
84100
85101 director->getEventDispatcher ()->dispatchCustomEvent (GLViewImpl::EVENT_WINDOW_RESIZED , nullptr );
86102}
@@ -97,8 +113,9 @@ bool AppDelegate::applicationDidFinishLaunching()
97113 glView = GLViewImpl::createWithRect (
98114 " OpenGD" , ax::Rect (0 , 0 , 1280 , 720 ), 1 .f , true );
99115#else
100- glView = GLViewImpl::create (" OpenGD" );
116+ glView = GLViewImpl::create (" OpenGD" , true );
101117#endif
118+
102119 /*
103120 auto full = dynamic_cast<GLViewImpl *>(glView);
104121 full->setFullscreen();
@@ -114,41 +131,35 @@ bool AppDelegate::applicationDidFinishLaunching()
114131
115132 // Set the design resolution
116133 glView->setDesignResolutionSize (569 , 320 ,
117- ResolutionPolicy::FIXED_WIDTH );
134+ ResolutionPolicy::SHOW_ALL );
135+
136+ // uhh stuff to make different aspect ratios work ig?
137+ if (glView->getFrameSize ().width > 1280 )
138+ glView->setDesignResolutionSize (569 + (glView->getFrameSize ().width - 1280 ), 320 ,
139+ ResolutionPolicy::FIXED_HEIGHT );
140+ else
141+ glView->setDesignResolutionSize (569 , 320 - (glView->getFrameSize ().width - 1280 ),
142+ ResolutionPolicy::FIXED_WIDTH );
143+
144+ if (glView->getFrameSize ().height > 720 )
145+ glView->setDesignResolutionSize (569 , 320 + (glView->getFrameSize ().height - 720 ),
146+ ResolutionPolicy::FIXED_WIDTH );
147+ else
148+ glView->setDesignResolutionSize (569 - (glView->getFrameSize ().height - 720 ), 320 ,
149+ ResolutionPolicy::FIXED_HEIGHT );
150+
118151
119152#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) || (AX_TARGET_PLATFORM == AX_PLATFORM_MAC) || \
120153 (AX_TARGET_PLATFORM == AX_PLATFORM_LINUX )
121154
122- glfwSetWindowAspectRatio (static_cast <GLViewImpl*>(glView)->getWindow (), 16 , 9 );
155+ // glfwSetWindowAspectRatio(static_cast<GLViewImpl*>(glView)->getWindow(), 16, 9);
123156
124157 glfwSetWindowSizeCallback (static_cast <GLViewImpl*>(glView)->getWindow (), AppDelegate::onGLFWwindowSizeCallback);
125158
126159#endif
127160
128- // glView->setFrameSize(1280, 720);
129-
130161 director->setContentScaleFactor (2 .0f );
131162
132- /*
133- // if the frame's height is larger than the height of medium size.
134- if (frameSize.height > mediumResolutionSize.height)
135- {
136- director->setContentScaleFactor(MIN(largeResolutionSize.height / designResolutionSize.height,
137- largeResolutionSize.width / designResolutionSize.width));
138- }
139- // if the frame's height is larger than the height of small size.
140- else if (frameSize.height > smallResolutionSize.height)
141- {
142- director->setContentScaleFactor(MIN(mediumResolutionSize.height / designResolutionSize.height,
143- mediumResolutionSize.width / designResolutionSize.width));
144- }
145- // if the frame's height is smaller than the height of medium size.
146- else
147- {
148- director->setContentScaleFactor(MIN(smallResolutionSize.height / designResolutionSize.height,
149- smallResolutionSize.width / designResolutionSize.width));
150- }
151- */
152163 register_all_packages ();
153164
154165 // create a scene. it's an autorelease object
0 commit comments