Android Open Source - GameOfLifeLiveWallpaper Bug Thing Pattern






From Project

Back to project page GameOfLifeLiveWallpaper.

License

The source code is released under:

Apache License

If you think the Android project GameOfLifeLiveWallpaper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.garrapeta.gameoflive.pattern;
/*www .  j  av a 2 s  .  c  om*/
import com.garrapeta.gameoflive.GameOfLifeWorld;

public class BugThingPattern implements Pattern {

    @Override
    public void addPattern(GameOfLifeWorld world, int x, int y) {
        world.setAlive(x + 2 , y + 0 , true);
        world.setAlive(x + 3 , y + 0 , true);
        world.setAlive(x + 4 , y + 0 , true);
        world.setAlive(x + 8 , y + 0 , true);
        world.setAlive(x + 9 , y + 0 , true);
        world.setAlive(x + 10 , y + 0 , true);

        world.setAlive(x + 0 , y + 2 , true);
        world.setAlive(x + 5 , y + 2 , true);
        world.setAlive(x + 7 , y + 2 , true);
        world.setAlive(x + 12 , y + 2 , true);

        world.setAlive(x + 0 , y + 3 , true);
        world.setAlive(x + 5 , y + 3 , true);
        world.setAlive(x + 7 , y + 3 , true);
        world.setAlive(x + 12 , y + 3 , true);

        world.setAlive(x + 0 , y + 3 , true);
        world.setAlive(x + 7 , y + 3 , true);
        world.setAlive(x + 12 , y + 3 , true);

        world.setAlive(x + 2 , y + 5 , true);
        world.setAlive(x + 3 , y + 5 , true);
        world.setAlive(x + 4 , y + 5 , true);
        world.setAlive(x + 8 , y + 5 , true);
        world.setAlive(x + 9 , y + 5 , true);
        world.setAlive(x + 10 , y + 5 , true);
    }

    @Override
    public void addPatternCentered(GameOfLifeWorld world) {
        int x = (world.getCols() - 12) / 2;
        int y = (world.getRows() - 6) / 2;
        addPattern(world, x, y);
    }
}




Java Source Code List

com.garrapeta.gameoflive.ApplicationTest.java
com.garrapeta.gameoflive.GameOfLifeActivity.java
com.garrapeta.gameoflive.GameOfLifeRenderer.java
com.garrapeta.gameoflive.GameOfLifeWallpaperService.java
com.garrapeta.gameoflive.GameOfLifeWorld.java
com.garrapeta.gameoflive.PreferencesActivity.java
com.garrapeta.gameoflive.pattern.BugThingPattern.java
com.garrapeta.gameoflive.pattern.Pattern.java