Android Open Source - GameOfLifeLiveWallpaper Game Of Life Wallpaper Service






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;
//w w  w.  j a v a  2 s  .  c  om
import android.service.wallpaper.WallpaperService;
import android.view.MotionEvent;
import android.view.SurfaceHolder;


public class GameOfLifeWallpaperService extends WallpaperService {

    @Override
    public Engine onCreateEngine() {
        return new MyWallpaperEngine();
    }

    /**
     * Wallpaper engine
     */
    private class MyWallpaperEngine extends Engine implements GameOfLifeRenderer.SurfaceHolderProvider {

        final GameOfLifeRenderer gameOfLifeRenderer;

        public MyWallpaperEngine() {
            gameOfLifeRenderer = new GameOfLifeRenderer(GameOfLifeWallpaperService.this, this);
        }

        @Override
        public void onVisibilityChanged(boolean visible) {
            gameOfLifeRenderer.onVisibilityChanged(visible);
        }

        @Override
        public void onSurfaceCreated(SurfaceHolder holder) {
            super.onSurfaceCreated(holder);
            gameOfLifeRenderer.surfaceCreated(holder);
        }

        @Override
        public void onSurfaceDestroyed(SurfaceHolder holder) {
            super.onSurfaceDestroyed(holder);
            gameOfLifeRenderer.surfaceDestroyed(holder);
        }

        @Override
        public void onSurfaceChanged(SurfaceHolder holder, int format,
                                     int width, int height) {

            super.onSurfaceChanged(holder, format, width, height);
            gameOfLifeRenderer.surfaceChanged(holder, format, width, height);
        }

        @Override
        public void onTouchEvent(MotionEvent event) {
            super.onTouchEvent(event);
            gameOfLifeRenderer.onTouchEvent(event);
        }

    }
}




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