GarageGames / Torque2D

MIT Licensed Open Source version of Torque 2D game engine from GarageGames
MIT License
1.67k stars 1.56k forks source link

3d deters patch 1 - iOS Display #357

Closed 3dDeters closed 8 years ago

3dDeters commented 8 years ago

This is a change that should allow any game to display properly on any iOS device in about the same way it does on Android.

greenfire27 commented 8 years ago

Hi! Thanks for submitting this. After reading through it I'm not sure it's going to work. You're still assigning the resolution to a global variable, but the canvas is created using the local. Also, the resolution has three parts, the width, height, and depth (which is normally 32). And the canvas creation code needs all three but your code would only give two. Make some tweaks to fix these things and then I'll merge.

3dDeters commented 8 years ago

Making resolution a global variable was something I did for my personal uses in managing aspect ratio to prevent screen stretching on different devices. I could add my aspect ratio code later, but It still needs some work. I just made the screen depth 32, but I will check if there is a way to read the screen depth directly from iOS in the same way I did hight and width.

I also think my changes make many things in the iOS parts of the engine unnecessary, but I don't want to be the judge of that. I'm just not sure what all can and can not be deleted safely.

greenfire27 commented 8 years ago

Changes are looking good! I have one more request. The if statement currently wrapped around creating the canvas is checking to make sure there is a device type in the prefs. Since it won't be using this anymore you should check instead that the platform is "iOS" similar to the Android check below. So something like:

if($platform $= "iOS")

If you make that change I'll be ready to merge.