File tree Expand file tree Collapse file tree 1 file changed +28
-7
lines changed Expand file tree Collapse file tree 1 file changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -146,13 +146,34 @@ -(NSInteger) runningDevice
146
146
NSInteger ret=-1 ;
147
147
148
148
#if __CC_PLATFORM_ANDROID
149
- if ([CCDirector sharedDirector ].contentScaleFactor > 1.0 )
150
- {
151
- ret = CCDeviceiPhoneRetinaDisplay;
152
- }
153
- else
154
- {
155
- ret = CCDeviceiPhone;
149
+
150
+
151
+ AndroidDisplayMetrics *metrics = [[AndroidDisplayMetrics alloc ] init ];
152
+ [[CCActivity currentActivity ].windowManager.defaultDisplay getMetrics: metrics];
153
+ double yInches= metrics.heightPixels /metrics.ydpi ;
154
+ double xInches= metrics.widthPixels /metrics.xdpi ;
155
+ double diagonalInches = sqrt (xInches*xInches + yInches*yInches);
156
+ if (diagonalInches<=6 ){
157
+
158
+
159
+ if ([CCDirector sharedDirector ].contentScaleFactor > 1.0 )
160
+ {
161
+ ret = CCDeviceiPhoneRetinaDisplay;
162
+ }
163
+ else
164
+ {
165
+ ret = CCDeviceiPhone;
166
+ }
167
+ } else {
168
+ if ([CCDirector sharedDirector ].contentScaleFactor > 1.0 )
169
+ {
170
+ ret = CCDeviceiPadRetinaDisplay;
171
+ }
172
+ else
173
+ {
174
+ ret = CCDeviceiPad;
175
+ }
176
+
156
177
}
157
178
#elif __CC_PLATFORM_IOS
158
179
You can’t perform that action at this time.
0 commit comments