{ "version": "https://jsonfeed.org/version/1", "user_comment": "This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format. To add this feed to your reader, copy the following URL -- https://coronalabs.com/feed/json/ -- and add it your reader.", "home_page_url": "https://coronalabs.com", "feed_url": "https://coronalabs.com/feed/json/", "title": "Corona Labs", "description": "", "items": [ { "id": "https://coronalabs.com/blog/2020/04/30/future-of-corona/", "url": "https://coronalabs.com/blog/2020/04/30/future-of-corona/", "title": "Future of Corona", "content_html": "

\"\"Hello, everyone.

\n

This is Vlad Shcherban, the main developer of Corona for the past several years. There are a lot of things I would like to discuss so I will try to be as brief as possible, with more details in the FAQ below.

\n

As you already know, as of May 1st, 2020,\u00a0 Corona Labs Inc., the company is no more.

\n

But Corona (the engine powering thousands of apps) is anything but finished. It is only starting as a completely open source project. I plan to continue working on it with development funded via crowdfunding. This idea seems to have been very warmly received by the community on the Forums and Slack, with people already pitching in to support my effort to keep Corona alive. I am very optimistic. If the trend continues, it seems I will be able to continue working on Corona full time. If you like using Corona, or use it for business and would like to see its development and support continue, please support my crowdfunding campaign on Patreon or GitHub Sponsors. Your support would be greatly appreciated by everyone using Corona.

\n
\n
\n\n
\n
\n\n
\n
\n\n

Currently Corona is deeply tied to Corona Labs Inc.’s web services. I have been working hard over the last few months to move everything to either the Simulator running on a user’s machine or to free services available to open source software. From now on, new builds of Corona will appear on the \u201cReleases\u201d section on Corona\u2019s GitHub.

\n

The amazing folks from Appodeal have decided to fund \u201ckeeping the lights on\u201d for essential parts of the Corona infrastructure: you will be able to download purchased Marketplace assets and make builds with existing versions of Corona Simulator. No new purchases, daily builds or plugin updates will be available from coronalabs.com after May 1st. Appodeal is also committed to contributing to the Corona open source project by releasing and updating plugins that will benefit the community in the near future.

\n

By the way, about Appodeal: they recently launched the app accelerator program: help with funding, user acquisition and monetization, while you are keeping rights to your app.

\n

(Re)brand & COVID-19

\n

About half a year ago an idea was passed around to rebrand Corona, because it seems to be tied to a company which is closing. Since then, coronavirus has impacted many lives, which pushed the idea of rebranding over the line. With our awesome Slack community, we picked a new name for the engine: Solar2D. We feel like it is a good name, both nice, and connected to the origins of the original name. This rebrand will not be our priority since making sure that everything keeps working after May 1 is. It will be done gradually. Corona has quite a name recognition in the industry, and has rooted in the ecosystem. We will not be trying to get rid of it, prioritizing backwards compatibility. Everything you would be able to google with for Corona or Corona SDK will still work for Solar2D.

\n

Forums

\n

Forums have always been essential part of the Corona community. Our Forums were using a quite dated engine and authentication was tied to infrastructure which will be shut down in months to come. As of today, we have migrated the Forums to a new, more modern platform. We tried our best to migrate the Forums to the new platform at forums.solar2d.com. Most posts should be available there. To access your existing account you would need to reset your password. Keep in mind, the new Forums are not tied to the Simulator login. You are not resetting your Corona/Solar2D password, only your Forums password.

\n

F.A.Q:

\n

Q: What are your funding goals?
\nA: I will be able to work full time on Corona without taking another job if funding exceeds an experienced software developer’s salary living in Toronto. 75% of money above the salary of a medium level software developer’s salary will be used for contractors to work on specific projects. I have hopes to get enough support to rehire, at least part time, some of the awesome developers we had to let go.

\n

Q: How do I migrate my projects to new Corona/Solar 2D?
\nA: You probably won\u2019t have to do anything. The plan is to have the Simulator continue working as it is now, automatically downloading Corona\u2019s first party plugins. Free plugins from other vendors would be added soon.

\n

Q: Would source code for plugins be available as well?

\n

A: Pretty much all code related to Corona Labs has been made available under the MIT license. I will move all updates & development of plugins to GitHub in public repositories. For now, all \u201ccom.coronalabs\u201d plugin binaries are available for download.

\n

Q: What about third-party plugins?
\nA: Third-party plugins can now be integrated using a custom plugin URL feature, or downloaded manually and placed in corresponding locations. I also have a plan to make the plugin system extendable, so the Simulator will be able to automatically configure plugins purchased from third-party stores. I am keeping in touch with vendors of most popular plugins to make sure they will be available.

\n

Q: Do I have to migrate my project to Native?
\nA: Only if you want to. The Simulator will continue working. In fact, it would be much easier to integrate with custom or self-built plugins.

\n

Q: You are vague about specific numbers on funding? Would there be some accountability?
\nA: I am vague, because I am coming from the background where talking about salaries is not something which is done. If you pledge $50 per month or more, I will disclose this information to you. Otherwise, I can assure you that my personal goals are more than reasonable.

\n

Q: How can I support Corona/Solar 2D?
\nA: Best way to support it is through crowdfunding on Patreon or GitHub Sponsors. Since everything is open source, you can also improve the project directly. Also, you can be extremely helpful by answering questions on the forums, and telling others about Corona/Solar 2D.

\n

Q: Are you starting a new company to support the engine?
\nA: No. I am doing this as an individual. I will try to build a fail-safe environment where everything is not tied to me. Crowdfunding is to support me and my goal of making Corona/Solar 2D the best game engine ever, and to keep it updated and up to requirements of all points of distribution, as much as possible.

\n

Q: What are some of the engine development goals for the near future, any roadmap?
\nA: There are needs and wants here. Making sure that everything works without Corona Labs web services, supporting AndroidX artifacts and moving to Metal because of Apple\u2019s plans to remove OpenGL are the most essential big tasks for the near future, as well as ongoing maintenance and plugin updates. Those are the needs which I would have to address to keep the engine functional. If funding permits, then the “wants” come in: I would really like to improve HTML5 support and add Switch support to the engine.

\n

 

\n", "date_published": "2020-05-01T01:28:41+00:00", "date_modified": "2020-05-01T01:28:41+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2020/04/30/the-forums-are-moving/", "url": "https://coronalabs.com/blog/2020/04/30/the-forums-are-moving/", "title": "The Forums are moving…", "content_html": "

The Corona Labs Forums are currently down as we migrate them to the new modern forum software on new hardware. The old Forums will remain down from this point forward. Once the migration is complete, forums.coronalabs.com will redirect to forums.solar2d.com or you can access them directly.

\n

You can reset your password here: https://forums.solar2d.com/password-reset

\n

Put in your Corona login email. You will get an email to that account and you can click on the link in the email to change the password.

\n

This password reset will just be for the Forums and will not affect your Simulator login.

\n

 

\n

 

\n", "date_published": "2020-04-30T12:03:54+00:00", "date_modified": "2020-04-30T21:21:24+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2020/04/22/corona-labs-transition-update-22-april-2020/", "url": "https://coronalabs.com/blog/2020/04/22/corona-labs-transition-update-22-april-2020/", "title": "Corona Labs transition update 22-April-2020", "content_html": "

Many of you are curious how our transition is going. Here is a quick update as to its status.

\n

Let’s start with rebranding\u2026

\n

Thanks to the help of the community, as we move away from Corona Labs Inc to our new open source/crowdfunding model, it’s time for a new name and new look.

\n

Introducing:

\n

\"\"

\n

Corona will be rebranding as Solar 2D. You helped pick out the name. You contributed some great branding to work with. And you helped pick the best of the best. You should start seeing this logo or variants showing up across our sites in days and weeks to come. We want to thank the wonderful people at fourbyfour.com for the logo! We want to also thank the community for driving this so our engineering efforts could go to our main priorities.

\n

Offline Builds

\n

One of the key milestones is not having dependencies on Corona Lab’s build servers. This is on track and is in a prototype that’s being polished. We are committed to keeping you using the Corona Solar 2D simulator instead of requiring native builds (which will still be an option if you like). We are on target hit this goal. TL;DR – You will use Solar 2D the same way you use Corona today.

\n

Plugins

\n

More information on plugins will be coming soon. It’s a deeper discussion point and we wanted to keep this quick! We are planning a larger Q&A post in the next few days. But all is proceeding as well.

\n

Forums

\n

We are moving the forums to a new platform. It’s our goal to keep as many posts as possible. We are working out a few issues at the moment. Stay tuned for an announcement specifically for that. There will likely need to be some downtime as we copy the latest content to the new server and change DNS to point to the new forums.

\n

Fundraising

\n

This is a question that comes up frequently. More details will be coming soon in the Q&A post regarding this. Solar 2D’s success depends on you to support it. You can start pledging your support today at: Github Sponsors or Patreon.

\n

We will be posting more information soon!

\n", "date_published": "2020-04-22T23:14:34+00:00", "date_modified": "2020-04-22T23:14:34+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2020/04/16/google-64-bit-deadline-coming-august-1-2020/", "url": "https://coronalabs.com/blog/2020/04/16/google-64-bit-deadline-coming-august-1-2020/", "title": "Google 64-bit deadline coming August 1, 2020", "content_html": "

When Google started enforcing their new 64-bit requirements last year, they gave Corona developers an extension. New apps still had to be 64-bit by the deadline, but for apps currently in the app store, they provided an extension until August 1, 2020. That’s a little over three months away.

\n

While most Corona apps are now in compliance, over 4,000 Corona-made apps are not and are in threat of being taken down on or after August 1. If you have apps that need updated. Get the latest daily build at https://developer.coronalabs.com/downloads/daily-builds/

\n

And update your apps sooner than later. This would also be a good time to disable the Corona Splash Screen. Make sure to include:

splashScreen = \r\n\t{\r\n\t\tenable = false\r\n\t},

in your build.settings file inside the settings = {} table to avoid any potential confusion with the app store’s current stance on the novel coronavirus and COVID-19.

\n", "date_published": "2020-04-16T22:34:59+00:00", "date_modified": "2020-04-16T22:34:59+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2020/03/24/keep-calm-and-corona-the-game-engine-no-relation-on/", "url": "https://coronalabs.com/blog/2020/03/24/keep-calm-and-corona-the-game-engine-no-relation-on/", "title": "Keep Calm and Corona (the game engine, no relation) On!", "content_html": "

We wanted to provide you a quick status update on how things are proceeding towards our May 1, 2020 transition to the new open source platform.

\n

Our goal through this transition is to make sure that you are able to build and deploy your games today, tomorrow and in the future and we are on track to keep you successful with Corona.

\n

On an engineering perspective, we have accomplished a lot already:

\n
    \n
  1. The source that we are using to build daily builds is on GitHub
  2. \n
  3. The license has been changed to MIT
  4. \n
  5. Building engine itself is being moved to GitHub. It’s already complete for macOS. Windows is in progress.
  6. \n
  7. Completely offline device builds for iOS/tvOS and Android are in a prototype state, with plugins sourced from the hard drive.
  8. \n
  9. Site docs.coronalabs.com is being built and deployed from sources.
  10. \n
  11. The community is making contributions to both C++ and Lua code as well as Documentation updates
  12. \n
  13. We have disabled the license checks for the Splash Screen Control and Self-Hosted plugins in latest daily builds.
  14. \n
\n

Over the next couple of weeks, we will be working on making the offline device builds production quality.\u00a0 After that we will start to decouple Corona builds from the Single Sign On system and then start shutting down the Marketplace and working on a new web page.

\n

On the community front, we are looking at new platforms for the forums.

\n

With regards to financing, initial contributions to the GitHub crowdfunding site are off to a good start, but to be successful we will need considerably more. You can pledge your ongoing support by visiting either Patreon or GitHub Sponsors. Note: we are not relying on crowdfunding yet, but after May the 1st, funding of the Corona game engine will be in your hands.

\n

Vlad Shcherban, Corona\u2019s main contributor, has committed to full-time on-going support of Corona so you can be assured that your ability to continue to use Corona will continue.

\n

Stay tuned for more information and updates.

\n", "date_published": "2020-03-24T22:18:10+00:00", "date_modified": "2020-03-24T22:18:10+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2020/02/12/corona-labs-annual-update/", "url": "https://coronalabs.com/blog/2020/02/12/corona-labs-annual-update/", "title": "Corona Labs annual update", "content_html": "

It’s 2020 and many of you have been wanting a roadmap for the next year. We\u2019ve got several major updates to shed the light on Corona\u2019s future and give you more perspective on your business goals connected to our product.

\n

First, let us separate the business entity Corona Labs from the product Corona. On May 1, 2020, Corona Labs Inc. as a business entity will cease to operate. The main reason for this decision is the difference between income this business generates and operational expenses demanded. We assume that many of you, as mobile business owners yourself, can relate to this move. We appreciate your understanding and would like to thank everyone who contributed to our community growth. We’ve seen a lot of great games and apps produced by you, the community. From large studios to determined indie developers, you’ve surprised us and amazed us.

\n

While Corona Labs will fade into an entry in the computer software corporate history as a business entity, Corona the product will go on as an open source project. Here are the details on how we\u2019re planning to proceed.

\n

TL; DR:

\n

Your existing and new games will continue to work. After we finish with the changes to the Corona Simulator, Native and CoronaCards, there should not be much difference in the development workflow for Corona users.

\n
    \n
  1. Some of the Corona Labs staff have expressed an interest in continuing to work with Corona as an as-available hobby project, so some engine development will continue. There is a possibility that engineers would seek funding through platforms like Patreon or Github Sponsors to continue work in larger capacity.
  2. \n
  3. Appodeal will continue to fund infrastructure costs and work with the open source staff to keep the Appodeal plugin up to date.
  4. \n
  5. The Corona open source license will change from its current dual license state (Commercial + GPLv3) to a single, much more permissive license: The MIT License will make building the open source version of Corona easier for you and lift distribution restrictions on your apps and games. If you are using the GPL version of Corona, you can continue doing so in your fork.
  6. \n
  7. Corona Labs will remove Splash Screen restrictions and plugin license checks from Native and Simulator builds. All first-party plugins will be open sourced and be available on GitHub. Corona\u2019s \u201cdaily\u201d builds will be built using tools available for Open Source projects, and would be available on GitHub releases.
  8. \n
  9. We will change the Corona Simulator to be an offline tool, building for all supported platforms using local storage as a source for plugins.
  10. \n
  11. Marketplace sales will cease. Vendors will be paid what they are owed, and will have to distribute updates for their plugins themselves. Users will be able to download purchased plugins and assets before the store closure. Corona Labs will stop accepting new submissions to the Marketplace on February, 15. 2020. Self-hosted plugins will be turned on for everyone so community plugin developers can continue to provide plugins.
  12. \n
  13. We will migrate the forums and coronalabs.com website content to another platform, since the current setup is tied to an expensive infrastructure. We may need several community members to volunteer to administer the new Forums. We are still working on what the coronalabs.com website access will become.
  14. \n
  15. The community is welcome to spin up discussion forums. Possibilities include using GitHub’s Issues, Reddit’s /r/CoronaSDK page, a Facebook Group, etc. The community Slack will remain.
  16. \n
  17. The Corona Labs maintained social media accounts will remain open, and we will turn them into sources of useful information for developers (i.e., industry news, development and monetization tips, etc.).
  18. \n
  19. All these will not happen overnight. We are working on changes to the parts of the engine, and will release them gradually, moving the build process offline as well as migrating content to different platforms.\u00a0We will post updates on the progress, as well as send out one more final email with all the details Feel free to follow Corona on Github or get involved in development. Progress will be reflected in this Github Project.
  20. \n
\n

We sincerely hope that Corona can continue to thrive and that our great community can be more involved in its future. If there is anyone who would be interested in volunteering, a partnership or acquiring Corona Labs, please, contact us by emailing support@coronalabs.com.

\n

If you want to discuss this, please use this Forum thread.

\n", "date_published": "2020-02-12T22:58:14+00:00", "date_modified": "2020-02-13T23:30:27+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2020/02/05/corona-labs-server-outages/", "url": "https://coronalabs.com/blog/2020/02/05/corona-labs-server-outages/", "title": "Corona Labs server outages", "content_html": "

As many of you have discovered, there has been an ongoing, periodic server outage. Our team has been working hard to try and find the root cause, but the issue has eluded us so far.

\n

We know this is not a physical server problem. We can access the server. It is a dedicated server, so no other traffic is involved. The server load levels, network bandwidth and such are well within normal operating standards. The website worker processes just start taking a very long time to complete starting around 6am GMT. The problem persists for a range of hours from a low of around 7 hours to a high of around 13 hours. After that the servers and services return to normal. This only manifests itself on weekdays and not every day.

\n

We are in the process of bringing in some external expertise to help us diagnose and solve the problems.

\n

Corona Labs is committed to solving this issue as fast as we can to ensure that you have a reliable experience when using Corona.

\n", "date_published": "2020-02-05T22:46:57+00:00", "date_modified": "2020-02-05T22:46:57+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2019/10/27/corona-now-supports-dark-mode/", "url": "https://coronalabs.com/blog/2019/10/27/corona-now-supports-dark-mode/", "title": "Corona now supports Dark Mode", "content_html": "

\"\"Apple recently added support for Dark Mode. Dark Mode first appeared in macOS Mojave and continues with macOS Catalina. On iOS Dark Mode first appeared in iOS 13. Even tvOS supports it! Dark Mode is a popular feature because many people prefer light text on a dark background and there is evidence that it\u2019s more energy friendly as well. Android supports “Dark Theme” starting with Android 10. Corona now supports this across all supported platforms as well.

\n

Starting with daily build 2019.3545 , Corona now recognizes Dark Mode automatically and updates native.newTextField() and native.newTextBox() objects to work with the selected mode.

\n

In addition, system.getInfo(\u201cdarkMode\u201d) will return a true or false value, so you can now theme your app to the mode selected.

local darkMode = system.getInfo(\"darkMode\")

On iOS based builds, you can force your your app into “light” mode by adding an entry into the plist:

settings = \r\n{\r\n    iphone = \r\n    { \r\n         plist =\r\n         {\r\n               UIUserInterfaceStyle = \"Light\",\r\n         }\r\n     }\r\n}

Please note, “Light” is case sensitive and must be capitalized. This works on older Corona builds and if you don’t want to update to the latest daily build, this is a way to keep the native text objects themed with your current app. If you want to do this for macOS builds, use this entry in your macOS plist:

settings = \r\n{\r\n    macos = \r\n    { \r\n         plist =\r\n         {\r\n               NSRequiresAquaSystemAppearance = true,\r\n         }\r\n     }\r\n}

\n", "date_published": "2019-10-27T16:12:07+00:00", "date_modified": "2019-10-30T22:01:32+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2019/10/03/app-sign-in-for-your-corona-apps/", "url": "https://coronalabs.com/blog/2019/10/03/app-sign-in-for-your-corona-apps/", "title": "App Sign In for your Corona apps", "content_html": "\n
\n
\n
\n
\n
\n
\n

Thanks to master plugin creator, Scott Harrison for this guest post on using Google and Apple Sign-In in your apps.

\n
\n
\n

Many apps and games have there own login system. Whether you need a login for storing data, sharing, or multiplayer, setting up a login system is an important part of your app. While an email and password system is usually what most apps use, you should consider looking at using a third-party login system. Third-party systems allow the user to log in in faster and save the user from having to make another password. This tutorial will show you how to integrate both Google and Apple sign in.

\n

Google Sign In

\n

Start of by going to Corona Labs Marketplace and activate the Google Sign In Plugin. Next you need to get a client ID for Android and iOS. Go to Google console and enable “Identity Toolkit API”. Next create client id in Credentials section. Setup a client ID for iOS and Web (which is used for Android).
\n\"\"
\nAlso make sure to add to put your iOS URL scheme inside you build.settings
\n\"\"

\n

settings =\r\n{\r\n\r\n    android =\r\n    {\r\n        useGoogleServicesJson = true,\r\n        \r\n        usesPermissions =\r\n        {\r\n            \"android.permission.INTERNET\"\r\n        },\r\n\r\n    },\r\n    iphone = \r\n    {\r\n        plist = \r\n        {\r\n            CFBundleURLTypes = \r\n            {\r\n                {\r\n                    CFBundleURLSchemes = \r\n                    {\r\n                        \"com.googleusercontent.apps.REPLACE_WITH_YOUR_URL_SCHEME\",        \r\n                    }\r\n                }\r\n            },\r\n        },\r\n    },\r\n\r\n\r\n    plugins = {\r\n        [\"plugin.firestore\"] =\r\n            {\r\n                publisherId = \"tech.scotth\",\r\n            },\r\n    },\r\n}

\n

Note: if you are using Firebase, just grab the iOS client ID from the GoogleService-Info.plist file under CLIENT_ID key and for Android go to google-services.json under the keys client >oauth_client>client_id,

\n

Next use the code snippet below to insert the client id based on the platform you are using.

\n

local googleSignIn = require( \"plugin.googleSignIn\" )\r\nlocal json = require( \"json\" )\r\n\r\ngoogleSignIn.init()\r\nlocal androidClientID = \"Your Android client id\"\r\nlocal clientID = \"Your iOS client id\" -- iOS default\r\n\r\nif ( system.getInfo( \"platform\" ) == \"android\" ) then\r\n   clientID = androidClientID\r\nend\r\n\r\ngoogleSignIn.signIn( clientID, nil, nil, function ( event ) \r\n        print( json.encode( event ) )\r\n    end \r\n)

\n

Read more about the Google Sign In Plugin in the documentation.

\n

Apple Sign In

\n

Apple introduced a new way to sign in on iOS 13+. They are requiring app makers to add Apple Sign In if they use other third-party sign in options like Google or Facebook. It is easy for developers to implement Apple Sign In for iOS devices. To set up all you need to do is start by activating the free Apple Sign In Plugin in the Corona Marketplace. Make sure your App ID is setup with the Apple Sign In entitlement. This will require you to generate and download a new provisioning profile after adding the entitlement.
\n\"\"

\n

Add Apple Sign In entitlements to build.settings

\n

iphone =\r\n    {\r\n        plist =\r\n        {\r\n            -- put entitlements outside plist\r\n        },\r\n        entitlements = {\r\n            [\"com.apple.developer.applesignin\"] = {\"Default\"},\r\n        }\r\n    },\r\n    plugins = {\r\n        [\"plugin.appleSignIn\"] =\r\n            {\r\n                publisherId = \"tech.scotth\",\r\n            },\r\n    },

\n

Then just use the Apple Sign In plugin in your app to login on your iOS 13+ device

\n

local appleSignIn = require( \"plugin.appleSignIn\" )\r\nlocal json = require( \"json\" )\r\n\r\nappleSignIn.show( \"name\", function( event )\r\n        print( json.encode( event ) )\r\n    end \r\n)

\n

Note: The first value in appleSignIn.show() can either be “name“, which will get the name of the user, “email“, will get the email of the user, or “nameAndEmail“, which will get the email and name.

\n

Read more about the Apple Sign In Plugin in the documentation.

\n", "date_published": "2019-10-03T15:22:31+00:00", "date_modified": "2019-10-03T15:22:31+00:00", "author": { "name": "Rob Miracle" } }, { "id": "https://coronalabs.com/blog/2019/09/27/a-simple-progressview-for-corona/", "url": "https://coronalabs.com/blog/2019/09/27/a-simple-progressview-for-corona/", "title": "A simple progressView for Corona", "content_html": "

One of the things that makes Corona great is that we offer over 1,000 API calls to make your life as a developer easier. This includes various convenience APIs that make our simple-to-use APIs even simpler.

\n

However, sometimes those convenience methods can be less of a convenience and more of a headache when you try to use them beyond what they were designed for. Let’s examine the widget.* library as an example.

\n

The widget.* library contains API’s to create buttons, switches, tableViews and more, but they were created with the intention of emulating the look and feel of iOS and Android UI elements. Corona Labs eventually added options to alter their look so they could be themed to fit your game or app better. The problem is trying to theme these widgets can be more complex than building a custom widget on your own. One of these widgets is the widget.newProgressView.

\n

In its simplest setup, the widget.newProgressView is quite simple:

local widget = require( \"widget\" )\r\n\r\nlocal progressView = widget.newProgressView({\r\n        left = 50,\r\n        top = 100,\r\n        width = 220,\r\n        isAnimated = true\r\n    })\r\n\r\nprogressView:setProgress( 0.5 )

And you get:
\n\"\"

\n

when the progress is set to 50%. It’s a simple iOS-like progressView. If you change the widget theme to Android, it will be more familiar to native Android apps. But what if you want to do something that fits your app better? Well you can use image sheets to do that. Let’s look at the code first:

local options = {\r\n    width = 64,\r\n    height = 64,\r\n    numFrames = 6,\r\n    sheetContentWidth = 384,\r\n    sheetContentHeight = 64\r\n}\r\nlocal progressSheet = graphics.newImageSheet( \"widget-progress-view.png\", options )\r\n\r\nlocal progressView = widget.newProgressView({\r\n        sheet = progressSheet,\r\n        fillOuterLeftFrame = 1,\r\n        fillOuterMiddleFrame = 2,\r\n        fillOuterRightFrame = 3,\r\n        fillOuterWidth = 64,\r\n        fillOuterHeight = 64,\r\n        fillInnerLeftFrame = 4,\r\n        fillInnerMiddleFrame = 5,\r\n        fillInnerRightFrame = 6,\r\n        fillWidth = 64,\r\n        fillHeight = 64,\r\n        left = 50,\r\n        top = 200,\r\n        width = 220,\r\n        isAnimated = true\r\n    })\r\n\r\nprogressView:setProgress( 0.5 )

There is a lot more you have to do to set it up code wise, but in addition you have to provide an image sheet that has to be specially constructed. It’s a six frame, 64px X 64px per frame image, where you have an outer frame and an inner fill. Frames 1 & 3 represent the end-caps of the outer frame, frames 4 & 6 represent the fill of the end caps. Frame 2 is the outer frame that’s stretched to fill the size you’ve set (width = 220 above) and frame 5 is the actual progress image that will be stretched to the percentages the view is set to. Even with this, it’s limited. This image sheet (ignore the background colors, they are there just to show you each frame):
\n\"\"
\nwill result in a progressView that looks like:
\n\"\"

\n

That frame and fill may not be what you want. What if you want to have something like a red to yellow to green gradient and perhaps have a pointer that shows where in the red to green range you are? Well you can’t really do that with this widget. Why? Because the middle frames stretch to the width and then the end caps are added.

\n

But you can do this with one image and one display.newRect() if you don’t mind rectangles, or a third image to act as a mask if you want rounded corners.

\n

Let’s look at an example that will give you that gradient “temperature gauge”. Starting with this image and mask:

\n

\"\"
\nand:
\n\"\"

\n

The image will be the background of our progressView and the mask will be used to give it rounded corners. We will also use a display.newRect() and fill it with a navy blue color that will block out the percentage of the gradient that hasn’t been reached yet. At 75% progress we should have something that looks like:

\n

\"\"

\n

The code for this is quite simple. Let’s make a function to create a new gradient progressView and also create a method to set the percentage.

local function customProgressView(percent)\r\n    local thisProgressView = display.newGroup()\r\n    thisProgressView.backgound = display.newImageRect(thisProgressView, \"pvBackground.png\", 200, 40)\r\n    local mask = graphics.newMask(\"pvMask.png\")\r\n    thisProgressView:setMask(mask)\r\n    thisProgressView.progress = display.newRect(thisProgressView, 100, 0, 200, 40)\r\n    thisProgressView.progress:setFillColor(0,0.25, 0.5)\r\n    thisProgressView.progress.anchorX = 1\r\n    thisProgressView.progress.width = 200 - (percent * 200)\r\n\r\n    function thisProgressView:setProgress( percent )\r\n        self.progress.width = 200 - (percent * 200)\r\n    end\r\n\r\n    return thisProgressView\r\nend\r\n\r\nlocal progressView3 = customProgressView(0)\r\nprogressView3:setProgress( 0.75 )\r\n\r\nprogressView3.x = display.contentCenterX\r\nprogressView3.y = 350

Start by creating a display.newGroup() to hold the progressView. This will not only serve as a single display object that we can easily position, but also act as a table to hold the three display objects and the function to set the percentage. The function will return a handle to the display.newGroup() that you will manipulate in your code.

\n

Next set the background image using a display.newImageRect() to load our gradient background image. This tutorial hard codes the size, but you can easily pass size parameters to the creation function. A graphics.newMask() is added to the group, so that any other display objects added to the group will be affected by the mask.

\n

A display.newRect() is created and stored in the group as well. This will hide the progress yet to be achieved. This requires a little trickery to work right. Anchor the rectangle to the right side. Set the color and use the .width value of the rectangle to size it to how much you want to block.

\n

Add a function to the group that can be used to set the percentage after the initial creation. It’s the same math used above.

\n

Finally return the group to the calling function. Then in the calling function, you can initialize the progressView and then set the percentage.

\n

The entire function and code to position and set the value 22 lines of code. Trying to use the widget.newProgressView()‘s theming option is 28 lines (plus the widget itself!), can’t do this kind of customization, and is more code.

\n

Hopefully this will demonstrate that some things you think are hard are actually pretty simple.

\n", "date_published": "2019-09-27T21:10:54+00:00", "date_modified": "2019-09-27T21:10:54+00:00", "author": { "name": "Rob Miracle" } } ] }