├── .gitignore ├── PathFind ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── ic_launcher-web.png ├── libs │ └── android-support-v4.jar ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ ├── dancing1.png │ │ ├── dancing2.png │ │ ├── dancing3.png │ │ ├── dancing4.png │ │ ├── dancing5.png │ │ ├── dancing6.png │ │ ├── dancing7.png │ │ ├── dancing8.png │ │ ├── grass.jpg │ │ ├── ground.jpg │ │ ├── ic_launcher.png │ │ ├── postsbg.jpg │ │ ├── spikerock1.png │ │ ├── spikerock2.png │ │ ├── spikerock3.png │ │ ├── spikerock4.png │ │ ├── spikerock5.png │ │ ├── spikerock6.png │ │ ├── spikerock7.png │ │ ├── spikerock8.png │ │ ├── stone.png │ │ ├── sunflower1.png │ │ ├── sunflower2.png │ │ ├── sunflower3.png │ │ ├── sunflower4.png │ │ ├── sunflower5.png │ │ ├── sunflower6.png │ │ ├── sunflower7.png │ │ ├── sunflower8.png │ │ ├── torchwood1.png │ │ ├── torchwood2.png │ │ ├── torchwood3.png │ │ ├── torchwood4.png │ │ ├── torchwood5.png │ │ ├── torchwood6.png │ │ ├── torchwood7.png │ │ ├── torchwood8.png │ │ ├── zz1.png │ │ ├── zz2.png │ │ ├── zz3.png │ │ ├── zz4.png │ │ ├── zz5.png │ │ ├── zz6.png │ │ ├── zz7.png │ │ └── zz8.png │ ├── drawable-ldpi │ │ └── postsbg.jpg │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── layout │ │ └── activity_main.xml │ ├── menu │ │ └── main.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ ├── values-w820dp │ │ └── dimens.xml │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── com │ └── dean │ └── pathfind │ ├── Animation.java │ ├── DrawManager.java │ ├── MainActivity.java │ └── PathFindView.java └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | -------------------------------------------------------------------------------- /PathFind/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /PathFind/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainActivity 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /PathFind/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/com/dean/pathfind/Animation.java=gbk 3 | encoding//src/com/dean/pathfind/DrawManager.java=UTF-8 4 | encoding//src/com/dean/pathfind/PathFindView.java=UTF-8 5 | -------------------------------------------------------------------------------- /PathFind/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /PathFind/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PathFind/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/ic_launcher-web.png -------------------------------------------------------------------------------- /PathFind/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/libs/android-support-v4.jar -------------------------------------------------------------------------------- /PathFind/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /PathFind/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/dancing1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/dancing1.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/dancing2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/dancing2.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/dancing3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/dancing3.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/dancing4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/dancing4.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/dancing5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/dancing5.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/dancing6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/dancing6.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/dancing7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/dancing7.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/dancing8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/dancing8.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/grass.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/grass.jpg -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/ground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/ground.jpg -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/postsbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/postsbg.jpg -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/spikerock1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/spikerock1.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/spikerock2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/spikerock2.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/spikerock3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/spikerock3.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/spikerock4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/spikerock4.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/spikerock5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/spikerock5.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/spikerock6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/spikerock6.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/spikerock7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/spikerock7.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/spikerock8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/spikerock8.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/stone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/stone.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/sunflower1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/sunflower1.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/sunflower2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/sunflower2.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/sunflower3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/sunflower3.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/sunflower4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/sunflower4.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/sunflower5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/sunflower5.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/sunflower6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/sunflower6.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/sunflower7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/sunflower7.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/sunflower8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/sunflower8.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/torchwood1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/torchwood1.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/torchwood2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/torchwood2.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/torchwood3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/torchwood3.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/torchwood4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/torchwood4.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/torchwood5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/torchwood5.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/torchwood6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/torchwood6.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/torchwood7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/torchwood7.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/torchwood8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/torchwood8.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/zz1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/zz1.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/zz2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/zz2.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/zz3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/zz3.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/zz4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/zz4.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/zz5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/zz5.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/zz6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/zz6.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/zz7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/zz7.png -------------------------------------------------------------------------------- /PathFind/res/drawable-hdpi/zz8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-hdpi/zz8.png -------------------------------------------------------------------------------- /PathFind/res/drawable-ldpi/postsbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-ldpi/postsbg.jpg -------------------------------------------------------------------------------- /PathFind/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /PathFind/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /PathFind/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /PathFind/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /PathFind/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /PathFind/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /PathFind/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /PathFind/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /PathFind/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /PathFind/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PathFind 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /PathFind/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /PathFind/src/com/dean/pathfind/Animation.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a396901990/PathFind/e9be7bae955cf1c2d5f2b1d69e338cb69b4a1548/PathFind/src/com/dean/pathfind/Animation.java -------------------------------------------------------------------------------- /PathFind/src/com/dean/pathfind/DrawManager.java: -------------------------------------------------------------------------------- 1 | package com.dean.pathfind; 2 | 3 | import java.io.InputStream; 4 | import java.util.ArrayList; 5 | import java.util.LinkedList; 6 | import java.util.Queue; 7 | 8 | import android.content.Context; 9 | import android.graphics.Bitmap; 10 | import android.graphics.BitmapFactory; 11 | import android.graphics.Canvas; 12 | import android.graphics.Color; 13 | import android.graphics.Paint; 14 | import android.graphics.Rect; 15 | import android.graphics.Paint.Style; 16 | 17 | public class DrawManager 18 | { 19 | 20 | private Paint linePaint; 21 | 22 | private Paint pathPaint; 23 | 24 | private Paint textPaint; 25 | 26 | private Paint buttonPaint; 27 | 28 | private float[] xLinesPos; 29 | 30 | private float[] yLinesPos; 31 | 32 | private int mWidth; 33 | 34 | private int mHeight; 35 | 36 | private float col_width; 37 | 38 | private float col_height; 39 | 40 | private Context context; 41 | 42 | public static final int WIDTH_COUNT = 8; 43 | 44 | public static final int HEIGHT_COUNT = 8; 45 | 46 | public int margin = 0; 47 | 48 | /** 向下移动动画 **/ 49 | private final static int ANIM_DOWN = 0; 50 | 51 | /** 向左移动动画 **/ 52 | private final static int ANIM_LEFT = 1; 53 | 54 | /** 向右移动动画 **/ 55 | private final static int ANIM_RIGHT = 2; 56 | 57 | /** 向上移动动画 **/ 58 | private final static int ANIM_UP = 3; 59 | 60 | /** 动画的总数量 **/ 61 | private final static int ANIM_COUNT = 4; 62 | 63 | private Animation mHeroAnim[] = new Animation[ANIM_COUNT]; 64 | 65 | private Animation mStoneAnim; 66 | 67 | private Animation mTorchwood; 68 | 69 | private Animation mSpikerock; 70 | 71 | private Animation mSunFlower; 72 | 73 | private Animation mZombieDancing; 74 | 75 | public int endPosX, endPosY; 76 | 77 | public int mapWidth, mapHeight; 78 | 79 | public Rect btn1_rect, btn2_rect; 80 | 81 | public static final int[][] mMapView = 82 | { 83 | { 0, 1, 1, 3, 0, 0, 0, 1 }, 84 | { 0, 0, 0, 2, 0, 1, 0, 1 }, 85 | { 1, 0, 3, 1, 0, 3, 0, 0 }, 86 | { 2, 0, 0, 2, 0, 0, 3, 0 }, 87 | { 0, 0, 0, 0, 0, 0, 1, 0 }, 88 | { 1, 1, 0, 1, 1, 0, 0, 0 }, 89 | { 1, 0, 0, 0, 0, 3, 0, 1 }, 90 | { 1, 0, 2, 1, 0, 0, 0, 8 } }; 91 | 92 | public DrawManager( Context context, int screenWidth, int screenHeight ) 93 | { 94 | this.context = context; 95 | mWidth = screenWidth; 96 | mHeight = screenHeight; 97 | 98 | initConstant(); 99 | initPaint(); 100 | initLineGrids(); 101 | initAnimation(); 102 | } 103 | 104 | int[][] a = new int[64][64]; 105 | 106 | int[][] dfs_book = new int[64][64]; 107 | 108 | int[][] bfs_book = new int[64][64]; 109 | 110 | public ArrayList dfs_posList = new ArrayList(); 111 | 112 | public ArrayList bfs_posList = new ArrayList(); 113 | 114 | // 深度优先搜索 115 | public void DFS( int x, int y ) 116 | throws Exception 117 | { 118 | 119 | int tx, ty; 120 | 121 | int[] pos = 122 | { x, y }; 123 | dfs_posList.add(pos); 124 | 125 | // 是否到达目的地 126 | if (mMapView[y][x] == 8) 127 | { 128 | throw new Exception("find"); 129 | } 130 | 131 | // 顺时针循环,右下左上四个方向 132 | for (int k = 0; k < 4; k++) 133 | { 134 | tx = x + next[k][1]; 135 | ty = y + next[k][0]; 136 | 137 | // 是否出了边界 138 | boolean isOut = tx < 0 || tx >= mapWidth || ty < 0 || ty >= mapHeight; 139 | if (!isOut) 140 | { 141 | 142 | // 是否是障碍物 143 | if (mMapView[ty][tx] == 0 && dfs_book[tx][ty] == 0 || mMapView[ty][tx] == 8) 144 | { 145 | dfs_book[tx][ty] = 1; 146 | DFS(tx, ty); 147 | dfs_book[tx][ty] = 0; 148 | } 149 | } 150 | 151 | } 152 | } 153 | 154 | // 广度优先搜索(Breadth First Search) 155 | public void BFS() 156 | { 157 | 158 | // 存储点的序列 159 | Queue queue = new LinkedList(); 160 | 161 | int x, y; 162 | int[] pos = 163 | { 0, 0 }; 164 | queue.offer(pos); 165 | 166 | while (!queue.isEmpty()) 167 | { 168 | // 从队列中取出并移除 169 | pos = queue.poll(); 170 | bfs_posList.add(pos); 171 | 172 | // 顺时针循环,右下左上四个方向 173 | for (int k = 0; k < 4; k++) 174 | { 175 | x = pos[0]; 176 | y = pos[1]; 177 | 178 | // 是否到达目的地 179 | if (mMapView[y][x] == 8) 180 | { 181 | return; 182 | } 183 | 184 | x += next[k][1]; 185 | y += next[k][0]; 186 | 187 | // 是否出了边界 188 | boolean isOut = x < 0 || x >= mapWidth || y < 0 || y >= mapHeight; 189 | if (!isOut) 190 | { 191 | // 是否是障碍物 192 | if (mMapView[y][x] == 0 && bfs_book[x][y] == 0 || mMapView[y][x] == 8) 193 | { 194 | bfs_book[x][y] = 1; 195 | queue.offer(new int[] 196 | { x, y }); 197 | } 198 | } 199 | 200 | } 201 | } 202 | } 203 | 204 | int[][] next = 205 | { 206 | { 0, 1 }, // 右 207 | { 1, 0 }, // 下 208 | { 0, -1 }, // 左 209 | { -1, 0 } // 上 210 | }; 211 | 212 | private void initConstant() 213 | { 214 | col_width = (float) mWidth / WIDTH_COUNT; 215 | col_height = col_width; 216 | margin = (mHeight - mWidth) / 2; 217 | 218 | mapWidth = 8; 219 | mapHeight = 8; 220 | 221 | endPosX = mMapView[0].length; 222 | endPosY = mMapView.length; 223 | 224 | bfs_book[0][0] = 1; 225 | dfs_book[0][0] = 1; 226 | BFS(); 227 | try 228 | { 229 | DFS(0, 0); 230 | } 231 | catch (Exception e) 232 | { 233 | e.printStackTrace(); 234 | } 235 | } 236 | 237 | private void initLineGrids() 238 | { 239 | xLinesPos = new float[(WIDTH_COUNT + 1) * 4]; 240 | yLinesPos = new float[(HEIGHT_COUNT + 1) * 4]; 241 | 242 | // 竖线 243 | for (int i = 0; i <= WIDTH_COUNT; i++) 244 | { 245 | xLinesPos[i * 4 + 0] = i * col_width; 246 | xLinesPos[i * 4 + 1] = margin; 247 | xLinesPos[i * 4 + 2] = i * col_width; 248 | xLinesPos[i * 4 + 3] = mHeight - margin; 249 | } 250 | 251 | // 横线 252 | for (int i = 0; i <= HEIGHT_COUNT; i++) 253 | { 254 | yLinesPos[i * 4 + 0] = 0; 255 | yLinesPos[i * 4 + 1] = margin + i * col_height; 256 | yLinesPos[i * 4 + 2] = mWidth; 257 | yLinesPos[i * 4 + 3] = margin + i * col_height; 258 | } 259 | } 260 | 261 | private void initAnimation() 262 | { 263 | mStoneAnim = new Animation(context, new int[] 264 | { R.drawable.zz1, R.drawable.zz2, R.drawable.zz3, R.drawable.zz4, R.drawable.zz5, R.drawable.zz6, R.drawable.zz7, R.drawable.zz8 }, true); 265 | 266 | mTorchwood = new Animation(context, new int[] 267 | { R.drawable.torchwood1, R.drawable.torchwood2, R.drawable.torchwood3, R.drawable.torchwood4, R.drawable.torchwood5, R.drawable.torchwood6, R.drawable.torchwood7, R.drawable.torchwood8 }, true); 268 | 269 | mSpikerock = new Animation(context, new int[] 270 | { R.drawable.spikerock1, R.drawable.spikerock2, R.drawable.spikerock3, R.drawable.spikerock4, R.drawable.spikerock5, R.drawable.spikerock6, R.drawable.spikerock7, R.drawable.spikerock8 }, true); 271 | 272 | mSunFlower = new Animation(context, new int[] 273 | { R.drawable.sunflower1, R.drawable.sunflower2, R.drawable.sunflower3, R.drawable.sunflower4, R.drawable.sunflower5, R.drawable.sunflower6, R.drawable.sunflower7, R.drawable.sunflower8 }, true); 274 | 275 | mZombieDancing = new Animation(context, new int[] 276 | { R.drawable.dancing1, R.drawable.dancing2, R.drawable.dancing3, R.drawable.dancing4, R.drawable.dancing5, R.drawable.dancing6, R.drawable.dancing7, R.drawable.dancing8 }, true); 277 | } 278 | 279 | private void initPaint() 280 | { 281 | linePaint = new Paint(); 282 | linePaint.setAntiAlias(true); 283 | linePaint.setColor(Color.GRAY); 284 | linePaint.setStrokeWidth(4.0f); 285 | 286 | pathPaint = new Paint(); 287 | pathPaint.setStyle(Style.FILL); 288 | 289 | textPaint = new Paint(); 290 | textPaint.setAntiAlias(true); 291 | textPaint.setTextSize(50); 292 | textPaint.setColor(Color.BLACK); 293 | 294 | buttonPaint = new Paint(); 295 | buttonPaint.setStyle(Style.FILL_AND_STROKE); 296 | buttonPaint.setStrokeWidth(5.0f); 297 | 298 | } 299 | 300 | public void drawMap( Canvas mCanvas ) 301 | { 302 | mCanvas.drawColor(Color.WHITE); 303 | 304 | mCanvas.drawLines(xLinesPos, linePaint); 305 | mCanvas.drawLines(yLinesPos, linePaint); 306 | 307 | for (int i = 0; i < mMapView.length; i++) 308 | { 309 | int[] colMap = mMapView[i]; 310 | for (int j = 0; j < colMap.length; j++) 311 | { 312 | int value = mMapView[i][j]; 313 | if (value == 1) 314 | { 315 | drawStone(mCanvas, j, i); 316 | } 317 | else if (value == 2) 318 | { 319 | drawTorchWood(mCanvas, j, i); 320 | } 321 | else if (value == 3) 322 | { 323 | drawSpikeRockWood(mCanvas, j, i); 324 | } 325 | else if (value == 8) 326 | { 327 | drawSunFlower(mCanvas, j, i); 328 | } 329 | } 330 | } 331 | 332 | drawZombieDancing(mCanvas, 0, 0); 333 | } 334 | 335 | public void drawButton( Canvas mCanvas ) 336 | { 337 | 338 | String text1 = "深度优先搜索"; 339 | String text2 = "广度优先搜索"; 340 | 341 | int button1_width = margin / 4 + (int) textPaint.measureText(text1); 342 | int button2_width = margin / 4 + (int) textPaint.measureText(text2); 343 | 344 | int button_margin = (mWidth - button1_width - button2_width) / 3; 345 | int left1 = button_margin; 346 | int top1 = margin / 4; 347 | int right1 = left1 + button1_width; 348 | int bottom1 = top1 + margin / 2; 349 | 350 | int left2 = right1 + button_margin; 351 | int top2 = margin / 4; 352 | int right2 = left2 + button2_width; 353 | int bottom2 = top1 + margin / 2; 354 | 355 | btn1_rect = new Rect(left1, top1, right1, bottom1); 356 | buttonPaint.setColor(Color.BLUE); 357 | buttonPaint.setAlpha(100); 358 | mCanvas.drawRect(btn1_rect, buttonPaint); 359 | 360 | buttonPaint.setColor(Color.GREEN); 361 | buttonPaint.setAlpha(100); 362 | btn2_rect = new Rect(left2, top2, right2, bottom2); 363 | mCanvas.drawRect(btn2_rect, buttonPaint); 364 | 365 | float[] textSize1 = getTextSize(btn1_rect, text1); 366 | mCanvas.drawText(text1, textSize1[0], textSize1[1], textPaint); 367 | 368 | float[] textSize2 = getTextSize(btn2_rect, text2); 369 | mCanvas.drawText(text2, textSize2[0], textSize2[1], textPaint); 370 | } 371 | 372 | private float[] getTextSize( Rect rect, String text ) 373 | { 374 | float textX = rect.left - (rect.left - rect.right) / 2 - textPaint.measureText(text) / 2; 375 | float textY = rect.top - (rect.top - rect.bottom) / 2 - (textPaint.descent() + textPaint.ascent()) / 2; 376 | return new float[] 377 | { textX, textY }; 378 | } 379 | 380 | public int[][] drawPath( Canvas mCanvas, int color, int[][] pathPos ) 381 | { 382 | int x = 0; 383 | int y = 0; 384 | int alpha_unit = 100 / pathPos.length; 385 | int isActive = 0; 386 | int active_num = 0; 387 | 388 | for (int i = 0; i < pathPos.length; i++) 389 | { 390 | if (i == 0) 391 | { 392 | pathPos[i][2] = 1; 393 | } 394 | int[] pos = pathPos[i]; 395 | x = pos[0]; 396 | y = pos[1]; 397 | isActive = pos[2]; 398 | if (isActive == 1) 399 | { 400 | Rect rect = calcCellPos(x, y); 401 | int alpah = i * alpha_unit + 50; 402 | pathPaint.setColor(color); 403 | pathPaint.setAlpha(alpah); 404 | mCanvas.drawRect(rect, pathPaint); 405 | 406 | String text = i + ""; 407 | float[] textSize1 = getTextSize(rect, text); 408 | mCanvas.drawText(text, textSize1[0], textSize1[1], textPaint); 409 | 410 | active_num = i; 411 | } 412 | } 413 | if (active_num + 1 < pathPos.length) 414 | { 415 | pathPos[active_num + 1][2] = 1; 416 | } 417 | 418 | return pathPos; 419 | } 420 | 421 | public void drawStone( Canvas mCanvas, int xPos, int yPos ) 422 | { 423 | Rect rect = calcCellPos(xPos, yPos); 424 | mStoneAnim.DrawAnimation(mCanvas, new Paint(), rect); 425 | } 426 | 427 | public void drawTorchWood( Canvas mCanvas, int xPos, int yPos ) 428 | { 429 | 430 | Rect rect = calcCellPos(xPos, yPos); 431 | mTorchwood.DrawAnimation(mCanvas, new Paint(), rect); 432 | } 433 | 434 | public void drawSpikeRockWood( Canvas mCanvas, int xPos, int yPos ) 435 | { 436 | Rect rect = calcCellPos(xPos, yPos); 437 | mSpikerock.DrawAnimation(mCanvas, new Paint(), rect); 438 | } 439 | 440 | public void drawSunFlower( Canvas mCanvas, int xPos, int yPos ) 441 | { 442 | Rect rect = calcCellPos(xPos, yPos); 443 | mSunFlower.DrawAnimation(mCanvas, new Paint(), rect); 444 | } 445 | 446 | public void drawZombieDancing( Canvas mCanvas, int xPos, int yPos ) 447 | { 448 | Rect rect = calcCellPos(xPos, yPos); 449 | mZombieDancing.DrawAnimation(mCanvas, new Paint(), rect); 450 | } 451 | 452 | private Rect calcCellPos( int x, int y ) 453 | { 454 | int left = (int) (x * col_width); 455 | int top = (int) (y * col_height) + margin; 456 | int right = left + (int) col_width; 457 | int bottom = top + (int) col_height; 458 | 459 | return new Rect(left, top, right, bottom); 460 | } 461 | 462 | public Bitmap ReadBitMap( Context context, int resId ) 463 | { 464 | BitmapFactory.Options opt = new BitmapFactory.Options(); 465 | opt.inPreferredConfig = Bitmap.Config.RGB_565; 466 | opt.inPurgeable = true; 467 | opt.inInputShareable = true; 468 | InputStream is = context.getResources().openRawResource(resId); 469 | return BitmapFactory.decodeStream(is, null, opt); 470 | } 471 | } 472 | -------------------------------------------------------------------------------- /PathFind/src/com/dean/pathfind/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.dean.pathfind; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.Window; 6 | import android.view.WindowManager; 7 | 8 | public class MainActivity extends Activity { 9 | 10 | int[][] map; 11 | public static final int WIDTH_COUNT = 10; 12 | public static final int HEIGHT_COUNT = 15; 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | requestWindowFeature(Window.FEATURE_NO_TITLE); 18 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 19 | WindowManager.LayoutParams.FLAG_FULLSCREEN); 20 | 21 | setContentView(new PathFindView(this)); 22 | } 23 | 24 | private int[][] generateMap() { 25 | int[][] map = new int[HEIGHT_COUNT][HEIGHT_COUNT]; 26 | for (int i = 0; i < HEIGHT_COUNT - 1; i++) { 27 | for (int j = 0; j < WIDTH_COUNT - 1; j++) { 28 | 29 | } 30 | } 31 | return map; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /PathFind/src/com/dean/pathfind/PathFindView.java: -------------------------------------------------------------------------------- 1 | package com.dean.pathfind; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Date; 5 | 6 | import android.annotation.SuppressLint; 7 | import android.app.Activity; 8 | import android.content.Context; 9 | import android.graphics.Canvas; 10 | import android.graphics.Color; 11 | import android.util.DisplayMetrics; 12 | import android.view.MotionEvent; 13 | import android.view.SurfaceHolder; 14 | import android.view.SurfaceView; 15 | 16 | /** 17 | * @author Dean Guo 18 | **/ 19 | public class PathFindView 20 | extends SurfaceView 21 | implements SurfaceHolder.Callback, Runnable 22 | { 23 | 24 | private SurfaceHolder mHolder; 25 | 26 | private Canvas mCanvas; 27 | 28 | private boolean isRun; 29 | 30 | // 屏幕宽高 31 | public static int WIDTH, HEIGHT; 32 | 33 | private DrawManager drawManager; 34 | 35 | int[][] path; 36 | 37 | public PathFindView( Context context ) 38 | { 39 | super(context); 40 | 41 | // 设置视图宽高(像素) 42 | DisplayMetrics metric = new DisplayMetrics(); 43 | ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metric); 44 | WIDTH = metric.widthPixels; 45 | HEIGHT = metric.heightPixels; 46 | 47 | mHolder = this.getHolder(); 48 | mHolder.addCallback(this); 49 | 50 | drawManager = new DrawManager(context, WIDTH, HEIGHT); 51 | 52 | } 53 | 54 | @Override 55 | public void run() 56 | { 57 | 58 | Date date = null; 59 | while (isRun) 60 | { 61 | try 62 | { 63 | date = new Date(); 64 | mCanvas = mHolder.lockCanvas(null); 65 | if (mCanvas != null) 66 | { 67 | synchronized (mHolder) 68 | { 69 | drawManager.drawMap(mCanvas); 70 | drawManager.drawButton(mCanvas); 71 | if (isOk) path = drawManager.drawPath(mCanvas, Color.RED, path); 72 | 73 | // 控制帧数 74 | Thread.sleep(Math.max(0, 200 - (new Date().getTime() - date.getTime()))); 75 | } 76 | } 77 | } 78 | catch (Exception e) 79 | { 80 | e.printStackTrace(); 81 | } 82 | finally 83 | { 84 | if (mCanvas != null) 85 | { 86 | mHolder.unlockCanvasAndPost(mCanvas); 87 | } 88 | } 89 | } 90 | } 91 | 92 | boolean isOk = false; 93 | 94 | @SuppressLint("ClickableViewAccessibility") 95 | @Override 96 | public boolean onTouchEvent( MotionEvent event ) 97 | { 98 | switch (event.getPointerCount()) 99 | { 100 | // 单点触摸 101 | case 1: 102 | switch (event.getAction()) 103 | { 104 | case MotionEvent.ACTION_DOWN: 105 | float x = event.getX(); 106 | float y = event.getY(); 107 | ArrayList pos = null; 108 | // 按钮1按下 109 | if (drawManager.btn1_rect.contains((int) x, (int) y)) 110 | { 111 | pos = drawManager.dfs_posList; 112 | } 113 | // 按钮2按下 114 | if (drawManager.btn2_rect.contains((int) x, (int) y)) 115 | { 116 | pos = drawManager.bfs_posList; 117 | } 118 | 119 | if (pos != null) 120 | { 121 | isOk = true; 122 | path = new int[pos.size()][3]; 123 | for (int i = 0; i < pos.size(); i++) 124 | { 125 | path[i][0] = pos.get(i)[0]; // x 126 | path[i][1] = pos.get(i)[1]; // y 127 | path[i][2] = 0; // isActive 128 | } 129 | } 130 | break; 131 | case MotionEvent.ACTION_UP: 132 | break; 133 | default: 134 | break; 135 | } 136 | break; 137 | } 138 | 139 | return true; 140 | } 141 | 142 | // Surface的大小发生改变时调用 143 | @Override 144 | public void surfaceChanged( SurfaceHolder holder, int format, int width, int height ) 145 | { 146 | } 147 | 148 | // Surface创建时激发,一般在这里调用画面的线程 149 | @Override 150 | public void surfaceCreated( SurfaceHolder holder ) 151 | { 152 | isRun = true; 153 | new Thread(this).start(); 154 | } 155 | 156 | // 销毁时激发,一般在这里将画面的线程停止、释放。 157 | @Override 158 | public void surfaceDestroyed( SurfaceHolder argholder0 ) 159 | { 160 | isRun = false; 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PathFind 2 | 详细的介绍可以参考我的blog: 3 | [http://blog.csdn.net/a396901990/article/details/45028741] 4 | 5 | 效果图: 6 | ![alt pic](http://img.my.csdn.net/uploads/201503/12/1426092118_7791.gif "效果1") 7 | 8 | ![alt pic](http://img.my.csdn.net/uploads/201503/12/1426092118_4759.gif "效果2") 9 | --------------------------------------------------------------------------------