Exercises
We’ve covered a lot of the basics of live wallpapers in this chapter, but there’s still a lot of low-hanging fruit left for us to pick. Let’s start off with the following exercises:
-
To optimize performance, let’s change the way we initialize the particle system and reduce the total particle count from 10,000 to something a lot lower. Once that’s done, let’s optimize things further by removing particles that fall below the terrain. One way you can do this is by swapping each particle to be removed with the last good active particle in the array.
When you make these changes, try updating the behavior so that the particle system doesn’t get reset if onSurfaceCreated is called a second time.
-
Android live wallpapers support an additional ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access