If you have a Graphics 1.0-based project and want to take advantage of all the new features, updates, and fixes in Graphics 2.0, then you can migrate your code with the help of our Graphics 2.0 Migration Guide.
In this post, I’ll talk about the Graphics 1.0 Compatibility Mode. This is probably the fastest path for existing projects. However, you will not be able take full advantage of new Graphics 2.0 features (see Limitations below).
Graphics 1.0 Compatibility Mode
With Graphics 1.0 Compatibility Mode, you can use most of the original Graphics 1.0 behaviors. For many projects, all you have to do is add one line to your
config.lua file and you’re done!
graphicsCompatibility = 1, -- This turns on Graphics 1.0 Compatibility mode
width = 320, height = 480, scale = "letterbox",
“Great, but what about a complex, real-world project?”
Challenge accepted! Earlier this morning, we converted a complex, real-world project, Major Magnet, to Graphics 2.0 using V1 Compatibility Mode. The steps were trivial:
- Include the sprite legacy library.
The second step was necessary only because Major Magnet relies on two 3rd-party libraries: ParticleCandy and TextCandy, which in turn rely on the legacy sprite library. So, all that was needed was to copy over and
sprite.lua file inside the project.
If you’re a Corona Enterprise developer, you can also take advantage of the 1.0 compatibility mode. The one thing you’ll need to do is update your projects:
- iOS: Ensure that the project links against CoreVideo.framework and GLKit.framework.
- Android: Update AndroidManifest.xml so that it requires OpenGL-ES 2.0.
Graphics 1.0 compatibility mode works great in a lot of situations, but it’s not for everyone. Graphics 2.0 features will only be supported in true 2.0-based projects, so if you want to use the power of Graphics 2.0, you should migrate your code to 2.0 instead of relying on the compatibility mode.
If you’ve been experimenting with 1.0 compatibility mode, some new features may appear to work, but there’s no guarantee that they’ll continue to work under V1 Compatibility, especially in subsequent releases and/or platforms. Relying on Graphics 2.0 features while in 1.0 compatibility mode is done at your own risk!
If you’re using the widget library, most widgets work as intended. However, newTableView() and newScrollView() use a new Graphics 2.0 feature (containers), so some changes will be required in regards to positioning these widgets (usually they will be offset by half the width and height). Please see the Migration Guide for details.
If your project uses the following 3rd-party libraries, here are some tips and observations based on what I’ve seen:
- Particle Candy: This requires the old sprite library, so use the sprite legacy library. [UPDATE]: ParticleCandy has been updated for Graphics 2.0.
- Text Candy: This also requires the old sprite library. [UPDATE]: TextCandy has been updated for Graphics 2.0.
- Director: This only seems to work in Graphics 1.0 Compatibility Mode. You may experience touch issues if you run this directly as a 2.0 project.