├── .gitignore ├── app ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── mycardboarddreams │ │ └── jacobsladder │ │ └── deluxe │ │ └── drivers │ │ └── CubeDriverTest.java │ ├── debug │ └── AndroidManifest.xml │ ├── free │ ├── AndroidManifest.xml │ └── res │ │ ├── drawable-xxhdpi │ │ └── iconhq.png │ │ ├── layout │ │ └── preference_group_custom_panel.xml │ │ ├── mipmap-hdpi │ │ └── logo.png │ │ ├── mipmap-mdpi │ │ └── logo.png │ │ ├── mipmap-xhdpi │ │ └── logo.png │ │ ├── mipmap-xxhdpi │ │ └── logo.png │ │ ├── mipmap-xxxhdpi │ │ └── logo.png │ │ ├── values-de │ │ └── strings.xml │ │ ├── values-es │ │ └── strings.xml │ │ ├── values-fr │ │ └── strings.xml │ │ ├── values-ja │ │ └── strings.xml │ │ ├── values-pt │ │ └── strings.xml │ │ ├── values-zh │ │ └── strings.xml │ │ └── values │ │ └── strings.xml │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── Drawing │ │ ├── ColorSets │ │ │ ├── colorset.cpp │ │ │ ├── colorset.h │ │ │ ├── facecolor.cpp │ │ │ ├── jacobsladder.cpp │ │ │ ├── light.h │ │ │ └── utils.h │ │ ├── bufferbindings.cpp │ │ ├── drawing.cpp │ │ ├── drawing.h │ │ ├── objectbuffers.cpp │ │ ├── objectbuffers.h │ │ ├── textures.cpp │ │ └── textures.h │ ├── Drivers │ │ ├── Goals │ │ │ ├── goalcuboid.h │ │ │ ├── goalline.h │ │ │ ├── goalobject.cpp │ │ │ ├── goalobject.h │ │ │ ├── goalplane.h │ │ │ ├── goalpointtype.h │ │ │ ├── goals.cpp │ │ │ └── goals.h │ │ ├── Grid │ │ │ ├── grid.h │ │ │ ├── gridalgorithm.cpp │ │ │ ├── gridcreate.cpp │ │ │ ├── gridcubes.cpp │ │ │ ├── gridposition.cpp │ │ │ ├── gridposition.h │ │ │ ├── gridpositionstate.h │ │ │ └── gridutilities.cpp │ │ ├── cubedriver.cpp │ │ ├── cubedriver.h │ │ ├── cubedrivercreate.cpp │ │ └── cubedrivertouch.cpp │ ├── Geometry │ │ ├── corner.h │ │ ├── cube.cpp │ │ ├── cube.h │ │ ├── dimension.h │ │ └── position.h │ ├── Stats │ │ ├── aggregatestats.h │ │ ├── driverstats.h │ │ ├── goalstats.h │ │ ├── gridstats.h │ │ ├── iterativecollectionsstats.h │ │ ├── statssnapshot.cpp │ │ └── statssnapshot.h │ ├── SurfaceRenderer │ │ ├── jniapi.cpp │ │ ├── jniapi.h │ │ ├── logger.h │ │ ├── native_handle.h │ │ ├── surfacehandler.cpp │ │ ├── surfacehandler.h │ │ ├── surfacerenderer.cpp │ │ ├── surfacerenderer.h │ │ ├── surfacerenderer_render.cpp │ │ ├── surfaceutils.cpp │ │ └── surfaceutils.h │ ├── Template │ │ ├── templatecreator.cpp │ │ ├── templatewallpaper.cpp │ │ └── templatewallpaper.h │ ├── TestSuite │ │ ├── cubedrivertest.cpp │ │ └── cubedrivertest.h │ ├── Utils │ │ ├── alliterativecollections.cpp │ │ ├── alliterativecollections.h │ │ ├── iterativecollection.cpp │ │ ├── iterativecollection.h │ │ ├── iterativecollectionmember.h │ │ ├── iterativelisttypes.h │ │ ├── linkedlistitem.h │ │ ├── timer.cpp │ │ ├── timer.h │ │ ├── utils.cpp │ │ └── utils.h │ ├── jniapi.cpp │ ├── jniapi.h │ ├── wallpaper.cpp │ ├── wallpaper.h │ ├── wallpapercreator.cpp │ └── wallpaperhandler.cpp │ ├── java │ ├── com │ │ └── mycardboarddreams │ │ │ └── jacobsladder │ │ │ ├── AnalyticsHelper.java │ │ │ ├── Dimensions.java │ │ │ ├── JacobsLadderService.java │ │ │ ├── SettingsActivity.java │ │ │ ├── ThemeManager.java │ │ │ ├── ThemesHelper.java │ │ │ ├── baselib │ │ │ └── NativeGLWallpaperService.java │ │ │ ├── preferences │ │ │ ├── CheckBoxVerticalPreference.java │ │ │ ├── DropDownHeaderPreference.java │ │ │ ├── SaveCustomThemePreference.java │ │ │ ├── SeekBarPreference.java │ │ │ ├── SeekBarSummaryPreference.java │ │ │ ├── TextListPopupPreference.java │ │ │ ├── ThemeSelectAdapter.java │ │ │ ├── ThemeSelectPreference.java │ │ │ └── custom │ │ │ │ └── CustomColorsCategoryPreference.java │ │ │ ├── template │ │ │ ├── TemplateSettings.java │ │ │ ├── TemplateSettingsActivity.java │ │ │ └── TemplateWallpaperService.java │ │ │ └── view │ │ │ ├── RolloutView.java │ │ │ └── WallpaperSurface.java │ └── net │ │ └── margaritov │ │ └── preference │ │ └── colorpicker │ │ ├── ColorPickerDialog.java │ │ ├── ColorPickerGradientView.java │ │ ├── ColorPickerPanelView.java │ │ └── ColorPickerPreference.java │ └── res │ ├── drawable-hdpi │ ├── custom_theme_icon.png │ ├── ic_cancel_white_24dp.png │ ├── ic_done_white_24dp.png │ ├── ic_save_white_36dp.png │ ├── icon_help.png │ ├── logo_small.png │ ├── save_icon.png │ ├── settings_brightness.png │ ├── settings_speed.png │ ├── settings_theme.png │ └── settings_total_icon.png │ ├── drawable-ldpi │ ├── custom_theme_icon.png │ ├── icon_help.png │ ├── logo_small.png │ ├── save_icon.png │ ├── settings_brightness.png │ ├── settings_speed.png │ ├── settings_theme.png │ └── settings_total_icon.png │ ├── drawable-mdpi │ ├── custom_theme_icon.png │ ├── ic_ab_back_holo_dark.png │ ├── ic_cancel_white_24dp.png │ ├── ic_done_white_24dp.png │ ├── ic_save_white_36dp.png │ ├── icon_help.png │ ├── logo_small.png │ ├── save_icon.png │ ├── settings_brightness.png │ ├── settings_speed.png │ ├── settings_theme.png │ └── settings_total_icon.png │ ├── drawable-nodpi │ ├── airplanewindow.png │ ├── aquarium.png │ ├── arctic.png │ ├── backstage.png │ ├── bacterium.png │ ├── bananas.png │ ├── blueultrasonic.png │ ├── calypso.png │ ├── cube_custom_bottom_left_shade.png │ ├── cube_custom_bottom_right_shade.png │ ├── cube_custom_top_left_shade.png │ ├── cube_custom_top_right_shade.png │ ├── custom_theme.png │ ├── custom_theme_icon_dark.png │ ├── customcolorbackdrop.png │ ├── disco.png │ ├── ember.png │ ├── emeraldforest.png │ ├── fernlight.png │ ├── geode.png │ ├── gold.png │ ├── gotham.png │ ├── icon_small.png │ ├── jacobsladder.png │ ├── limecream.png │ ├── limejello.png │ ├── marshmallow.png │ ├── orpheus.png │ ├── paleblue.png │ ├── selector_theme_enabled_color.xml │ ├── sepia.png │ ├── shadowcliffs.png │ ├── storm.png │ ├── sunflower.png │ ├── swimmingpool.png │ ├── tangerine.png │ ├── toast_backing.xml │ ├── tokyo.png │ └── underworld.png │ ├── drawable-xhdpi │ ├── custom_theme_icon.png │ ├── ic_ab_back_holo_dark.png │ ├── ic_cancel_white_24dp.png │ ├── ic_done_white_24dp.png │ ├── ic_save_white_36dp.png │ ├── icon_help.png │ ├── logo_small.png │ ├── save_icon.png │ ├── settings_brightness.png │ ├── settings_speed.png │ ├── settings_theme.png │ └── settings_total_icon.png │ ├── drawable-xxhdpi │ ├── custom_theme_icon.png │ ├── ic_cancel_white_24dp.png │ ├── ic_done_white_24dp.png │ ├── ic_save_white_36dp.png │ ├── icon_help.png │ ├── iconhq.png │ ├── lightbulb_light.png │ ├── logo_small.png │ ├── save_icon.png │ ├── settings_brightness.png │ ├── settings_speed.png │ ├── settings_theme.png │ └── settings_total_icon.png │ ├── drawable-xxxhdpi │ ├── ic_cancel_white_24dp.png │ ├── ic_done_white_24dp.png │ └── ic_save_white_36dp.png │ ├── drawable │ ├── alpha_background_tile.png │ ├── alpha_tiled_background.xml │ ├── preference_list_divider.xml │ └── shape_face_square.xml │ ├── layout-land │ └── dialog_color_picker.xml │ ├── layout │ ├── custom_toast.xml │ ├── dialog_color_picker.xml │ ├── font_size_widget.xml │ ├── help_dialog.xml │ ├── help_dialog_item.xml │ ├── preference_background_checkbox.xml │ ├── preference_create_custom_theme.xml │ ├── preference_group_custom_colors.xml │ ├── preference_group_custom_panel.xml │ ├── preference_save_custom_theme.xml │ ├── preference_save_custom_theme_view.xml │ ├── preference_select_theme_view.xml │ ├── preference_theme_list_item.xml │ ├── preference_widget_seekbar.xml │ └── settings_loading.xml │ ├── mipmap-hdpi │ └── logo.png │ ├── mipmap-ldpi │ └── logo.png │ ├── mipmap-mdpi │ └── logo.png │ ├── mipmap-xhdpi │ └── logo.png │ ├── mipmap-xxhdpi │ └── logo.png │ ├── mipmap-xxxhdpi │ └── logo.png │ ├── values-de │ └── strings.xml │ ├── values-es │ └── strings.xml │ ├── values-fr │ └── strings.xml │ ├── values-ja │ └── strings.xml │ ├── values-pt │ └── strings.xml │ ├── values-zh │ └── strings.xml │ ├── values │ ├── arrays.xml │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ ├── whitewallpaper.xml │ └── whitewallpaper_settings.xml ├── build.gradle ├── common ├── .gitignore ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── mycardboarddreams │ └── jacobsladder │ └── TestProperties.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── testdisplay ├── .gitignore ├── build.gradle └── src └── main └── java └── com └── mycardboarddreams └── jacobsladder ├── AggregateStats.java └── display ├── DisplayResults.java ├── DrawableMapping.java ├── GraphDrawPanel.java ├── GraphFrame.java ├── GraphStrategy.java └── StrategiesImpl.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/ 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | /stats.txt 11 | /fastlane/ 12 | /Google Play Android Developer* 13 | **/google-services.json 14 | **/fabric.properties -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { url 'https://maven.fabric.io/public' } 4 | } 5 | 6 | dependencies { 7 | classpath 'io.fabric.tools:gradle:1.+' 8 | } 9 | } 10 | 11 | apply plugin: 'com.android.application' 12 | apply plugin: 'com.google.firebase.firebase-crash' 13 | 14 | /* 15 | 16 | If you add your API Key to the manifest, uncomment the line below 17 | 18 | */ 19 | 20 | // apply plugin: 'io.fabric' 21 | 22 | repositories { 23 | maven { url 'https://maven.fabric.io/public' } 24 | } 25 | 26 | 27 | 28 | android { 29 | compileSdkVersion 24 30 | buildToolsVersion "24.0.3" 31 | defaultConfig { 32 | applicationId "com.mycardboarddreams.jacobsladder" 33 | minSdkVersion 17 34 | targetSdkVersion 24 35 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 36 | externalNativeBuild { 37 | cmake { 38 | cppFlags "-frtti -fexceptions -llog -landroid -lEGL -lGLESv1_CM" 39 | } 40 | } 41 | } 42 | buildTypes { 43 | release { 44 | minifyEnabled false 45 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 46 | } 47 | } 48 | 49 | productFlavors { 50 | free { 51 | versionCode 41 52 | versionName "4.0.4" 53 | versionNameSuffix "-free" 54 | } 55 | deluxe { 56 | versionCode 16 57 | versionName "2.6" 58 | applicationIdSuffix ".deluxe" 59 | versionNameSuffix "-deluxe" 60 | } 61 | } 62 | 63 | externalNativeBuild { 64 | cmake { 65 | path "CMakeLists.txt" 66 | } 67 | } 68 | } 69 | 70 | dependencies { 71 | compile 'com.google.android.gms:play-services-analytics:10.0.1' 72 | compile 'com.google.firebase:firebase-crash:10.0.1' 73 | 74 | androidTestCompile 'org.assertj:assertj-core:2.5.0' 75 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 76 | exclude group: 'com.android.support', module: 'support-annotations' 77 | }) 78 | androidTestCompile project(':common') 79 | 80 | compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') { 81 | transitive = true 82 | } 83 | compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') { 84 | transitive = true; 85 | } 86 | 87 | } 88 | 89 | 90 | apply plugin: 'com.google.gms.google-services' 91 | 92 | /* 93 | If you add your Fabric/Crashlytics API Key to the manifest, uncomment the lines below 94 | */ 95 | 96 | //crashlytics { 97 | // enableNdk true 98 | // androidNdkOut 'build/intermediates/cmake/debug/obj' 99 | // androidNdkLibsOut 'build/intermediates/cmake/release/obj' 100 | //} 101 | 102 | /* 103 | 104 | Then run this >> ./gradlew crashlyticsUploadSymbolsRelease to upload 105 | 106 | If you add flavors to your project, you need to run this instead: 107 | 108 | ./gradlew crashlyticsUploadSymbolsRelease 109 | 110 | Replace with your capitalized flavor name 111 | 112 | */ 113 | 114 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/abc/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/mycardboarddreams/jacobsladder/deluxe/drivers/CubeDriverTest.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.deluxe.drivers; 2 | 3 | import com.mycardboarddreams.jacobsladder.TestProperties; 4 | import com.mycardboarddreams.jacobsladder.deluxe.R; 5 | 6 | import android.content.res.Resources; 7 | import android.os.Environment; 8 | import android.test.AndroidTestCase; 9 | import android.util.Log; 10 | 11 | import org.junit.Test; 12 | 13 | import java.io.File; 14 | import java.io.FileOutputStream; 15 | 16 | import static org.assertj.core.api.Java6Assertions.assertThat; 17 | 18 | public class CubeDriverTest extends AndroidTestCase{ 19 | 20 | private static final String LOG_TAG = CubeDriverTest.class.getSimpleName(); 21 | 22 | private static final float SPEED = 1.0f; 23 | 24 | static { 25 | Log.d(LOG_TAG, "Loading native library"); 26 | System.loadLibrary("native-lib"); 27 | Log.d(LOG_TAG, "Done loading native library"); 28 | } 29 | 30 | @Test 31 | public void testRunDriverIterations(){ 32 | Resources resources = getContext().getResources(); 33 | long startTime = System.currentTimeMillis(); 34 | 35 | File f = new File(Environment.getExternalStorageDirectory().getPath(), TestProperties.STATS_FILE_NAME); 36 | 37 | String driverInstance = createDriverInstance( 38 | resources.getInteger(R.integer.default_x_blocks), 39 | resources.getInteger(R.integer.default_y_blocks), 40 | resources.getInteger(R.integer.default_z_blocks), 41 | TestProperties.TOTAL_NUMBER_OF_SAMPLES, 10, SPEED); 42 | 43 | assertThat(driverInstance).isNotEmpty(); 44 | 45 | FileOutputStream outputStream; 46 | 47 | try { 48 | outputStream = new FileOutputStream(f, false); 49 | outputStream.write(driverInstance.getBytes()); 50 | outputStream.close(); 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | } 54 | 55 | 56 | Log.d("TAG", driverInstance); 57 | 58 | long endTime = System.currentTimeMillis(); 59 | 60 | Log.d(LOG_TAG, "Total time taken to run " + TestProperties.TOTAL_NUMBER_OF_SAMPLES + 61 | " samples was " + ((float)(endTime - startTime))/1000f + " seconds."); 62 | } 63 | 64 | //---------------------------- 65 | public static native String createDriverInstance(int xBlocks, int yBlocks, int zBlocks, int iterations, int iterationSpan, float speed); 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/free/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /app/src/free/res/drawable-xxhdpi/iconhq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/free/res/drawable-xxhdpi/iconhq.png -------------------------------------------------------------------------------- /app/src/free/res/mipmap-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/free/res/mipmap-hdpi/logo.png -------------------------------------------------------------------------------- /app/src/free/res/mipmap-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/free/res/mipmap-mdpi/logo.png -------------------------------------------------------------------------------- /app/src/free/res/mipmap-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/free/res/mipmap-xhdpi/logo.png -------------------------------------------------------------------------------- /app/src/free/res/mipmap-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/free/res/mipmap-xxhdpi/logo.png -------------------------------------------------------------------------------- /app/src/free/res/mipmap-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/free/res/mipmap-xxxhdpi/logo.png -------------------------------------------------------------------------------- /app/src/free/res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @string/jacobs_ladder_free 5 | 6 | -------------------------------------------------------------------------------- /app/src/free/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @string/jacobs_ladder_free 5 | 6 | -------------------------------------------------------------------------------- /app/src/free/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @string/jacobs_ladder_free 5 | 6 | -------------------------------------------------------------------------------- /app/src/free/res/values-ja/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @string/jacobs_ladder_free 5 | 6 | -------------------------------------------------------------------------------- /app/src/free/res/values-pt/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @string/jacobs_ladder_free 5 | 6 | -------------------------------------------------------------------------------- /app/src/free/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @string/jacobs_ladder_free 5 | 6 | -------------------------------------------------------------------------------- /app/src/free/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @string/jacobs_ladder_free 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 40 | 41 | 42 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drawing/ColorSets/colorset.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef COLORSET_H_ 3 | #define COLORSET_H_ 4 | 5 | #include "light.h" 6 | #include "Utils/utils.h" 7 | 8 | #define TOP_LEFT 0 9 | #define TOP_RIGHT 1 10 | #define BOTTOM_LEFT 2 11 | #define BOTTOM_RIGHT 3 12 | 13 | #define NUM_CORNERS 4 14 | 15 | #define LEFT_FACE 0 16 | #define RIGHT_FACE 1 17 | #define TOP_FACE 2 18 | #define BOTTOM_FACE 3 19 | #define NEAR_FACE 4 20 | 21 | #define NUM_FACES 5 22 | 23 | #define BRIGHTNESS_CAP 0.7f 24 | 25 | #define OPTIMAL_DISTANCE 8.0f 26 | 27 | #define STANDARD_WIDTH 22 28 | #define STANDARD_DEPTH 48 29 | 30 | #define NUM_LIGHTS 7 31 | 32 | enum ColorSetPositions 33 | { 34 | CP_BACKGROUND = 0, 35 | 36 | CP_LEFT_FACE_BL, 37 | CP_RIGHT_FACE_BL, 38 | CP_TOP_FACE_BL, 39 | CP_BOTTOM_FACE_BL, 40 | CP_NEAR_FACE_BL, 41 | 42 | CP_LEFT_FACE_TL, 43 | CP_RIGHT_FACE_TL, 44 | CP_TOP_FACE_TL, 45 | CP_BOTTOM_FACE_TL, 46 | CP_NEAR_FACE_TL, 47 | 48 | CP_LEFT_FACE_TR, 49 | CP_RIGHT_FACE_TR, 50 | CP_TOP_FACE_TR, 51 | CP_BOTTOM_FACE_TR, 52 | CP_NEAR_FACE_TR, 53 | 54 | CP_LEFT_FACE_BR, 55 | CP_RIGHT_FACE_BR, 56 | CP_TOP_FACE_BR, 57 | CP_BOTTOM_FACE_BR, 58 | CP_NEAR_FACE_BR, 59 | 60 | CP_BOTTOM_LEFT, 61 | CP_TOP_RIGHT, 62 | CP_TOP_LEFT, 63 | CP_BOTTOM_RIGHT, 64 | 65 | CP_PRIMARY_LIGHT, 66 | CP_DISTANT_LIGHT, 67 | CP_MID_LIGHT, 68 | 69 | CP_HAS_BACKGROUND, 70 | 71 | }; 72 | 73 | #define LENGTH_OF_CUSTOM_ARRAY 29 74 | 75 | struct ColorSetStruct 76 | { 77 | color_array backgroundColor; 78 | color_array cornerColors[NUM_CORNERS][NUM_FACES]; 79 | Light lights[7]; 80 | bool hasBackground; 81 | 82 | }; 83 | 84 | class ColorSet 85 | { 86 | public: 87 | 88 | static ColorSet *getCurrentColorSet(); 89 | 90 | color_array **** coloredVertices; 91 | 92 | bool colorHasRecentlyChanged; 93 | 94 | void buildFaceColors(GLuint xBlocks, GLuint yBlocks, GLuint zBlocks); 95 | 96 | void deleteAllArrays(); 97 | 98 | void setBackgroundColorInThread(); 99 | 100 | GLuint* updateCurrentColorSet(const GLint *customColors = 0); 101 | 102 | ColorSet(); 103 | ~ColorSet(); 104 | 105 | GLuint* setColorArrays(const GLuint newColors[LENGTH_OF_CUSTOM_ARRAY]); 106 | 107 | bool currentSetHasBackground(); 108 | 109 | void clearUpdateFlag(); 110 | 111 | 112 | GLuint *getApparentColors(); 113 | 114 | private: 115 | static ColorSet currentColorSet; 116 | static ColorSetStruct colorSetStruct; 117 | GLuint apparentColors[LENGTH_OF_CUSTOM_ARRAY]; 118 | 119 | GLuint X_BLOCKS_PLUS_1, Y_BLOCKS_PLUS_1, Z_BLOCKS_PLUS_1; 120 | 121 | GLuint priorColors[LENGTH_OF_CUSTOM_ARRAY]; 122 | 123 | void mergeColors(GLubyte in[4], color_array (&color1), color_array (&color2), GLfloat fraction1); 124 | 125 | void createDistancePaintsArray(); 126 | 127 | void setCustomLightList(const GLuint newColors[LENGTH_OF_CUSTOM_ARRAY]); 128 | GLuint* setCustomCornerList(const GLuint newColors[LENGTH_OF_CUSTOM_ARRAY]); 129 | 130 | void updateBackground(const GLuint newColors[LENGTH_OF_CUSTOM_ARRAY]); 131 | 132 | bool checkRecentChanges(const GLuint *newColors); 133 | 134 | GLubyte* applyLightsToFace(GLfloat x_block_fraction, 135 | GLfloat y_block_fraction, 136 | GLfloat z_block_fraction, 137 | color_array baseFaceColor, GLubyte face); 138 | 139 | GLuint applyLightsToFace(GLfloat x_block_fraction, 140 | GLfloat y_block_fraction, 141 | GLfloat z_block_fraction, 142 | GLuint baseFaceColor, GLubyte face); 143 | 144 | GLuint* applyLightsToFaces(const GLuint newColors[LENGTH_OF_CUSTOM_ARRAY]); 145 | }; 146 | 147 | 148 | #endif /* COLORSET_H_ */ 149 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drawing/ColorSets/jacobsladder.cpp: -------------------------------------------------------------------------------- 1 | #include "colorset.h" 2 | 3 | ColorSetStruct ColorSet::colorSetStruct = 4 | { 5 | 6 | { 3, 15, 33, 255 }, 7 | 8 | { 9 | { // TOP LEFT 10 | { 93, 172, 239, 255 }, // LEFT 11 | { 127, 222, 255, 255 }, // RIGHT 12 | { 88, 180, 244, 255 }, // TOP 13 | { 94, 205, 244, 255 }, // BOTTOM 14 | { 90, 223, 244, 255 }, // BACK 15 | },{ // TOP RIGHT 16 | { 93, 172, 239, 255 }, // LEFT 17 | { 127, 222, 255, 255 }, // RIGHT 18 | { 88, 180, 244, 255 }, // TOP 19 | { 94, 205, 244, 255 }, // BOTTOM 20 | { 90, 223, 244, 255 }, // BACK 21 | },{ // BOTTOM LEFT 22 | { 93, 172, 239, 255 }, // LEFT 23 | { 127, 222, 255, 255 }, // RIGHT 24 | { 88, 180, 244, 255 }, // TOP 25 | { 94, 205, 244, 255 }, // BOTTOM 26 | { 90, 223, 244, 255 }, // BACK 27 | },{ // BOTTOM RIGHT 28 | { 93, 172, 239, 255 }, // LEFT 29 | { 127, 222, 255, 255 }, // RIGHT 30 | { 88, 180, 244, 255 }, // TOP 31 | { 94, 205, 244, 255 }, // BOTTOM 32 | { 90, 223, 244, 255 }, // BACK 33 | } 34 | }, 35 | 36 | { 37 | (Light){ // bottom left 38 | "Bottom left", 39 | 0.2f, 0.2f, -0.2f, 40 | 6, 172, 245, 709 41 | }, 42 | (Light){ //top right 43 | "Top Right", 44 | 0.8f, 0.8f, -0.2f, 45 | 17, 120, 181, 690 46 | }, 47 | (Light){ //top left 48 | "Top left", 49 | 0.2f, 0.8f, -0.2f, 50 | 24, 122, 198, 721 51 | }, 52 | (Light){ // bottom right 53 | "Bottom right", 54 | 0.8f, 0.2f, -0.2f, 55 | 22, 145, 244, 803 56 | }, 57 | 58 | (Light){ // primary 59 | "Primary", 60 | 0.5f, 0.5f, 0.1f, 61 | 7, 107, 153, 1066 62 | }, 63 | (Light){ // Distant bright 64 | "Distant", 65 | 0.5f, 0.5f, 0.8f, 66 | 0, 255, 202, 1349 67 | }, 68 | (Light){ // Mid-distance 69 | "Mid", 70 | 0.5f, 0.5f, 0.5f, 71 | 51, 171, 210, 1342 72 | }, 73 | 74 | }, 75 | //has background 76 | true, 77 | 78 | }; 79 | 80 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drawing/ColorSets/light.h: -------------------------------------------------------------------------------- 1 | #ifndef LIGHT_H_ 2 | #define LIGHT_H_ 3 | 4 | #include // requires ndk r5 or newer 5 | #include 6 | #include 7 | #include "SurfaceRenderer/logger.h" 8 | #include "Drawing/ColorSets/colorset.h" 9 | #include "Drawing/ColorSets/utils.h" 10 | #include "SurfaceRenderer/surfaceutils.h" 11 | 12 | 13 | 14 | #define MAX_LIGHT_STRENGTH 1600.0f 15 | 16 | struct Light 17 | { 18 | const char* lightName; 19 | GLfloat x_pos_fraction, y_pos_fraction, z_pos_fraction; 20 | GLubyte colors[3]; 21 | GLfloat maxReach; 22 | 23 | void assignFromColor(GLuint color){ 24 | 25 | color_array cols = {0, 0, 0, 0}; 26 | 27 | getColorByteArrayFromInt(color, false, cols); 28 | assignFromColorArray(cols); 29 | } 30 | 31 | void assignFromColorArray(GLubyte *cols){ 32 | 33 | colors[0] = cols[0]; 34 | colors[1] = cols[1]; 35 | colors[2] = cols[2]; 36 | 37 | maxReach = MAX_LIGHT_STRENGTH*cols[3]/255.0f; 38 | } 39 | }; 40 | 41 | 42 | #endif /* LIGHT_H_ */ 43 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drawing/ColorSets/utils.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef COLORSETS_UTILS_H 3 | #define COLORSETS_UTILS_H 4 | 5 | typedef GLubyte color_array[4]; 6 | 7 | static void getColorBytesFromInt(GLuint color, color_array (&outColor)) 8 | { 9 | outColor[0] = (GLubyte)((color >> 16) & 0xFF); 10 | outColor[1] = (GLubyte)((color >> 8) & 0xFF); 11 | outColor[2] = (GLubyte)(color & 0xFF); 12 | outColor[3] = 255; 13 | } 14 | 15 | static void getColorByteArrayFromInt(GLuint color, bool opaque, color_array (&outColor)) 16 | { 17 | outColor[0] = (GLubyte)((color >> 16) & 0xFF); 18 | outColor[1] = (GLubyte)((color >> 8) & 0xFF); 19 | outColor[2] = (GLubyte)(color & 0xFF); 20 | outColor[3] = (GLubyte)(opaque ? 255 : ((color >> 24) & 0xFF)); 21 | 22 | } 23 | 24 | static GLuint getColorIntFromByteArray(color_array outColor) 25 | { 26 | return (outColor[3] << 24) | (outColor[0] << 16) | (outColor[1] << 8) | (outColor[2]); 27 | } 28 | 29 | #endif //COLORSETS_UTILS_H 30 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drawing/bufferbindings.cpp: -------------------------------------------------------------------------------- 1 | #include "objectbuffers.h" 2 | 3 | #define LOG_TAG "Buffer Binding" 4 | 5 | void ObjectBuffers::unbindVertexBuffers() 6 | { 7 | pthread_mutex_lock(&_mutex_buffer); 8 | 9 | if(!Constants::RENDER_OPENGL && !DRAW_CUBES && !DRAW_BACKGROUND) { 10 | pthread_mutex_unlock(&_mutex_buffer); 11 | return; 12 | } 13 | 14 | START_TIMER 15 | 16 | 17 | if(!cubeVBO_Pointers && !backgroundVBO_Pointers) 18 | LOG_INFO_DEBUG(" No vertex buffers to unbind."); 19 | else 20 | LOG_INFO_DEBUG(" Unbinding vertex buffers..."); 21 | 22 | if(cubeVBO_Pointers && glIsBuffer(cubeVBO_Pointers[0])) 23 | { 24 | LOG_INFO_DEBUG(" Deleting Cube Vertex Buffer Objects..."); 25 | glBindBuffer(GL_ARRAY_BUFFER, 0); 26 | glDeleteBuffers(Z_BLOCKS, cubeVBO_Pointers); 27 | 28 | } 29 | 30 | if(backgroundVBO_Pointers && glIsBuffer(backgroundVBO_Pointers[0])) 31 | { 32 | LOG_INFO_DEBUG(" Deleting Background Vertex Buffer Objects..."); 33 | glBindBuffer(GL_ARRAY_BUFFER, 0); 34 | glDeleteBuffers(Z_BLOCKS, backgroundVBO_Pointers); 35 | } 36 | 37 | END_TIMER(SurfaceTimer::UNSET_VERTICES) 38 | 39 | pthread_mutex_unlock(&_mutex_buffer); 40 | } 41 | 42 | 43 | void ObjectBuffers::bindVerticesToBuffersInThread() 44 | { 45 | pthread_mutex_lock(&_mutex_buffer); 46 | 47 | textures->loadTextureRAW(); 48 | 49 | if(!Constants::RENDER_OPENGL && !DRAW_CUBES && !DRAW_BACKGROUND) { 50 | pthread_mutex_unlock(&_mutex_buffer); 51 | return; 52 | } 53 | 54 | START_TIMER 55 | 56 | unbindVertexBuffers(); 57 | 58 | ColorSet::getCurrentColorSet()->setBackgroundColorInThread(); 59 | 60 | LOG_INFO_DEBUG(" Generating background VBOs %p", BackgroundColoredVertices); 61 | 62 | glGenBuffers(Z_BLOCKS, backgroundVBO_Pointers); 63 | 64 | for(GLuint i = 0; i < Z_BLOCKS; i++) 65 | { 66 | glBindBuffer(GL_ARRAY_BUFFER, backgroundVBO_Pointers[i]); 67 | glBufferData(GL_ARRAY_BUFFER, sizeof(corner)*BACKGROUND_VERTEX_SIZE, BackgroundColoredVertices[i], GL_STATIC_DRAW); 68 | glBindBuffer(GL_ARRAY_BUFFER, 0); 69 | } 70 | 71 | LOG_INFO_DEBUG(" Generating cube VBOs %p", AllColoredVertexCorners); 72 | 73 | glGenBuffers(Z_BLOCKS, cubeVBO_Pointers); 74 | 75 | GLsizeiptr bufferSize = sizeof(corner)*FULL_VERTEX_BUFFER_PER_SLICE; 76 | 77 | LOG_INFO_DEBUG(" Generated/bound background buffers. (%d depth).", Z_BLOCKS); 78 | 79 | for(GLuint z = 0; z < Z_BLOCKS; z++) 80 | { 81 | glBindBuffer(GL_ARRAY_BUFFER, cubeVBO_Pointers[z]); 82 | glBufferData(GL_ARRAY_BUFFER, bufferSize, AllColoredVertexCorners[z], GL_STATIC_DRAW); 83 | glBindBuffer(GL_ARRAY_BUFFER, 0); 84 | } 85 | 86 | //set up rendering----------------------------- 87 | if(Z_BLOCKS > 0) { 88 | glBindBuffer(GL_ARRAY_BUFFER, cubeVBO_Pointers[0]); 89 | } 90 | 91 | LOG_INFO_DEBUG(" Generated/bound cube buffers"); 92 | 93 | glVertexPointer(3, GL_FLOAT, sizeof(corner), (void*)0); 94 | glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(corner), COLOR_OFFSET); 95 | glTexCoordPointer(2, GL_FLOAT, sizeof(corner), TEXTURE_OFFSET); 96 | 97 | LOG_INFO_DEBUG(" Finished setting vertices/color grid buffers." 98 | "\n Vertex buffer has %d corner points" 99 | "\n Each print array has %d spots" 100 | "\n VBO buffer size %5.0f Kb, corner size %ld (Offsets %ld %ld)", 101 | FULL_VERTEX_BUFFER_PER_SLICE, 102 | FULL_VERTEX_BUFFER_PER_SLICE, 103 | bufferSize/1000.0f, 104 | sizeof(corner), 105 | (intptr_t)COLOR_OFFSET, 106 | (intptr_t)TEXTURE_OFFSET); 107 | 108 | END_TIMER(SurfaceTimer::SET_VERTICES) 109 | 110 | pthread_mutex_unlock(&_mutex_buffer); 111 | } 112 | 113 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drawing/drawing.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ENGINE_H_ 3 | #define ENGINE_H_ 4 | 5 | #include // requires ndk r5 or newer 6 | #include 7 | #include "Geometry/cube.h" 8 | #include "Geometry/dimension.h" 9 | #include "Geometry/corner.h" 10 | #include "Drivers/Grid/grid.h" 11 | #include "Utils/iterativecollection.h" 12 | #include "objectbuffers.h" 13 | 14 | #define CAMERA_ITERATION 0.1f 15 | #define CAMERA_BACK_OFFSET 0.0f 16 | 17 | #define CUBE_SIDE 1.0f 18 | 19 | #define ZOOM_FACTOR 1.1f 20 | 21 | #define NEAR_FIELD 1.0f 22 | 23 | class Drawing { 24 | 25 | public: 26 | Drawing(); 27 | ~Drawing(); 28 | 29 | //Animation=============================================== 30 | void drawCubes(GLfloat fractionOfPreferredFrame, 31 | GLfloat angleOfRotation, 32 | Grid *grid, 33 | IterativeCollection *movingElements, 34 | Goals* goalSet); 35 | 36 | GLuint cameraMovementShift; 37 | 38 | private: 39 | 40 | void drawBackgroundSegment(GLfloat angleOfRotation, GLuint slice); 41 | void drawMovingCube(GLfloat angleOfRotation,Cube* c); 42 | GLuint printStaticCube(GLubyte faces, GLushort currentIndexPos, GLuint pointStart); 43 | 44 | GLfloat cameraMovement; 45 | 46 | static GLushort backgroundIdsLeft[]; 47 | static GLushort backgroundIdsBottom[]; 48 | static GLushort backgroundIdsRight[]; 49 | static GLushort backgroundIdsTop[]; 50 | 51 | 52 | void drawSingleCube(GLfloat angleOfRotation, GLfloat xPos, GLfloat yPos, GLfloat zPos, GLuint x, GLuint y, GLuint z); 53 | 54 | ObjectBuffers *getBuffer(); 55 | 56 | 57 | void drawGoalSets(GLfloat angleOfRotation, GoalObject* goal); 58 | 59 | void renderGoalBoxes(GLfloat angleOfRotation, Goals *goalSet); 60 | }; 61 | 62 | #endif /* ENGINE_H_ */ 63 | 64 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drawing/objectbuffers.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef OBJECTBUFFERS_H_ 3 | #define OBJECTBUFFERS_H_ 4 | 5 | #include // requires ndk r5 or newer 6 | #include 7 | #include 8 | #include "Geometry/corner.h" 9 | #include "Geometry/dimension.h" 10 | #include "SurfaceRenderer/surfaceutils.h" 11 | #include "Drawing/ColorSets/colorset.h" 12 | #include "textures.h" 13 | 14 | #define BACKGROUND_VERTEX_SIZE 24 15 | 16 | #define NUM_VERTICES_PER_CUBE 6 17 | 18 | #define MEMBER_OFFSET(s,m) ((void *)(offsetof(s,m))) 19 | 20 | class ObjectBuffers { 21 | 22 | public: 23 | 24 | static ObjectBuffers *getObjectBuffers(); 25 | 26 | static ObjectBuffers *objectBuffers; 27 | 28 | pthread_mutex_t _mutex_buffer; 29 | pthread_mutexattr_t Attr; 30 | 31 | corner **BackgroundColoredVertices; 32 | corner **AllColoredVertexCorners; 33 | 34 | bool DRAW_BACKGROUND; 35 | bool DRAW_CUBES; 36 | 37 | void* TEXTURE_OFFSET; 38 | void* COLOR_OFFSET; 39 | 40 | GLushort *fullIndexList; 41 | GLuint *fullIndexListCount; 42 | 43 | GLuint *cubeVBO_Pointers; 44 | GLuint *backgroundVBO_Pointers; 45 | 46 | GLint CUBES_PER_SLICE; 47 | GLshort VERTICES_PER_SLICE; 48 | GLint FULL_VERTEX_BUFFER_PER_SLICE; 49 | 50 | Dimension *currentSize; 51 | unsigned short X_BLOCKS, Y_BLOCKS, Z_BLOCKS; 52 | GLfloat X_BLOCKS_MID, Y_BLOCKS_MID; 53 | 54 | ObjectBuffers(); 55 | virtual ~ObjectBuffers(); 56 | 57 | void deriveVerticesFromDimensions(Dimension dimens); 58 | 59 | bool isSimilarDimensions(Dimension dimens); 60 | 61 | void bindVerticesToBuffersInThread(); 62 | void unbindVertexBuffers(); 63 | 64 | bool isBufferReady(); 65 | 66 | bool tryRederiveVertices(Dimension newDimens); 67 | 68 | int getObjectBufferVersion(); 69 | 70 | void lock(); 71 | void unlock(); 72 | 73 | bool colorSetHasBackground(); 74 | 75 | private: 76 | 77 | bool isReady; 78 | Textures *textures; 79 | 80 | int objectBufferVersion; 81 | 82 | void deriveIndexLists(); 83 | 84 | virtual void setDimension(Dimension dimens); 85 | 86 | void deleteAllArrays(); 87 | void createAllArrays(); 88 | 89 | void deleteIndexLists(); 90 | void deleteBackgroundArrays(); 91 | void deleteGridArrays(); 92 | void deleteBuffers(); 93 | 94 | void deriveBackground(); 95 | void deriveBackgroundSlice( GLuint z_near, GLuint z_far, corner *backgroundSegment); 96 | void deriveForegroundVertices(); 97 | void initializeVBOs(); 98 | 99 | }; 100 | 101 | 102 | #endif /* OBJECTBUFFERS_H_ */ 103 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drawing/textures.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TEXTURES_H_ 3 | #define TEXTURES_H_ 4 | 5 | 6 | #define TEXTURE_WIDTH 64 7 | #define TEXTURE_HALF_WIDTH 32 8 | 9 | #define COMPONENTS 3 10 | #define MIPMAP_LEVELS 1 11 | 12 | #include // requires ndk r5 or newer 13 | #include 14 | 15 | class Textures 16 | { 17 | private: 18 | static unsigned char **texturePixelData; 19 | static unsigned char const edgeColors[][4]; 20 | 21 | 22 | public: 23 | Textures(); 24 | ~Textures(); 25 | 26 | static void generateTexture(); 27 | unsigned char** getTextureData(); 28 | 29 | void unbindTexture(); 30 | 31 | void loadTextureRAW(); 32 | 33 | private: 34 | GLuint texture[2]; 35 | 36 | }; 37 | #endif /* TEXTURES_H_ */ 38 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Goals/goalcuboid.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef GOALPOINT_H_ 4 | #define GOALPOINT_H_ 5 | 6 | #include "Drivers/Goals/goalobject.h" 7 | 8 | class GoalCuboid : public GoalObject { 9 | 10 | public: 11 | 12 | GoalCuboid(unsigned short x_center, unsigned short y_center, unsigned short z_center, 13 | GLuint dist_x, GLuint dist_y, GLuint dist_z, 14 | GLuint max_x, GLuint max_y, GLuint max_z, 15 | GoalPointType type, GLubyte pullToWallsDir) : GoalObject(type, max_x, max_y, max_z) { 16 | 17 | groundDirection = pullToWallsDir; 18 | 19 | x = x_center; 20 | y = y_center; 21 | z = z_center; 22 | 23 | GLint st = (x - dist_x); 24 | x_start = GLuint(st < 0 ? 0 : st); 25 | st = (y - dist_y); 26 | y_start = GLuint(st < 0 ? 0 : st); 27 | st = (z - dist_z); 28 | z_start = GLuint(st < 0 ? 0 : st); 29 | 30 | x_end = x + dist_x; 31 | if(x_end > max_x) x_end = max_x; 32 | y_end = y + dist_y; 33 | if(y_end > max_y) y_end = max_y; 34 | z_end = z + dist_z; 35 | if(z_end > max_z) z_end = max_z; 36 | 37 | 38 | expectedTargetCountInCube = ((x_end - x_start)*(y_end - y_start)*2 + (z_end - z_start - 2)*(y_end - y_start)*2 + 20); 39 | 40 | availableTargets = new IterativeCollection(expectedTargetCountInCube, TARGET_LIST); 41 | filledTargets = new IterativeCollection(expectedTargetCountInCube, TARGET_LIST); 42 | 43 | } 44 | 45 | bool isUpForDestruction(){ 46 | return true; 47 | } 48 | 49 | }; 50 | 51 | 52 | #endif /* GOALPOINT_H_ */ 53 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Goals/goalline.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GOALLINE_H_ 3 | #define GOALLINE_H_ 4 | 5 | #include "Drivers/Goals/goalobject.h" 6 | #include 7 | 8 | class GoalLine : public GoalObject{ 9 | 10 | public: 11 | GLubyte _axis; 12 | 13 | GoalLine(GLuint u, GLuint v, 14 | GLuint dist_u, GLuint dist_v, 15 | GLuint max_x, GLuint max_y, GLuint max_z, 16 | GLubyte axis, GoalPointType type, GLubyte pullToWallsDir) : 17 | GoalObject(type, max_x, max_y, max_z) { 18 | 19 | groundDirection = pullToWallsDir; 20 | 21 | _axis = axis; 22 | GLint st = 0; 23 | GLuint axisLength = 0; 24 | 25 | switch(_axis){ 26 | case X_DIR: 27 | x_start = 0; 28 | x_end = max_x; 29 | x = max_x/2; 30 | axisLength = max_x; 31 | 32 | st = (v - dist_v); 33 | y_start = GLuint(st < 0 ? 0 : st); 34 | y_end = v + dist_v; 35 | if(y_end > max_y) y_end = max_y; 36 | y = v; 37 | 38 | st = (u - dist_u); 39 | z_start = GLuint(st < 0 ? 0 : st); 40 | z_end = u + dist_u; 41 | if(z_end > max_z) z_end = max_z; 42 | z = u; 43 | 44 | break; 45 | case Y_DIR: 46 | y_start = 0; 47 | y_end = max_y; 48 | y = max_y/2; 49 | axisLength = max_y; 50 | 51 | st = (u - dist_u); 52 | x_start = GLuint(st < 0 ? 0 : st); 53 | x_end = u + dist_u; 54 | if(x_end > max_x) x_end = max_x; 55 | x = u; 56 | 57 | st = (v - dist_v); 58 | z_start = GLuint(st < 0 ? 0 : st); 59 | z_end = v + dist_v; 60 | if(z_end > max_z) z_end = max_z; 61 | z = v; 62 | 63 | break; 64 | case Z_DIR: 65 | z_start = 0; 66 | z_end = max_z; 67 | z = max_z/2; 68 | axisLength = max_z; 69 | 70 | st = (u - dist_u); 71 | x_start = GLuint(st < 0 ? 0 : st); 72 | x_end = u + dist_u; 73 | if(x_end > max_x) x_end = max_x; 74 | x = u; 75 | 76 | st = (v - dist_v); 77 | y_start = GLuint(st < 0 ? 0 : st); 78 | y_end = v + dist_v; 79 | if(y_end > max_y) y_end = max_y; 80 | y = v; 81 | 82 | break; 83 | default: 84 | //TODO? 85 | break; 86 | } 87 | 88 | expectedTargetCountInCube = ((x_end - x_start)*(y_end - y_start)*axisLength); 89 | 90 | availableTargets = new IterativeCollection(expectedTargetCountInCube, TARGET_LIST); 91 | filledTargets = new IterativeCollection(expectedTargetCountInCube, TARGET_LIST); 92 | } 93 | 94 | bool isUpForDestruction(){ 95 | return true; 96 | } 97 | 98 | }; 99 | 100 | 101 | #endif /* GOALLINE_H_ */ 102 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Goals/goalobject.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GOALOBJECT_H_ 3 | #define GOALOBJECT_H_ 4 | 5 | #include // requires ndk r5 or newer 6 | #include 7 | 8 | #include "Utils/utils.h" 9 | #include "Drivers/Grid/gridposition.h" 10 | #include "Utils/iterativecollection.h" 11 | #include "Utils/alliterativecollections.h" 12 | #include "Stats/goalstats.h" 13 | #include "Drivers/Goals/goalpointtype.h" 14 | #include 15 | #include 16 | 17 | class GoalObject : public IterativeCollectionMember { 18 | 19 | public: 20 | 21 | unsigned int id; 22 | 23 | bool isViolated; 24 | 25 | GLuint x_start, y_start, z_start; 26 | GLuint x_end, y_end, z_end; 27 | GoalPointType goalType; 28 | 29 | GoalObject(GoalPointType type, GLuint x_blocks, GLuint y_blocks, GLuint z_blocks); 30 | 31 | virtual ~GoalObject(); 32 | 33 | GoalPointType getGoalType(); 34 | 35 | virtual bool containsPoint(GridPosition *pos); 36 | virtual bool populateGrid(GridPosition ****grid); 37 | virtual void removeFromGrid(AllIterativeCollections *allCollections, 38 | ReasonForDestruction reason); 39 | 40 | virtual GridPosition *getRandomTarget(); 41 | 42 | virtual bool isUpForDestruction() = 0; 43 | 44 | virtual GLint distanceToCenterPoint(GridPosition *position); 45 | 46 | virtual void getGoalStats(GoalStats &stats); 47 | 48 | void removeTarget(GridPosition *target, AllIterativeCollections *allCollections, ReasonForDestruction reason); 49 | 50 | bool targetWasOccupied(GridPosition *occupiedTarget); 51 | 52 | bool targetWasFailed(GridPosition *failedTarget, unsigned int frustration); 53 | 54 | GLuint totalTargetNumber; 55 | GLuint failedTargets; 56 | 57 | GLuint numberOfRequests; 58 | 59 | long getPendingRequests(); 60 | 61 | bool isGrounded(); 62 | 63 | ReasonForDestruction getReasonForDestruction(unsigned int numSelected); 64 | 65 | IterativeCollection *availableTargets; 66 | IterativeCollection *filledTargets; 67 | 68 | void allowAsTarget(GridPosition *target); 69 | 70 | GLuint getNumAvailable(); 71 | 72 | private: 73 | 74 | GLuint X_BLOCKS, Y_BLOCKS, Z_BLOCKS; 75 | GLfloat requestToTargetRatio; 76 | 77 | GLfloat filledMovingAverage; 78 | 79 | GLuint cumulativeFrustration; 80 | 81 | GLint min(GLint val1, GLint val2); 82 | GLfloat absf(GLfloat val); 83 | 84 | protected: 85 | 86 | GLubyte groundDirection; 87 | 88 | GLuint expectedTargetCountInCube; 89 | 90 | }; 91 | 92 | 93 | 94 | #endif /* GOALOBJECT_H_ */ 95 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Goals/goalplane.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GOALPLANE_H_ 3 | #define GOALPLANE_H_ 4 | 5 | #include "Drivers/Goals/goalobject.h" 6 | 7 | class GoalPlane : public GoalObject{ 8 | 9 | public: 10 | 11 | GLubyte normalDirection; 12 | unsigned short x_y_z_value; 13 | 14 | GoalPlane(unsigned short _x_y_z_value, GLubyte normalAxis, 15 | unsigned short max_x, unsigned short max_y, unsigned short max_z, 16 | GoalPointType type, GLubyte pullToWallsDir) : 17 | GoalObject(type, max_x, max_y, max_z) { 18 | 19 | groundDirection = pullToWallsDir; 20 | 21 | normalDirection = normalAxis; 22 | x_y_z_value = _x_y_z_value; 23 | 24 | switch(normalDirection){ 25 | case X_DIR: 26 | x = x_y_z_value; 27 | y = max_y/2u; 28 | z = max_z/2u; 29 | 30 | y_start = 0; 31 | z_start = 0; 32 | 33 | y_end = max_y; 34 | z_end = max_z; 35 | 36 | x_start = x_y_z_value; 37 | x_end = x_y_z_value + 1; 38 | 39 | expectedTargetCountInCube = (max_y*max_z); 40 | break; 41 | case Y_DIR: 42 | x = max_x/2; 43 | y = x_y_z_value; 44 | z = max_z/2; 45 | 46 | x_start = 0; 47 | z_start = 0; 48 | 49 | x_end = max_x; 50 | z_end = max_z; 51 | 52 | y_start = x_y_z_value; 53 | y_end = x_y_z_value + 1; 54 | 55 | expectedTargetCountInCube = (max_x*max_z); 56 | break; 57 | case Z_DIR: 58 | x = max_x/2; 59 | y = max_y/2; 60 | z = x_y_z_value; 61 | 62 | x_start = 0; 63 | y_start = 0; 64 | 65 | x_end = max_x; 66 | y_end = max_y; 67 | 68 | z_start = x_y_z_value; 69 | z_end = x_y_z_value + 1; 70 | 71 | expectedTargetCountInCube = (max_x*max_y); 72 | break; 73 | default: 74 | //TODO? 75 | break; 76 | } 77 | 78 | availableTargets = new IterativeCollection(expectedTargetCountInCube, TARGET_LIST); 79 | filledTargets = new IterativeCollection(expectedTargetCountInCube, TARGET_LIST); 80 | } 81 | 82 | bool isUpForDestruction(){ 83 | return true; 84 | } 85 | 86 | }; 87 | 88 | 89 | 90 | #endif /* GOALPLANE_H_ */ 91 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Goals/goalpointtype.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GOALPOINTTYPE_H_ 3 | #define GOALPOINTTYPE_H_ 4 | 5 | 6 | 7 | enum GoalPointType{ 8 | NEUTRAL, 9 | ATTRACT, 10 | REPEL, 11 | }; 12 | 13 | 14 | 15 | #endif /* GOALPOINTTYPE_H_ */ 16 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Goals/goals.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GOALS_H_ 3 | #define GOALS_H_ 4 | 5 | #include "Drivers/Goals/goalobject.h" 6 | #include "Utils/iterativecollection.h" 7 | #include "Drivers/Grid/gridposition.h" 8 | #include "Geometry/dimension.h" 9 | #include "Stats/goalstats.h" 10 | 11 | enum GoalType{ 12 | GOALS_NONE = 0, 13 | GOALS_EDGE_WALK = 1, 14 | }; 15 | 16 | class Goals : public Dimension{ 17 | 18 | public: 19 | 20 | GoalType currentGoalType; 21 | 22 | IterativeCollection goalList = IterativeCollection(MAX_GOAL_POINTS + 20, GOAL_LIST); 23 | 24 | Goals(); 25 | ~Goals(); 26 | 27 | void createNewGoalObjects(GridPosition ****gridPositions); 28 | 29 | void markTargetAsFailed(GridPosition *failedTarget, GLuint frustration); 30 | 31 | void deleteGoalGrids(); 32 | void createNewGoalsGrid(GoalType type, Dimension dimens); 33 | 34 | void recycleViolatedGoalObjects(GridPosition ****grid, AllIterativeCollections *allCollections, unsigned int numSelected, bool needMoreGoals); 35 | void tryToViolateGoalToTouch(GridPosition *pos); 36 | 37 | void claimTargetAsOccupied(GridPosition *targetPosition); 38 | 39 | GridPosition *getRandomTarget(GridPosition *pos); 40 | 41 | void getGoalStats(GoalAggregateStats &aggrStats); 42 | 43 | void moveOutOfGoal(Cube *cube); 44 | 45 | int getNumAvailableTargets(); 46 | 47 | private: 48 | 49 | /*** Goal stats**/ 50 | GLuint claimedAsOccupied; 51 | GLuint claimedAsFailed; 52 | GLuint noNearbyGoals; 53 | GLuint noTargetsForNearbyGoal; 54 | GLuint numDeletedGoals; 55 | GLuint numCreatedGoals; 56 | 57 | GoalStats historyOfStats[MAX_GOAL_POINTS]; 58 | 59 | void resetStatsValues(); 60 | 61 | GoalObject *getClosestGoal(GridPosition *pos); 62 | 63 | GoalObject *createRandomGoal(GridPosition ****grid, AllIterativeCollections *allCollections); 64 | 65 | }; 66 | 67 | 68 | 69 | 70 | #endif /* GOALS_H_ */ 71 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Grid/grid.h: -------------------------------------------------------------------------------- 1 | #ifndef GRID_H 2 | #define GRID_H 3 | 4 | #include "Utils/utils.h" 5 | #include "SurfaceRenderer/surfaceutils.h" 6 | 7 | #include "Geometry/cube.h" 8 | #include "Geometry/dimension.h" 9 | #include "Stats/gridstats.h" 10 | #include "Drivers/Goals/goals.h" 11 | #include 12 | #include 13 | 14 | #define MAX_MOVE_TRIES 4 15 | 16 | 17 | class Grid : public Dimension 18 | { 19 | private: 20 | 21 | GLuint X_BLOCKS_MINUS_1, Y_BLOCKS_MINUS_1, Z_BLOCKS_MINUS_1; 22 | GLfloat X_BLOCKS_MID, Y_BLOCKS_MID; 23 | 24 | GLuint numFloatingUnableToMove; 25 | GLuint numFloatingUnableToMoveInRepel; 26 | GLuint numUnableToMove; 27 | GLuint amountOfFrustration; 28 | GLuint totalMoveAttempts; 29 | GLuint unableToGiveTarget; 30 | GLuint newlyStartedToMove; 31 | GLuint cubeReversedOnItself; 32 | GLuint settingNewTarget; 33 | GLuint foundAdjacentTarget; 34 | GLuint numRandomizerFailed; 35 | GLuint cantMoveInAnyDirection; 36 | GLuint shouldntMoveInAnyDirection; 37 | 38 | GLuint newDirectionLeft; 39 | GLuint newDirectionRight; 40 | GLuint newDirectionTop; 41 | GLuint newDirectionBottom; 42 | GLuint newDirectionNear; 43 | GLuint newDirectionFar; 44 | 45 | 46 | static GLubyte X_NEXT[]; 47 | static GLubyte Y_NEXT[]; 48 | static GLubyte Z_NEXT[]; 49 | 50 | 51 | /* Instantiation methods */ 52 | void deleteGridPositionArray(); 53 | 54 | void setupGridPositionLinks(); 55 | 56 | 57 | /* Utils */ 58 | void setAdjacentCubesDrawableBitsOnEmpty(GridPosition *emptyPosition); 59 | 60 | void setDrawableSidesForSelfAndAdjacentLanded(GridPosition *thisPosition); 61 | 62 | void setAdjacentGridPosRefs(GridPosition *toPosition, GLuint x, GLuint y, GLuint z); 63 | 64 | /* Goal behavior */ 65 | bool tryToSetTarget(Goals * goalSet, Cube *c); 66 | bool isAcceptableTarget(GridPosition *toPosition, GridPosition *target); 67 | 68 | GLubyte getBestDirectionForCube(Cube *c, bool isContinuing); 69 | 70 | GridPosition *findAdjacentTarget(GridPosition *toPosition); 71 | 72 | void resetStatsVariables(); 73 | 74 | public: 75 | GridPosition ****_gridPositionsArray; 76 | 77 | bool *_sliceIsDirty; 78 | 79 | Grid(); 80 | ~Grid(); 81 | 82 | /* Instantiation methods */ 83 | void createGridPositionArray(); 84 | 85 | void resetGridAndGoalArrays(); 86 | void resetGridToDimensions(Dimension dimens); 87 | 88 | bool deleteACube(Cube *c); 89 | bool placeACube(Cube *c, Position *pos); 90 | 91 | bool isReady(); 92 | 93 | void resetSlicesToDirty(); 94 | 95 | 96 | /* Cube behavior */ 97 | GridPosition *getGridElement(GLuint x, GLuint y, GLuint z); 98 | 99 | void cubeHasStoppedMoving(GridPosition *landedPosition); 100 | 101 | void setACubeAsMoving(Cube *c, GLubyte dir); 102 | 103 | GLubyte setAbleToMoveToBits(Cube *c); 104 | 105 | /* Goal behavior */ 106 | void setGoalsAtEdges(); 107 | 108 | GLubyte findAndSetNewSuggestedDirection(Goals * goalSet, Cube *c, bool isContinuing); 109 | 110 | bool shouldKeepMoving(GridPosition *position); 111 | bool isGoodCandidateToMove(Cube *c); 112 | 113 | bool isInGoals(GridPosition *gridPosition); 114 | 115 | void getGridStats(GridStats &stats); 116 | 117 | }; 118 | 119 | 120 | #endif /* GRID_H */ 121 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Grid/gridcubes.cpp: -------------------------------------------------------------------------------- 1 | #include "Drivers/Grid/grid.h" 2 | 3 | bool Grid::deleteACube(Cube *c){ 4 | bool ret = false; 5 | 6 | GridPosition *cubePosition = c->getGridElement(); 7 | setAdjacentCubesDrawableBitsOnEmpty(cubePosition); 8 | 9 | if(c->isMoving()){ 10 | ret = true; 11 | } 12 | else 13 | _sliceIsDirty[c->z] = true; 14 | 15 | c->getGridElement()->setProperties(c, STATE_NONE, NO_SIDE); 16 | 17 | return ret; 18 | } 19 | 20 | 21 | bool Grid::placeACube(Cube *c, Position *pos){ 22 | 23 | GridPosition *cubePosition = getGridElement(pos->x, pos->y, pos->z); 24 | 25 | if(!cubePosition->cube) 26 | { 27 | c->placeCubeAt(cubePosition); 28 | 29 | setDrawableSidesForSelfAndAdjacentLanded(cubePosition); 30 | 31 | return true; 32 | } 33 | return false; 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Grid/gridposition.cpp: -------------------------------------------------------------------------------- 1 | #ifndef IDENTITY_CPP_ 2 | #define IDENTITY_CPP_ 3 | 4 | #include "Geometry/cube.h" 5 | 6 | 7 | bool GridPosition::isEmptyTarget(){ 8 | return (state == STATE_NONE && goalNum > 0); 9 | } 10 | 11 | 12 | void GridPosition::setProperties(Cube *cubeRef, GridPositionState gpState, GLubyte movingToDirection) 13 | { 14 | cube = cubeRef; 15 | state = gpState; 16 | movingDirection = movingToDirection; 17 | } 18 | 19 | bool GridPosition::isNotBlockedInThisDirection(GLubyte dir) 20 | { 21 | return state == STATE_NONE && goalNum >= 0; 22 | } 23 | 24 | bool GridPosition::isEmptyOrMovingSpot() 25 | { 26 | return state != STATE_STATIC; 27 | } 28 | 29 | bool GridPosition::isInUntenablePosition(){ 30 | return sidesTouchingStaticCubes == 0 || goalNum < 0; 31 | } 32 | 33 | bool GridPosition::isSupportedFromWall(){ 34 | GridPosition *toWalls = getPositionInWallsDirection(); 35 | return goalNum >= 0 && (!toWalls || toWalls->state == STATE_STATIC); 36 | } 37 | 38 | GLubyte GridPosition::sidesInStaticContact(){ 39 | return sidesTouchingStaticCubes; 40 | } 41 | 42 | 43 | GLubyte GridPosition::getDrawableFaces(){ 44 | return _drawableStaticBits; 45 | } 46 | 47 | 48 | void GridPosition::isUndermined(){ 49 | if(!isBasicGoalPosition && goalNum == 0 && cube){ 50 | cube->isUndermined(); 51 | if(leftGridPos) 52 | leftGridPos->isUndermined(); 53 | if(rightGridPos) 54 | rightGridPos->isUndermined(); 55 | if(upGridPos) 56 | upGridPos->isUndermined(); 57 | if(downGridPos) 58 | downGridPos->isUndermined(); 59 | if(nearGridPos) 60 | nearGridPos->isUndermined(); 61 | if(farGridPos) 62 | farGridPos->isUndermined(); 63 | } 64 | 65 | } 66 | 67 | GridPosition *GridPosition::findPositionInDirection(GLubyte dir){ 68 | switch(dir){ 69 | case LEFT_SIDE: 70 | return leftGridPos; 71 | case RIGHT_SIDE: 72 | return rightGridPos; 73 | case TOP_SIDE: 74 | return upGridPos; 75 | case BOTTOM_SIDE: 76 | return downGridPos; 77 | case FAR_SIDE: 78 | return farGridPos; 79 | case NEAR_SIDE: 80 | return nearGridPos; 81 | default: 82 | return 0; 83 | } 84 | } 85 | 86 | void GridPosition::setPullToWallsPosition(){ 87 | pullToWallsGridPos = findPositionInDirection(pullToWallsDirection); 88 | } 89 | 90 | GridPosition *GridPosition::getPositionInWallsDirection(){ 91 | if(goalNum <= 0) 92 | return pullToWallsGridPos; 93 | else 94 | return findPositionInDirection(goalPullToWallsDirection); 95 | } 96 | 97 | 98 | bool GridPosition::isInValidState(){ 99 | return (((sidesTouchingStaticCubes & LEFT_SIDE) == 0) ^ (!leftGridPos || (leftGridPos->cube && leftGridPos->state == STATE_STATIC))) && 100 | (((sidesTouchingStaticCubes & RIGHT_SIDE) == 0) ^ (!rightGridPos || (rightGridPos->cube && rightGridPos->state == STATE_STATIC))) && 101 | (((sidesTouchingStaticCubes & TOP_SIDE) == 0) ^ (!upGridPos || (upGridPos->cube && upGridPos->state == STATE_STATIC))) && 102 | (((sidesTouchingStaticCubes & BOTTOM_SIDE) == 0) ^ (!downGridPos || (downGridPos->cube && downGridPos->state == STATE_STATIC))) && 103 | (((sidesTouchingStaticCubes & NEAR_SIDE) == 0) ^ (nearGridPos->cube && nearGridPos->state == STATE_STATIC)) && 104 | (((sidesTouchingStaticCubes & FAR_SIDE) == 0) ^ (farGridPos->cube && farGridPos->state == STATE_STATIC)); 105 | } 106 | 107 | #endif /* IDENTITY_CPP_ */ 108 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Grid/gridposition.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef IDENTITY_H_ 3 | #define IDENTITY_H_ 4 | 5 | #define NO_SIDE 0x00u 6 | #define LEFT_SIDE 0x01u 7 | #define RIGHT_SIDE 0x02u 8 | #define BOTTOM_SIDE 0x04u 9 | #define TOP_SIDE 0x08u 10 | #define NEAR_SIDE 0x10u 11 | #define FAR_SIDE 0x20u 12 | 13 | #define X_DIR 0x03u //(LEFT_SIDE|RIGHT_SIDE) 14 | #define Y_DIR 0x0Cu //(BOTTOM_SIDE|TOP_SIDE) 15 | #define Z_DIR 0x30u //(NEAR_SIDE|FAR_SIDE) 16 | #define ALL_DIR 0x3Fu //(X_DIR|Y_DIR|Z_DIR) 17 | 18 | #include // requires ndk r5 or newer 19 | #include 20 | 21 | #include "Utils/iterativecollectionmember.h" 22 | #include "Drivers/Grid/gridpositionstate.h" 23 | 24 | class Cube; 25 | 26 | class GridPosition : public IterativeCollectionMember 27 | { 28 | 29 | public: 30 | 31 | 32 | Cube *cube; 33 | GridPositionState state; 34 | GLubyte movingDirection; 35 | 36 | bool isBasicGoalPosition; 37 | 38 | GLubyte pullToWallsDirection; 39 | GLubyte goalPullToWallsDirection; 40 | GLubyte pullAgainstWallsDirection; 41 | 42 | GLubyte sidesTouchingStaticCubes; 43 | GLubyte _drawableStaticBits; 44 | 45 | GridPosition *leftGridPos, *rightGridPos, *upGridPos, *downGridPos, *nearGridPos, *farGridPos; 46 | GridPosition *pullToWallsGridPos; 47 | 48 | GLint goalNum; 49 | 50 | GridPosition(Cube *d=0, GLint m=0, GridPositionState state=STATE_NONE, GLuint x_=0, GLuint y_=0, GLuint z_=0): 51 | IterativeCollectionMember(), cube(d), 52 | state(state){ 53 | x = x_; 54 | y = y_; 55 | z = z_; 56 | movingDirection = 0; 57 | sidesTouchingStaticCubes = NO_SIDE; 58 | 59 | _drawableStaticBits = 0; 60 | 61 | isBasicGoalPosition = false; 62 | 63 | pullToWallsDirection = 0; 64 | pullAgainstWallsDirection = 0; 65 | goalPullToWallsDirection = 0; 66 | 67 | goalNum = 0; 68 | 69 | leftGridPos = 0; 70 | rightGridPos = 0; 71 | upGridPos = 0; 72 | downGridPos = 0; 73 | nearGridPos = 0; 74 | farGridPos = 0; 75 | 76 | pullToWallsGridPos = 0; 77 | } 78 | 79 | void setProperties(Cube *cubeRef, GridPositionState gpState, GLubyte movingToDirection); 80 | 81 | bool isNotBlockedInThisDirection(GLubyte dir); 82 | bool isEmptyOrMovingSpot(); 83 | bool isInUntenablePosition(); 84 | GLubyte sidesInStaticContact(); 85 | bool isSupportedFromWall(); 86 | 87 | GLubyte getDrawableFaces(); 88 | 89 | void isUndermined(); 90 | bool isEmptyTarget(); 91 | 92 | GridPosition *getPositionInWallsDirection(); 93 | 94 | void setPullToWallsPosition(); 95 | 96 | GridPosition *findPositionInDirection(GLubyte dir); 97 | 98 | bool isInValidState(); 99 | }; 100 | 101 | 102 | #endif /* IDENTITY_H_ */ 103 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/Grid/gridpositionstate.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GRIDPOSITIONSTATE_H_ 3 | #define GRIDPOSITIONSTATE_H_ 4 | 5 | 6 | 7 | enum GridPositionState 8 | { 9 | STATE_NONE = 0, 10 | STATE_STATIC = 1, 11 | STATE_MOVING = 2, 12 | STATE_PAUSED = 3, 13 | }; 14 | 15 | 16 | #endif /* GRIDPOSITIONSTATE_H_ */ 17 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/cubedriver.h: -------------------------------------------------------------------------------- 1 | #ifndef CUBEDRIVER_H_ 2 | #define CUBEDRIVER_H_ 3 | 4 | #include "Geometry/cube.h" 5 | #include "Geometry/dimension.h" 6 | #include "Drivers/Grid/grid.h" 7 | #include "Utils/alliterativecollections.h" 8 | #include "Stats/aggregatestats.h" 9 | #include "Stats/driverstats.h" 10 | 11 | #define MOVE_SELECTED_INCREMENT 10 12 | #define CHECK_UNSUPPORTED_INCREMENT 10 13 | 14 | #define MAX_RANDOM_MOVE_PER_FRAME 5 15 | 16 | #define FRACTION_OF_SELECTION_TO_PRIORITY 0.1f 17 | 18 | #define MAX_MOVING_AT_A_TIME 200u 19 | 20 | 21 | enum TunnelWall 22 | { 23 | RIGHT_WALL = 0, 24 | LEFT_WALL = 1, 25 | TOP_WALL = 2, 26 | BOTTOM_WALL = 3, 27 | }; 28 | 29 | 30 | 31 | class CubeDriver : public Dimension{ 32 | 33 | public: 34 | 35 | enum TargetGridType 36 | { 37 | TARGET_NONE, 38 | TARGET_RANDOM, 39 | TARGET_Z_WALK, 40 | }; 41 | 42 | Grid _grid; 43 | Goals goalSet; 44 | 45 | AllIterativeCollections allArrayCollections; 46 | 47 | bool shouldRefresh; 48 | 49 | CubeDriver(); 50 | ~CubeDriver(); 51 | 52 | void setToNewColors(); 53 | 54 | void resetIfNecessary(); 55 | 56 | /* Instantiation methods */ 57 | bool initializeDimensions(Dimension dimens); 58 | 59 | bool isDriverInitialized(); 60 | 61 | /* Iteration methods */ 62 | void iterateOneFrame(GLuint fractionOfPreferredFrame); 63 | 64 | /* touch event */ 65 | void onTouchEvent(GLint x, GLint y, GLfloat xConst, GLfloat yConst, GLuint cameraMovementShift, GLboolean isSingleTap); 66 | 67 | 68 | /* TEST METHODS */ 69 | AggregateStats getAggregateStats(); 70 | 71 | private: 72 | 73 | TargetGridType currentTargetType; 74 | 75 | GLuint numCubesMovedToSelection; 76 | GLuint unableToGetCandidate; 77 | bool failedToGetToPriority; 78 | GLuint priorityCubeCouldNotMove; 79 | GLuint selectionWasInGoals; 80 | GLuint numInUntenablePosition; 81 | 82 | bool isInitialized; 83 | 84 | void deleteACube(Cube *c); 85 | 86 | void setInitialCubePositions(); 87 | bool setCubeRandomPos(Cube *c); 88 | 89 | void getDriverStats(DriverStats &stats); 90 | 91 | /* Instantiation methods */ 92 | void revertDriver(); 93 | 94 | bool tryToPlaceCubeInGrid(Cube *c, Position *pos); 95 | 96 | void initializeGoalValues(); 97 | 98 | /* touch event */ 99 | bool setSurroundFromTouch(GridPosition *touchedGridPosition); 100 | 101 | /* Iteration methods */ 102 | void iterateMovingCubes(GLuint fractionOfPreferredFrame); 103 | 104 | void moveSelectionToPriority(); 105 | bool startPriorityCubesMoving(); 106 | 107 | void moveNewCandidatesToSelected(); 108 | 109 | void stopCubeMoving(Cube *c); 110 | 111 | bool tryToGetNextMove(Cube *c); 112 | 113 | Cube *getCubeFurthestFromWall(Cube *c); 114 | }; 115 | 116 | 117 | 118 | 119 | #endif /* CUBEDRIVER_H_ */ 120 | -------------------------------------------------------------------------------- /app/src/main/cpp/Drivers/cubedrivertouch.cpp: -------------------------------------------------------------------------------- 1 | #include "Drivers/cubedriver.h" 2 | #include "Drawing/drawing.h" 3 | 4 | #define LOG_TAG "Cube Driver Touch" 5 | 6 | void CubeDriver::onTouchEvent(GLint x, GLint y, GLfloat xConst, GLfloat yConst, GLuint cameraMovementShift, GLboolean isSingleTap) 7 | { 8 | GLuint _x = 0, _y = 0; 9 | GridPosition *position; 10 | 11 | if( !allArrayCollections.movingElements || 12 | !allArrayCollections.movingElements->hasRoom()) 13 | return; 14 | 15 | if(!_grid.isReady()) 16 | return; 17 | 18 | for(GLuint z = 0; z < Z_BLOCKS; z++){ 19 | 20 | _x = (GLint)((xConst)*(CUBE_SIDE*(GLfloat)z - CAMERA_BACK_OFFSET)) + X_BLOCKS_MID; 21 | _y = (GLint)((yConst)*(CUBE_SIDE*(GLfloat)z - CAMERA_BACK_OFFSET)) + Y_BLOCKS_MID; 22 | 23 | if(_x >= X_BLOCKS || _y >= Y_BLOCKS) 24 | break; 25 | 26 | position = _grid.getGridElement(_x, _y, ((z + cameraMovementShift) % Z_BLOCKS)); 27 | 28 | Cube *cube = position->cube; 29 | if(cube){ 30 | cube->wasTouched = true; 31 | 32 | if(isSingleTap){ 33 | goalSet.tryToViolateGoalToTouch(position); 34 | } 35 | else if(!cube->isMoving()) { 36 | allArrayCollections.addCubeToList(cube, PRIORITY_LIST); 37 | setSurroundFromTouch(position); 38 | } 39 | break; 40 | 41 | } 42 | } 43 | } 44 | 45 | bool CubeDriver::setSurroundFromTouch(GridPosition *touchedGridPosition) 46 | { 47 | GLuint x = touchedGridPosition->x, 48 | y = touchedGridPosition->y; 49 | Cube *cube; 50 | 51 | if(x > 0){ 52 | cube = touchedGridPosition->leftGridPos->cube; 53 | if(cube && (touchedGridPosition->leftGridPos->state == STATE_STATIC)) { 54 | allArrayCollections.addCubeToList(cube, PRIORITY_LIST); 55 | cube->wasTouched = true; 56 | } 57 | } 58 | 59 | if(x < X_BLOCKS-1){ 60 | cube = touchedGridPosition->rightGridPos->cube; 61 | if(cube && (touchedGridPosition->rightGridPos->state == STATE_STATIC)) { 62 | allArrayCollections.addCubeToList(cube, PRIORITY_LIST); 63 | cube->wasTouched = true; 64 | } 65 | } 66 | 67 | if(y > 0){ 68 | cube = touchedGridPosition->downGridPos->cube; 69 | if(cube && (touchedGridPosition->downGridPos->state == STATE_STATIC)) { 70 | allArrayCollections.addCubeToList(cube, PRIORITY_LIST); 71 | cube->wasTouched = true; 72 | } 73 | } 74 | 75 | if(y < Y_BLOCKS-1){ 76 | cube = touchedGridPosition->upGridPos->cube; 77 | if(cube && (touchedGridPosition->upGridPos->state == STATE_STATIC)) { 78 | allArrayCollections.addCubeToList(cube, PRIORITY_LIST); 79 | cube->wasTouched = true; 80 | } 81 | } 82 | 83 | cube = touchedGridPosition->nearGridPos->cube; 84 | if(cube && (touchedGridPosition->nearGridPos->state == STATE_STATIC)) { 85 | allArrayCollections.addCubeToList(cube, PRIORITY_LIST); 86 | cube->wasTouched = true; 87 | } 88 | 89 | cube = touchedGridPosition->farGridPos->cube; 90 | if(cube && (!touchedGridPosition->farGridPos->state == STATE_STATIC)) { 91 | allArrayCollections.addCubeToList(cube, PRIORITY_LIST); 92 | cube->wasTouched = true; 93 | } 94 | 95 | return true; 96 | } 97 | 98 | -------------------------------------------------------------------------------- /app/src/main/cpp/Geometry/corner.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CORNER_H_ 3 | #define CORNER_H_ 4 | 5 | #include 6 | 7 | struct Vertex { 8 | GLfloat x, y, z; 9 | }; 10 | 11 | struct Texture { 12 | GLfloat u, v, t; 13 | }; 14 | 15 | struct corner { 16 | Vertex vertex; 17 | Texture texture; 18 | color_array color[4]; 19 | }; 20 | 21 | 22 | 23 | #endif /* CORNER_H_ */ 24 | -------------------------------------------------------------------------------- /app/src/main/cpp/Geometry/cube.h: -------------------------------------------------------------------------------- 1 | #ifndef CUBEPOS_H_ 2 | #define CUBEPOS_H_ 3 | 4 | #include // requires ndk r5 or newer 5 | #include 6 | 7 | #include "SurfaceRenderer/logger.h" 8 | #include "Utils/iterativecollectionmember.h" 9 | #include "Drivers/Grid/gridposition.h" 10 | 11 | class Cube : public IterativeCollectionMember{ 12 | 13 | 14 | public: 15 | 16 | Cube(); 17 | ~Cube(); 18 | 19 | GLuint stepMovedFragment; 20 | GLubyte moveDirection; 21 | 22 | GLuint frustration; 23 | bool wasTouched; 24 | 25 | GLubyte _shouldMoveToBitsInContact; 26 | GLubyte _canMoveToBits; 27 | 28 | GLubyte lastMovedDirection; 29 | GLubyte priorMovedDirection; 30 | 31 | GLint diff_destx, 32 | diff_desty, 33 | diff_destz; 34 | 35 | 36 | /* STATE METHODS */ 37 | 38 | void placeCubeAt(GridPosition *position); 39 | GridPosition *updateVariablesAfterMoving(); 40 | 41 | bool incrementMovement(GLuint increment); 42 | 43 | bool shouldMoveInThisDirection(GLubyte dir); 44 | void setNewDirectionVariables(GLubyte dir); 45 | void stopMoving(); 46 | 47 | void giveTargetGridPosition(GridPosition *target, GLuint MAX_Z); 48 | 49 | GridPosition *getFailedTarget(); 50 | 51 | 52 | /* GET PROPERTIES */ 53 | 54 | GridPosition *getGridElement(); 55 | 56 | GLboolean isMoving(); 57 | 58 | bool shouldMoveToInContact(GLubyte dir); 59 | bool canMoveInThisDirectionInAPinch(GLubyte dir); 60 | 61 | bool isJustStartingToMove(); 62 | 63 | void isUndermined(); 64 | 65 | GridPosition *getNextPosition(); 66 | 67 | static void sortDistancesHighestToLowest(Cube *c, GLubyte (&sorted)[3]); 68 | 69 | bool isMoveStateValid(); 70 | 71 | bool isInGoal(); 72 | 73 | private: 74 | 75 | void resetVariables(); 76 | 77 | GLuint currentJourneyLength; 78 | 79 | GridPosition *nextPosition; 80 | GridPosition *targetPosition; 81 | 82 | GridPosition *currPosition; 83 | 84 | }; 85 | 86 | 87 | 88 | #endif /* CUBEPOS_H_ */ 89 | -------------------------------------------------------------------------------- /app/src/main/cpp/Geometry/dimension.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef DIMENSION_H_ 3 | #define DIMENSION_H_ 4 | 5 | 6 | class Dimension{ 7 | public: 8 | unsigned short X_BLOCKS, Y_BLOCKS, Z_BLOCKS, TOTAL_BLOCKS; 9 | 10 | GLfloat X_BLOCKS_MID; 11 | GLfloat Y_BLOCKS_MID; 12 | 13 | Dimension(){ 14 | X_BLOCKS = 0; 15 | Y_BLOCKS = 0; 16 | Z_BLOCKS = 0; 17 | TOTAL_BLOCKS = 0; 18 | 19 | X_BLOCKS_MID = 0.0f; 20 | Y_BLOCKS_MID = 0.0f; 21 | } 22 | 23 | Dimension(unsigned short x, unsigned short y, unsigned short z, unsigned short total){ 24 | X_BLOCKS = x; 25 | Y_BLOCKS = y; 26 | Z_BLOCKS = z; 27 | TOTAL_BLOCKS = total; 28 | 29 | X_BLOCKS_MID = ((GLfloat)X_BLOCKS/2.0f); 30 | Y_BLOCKS_MID = ((GLfloat)Y_BLOCKS/2.0f); 31 | } 32 | 33 | void setDimension(Dimension dimens){ 34 | 35 | X_BLOCKS = dimens.X_BLOCKS; 36 | Y_BLOCKS = dimens.Y_BLOCKS; 37 | Z_BLOCKS = dimens.Z_BLOCKS; 38 | TOTAL_BLOCKS = dimens.TOTAL_BLOCKS; 39 | 40 | X_BLOCKS_MID = ((GLfloat)X_BLOCKS/2.0f); 41 | Y_BLOCKS_MID = ((GLfloat)Y_BLOCKS/2.0f); 42 | } 43 | 44 | 45 | bool isSimilarDimensions(Dimension dimens) 46 | { 47 | bool isSimilar = dimens.X_BLOCKS == X_BLOCKS && 48 | dimens.Y_BLOCKS == Y_BLOCKS && 49 | dimens.Z_BLOCKS == Z_BLOCKS && 50 | dimens.TOTAL_BLOCKS == TOTAL_BLOCKS; 51 | 52 | return isSimilar; 53 | } 54 | }; 55 | 56 | 57 | 58 | #endif /* DIMENSION_H_ */ 59 | -------------------------------------------------------------------------------- /app/src/main/cpp/Geometry/position.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef POSITION_H_ 3 | #define POSITION_H_ 4 | 5 | 6 | class Position{ 7 | public: 8 | unsigned short x, y, z; 9 | 10 | Position(){ 11 | x = 0; 12 | y = 0; 13 | z = 0; 14 | } 15 | }; 16 | 17 | 18 | #endif /* POSITION_H_ */ 19 | -------------------------------------------------------------------------------- /app/src/main/cpp/Stats/aggregatestats.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef AGGREGATESTATS_H_ 3 | #define AGGREGATESTATS_H_ 4 | 5 | #include "Stats/iterativecollectionsstats.h" 6 | #include "Stats/goalstats.h" 7 | #include "Stats/driverstats.h" 8 | #include "Stats/gridstats.h" 9 | #include 10 | #include 11 | 12 | 13 | struct AggregateStats { 14 | 15 | public: 16 | DriverStats driverStats; 17 | 18 | GoalAggregateStats goalAggregateStats; 19 | 20 | IterativeCollectionStats arrayStats[4]; 21 | 22 | GridStats gridStats; 23 | 24 | std::string getAsJson(){ 25 | 26 | std::string fullStatsString("{arrayStats:["); 27 | 28 | std::string arrayStatsJson(""); 29 | for(int i = 0; i < 4; i++){ 30 | arrayStatsJson += arrayStats[i].getAsJson(); 31 | } 32 | 33 | fullStatsString += arrayStatsJson + std::string("],goalAggregateStats:{"); 34 | 35 | std::string goalStatsJson = goalAggregateStats.getAsJson(); 36 | 37 | fullStatsString += goalStatsJson + std::string("},identityGridStats:"); 38 | 39 | std::string gridStatsJson = gridStats.getAsJson(); 40 | 41 | fullStatsString += gridStatsJson + std::string(",driverStats:"); 42 | 43 | std::string driverStatsJson = driverStats.getAsJson(); 44 | fullStatsString += driverStatsJson + std::string("}\r\n"); 45 | 46 | return fullStatsString; 47 | } 48 | 49 | }; 50 | 51 | 52 | 53 | #endif /* AGGREGATESTATS_H_ */ 54 | -------------------------------------------------------------------------------- /app/src/main/cpp/Stats/driverstats.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef DRIVERSTATS_H_ 3 | #define DRIVERSTATS_H_ 4 | 5 | #include 6 | #include 7 | 8 | struct DriverStats { 9 | public: 10 | bool failedToGetToPriority; 11 | unsigned int numCubesMovedToSelect; 12 | unsigned int unableToGetCandidate; 13 | unsigned int priorityCubeCouldNotMove; 14 | unsigned int selectionWasInGoals; 15 | unsigned int numInUntenablePosition; 16 | 17 | std::string getAsJson(){ 18 | char buffStart[250]; 19 | snprintf(buffStart, sizeof(buffStart), "{failedToGetToPriority:\"%s\",numCubesMovedToSelect:\"%d\",unableToGetCandidate:\"%d\"," 20 | "priorityCubeCouldNotMove:\"%d\",selectionWasInGoals:\"%d\",numInUntenablePosition:\"%d\"}", 21 | failedToGetToPriority ? "true" : "false", 22 | numCubesMovedToSelect, 23 | unableToGetCandidate, 24 | priorityCubeCouldNotMove, 25 | selectionWasInGoals, 26 | numInUntenablePosition); 27 | 28 | return std::string(buffStart); 29 | } 30 | 31 | }; 32 | 33 | 34 | #endif /* DRIVERSTATS_H_ */ 35 | -------------------------------------------------------------------------------- /app/src/main/cpp/Stats/gridstats.h: -------------------------------------------------------------------------------- 1 | #ifndef IDENTITY_STATS_H_ 2 | #define IDENTITY_STATS_H_ 3 | 4 | #include 5 | #include 6 | 7 | struct GridStats { 8 | public: 9 | unsigned int frustration; 10 | unsigned int moveAttempts; 11 | unsigned int numUnableToMove; 12 | unsigned int totalAttractIdentities; 13 | unsigned int unableToGiveTarget; 14 | unsigned int newlyStartedToMove; 15 | unsigned int numFloatingUnableToMove; 16 | unsigned int numStaticIdentities; 17 | unsigned int numCubesInAttractGoalPositions; 18 | unsigned int numEmptyGoals; 19 | unsigned int numPausedIdentities; 20 | unsigned int numMovingIdentities; 21 | unsigned int cubeReversedOnItself; 22 | unsigned int numFloatingUnableToMoveInRepel; 23 | unsigned int numInvalidIdents; 24 | unsigned int numMovingInvalid; 25 | unsigned int settingNewTarget; 26 | unsigned int foundAdjacentTarget; 27 | unsigned int numRandomizerFailed; 28 | unsigned int cantMoveInAnyDirection; 29 | unsigned int shouldntMoveInAnyDirection; 30 | 31 | unsigned int newDirectionLeft; 32 | unsigned int newDirectionRight; 33 | unsigned int newDirectionTop; 34 | unsigned int newDirectionBottom; 35 | unsigned int newDirectionNear; 36 | unsigned int newDirectionFar; 37 | 38 | std::string getAsJson(){ 39 | char buffStart[695]; 40 | snprintf(buffStart, sizeof(buffStart), "{frustration:\"%d\",moveAttempts:\"%d\",numUnableToMove:\"%d\"," 41 | "totalAttractIdentities:\"%d\",unableToGiveTarget:\"%d\",newlyStartedToMove:\"%d\"," 42 | "numFloatingUnableToMove:\"%d\",numStaticIdentities:\"%d\",numCubesInAttractGoalPositions:\"%d\"," 43 | "numEmptyGoals:\"%d\",numPausedIdentities:\"%d\",numMovingIdentities:\"%d\"," 44 | "cubeReversedOnItself:\"%d\",numFloatingUnableToMoveInRepel:\"%d\",numInvalidIdents:\"%d\",numMovingInvalid:\"%d\"," 45 | "settingNewTarget:\"%d\",foundAdjacentTarget:\"%d\",numRandomizerFailed:\"%d\",cantMoveInAnyDirection:\"%d\"," 46 | "shouldntMoveInAnyDirection:\"%d\"," 47 | "newDirectionLeft:\"%d\",newDirectionRight:\"%d\",newDirectionTop:\"%d\"," 48 | "newDirectionBottom:\"%d\",newDirectionNear:\"%d\",newDirectionFar:\"%d\"}", 49 | frustration, 50 | moveAttempts, 51 | numUnableToMove, 52 | totalAttractIdentities, 53 | unableToGiveTarget, 54 | newlyStartedToMove, 55 | numFloatingUnableToMove, 56 | numStaticIdentities, 57 | numCubesInAttractGoalPositions, 58 | numEmptyGoals, 59 | numPausedIdentities, 60 | numMovingIdentities, 61 | cubeReversedOnItself, 62 | numFloatingUnableToMoveInRepel, 63 | numInvalidIdents, 64 | numMovingInvalid, 65 | settingNewTarget, 66 | foundAdjacentTarget, 67 | numRandomizerFailed, 68 | cantMoveInAnyDirection, 69 | shouldntMoveInAnyDirection, 70 | 71 | newDirectionLeft, 72 | newDirectionRight, 73 | newDirectionTop, 74 | newDirectionBottom, 75 | newDirectionNear, 76 | newDirectionFar 77 | ); 78 | 79 | return std::string(buffStart); 80 | } 81 | }; 82 | 83 | 84 | #endif /* IDENTITY_STATS_H_ */ 85 | -------------------------------------------------------------------------------- /app/src/main/cpp/Stats/iterativecollectionsstats.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ITERATIVECOLLECTIONSTATS_H_ 3 | #define ITERATIVECOLLECTIONSTATS_H_ 4 | 5 | #include "Utils/iterativelisttypes.h" 6 | #include 7 | #include 8 | 9 | struct IterativeCollectionStats{ 10 | public: 11 | AddedToListType type; 12 | unsigned int capacity; 13 | unsigned int filled; 14 | unsigned int movingAverage; 15 | 16 | std::string getAsJson(){ 17 | char buff[200]; 18 | snprintf(buff, sizeof(buff), "{filled:\"%d\",capacity:\"%d\",movingAverage:\"%d\"},", 19 | filled, 20 | capacity, 21 | movingAverage); 22 | 23 | return std::string(buff); 24 | } 25 | 26 | }; 27 | 28 | 29 | #endif /* ITERATIVECOLLECTIONSTATS_H_ */ 30 | -------------------------------------------------------------------------------- /app/src/main/cpp/Stats/statssnapshot.cpp: -------------------------------------------------------------------------------- 1 | #include "Stats/statssnapshot.h" 2 | 3 | #define LOG_TAG "StatsSnapshot" 4 | 5 | std::string StatsSnapshot::startRecording(CubeDriver *driver, GLuint iterations, GLuint iterationSpan, GLfloat speed){ 6 | 7 | std::string statsJson(""); 8 | 9 | for(uint i = 0; i < iterations; i++){ 10 | 11 | for(uint j = 0; j < iterationSpan; j++){ 12 | driver->iterateOneFrame(static_cast(fabsf(speed*FLOATING_POINT_PRECISION))); 13 | } 14 | 15 | AggregateStats stats = driver->getAggregateStats(); 16 | 17 | statsJson += stats.getAsJson(); 18 | } 19 | 20 | return statsJson; 21 | } -------------------------------------------------------------------------------- /app/src/main/cpp/Stats/statssnapshot.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef STATSSNAPSHOT_H_ 3 | #define STATSSNAPSHOT_H_ 4 | 5 | #include "Stats/aggregatestats.h" 6 | #include "Drivers/cubedriver.h" 7 | 8 | #include // requires ndk r5 or newer 9 | #include 10 | 11 | 12 | class StatsSnapshot { 13 | 14 | public: 15 | static std::string startRecording(CubeDriver *driver, GLuint iterations, GLuint iterationSpan, GLfloat speed); 16 | 17 | }; 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/SurfaceRenderer/jniapi.h: -------------------------------------------------------------------------------- 1 | #ifndef JNIAPI_H 2 | #define JNIAPI_H 3 | 4 | #include 5 | 6 | #include // requires ndk r5 or newer 7 | #include 8 | 9 | extern "C" { 10 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_baselib_NativeGLWallpaperService_00024NativeGLWallpaperEngine_nativeOnCreate(JNIEnv* jenv, jobject obj, jint id); 11 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_baselib_NativeGLWallpaperService_00024NativeGLWallpaperEngine_nativeOnStart(JNIEnv* jenv, jobject obj, jint id); 12 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_baselib_NativeGLWallpaperService_00024NativeGLWallpaperEngine_nativeOnPause(JNIEnv* jenv, jobject obj, jint id); 13 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_baselib_NativeGLWallpaperService_00024NativeGLWallpaperEngine_nativeOnResume(JNIEnv* jenv, jobject obj, jint id); 14 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_baselib_NativeGLWallpaperService_00024NativeGLWallpaperEngine_nativeOnStop(JNIEnv* jenv, jobject obj, jint id); 15 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_baselib_NativeGLWallpaperService_00024NativeGLWallpaperEngine_nativeOnFinish(JNIEnv* jenv, jobject obj, jint id); 16 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_baselib_NativeGLWallpaperService_00024NativeGLWallpaperEngine_nativeSetSurface(JNIEnv* jenv, jobject obj, jint id, jobject javaSurface); 17 | 18 | 19 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeOnCreate(JNIEnv* jenv, jobject obj, jint id); 20 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeOnStart(JNIEnv* jenv, jobject obj, jint id); 21 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeOnPause(JNIEnv* jenv, jobject obj, jint id); 22 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeOnResume(JNIEnv* jenv, jobject obj, jint id); 23 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeOnStop(JNIEnv* jenv, jobject obj, jint id); 24 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeOnFinish(JNIEnv* jenv, jobject obj, jint id); 25 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeSetSurface(JNIEnv* jenv, jobject obj, jint id, jobject surface); 26 | 27 | }; 28 | 29 | #endif // JNIAPI_H 30 | -------------------------------------------------------------------------------- /app/src/main/cpp/SurfaceRenderer/logger.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGGER_H 2 | #define LOGGER_H 3 | 4 | #include 5 | #include 6 | 7 | //#define COLLECT_STATS 8 | 9 | #define LOG_INFO(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 10 | #define LOG_ERROR(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) 11 | 12 | 13 | #endif // LOGGER_H 14 | -------------------------------------------------------------------------------- /app/src/main/cpp/SurfaceRenderer/native_handle.h: -------------------------------------------------------------------------------- 1 | #ifndef NATIVE_HANDLE_H_ 2 | #define NATIVE_HANDLE_H_ 3 | 4 | #include 5 | 6 | class NativeHandle{ 7 | public: 8 | 9 | static jfieldID getHandleField(JNIEnv *env, jobject obj) 10 | { 11 | jclass c = env->GetObjectClass(obj); 12 | // J is the type signature for long: 13 | return env->GetFieldID(c, "nativeHandle", "J"); 14 | } 15 | 16 | template 17 | static T *getHandle(JNIEnv *env, jobject obj) 18 | { 19 | jlong handle = env->GetLongField(obj, getHandleField(env, obj)); 20 | return reinterpret_cast(handle); 21 | } 22 | 23 | template 24 | static void setHandle(JNIEnv *env, jobject obj, T *t) 25 | { 26 | jlong handle = reinterpret_cast(t); 27 | env->SetLongField(obj, getHandleField(env, obj), handle); 28 | } 29 | 30 | }; 31 | 32 | 33 | #endif /* NATIVE_HANDLE_H_ */ 34 | -------------------------------------------------------------------------------- /app/src/main/cpp/SurfaceRenderer/surfacehandler.cpp: -------------------------------------------------------------------------------- 1 | #include "SurfaceRenderer/surfacerenderer.h" 2 | #include "SurfaceRenderer/logger.h" 3 | 4 | #include "SurfaceRenderer/surfacehandler.h" 5 | #include "SurfaceRenderer/native_handle.h" 6 | #include "SurfaceRenderer/surfaceutils.h" 7 | 8 | #define LOG_TAG "SurfaceRenderer handler" 9 | 10 | SurfaceRenderer* SurfaceHandler::getSurfaceRendererByHandle(jint id, jobject obj, JNIEnv *jenv) 11 | { 12 | SurfaceRenderer *existingSurfaceRenderer = NativeHandle::getHandle(jenv, obj); 13 | 14 | if(!existingSurfaceRenderer){ 15 | LOG_ERROR_DEBUG("Creating new SurfaceRenderer (%p) and setting handle", existingSurfaceRenderer); 16 | existingSurfaceRenderer = getNewSurfaceRenderer(id); 17 | 18 | NativeHandle::setHandle(jenv, obj, existingSurfaceRenderer); 19 | } 20 | 21 | if(!existingSurfaceRenderer) 22 | LOG_ERROR("Unable to create SurfaceRenderer (%d)", id); 23 | 24 | return existingSurfaceRenderer; 25 | } 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/cpp/SurfaceRenderer/surfacehandler.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef SURFACEGENERATOR_H_ 3 | #define SURFACEGENERATOR_H_ 4 | 5 | #include "SurfaceRenderer/surfacerenderer.h" 6 | 7 | 8 | class SurfaceHandler 9 | { 10 | public: 11 | static SurfaceRenderer * getSurfaceRendererByHandle(jint id, jobject obj, JNIEnv *jenv); 12 | 13 | static SurfaceRenderer * getNewSurfaceRenderer(GLuint id); 14 | 15 | }; 16 | 17 | 18 | 19 | #endif /* SURFACEGENERATOR_H_ */ 20 | -------------------------------------------------------------------------------- /app/src/main/cpp/SurfaceRenderer/surfacerenderer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef SURFACERENDERER_H_ 3 | #define SURFACERENDERER_H_ 4 | 5 | #include // requires ndk r5 or newer 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #include // requires ndk r5 or newer 12 | #include // requires ndk r5 or newer 13 | 14 | #define PREFERRED_FRAME_DURATION 45 15 | 16 | 17 | class SurfaceRenderer{ 18 | 19 | public: 20 | ANativeWindow* _window; 21 | 22 | GLuint surface_id; 23 | 24 | SurfaceRenderer(GLuint id); 25 | virtual ~SurfaceRenderer(); 26 | 27 | void disposeWindow(); 28 | 29 | bool isPaused; 30 | 31 | // Following methods can be called from any thread. 32 | // They send message to render thread which executes required actions. 33 | void startThread(); 34 | void stopAndExitThread(); 35 | void finish(); 36 | void pause(); 37 | void resume(); 38 | bool setOrResetWindow(ANativeWindow* window); 39 | 40 | protected: 41 | 42 | GLfloat fractionOfPreferredFrame; 43 | 44 | enum RenderThreadMessage { 45 | MSG_NONE = 0, 46 | 47 | MSG_WINDOW_SET, 48 | MSG_WINDOW_RESET, 49 | MSG_RESET_SCENE_VBOS, 50 | 51 | MSG_RENDER_LOOP_EXIT, 52 | MSG_PAUSE, 53 | }; 54 | 55 | enum RenderThreadMessage _msg_renderer; 56 | int _msg_driver; 57 | 58 | // Threading variables 59 | pthread_t _renderThreadId; 60 | pthread_t _driverThreadId; 61 | pthread_mutex_t _mutex_rendering; 62 | pthread_mutex_t _mutex_driver; 63 | 64 | pthread_cond_t _condition_renderer; 65 | pthread_cond_t _condition_driver; 66 | 67 | 68 | // Helper method for starting the thread 69 | static void* renderThreadStartCallback(void *myself); 70 | static void* driverThreadStartCallback(void *myself); 71 | 72 | // RenderLoop is called in a rendering thread started in start() method 73 | // It creates rendering context and renders scene until stop() is called 74 | void renderLoopInThread(); 75 | void renderThread(); 76 | void iterateDriver(); 77 | 78 | void setThisFrameDuration(); 79 | 80 | bool initializeOpenGLContextInThread(bool reset = false); 81 | void destroyGLContextInThread(); 82 | void setupOpenGlContextInThread(bool resettingSurface = false); 83 | 84 | // Virtual methods to override*********************************** 85 | 86 | // Do all your OpenGL rendering calls here 87 | virtual void renderFrameInThread(GLfloat fractionOfPreferredFrame) = 0; 88 | 89 | // Do all your non-graphics calculations here 90 | virtual void iterateFrameInThread(GLfloat fractionOfPreferredFrame) = 0; 91 | 92 | // Do all custom GL setup here 93 | virtual void setupCustomOpenGLInThread(GLuint width, GLuint height) = 0; 94 | 95 | // Called when you are destroying the GL context 96 | virtual void destroyingCustomGLContextInThread() = 0; 97 | 98 | // ************************************************************** 99 | 100 | // Window + surface============================ 101 | // Android window, supported by NDK r5 and newer 102 | 103 | EGLDisplay _display; 104 | EGLSurface _surface; 105 | EGLContext _context; 106 | GLuint _width; 107 | GLuint _height; 108 | 109 | GLfloat _screenWidthHalf, _screenHeightHalf; 110 | GLfloat _screenRatio; 111 | 112 | }; 113 | 114 | 115 | #endif /* SURFACERENDERER_H_ */ 116 | -------------------------------------------------------------------------------- /app/src/main/cpp/SurfaceRenderer/surfaceutils.cpp: -------------------------------------------------------------------------------- 1 | #include "SurfaceRenderer/surfaceutils.h" 2 | 3 | #include 4 | #include 5 | 6 | bool Constants::DEBUG_DETAIL_MODE = true; 7 | bool Constants::RENDER_OPENGL = true; 8 | 9 | 10 | 11 | long long SurfaceTimer::checkCurrentTimestamp(){ 12 | 13 | struct timespec spec; 14 | 15 | clock_gettime(CLOCK_REALTIME, &spec); 16 | long long secs = ((long long) spec.tv_sec)*1000ll; 17 | long long xx = (long long)round(spec.tv_nsec / 1.0e6); 18 | 19 | return secs + xx; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/cpp/SurfaceRenderer/surfaceutils.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef SURFACEUTILS_H_ 3 | #define SURFACEUTILS_H_ 4 | 5 | 6 | #include "Utils/timer.h" 7 | #include "SurfaceRenderer/logger.h" 8 | #include 9 | 10 | class Constants{ 11 | public: 12 | static bool DEBUG_DETAIL_MODE; 13 | static bool RENDER_OPENGL; 14 | 15 | }; 16 | 17 | class SurfaceTimer { 18 | 19 | public: 20 | 21 | enum ModuleNames{ 22 | START, 23 | STOP, 24 | SET_BLOCKS, 25 | SET_COLORS, 26 | SET_WINDOW, 27 | SET_CUSTOM_OPENGL, 28 | DESTROY_OPENGL_CONTEXT, 29 | INIT_OPENGL_CONTEXT, 30 | BUILD_COLORS_INIT, 31 | BUILD_COLORS_DERIVE, 32 | UNSET_VERTICES, 33 | SET_CUBE_POSITIONS, 34 | SET_VERTICES, 35 | DERIVE_VERTICES, 36 | DERIVE_BACKGROUND, 37 | }; 38 | 39 | static long long checkCurrentTimestamp(); 40 | }; 41 | 42 | #define DEBUG_MODE_TIMER true 43 | #define DEBUG_OPENGL true 44 | 45 | #define FLOATING_POINT_PRECISION 65536 46 | 47 | #define RANDOM(n) (rand()%(n)) 48 | 49 | 50 | #define LOG_INFO_DEBUG(...) if(Constants::DEBUG_DETAIL_MODE)LOG_INFO(__VA_ARGS__) 51 | #define LOG_ERROR_DEBUG(...) if(Constants::DEBUG_DETAIL_MODE)LOG_ERROR(__VA_ARGS__) 52 | 53 | #ifdef DEBUG_MODE_TIMER 54 | 55 | #define START_TIMER Timer::startTimer(); 56 | #define END_TIMER(num) Timer::SavedTimes[num] = Timer::stopTimer(); 57 | 58 | #else 59 | 60 | #define START_TIMER 61 | #define END_TIMER(num) 62 | 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /app/src/main/cpp/Template/templatecreator.cpp: -------------------------------------------------------------------------------- 1 | #include "SurfaceRenderer/surfacehandler.h" 2 | #include "templatewallpaper.h" 3 | 4 | SurfaceRenderer * SurfaceHandler::getNewSurfaceRenderer(GLuint id){ 5 | return new TemplateWallpaper(id); 6 | } 7 | -------------------------------------------------------------------------------- /app/src/main/cpp/Template/templatewallpaper.cpp: -------------------------------------------------------------------------------- 1 | #include "Template/templatewallpaper.h" 2 | 3 | 4 | void TemplateWallpaper::setupCustomOpenGLInThread(GLuint width, GLuint height) 5 | { 6 | 7 | } 8 | 9 | void TemplateWallpaper::renderFrameInThread(GLfloat fractionOfPreferredFrame) 10 | { 11 | glClearColor(0.5f, fractionOfPreferredFrame, 0.1f, 1.0f); 12 | } 13 | 14 | void TemplateWallpaper::iterateFrameInThread(GLfloat fractionOfPreferredFrame) 15 | { 16 | 17 | } 18 | 19 | void TemplateWallpaper::destroyingCustomGLContextInThread() 20 | { 21 | 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/cpp/Template/templatewallpaper.h: -------------------------------------------------------------------------------- 1 | #ifndef TEMPLATEWALLPAPER_H_ 2 | #define TEMPLATEWALLPAPER_H_ 3 | 4 | #include "SurfaceRenderer/surfacerenderer.h" 5 | 6 | class TemplateWallpaper : public SurfaceRenderer { 7 | 8 | public: 9 | TemplateWallpaper(GLuint id) : SurfaceRenderer(id){} 10 | 11 | protected: 12 | void setupCustomOpenGLInThread(GLuint width, GLuint height); 13 | 14 | void renderFrameInThread(GLfloat fractionOfPreferredFrame); 15 | void iterateFrameInThread(GLfloat fractionOfPreferredFrame); 16 | 17 | void destroyingCustomGLContextInThread(); 18 | }; 19 | 20 | 21 | #endif /* TEMPLATEWALLPAPER_H_ */ 22 | -------------------------------------------------------------------------------- /app/src/main/cpp/TestSuite/cubedrivertest.cpp: -------------------------------------------------------------------------------- 1 | #include "TestSuite/cubedrivertest.h" 2 | #include "Drivers/cubedriver.h" 3 | #include "Stats/statssnapshot.h" 4 | 5 | #define LOG_TAG "tags" 6 | 7 | static CubeDriver *driver; 8 | 9 | 10 | 11 | JNIEXPORT jstring JNICALL Java_com_mycardboarddreams_jacobsladder_deluxe_drivers_CubeDriverTest_createDriverInstance( 12 | JNIEnv* jenv, jobject obj, 13 | jint xBlocks, jint yBlocks, jint zBlocks, jint iterations, jint iterationSpan, jfloat speed){ 14 | 15 | driver = new CubeDriver(); 16 | Dimension dimens = Dimension(xBlocks, yBlocks, zBlocks, 4000); 17 | driver->initializeDimensions(dimens); 18 | 19 | jstring result; 20 | 21 | std::string statsJson = StatsSnapshot::startRecording(driver, iterations, iterationSpan, speed); 22 | 23 | result = jenv->NewStringUTF(statsJson.c_str()); 24 | return result; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/cpp/TestSuite/cubedrivertest.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CUBEDRIVERTEST_H_ 3 | #define CUBEDRIVERTEST_H_ 4 | 5 | #include 6 | 7 | extern "C" { 8 | 9 | JNIEXPORT jstring JNICALL Java_com_mycardboarddreams_jacobsladder_deluxe_drivers_CubeDriverTest_createDriverInstance(JNIEnv* jenv, jobject obj, 10 | jint xBlocks, jint yBlocks, jint zBlocks, jint iterations, jint iterationSpan, jfloat speed); 11 | 12 | } 13 | 14 | #endif /* CUBEDRIVERTEST_H_ */ 15 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/alliterativecollections.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ALLITERATIVECOLLECTIONS_H_ 3 | #define ALLITERATIVECOLLECTIONS_H_ 4 | 5 | #include "Geometry/cube.h" 6 | #include "Utils/iterativecollection.h" 7 | #include "Stats/iterativecollectionsstats.h" 8 | 9 | class AllIterativeCollections { 10 | 11 | public: 12 | IterativeCollection *selectGroup; 13 | IterativeCollection *priorityGroup; 14 | IterativeCollection *movingElements; 15 | IterativeCollection *candidateGroup; 16 | 17 | AllIterativeCollections(); 18 | ~AllIterativeCollections(); 19 | 20 | void initializeArrays(); 21 | void deleteArrays(); 22 | void revertArrays(); 23 | 24 | bool addCubeToList(Cube *cube, const AddedToListType type); 25 | 26 | void getIterativeCollectionStats(IterativeCollectionStats (&stats)[4]); 27 | 28 | GLuint moveUnsupportedToPriority(); 29 | 30 | GLuint moveUnsupportedToPriorityList(IterativeCollection *listToCheck); 31 | 32 | private: 33 | 34 | bool doesListHaveRoom(const AddedToListType type); 35 | }; 36 | 37 | 38 | #endif /* ALLITERATIVECOLLECTIONS_H_ */ 39 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/iterativecollection.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARRAYUTILS_H_ 3 | #define ARRAYUTILS_H_ 4 | 5 | #include "Utils/iterativelisttypes.h" 6 | #include "Stats/iterativecollectionsstats.h" 7 | #include "Utils/linkedlistitem.h" 8 | #include "Geometry/cube.h" 9 | #include 10 | 11 | #define DEFAULT_ARRAY_SIZE 250 12 | #define MID_ARRAY_SIZE 2000 13 | #define LARGE_ARRAY_SIZE 4000 14 | 15 | 16 | template 17 | class IterativeCollection { 18 | 19 | public: 20 | 21 | IterativeCollection() { 22 | IterativeCollection(DEFAULT_ARRAY_SIZE, MOVING_LIST); 23 | }; 24 | 25 | IterativeCollection(GLuint maxSize, AddedToListType type); 26 | 27 | virtual ~IterativeCollection(); 28 | 29 | virtual IterativeCollectionStats getIterativeCollectionStats(); 30 | 31 | bool addItem(T item); 32 | bool removeItem(T item); 33 | bool hasRoom(); 34 | void resetArray(uint size); 35 | 36 | void lock(); 37 | void unlock(); 38 | 39 | bool contains(T item); 40 | 41 | T getRandomEntry(); 42 | 43 | GLuint getSize(); 44 | 45 | void resetIterator(){ 46 | currentNode = startingNode->next(); 47 | } 48 | 49 | T getNext(); 50 | 51 | 52 | T getFirst(); 53 | 54 | bool hasNext(){ 55 | return currentNode != 0; 56 | } 57 | GLuint movingAverage; 58 | GLuint updateMovingAverage(); 59 | 60 | 61 | private: 62 | AddedToListType _listType; 63 | 64 | pthread_mutex_t _mutex_list; 65 | 66 | LinkedListItem *startingNode; 67 | LinkedListItem *endingNode; 68 | LinkedListItem *currentNode; 69 | 70 | GLuint _pointer; 71 | 72 | GLuint _size; 73 | GLint _myId; 74 | 75 | void deleteAllNodes(); 76 | }; 77 | 78 | 79 | #endif /* ARRAYUTILS_H_ */ 80 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/iterativecollectionmember.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ITERATIVECOLLECTIONMEMBER_H_ 3 | #define ITERATIVECOLLECTIONMEMBER_H_ 4 | 5 | #include "Utils/iterativelisttypes.h" 6 | #include "Utils/linkedlistitem.h" 7 | #include "Geometry/position.h" 8 | 9 | template 10 | class IterativeCollectionMember : public Position{ 11 | 12 | public: 13 | AddedToListType addedToList; 14 | bool inserted; 15 | LinkedListItem *insertionPos; 16 | 17 | int addedToListId; 18 | 19 | IterativeCollectionMember() : Position(){ 20 | addedToList = NO_LIST; 21 | inserted = false; 22 | insertionPos = 0; 23 | addedToListId = 0; 24 | } 25 | 26 | }; 27 | 28 | 29 | #endif /* ITERATIVECOLLECTIONMEMBER_H_ */ 30 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/iterativelisttypes.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ITERATIVELISTTYPES_H_ 3 | #define ITERATIVELISTTYPES_H_ 4 | 5 | 6 | enum AddedToListType 7 | { 8 | NO_LIST, 9 | SELECTED_TO_MOVE_LIST, 10 | PRIORITY_LIST, 11 | CANDIDATE_LIST, 12 | MOVING_LIST, 13 | TARGET_LIST, 14 | GOAL_LIST, 15 | }; 16 | 17 | 18 | 19 | #endif /* ITERATIVELISTTYPES_H_ */ 20 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/linkedlistitem.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef LINKEDLISTITEM_H_ 3 | #define LINKEDLISTITEM_H_ 4 | 5 | 6 | template 7 | class LinkedListItem { 8 | public: 9 | LinkedListItem(T startItem){ 10 | nextItem = 0; 11 | previousItem = 0; 12 | item = startItem; 13 | } 14 | 15 | bool hasNext(){ 16 | return nextItem != 0; 17 | } 18 | 19 | LinkedListItem *next(){ 20 | return nextItem; 21 | } 22 | 23 | LinkedListItem *prev(){ 24 | return previousItem; 25 | } 26 | 27 | T getItem(){ 28 | return item; 29 | } 30 | 31 | void putNext(LinkedListItem *next){ 32 | nextItem = next; 33 | } 34 | 35 | void putPrevious(LinkedListItem *prev){ 36 | previousItem = prev; 37 | } 38 | 39 | T item; 40 | LinkedListItem *nextItem; 41 | LinkedListItem *previousItem; 42 | 43 | }; 44 | 45 | #endif /* LINKEDLISTITEM_H_ */ 46 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/timer.cpp: -------------------------------------------------------------------------------- 1 | #include "Utils/timer.h" 2 | #include "SurfaceRenderer/surfaceutils.h" 3 | 4 | long long Timer::currentTimestamp0 = 0; 5 | long long Timer::currentTimestamp1 = 0; 6 | 7 | unsigned long long *Timer::SavedTimes = new unsigned long long[20]; 8 | 9 | #define LOG_TAG "Timer" 10 | 11 | void Timer::startTimer(char timerNumber) 12 | { 13 | #ifdef DEBUG_MODE_TIMER 14 | (timerNumber == AD_HOC ? currentTimestamp0 : currentTimestamp1) = SurfaceTimer::checkCurrentTimestamp(); 15 | #endif 16 | } 17 | 18 | long long Timer::stopTimer(char timerNumber) 19 | { 20 | #ifdef DEBUG_MODE_TIMER 21 | return SurfaceTimer::checkCurrentTimestamp() - (timerNumber == AD_HOC ? currentTimestamp0 : currentTimestamp1); 22 | #else 23 | return 0; 24 | #endif 25 | } 26 | 27 | void Timer::printTimes() 28 | { 29 | #ifdef DEBUG_MODE_TIMER 30 | 31 | if(!Constants::DEBUG_DETAIL_MODE) 32 | return; 33 | 34 | LOG_ERROR_DEBUG("Wallpaper::start() took %llu ms", SavedTimes[SurfaceTimer::START]); 35 | LOG_ERROR_DEBUG("Wallpaper::stop() took %llu ms", SavedTimes[SurfaceTimer::STOP]); 36 | LOG_ERROR_DEBUG("Wallpaper::setWindow() took %llu ms", SavedTimes[SurfaceTimer::SET_WINDOW]); 37 | LOG_ERROR_DEBUG("Wallpaper::setBlocks() took %llu ms", SavedTimes[SurfaceTimer::SET_BLOCKS]); 38 | LOG_ERROR_DEBUG("Wallpaper::setInitialCubePositions() took %llu ms", SavedTimes[SurfaceTimer::SET_CUBE_POSITIONS]); 39 | LOG_ERROR_DEBUG("Wallpaper::setColors() took %llu ms", SavedTimes[SurfaceTimer::SET_COLORS]); 40 | LOG_ERROR_DEBUG("Wallpaper::setOpenGlContext() took %llu ms", SavedTimes[SurfaceTimer::SET_CUSTOM_OPENGL]); 41 | LOG_ERROR_DEBUG("Wallpaper::destroyGLContext() took %llu ms", SavedTimes[SurfaceTimer::DESTROY_OPENGL_CONTEXT]); 42 | LOG_ERROR_DEBUG("Engine::unsetVertices() took %llu ms", SavedTimes[SurfaceTimer::UNSET_VERTICES]); 43 | LOG_ERROR_DEBUG("Engine::setVertices() took %llu ms", SavedTimes[SurfaceTimer::SET_VERTICES]); 44 | LOG_ERROR_DEBUG("FaceColors::buildColors() init took %llu ms", SavedTimes[SurfaceTimer::BUILD_COLORS_INIT]); 45 | LOG_ERROR_DEBUG("FaceColors::buildColors() derive took %llu ms", SavedTimes[SurfaceTimer::BUILD_COLORS_DERIVE]); 46 | LOG_ERROR_DEBUG("Engine::deriveVerticies() took %llu ms", SavedTimes[SurfaceTimer::DERIVE_VERTICES]); 47 | LOG_ERROR_DEBUG("Engine::deriveBackground() took %llu ms", SavedTimes[SurfaceTimer::DERIVE_BACKGROUND]); 48 | LOG_ERROR_DEBUG("Wallpaper::initializeOpenGLContext() took %llu ms", SavedTimes[SurfaceTimer::INIT_OPENGL_CONTEXT]); 49 | 50 | #endif 51 | } 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/timer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TIMER_H 3 | #define TIMER_H 4 | 5 | class Timer 6 | { 7 | 8 | 9 | public: 10 | 11 | enum TimerType 12 | { 13 | AD_HOC = 0, 14 | LONG_TERM = 1, 15 | }; 16 | 17 | static void startTimer(char timerNumber = AD_HOC); 18 | static long long stopTimer(char timerNumber = AD_HOC); 19 | 20 | // store timer variables 21 | static unsigned long long *SavedTimes; 22 | 23 | static void printTimes(); 24 | 25 | private: 26 | static long long currentTimestamp0; 27 | static long long currentTimestamp1; 28 | 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "SurfaceRenderer/logger.h" 2 | #include "Drivers/Grid/gridposition.h" 3 | #include "Utils/utils.h" 4 | #include "SurfaceRenderer/surfaceutils.h" 5 | 6 | #define LOG_TAG "Utils" 7 | 8 | bool Utils::areOppositeDirections(GLubyte one, GLubyte two) 9 | { 10 | GLubyte merge = one | two; 11 | 12 | return (merge == X_DIR || merge == Y_DIR || merge == Z_DIR); 13 | } 14 | 15 | //error printing utility method--------------------------------------- 16 | void Utils::checkGlError(const char* mode, GLint id){ 17 | if(!DEBUG_OPENGL || !Constants::DEBUG_DETAIL_MODE) return; 18 | 19 | LOG_INFO_DEBUG("%s has error?", mode); 20 | GLenum err; 21 | while ((err = glGetError()) != GL_NO_ERROR) { 22 | LOG_INFO_DEBUG("%s %d (%d)", mode, err, id); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/cpp/Utils/utils.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef UTILS_H_ 3 | #define UTILS_H_ 4 | 5 | #include // requires ndk r5 or newer 6 | #include 7 | 8 | 9 | class Utils 10 | { 11 | 12 | public: 13 | static bool areOppositeDirections(GLubyte one, GLubyte two); 14 | static void checkGlError(const char* mode = "", GLint id = 0); 15 | 16 | }; 17 | 18 | 19 | 20 | #endif /* UTILS_H_ */ 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/jniapi.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef JNIAPI_H 3 | #define JNIAPI_H 4 | 5 | #include 6 | 7 | #include // requires ndk r5 or newer 8 | #include 9 | 10 | extern "C" { 11 | 12 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_JacobsLadderService_00024WhiteWallpaperEngine_nativeSetupBlocks(JNIEnv* jenv, jobject obj, jint id, jint x, jint y, jint z, jint total); 13 | JNIEXPORT jintArray JNICALL Java_com_mycardboarddreams_jacobsladder_JacobsLadderService_00024WhiteWallpaperEngine_nativeSetupCustomColors(JNIEnv* jenv, jobject obj, jint id, jstring setName, jintArray colors); 14 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_JacobsLadderService_00024WhiteWallpaperEngine_nativeSetupSpeed(JNIEnv* jenv, jobject obj, jint id, jint speed); 15 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_JacobsLadderService_00024WhiteWallpaperEngine_nativeSetupAngle(JNIEnv* jenv, jobject obj, jint id, jfloat angle); 16 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_JacobsLadderService_00024WhiteWallpaperEngine_nativeTouchEvent(JNIEnv* jenv, jobject obj, jint id, jfloat x, jfloat y, jboolean isSingleTap = JNI_TRUE); 17 | 18 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_JacobsLadderService_nativeIsInDebugMode(JNIEnv* jenv, jobject obj, jboolean isDebug); 19 | 20 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeSetupBlocks(JNIEnv* jenv, jobject obj, jint id, jint x, jint y, jint z, jint total); 21 | JNIEXPORT jintArray JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeSetupCustomColors(JNIEnv* jenv, jobject obj, jint id, jstring setName, jintArray colors); 22 | JNIEXPORT void JNICALL Java_com_mycardboarddreams_jacobsladder_view_WallpaperSurface_nativeSetupSpeed(JNIEnv* jenv, jobject obj, jint id, jint speed); 23 | 24 | JNIEXPORT jintArray JNICALL Java_net_margaritov_preference_colorpicker_ColorPickerPreference_nativeGetApparentCustomColors(JNIEnv* jenv, jobject obj); 25 | 26 | }; 27 | 28 | #endif // JNIAPI_H 29 | -------------------------------------------------------------------------------- /app/src/main/cpp/wallpaper.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef RENDERER_H 3 | #define RENDERER_H 4 | 5 | #include 6 | #include // requires ndk r5 or newer 7 | #include 8 | #include 9 | 10 | #include "SurfaceRenderer/surfacerenderer.h" 11 | #include "Drawing/drawing.h" 12 | #include "Drivers/cubedriver.h" 13 | #include "Drawing/objectbuffers.h" 14 | #include "Drawing/textures.h" 15 | 16 | class Wallpaper : public SurfaceRenderer { 17 | 18 | public: 19 | 20 | Wallpaper(GLuint id); 21 | ~Wallpaper(); 22 | 23 | void setBlocks(Dimension dimens); 24 | GLuint* setCustomColorScheme(GLint *colorSet); 25 | void setSpeed(GLint speed); 26 | void setAngle(GLfloat angle); 27 | 28 | void touchEvent(GLfloat x, GLfloat y, GLboolean isSingleTap); 29 | 30 | void setupCustomOpenGLInThread(GLuint width, GLuint height); 31 | 32 | bool resetSize(Dimension dimens); 33 | 34 | bool isInitialized(); 35 | 36 | GLuint* updateCurrentColorSet(GLint *customColors = 0); 37 | 38 | private: 39 | 40 | void renderFrameInThread(GLfloat fractionOfPreferredFrame); 41 | void iterateFrameInThread(GLfloat fractionOfPreferredFrame); 42 | 43 | void destroyingCustomGLContextInThread(); 44 | 45 | GLfloat angleOfRotation; 46 | GLfloat cubeMoveFraction; 47 | 48 | Drawing drawing; 49 | CubeDriver cubeDriver; 50 | 51 | int objectBufferVersion; 52 | 53 | }; 54 | 55 | #endif // RENDERER_H 56 | -------------------------------------------------------------------------------- /app/src/main/cpp/wallpapercreator.cpp: -------------------------------------------------------------------------------- 1 | #include "SurfaceRenderer/surfacehandler.h" 2 | #include "wallpaper.h" 3 | 4 | SurfaceRenderer * SurfaceHandler::getNewSurfaceRenderer(GLuint id){ 5 | return new Wallpaper(id); 6 | } 7 | -------------------------------------------------------------------------------- /app/src/main/cpp/wallpaperhandler.cpp: -------------------------------------------------------------------------------- 1 | #include "SurfaceRenderer/surfacehandler.h" 2 | #include "wallpaper.h" 3 | 4 | SurfaceRenderer * SurfaceHandler::getNewSurfaceRenderer(GLuint ident){ 5 | return new Wallpaper(ident); 6 | } 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/AnalyticsHelper.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder; 2 | 3 | import android.content.Context; 4 | 5 | public class AnalyticsHelper { 6 | private static final String CATEGORY_USAGE = "Usage"; 7 | private static final String CATEGORY_SETTINGS = "Settings"; 8 | 9 | private static final String TRACK_SET_WALLPAPER = "Set wallpaper"; 10 | private static final String TRACK_UNSET_WALLPAPER = "Unset wallpaper"; 11 | private static final String TRACK_PAUSE_TAP_WALLPAPER = "Pause by tap"; 12 | private static final String TRACK_UNPAUSE_TAP_WALLPAPER = "Unpause by tap"; 13 | private static final String TRACK_TOUCH_TO_MANIPULATE = "Touch manipulate"; 14 | 15 | private static final String TRACK_CHANGE_DIMENSIONS = "Change dimensions"; 16 | private static final String TRACK_CHANGE_THEME = "Change theme"; 17 | private static final String TRACK_CHANGE_BRIGHTNESS = "Change brightness"; 18 | 19 | 20 | // This class is deliberately empty to prevent analytics crashes 21 | 22 | 23 | public static void trackSetWallpaper(Context context) { 24 | 25 | } 26 | 27 | public static void trackUnSetWallpaper(Context context) { 28 | 29 | } 30 | 31 | public static void trackPauseWallpaperByTouch(Context context) { 32 | 33 | } 34 | 35 | public static void trackUnpauseWallpaperByTouch(Context context) { 36 | 37 | } 38 | 39 | public static void trackTouchToManipulate(Context context) { 40 | 41 | } 42 | 43 | public static void trackDimensionsChanged(Context context, int size) { 44 | 45 | } 46 | 47 | public static void trackThemeChanged(Context context, String theme) { 48 | 49 | } 50 | 51 | public static void trackBrightnessChanged(Context context, int brightnessLevel) { 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/Dimensions.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.content.res.Resources; 6 | import android.preference.PreferenceManager; 7 | 8 | import com.mycardboarddreams.jacobsladder.deluxe.R; 9 | 10 | public class Dimensions { 11 | 12 | final public int rows; 13 | final public int columns; 14 | final public int depth; 15 | 16 | final public int totalBlocks; 17 | 18 | public Dimensions(int rows, int columns, int depth, int totalBlocks){ 19 | this.rows = rows; 20 | this.columns = columns; 21 | this.depth = depth; 22 | this.totalBlocks = totalBlocks; 23 | } 24 | 25 | public static Dimensions getDimensionsForComplexity(Context context){ 26 | 27 | Resources res = context.getResources(); 28 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); 29 | 30 | int complexityLevel = prefs.getInt(res.getString(R.string.key_complexity_level), res.getInteger(R.integer.default_complexity_level)); 31 | 32 | int minComplexity = context.getResources().getInteger(R.integer.min_complexity_level); 33 | int maxComplexity = context.getResources().getInteger(R.integer.max_complexity_level); 34 | 35 | int minRows = context.getResources().getInteger(R.integer.min_y_blocks); 36 | int maxRows = context.getResources().getInteger(R.integer.max_y_blocks); 37 | 38 | int minCols = context.getResources().getInteger(R.integer.min_x_blocks); 39 | int maxCols = context.getResources().getInteger(R.integer.max_x_blocks); 40 | 41 | int minDepth = context.getResources().getInteger(R.integer.min_z_blocks); 42 | int maxDepth = context.getResources().getInteger(R.integer.max_z_blocks); 43 | 44 | int minTotal = context.getResources().getInteger(R.integer.min_total_blocks); 45 | int maxTotal = context.getResources().getInteger(R.integer.max_total_blocks); 46 | 47 | float complexityFraction = (float)(complexityLevel - minComplexity)/(float)(maxComplexity - minComplexity); 48 | 49 | int rows = minRows + (int)((maxRows - minRows)*complexityFraction); 50 | int columns = minCols + (int)((maxCols - minCols)*complexityFraction); 51 | int depth = minDepth + (int)((maxDepth - minDepth)*complexityFraction); 52 | int totalBlocks = minTotal + (int)((maxTotal - minTotal)*complexityFraction); 53 | 54 | return new Dimensions(rows, columns, depth, totalBlocks); 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/preferences/CheckBoxVerticalPreference.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.preferences; 2 | 3 | import android.content.Context; 4 | import android.preference.TwoStatePreference; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.widget.CheckBox; 8 | import android.widget.CompoundButton; 9 | import android.widget.CompoundButton.OnCheckedChangeListener; 10 | 11 | import com.mycardboarddreams.jacobsladder.deluxe.R; 12 | 13 | public class CheckBoxVerticalPreference extends TwoStatePreference implements OnCheckedChangeListener { 14 | 15 | public CheckBoxVerticalPreference(Context context, AttributeSet attrs, int defStyle) { 16 | super(context, attrs, defStyle); 17 | } 18 | 19 | public CheckBoxVerticalPreference(Context context, AttributeSet attrs) { 20 | this(context, attrs, android.R.attr.checkBoxPreferenceStyle); 21 | } 22 | 23 | public CheckBoxVerticalPreference(Context context) { 24 | this(context, null); 25 | } 26 | 27 | private View mView; 28 | 29 | @Override 30 | protected void onBindView(View view) { 31 | super.onBindView(view); 32 | mView = view; 33 | 34 | CheckBox checkboxView = (CheckBox)mView.findViewById(R.id.preference_checkbox_box); 35 | checkboxView.setOnCheckedChangeListener(this); 36 | 37 | refresh(); 38 | } 39 | 40 | @Override 41 | public boolean isChecked() { 42 | return getPersistedBoolean(true); 43 | } 44 | 45 | public void refresh(){ 46 | 47 | if (mView != null) { 48 | CheckBox chBox = (CheckBox) mView.findViewById(R.id.preference_checkbox_box); 49 | 50 | if(chBox.isChecked() == isChecked()) 51 | return; 52 | 53 | chBox.setChecked(isChecked()); 54 | } 55 | } 56 | 57 | @Override 58 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 59 | persistBoolean(isChecked); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/preferences/DropDownHeaderPreference.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.preferences; 2 | 3 | import android.content.Context; 4 | import android.preference.Preference; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | 8 | public class DropDownHeaderPreference extends Preference { 9 | 10 | private View layout; 11 | 12 | public DropDownHeaderPreference(Context context, AttributeSet attrs, int defStyle) { 13 | super(context, attrs, defStyle); 14 | } 15 | public DropDownHeaderPreference(Context context, AttributeSet attrs) { 16 | super(context, attrs); 17 | } 18 | public DropDownHeaderPreference(Context context) { 19 | super(context); 20 | } 21 | 22 | @Override 23 | protected void onBindView(View view) { 24 | super.onBindView(view); 25 | layout = view; 26 | } 27 | 28 | public void setOpenedState(boolean opened){ 29 | if(layout != null){ 30 | layout.setBackgroundResource(opened ? android.R.color.holo_blue_dark : android.R.color.transparent); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/preferences/SaveCustomThemePreference.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.preferences; 2 | 3 | import android.app.AlertDialog; 4 | import android.app.AlertDialog.Builder; 5 | import android.content.Context; 6 | import android.content.DialogInterface; 7 | import android.content.SharedPreferences; 8 | import android.preference.DialogPreference; 9 | import android.preference.PreferenceManager; 10 | import android.text.TextUtils; 11 | import android.util.AttributeSet; 12 | import android.view.View; 13 | import android.view.View.OnClickListener; 14 | import android.widget.TextView; 15 | 16 | import com.mycardboarddreams.jacobsladder.deluxe.R; 17 | import com.mycardboarddreams.jacobsladder.ThemesHelper; 18 | 19 | public class SaveCustomThemePreference extends DialogPreference { 20 | 21 | private View mView; 22 | 23 | public SaveCustomThemePreference(Context context, AttributeSet attrs, int deftype) { 24 | super(context, attrs, deftype); 25 | } 26 | 27 | public SaveCustomThemePreference(Context context, AttributeSet attrs) { 28 | super(context, attrs); 29 | } 30 | 31 | @Override 32 | protected void onBindView(View view) { 33 | super.onBindView(view); 34 | view.setOnClickListener(new OnClickListener() { 35 | @Override 36 | public void onClick(View v) { 37 | SaveCustomThemePreference.this.onClick(); 38 | } 39 | }); 40 | } 41 | 42 | @Override 43 | protected View onCreateDialogView() { 44 | mView = super.onCreateDialogView(); 45 | return mView; 46 | } 47 | 48 | 49 | @Override 50 | protected void onDialogClosed(boolean positiveResult) { 51 | super.onDialogClosed(positiveResult); 52 | if(positiveResult){ 53 | TextView title = (TextView) mView.findViewById(R.id.saved_text_view); 54 | 55 | String newCustomThemeTitle = title.getText().toString().trim(); 56 | 57 | if(TextUtils.isEmpty(newCustomThemeTitle)) 58 | return; 59 | 60 | String customThemePrefix = getContext().getResources().getString(R.string.custom_theme_prefix_); 61 | 62 | String prependedTheme = customThemePrefix + newCustomThemeTitle; 63 | SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); 64 | 65 | if(defaultSharedPreferences.contains(prependedTheme)) 66 | showOverwriteThemeDialog(newCustomThemeTitle); 67 | else 68 | ThemesHelper.saveCustomColors(getContext(), newCustomThemeTitle); 69 | 70 | } 71 | } 72 | 73 | 74 | private void showOverwriteThemeDialog(final String newCustomThemeTitle) { 75 | AlertDialog.Builder builder = new Builder(getContext()); 76 | builder. 77 | setTitle(R.string.custom_theme_save_overwrite_title). 78 | setMessage(getContext().getString(R.string.custom_theme_save_overwrite_body)). 79 | setPositiveButton(R.string.custom_theme_save_overwrite, new DialogInterface.OnClickListener() { 80 | 81 | @Override 82 | public void onClick(DialogInterface dialog, int which) { 83 | ThemesHelper.saveCustomColors(getContext(), newCustomThemeTitle); 84 | } 85 | }). 86 | setNegativeButton(R.string.custom_theme_save_cancel, null). 87 | show(); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/preferences/SeekBarSummaryPreference.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.preferences; 2 | 3 | /* 4 | * Copyright (C) 2011 The Android Open Source Project 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | import com.mycardboarddreams.jacobsladder.deluxe.R; 21 | 22 | import android.content.Context; 23 | import android.preference.Preference; 24 | import android.preference.Preference.OnPreferenceChangeListener; 25 | import android.text.TextUtils; 26 | import android.util.AttributeSet; 27 | import android.view.View; 28 | import android.widget.SeekBar; 29 | import android.widget.TextView; 30 | 31 | 32 | public class SeekBarSummaryPreference extends SeekBarPreference implements OnPreferenceChangeListener { 33 | 34 | CharSequence mSummary; 35 | TextView mSummaryView; 36 | 37 | public SeekBarSummaryPreference( 38 | Context context, AttributeSet attrs, int defStyle) { 39 | super(context, attrs, defStyle); 40 | init(context); 41 | } 42 | 43 | public SeekBarSummaryPreference(Context context, AttributeSet attrs) { 44 | super(context, attrs); 45 | init(context); 46 | } 47 | 48 | public SeekBarSummaryPreference(Context context) { 49 | super(context); 50 | init(context); 51 | } 52 | 53 | void init(Context context) { 54 | setWidgetLayoutResource(R.layout.font_size_widget); 55 | 56 | setOnPreferenceChangeListener(this); 57 | } 58 | 59 | @Override 60 | public void setSummary(CharSequence summary) { 61 | mSummary = summary; 62 | if (mSummaryView != null) { 63 | mSummaryView.setText(mSummary); 64 | } 65 | } 66 | 67 | public int getInitialValue(int defaultValue){ 68 | return getPersistedInt(defaultValue); 69 | } 70 | 71 | @Override 72 | public CharSequence getSummary() { 73 | return null; 74 | } 75 | 76 | @Override 77 | protected void onBindView(View view) { 78 | super.onBindView(view); 79 | 80 | mSummary = String.valueOf(currentValue); 81 | 82 | mSummaryView = (TextView) view.findViewById(R.id.text); 83 | if (TextUtils.isEmpty(mSummary)) { 84 | mSummaryView.setVisibility(View.GONE); 85 | } else { 86 | mSummaryView.setVisibility(View.VISIBLE); 87 | mSummaryView.setText(mSummary); 88 | } 89 | 90 | } 91 | 92 | @Override 93 | public void onStartTrackingTouch(SeekBar seekBar) { 94 | // Intentionally blank - prevent super.onStartTrackingTouch from running 95 | } 96 | 97 | @Override 98 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 99 | setSummary(String.valueOf(seekBar.getProgress() + _min)); 100 | } 101 | 102 | @Override 103 | public void onStopTrackingTouch(SeekBar seekBar) { 104 | syncProgress(seekBar); 105 | } 106 | 107 | @Override 108 | public boolean onPreferenceChange(Preference preference, Object newValue) { 109 | preference.setSummary(String.valueOf(((Integer)newValue).intValue() + _min)); 110 | return true; 111 | } 112 | 113 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/preferences/TextListPopupPreference.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.preferences; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.preference.DialogPreference; 6 | import android.util.AttributeSet; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.View.OnClickListener; 10 | import android.view.ViewGroup; 11 | import android.widget.ArrayAdapter; 12 | import android.widget.ListView; 13 | import android.widget.TextView; 14 | 15 | import com.mycardboarddreams.jacobsladder.deluxe.R; 16 | 17 | public class TextListPopupPreference extends DialogPreference implements OnClickListener{ 18 | 19 | String[] message; 20 | 21 | public TextListPopupPreference(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | init(context, attrs); 24 | } 25 | public TextListPopupPreference(Context context, AttributeSet attrs, int defStyle) { 26 | super(context, attrs, defStyle); 27 | init(context, attrs); 28 | } 29 | 30 | @Override 31 | protected void onBindView(View view) { 32 | super.onBindView(view); 33 | boolean isCustomThemeText = getKey() != null && getKey().equals(getContext().getString(R.string.key_custom_theme_help)); 34 | view.setBackgroundResource(isCustomThemeText ? 35 | R.color.background_faded_dark_grey : android.R.color.transparent); 36 | 37 | if(isCustomThemeText) 38 | view.setOnClickListener(this); 39 | } 40 | 41 | private void init(Context context, AttributeSet attrs) { 42 | final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.TextListPopupPreference); 43 | final int id = array.getResourceId(R.styleable.TextListPopupPreference_android_entryValues, 0); 44 | 45 | if (id != 0) { 46 | message = context.getResources().getStringArray(id); 47 | } 48 | array.recycle(); 49 | 50 | setPositiveButtonText(R.string.help_dialog_ok); 51 | setNegativeButtonText(null); 52 | } 53 | 54 | @Override 55 | protected View onCreateDialogView() { 56 | ListView lv = (ListView)LayoutInflater.from(getContext()).inflate(R.layout.help_dialog, null); 57 | 58 | if(message == null || message.length == 0) 59 | return lv; 60 | 61 | final String[] messageStrings = new String[message.length]; 62 | 63 | for(int i = 0; i < message.length; i++) 64 | messageStrings[i] = message[i].toString(); 65 | 66 | lv.setAdapter(new ArrayAdapter(getContext(), R.layout.help_dialog_item, R.id.text_item, message){ 67 | 68 | @Override 69 | public View getView(int position, View convertView, ViewGroup parent){ 70 | if(convertView == null){ 71 | convertView = LayoutInflater.from(getContext()).inflate(R.layout.help_dialog_item, null); 72 | } 73 | 74 | TextView tv = (TextView)convertView.findViewById(R.id.icon_item); 75 | TextView tv1 = (TextView)convertView.findViewById(R.id.text_item); 76 | tv.setText(String.valueOf(position+1) + ". "); 77 | tv1.setText(messageStrings[position]); 78 | 79 | return convertView; 80 | } 81 | }); 82 | 83 | return lv; 84 | } 85 | 86 | @Override 87 | public void onClick(View v) { 88 | onClick(); 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/preferences/ThemeSelectAdapter.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.preferences; 2 | 3 | import java.util.List; 4 | 5 | import android.app.Activity; 6 | import android.content.Context; 7 | import android.content.res.Resources; 8 | import android.support.annotation.NonNull; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.View.OnClickListener; 12 | import android.view.ViewGroup; 13 | import android.widget.ArrayAdapter; 14 | import android.widget.ImageView; 15 | import android.widget.TextView; 16 | 17 | import com.mycardboarddreams.jacobsladder.deluxe.R; 18 | import com.mycardboarddreams.jacobsladder.ThemeManager; 19 | import com.mycardboarddreams.jacobsladder.ThemeManager.Theme; 20 | 21 | 22 | class ThemeSelectAdapter extends ArrayAdapter { 23 | 24 | private OnClickListener onSelectCallback; 25 | 26 | private Resources resources; 27 | 28 | private Resources Resources() { 29 | if (resources == null) 30 | resources = getContext().getResources(); 31 | return resources; 32 | } 33 | 34 | public ThemeSelectAdapter(Context context, int textViewResourceId, OnClickListener lp, String key) { 35 | super(context, R.layout.preference_theme_list_item, textViewResourceId, ThemeManager.get(context).getAllThemes(context, key)); 36 | onSelectCallback = lp; 37 | } 38 | 39 | public ThemeSelectAdapter(Context context, int resource, 40 | int textViewResourceId, List objects) { 41 | super(context, resource, textViewResourceId, objects); 42 | } 43 | 44 | public ThemeSelectAdapter(Context context, int resource, 45 | int textViewResourceId) { 46 | super(context, resource, textViewResourceId); 47 | } 48 | public ThemeSelectAdapter(Context context, int resource) { 49 | super(context, resource); 50 | } 51 | 52 | @Override 53 | public boolean hasStableIds() { 54 | return true; 55 | } 56 | 57 | @Override 58 | @NonNull 59 | public View getView(int position, View convertView, @NonNull ViewGroup parent) { 60 | 61 | // inflate layout 62 | LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater(); 63 | 64 | if (convertView == null) 65 | convertView = inflater.inflate(R.layout.preference_theme_list_item, 66 | parent, false); 67 | convertView.setId(position); 68 | 69 | Theme theme = getItem(position); 70 | 71 | // set on click listener for row 72 | convertView.setOnClickListener(onSelectCallback); 73 | 74 | // set name 75 | TextView swatchTitle = (TextView) convertView.findViewById(R.id.colors_title_text); 76 | swatchTitle.setText(theme.readableName); 77 | swatchTitle.setAlpha(1f); 78 | swatchTitle.setBackgroundResource(theme.isSelected ? android.R.color.holo_blue_light : android.R.color.white); 79 | swatchTitle.setTextColor(Resources().getColor(theme.isSelected ? android.R.color.white : android.R.color.black)); 80 | 81 | convertView.findViewById(R.id.theme_title_background).setVisibility(View.VISIBLE); 82 | convertView.findViewById(R.id.theme_title_background_side).setVisibility(View.VISIBLE); 83 | 84 | convertView.setBackgroundColor(Resources().getColor( 85 | theme.isSelected ? android.R.color.holo_blue_light : android.R.color.background_dark)); 86 | 87 | // set colors 88 | ImageView backgroundImage = (ImageView)convertView.findViewById(R.id.theme_background_image); 89 | 90 | if (theme.demoImage != null){ 91 | backgroundImage.setImageDrawable(theme.demoImage); 92 | backgroundImage.setImageAlpha(255); 93 | } 94 | else{ 95 | backgroundImage.setImageDrawable(null); 96 | backgroundImage.setImageAlpha(255); 97 | } 98 | 99 | 100 | return convertView; 101 | } 102 | 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/preferences/ThemeSelectPreference.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.preferences; 2 | 3 | 4 | import android.app.AlertDialog.Builder; 5 | import android.content.Context; 6 | import android.preference.ListPreference; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.view.View.OnClickListener; 10 | import android.widget.ImageView; 11 | 12 | import com.mycardboarddreams.jacobsladder.deluxe.R; 13 | import com.mycardboarddreams.jacobsladder.ThemeManager; 14 | import com.mycardboarddreams.jacobsladder.ThemeManager.Theme; 15 | 16 | public class ThemeSelectPreference extends ListPreference implements OnClickListener { 17 | 18 | private ThemeSelectAdapter adapter; 19 | private View preferenceView; 20 | 21 | public ThemeSelectPreference(Context context, AttributeSet attrs, int defStyle) { 22 | super(context, attrs); 23 | } 24 | public ThemeSelectPreference(Context context, AttributeSet attrs) { 25 | super(context, attrs); 26 | } 27 | public ThemeSelectPreference(Context context) { 28 | super(context); 29 | } 30 | 31 | @Override 32 | protected void onBindView(View view) { 33 | preferenceView = view; 34 | updateSelectedThemeImage(); 35 | 36 | super.onBindView(view); 37 | } 38 | 39 | private void updateSelectedThemeImage() 40 | { 41 | if(preferenceView == null) 42 | return; 43 | 44 | Theme selectedTheme = ThemeManager.get(getContext()).getSelectedTheme(getContext(), getKey()); 45 | 46 | if (selectedTheme == null) 47 | return; 48 | 49 | ImageView demo = ((ImageView)preferenceView.findViewById(R.id.demo_layout)); 50 | 51 | if(demo != null) 52 | demo.setImageDrawable(selectedTheme.demoImage); 53 | 54 | } 55 | 56 | 57 | @Override 58 | protected void onPrepareDialogBuilder(Builder builder) { 59 | adapter = new ThemeSelectAdapter(getContext(), R.id.colors_title_text, this, getKey()); 60 | 61 | builder.setAdapter(adapter, this); 62 | super.onPrepareDialogBuilder(builder); 63 | } 64 | 65 | 66 | public void dismissDialog() 67 | { 68 | if(getDialog() != null) 69 | getDialog().dismiss(); 70 | } 71 | 72 | @Override 73 | public void onClick(View selectedView) { 74 | int position = selectedView.getId(); 75 | Theme theme = adapter.getItem(position); 76 | 77 | persistString(theme.keyName); 78 | 79 | updateSelectedThemeImage(); 80 | 81 | dismissDialog(); 82 | } 83 | 84 | 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/template/TemplateSettings.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.template; 2 | 3 | import android.preference.PreferenceActivity; 4 | 5 | /** 6 | * Created on 2017-02-22. 7 | */ 8 | 9 | public class TemplateSettings extends PreferenceActivity { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/template/TemplateSettingsActivity.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.template; 2 | 3 | import android.preference.PreferenceActivity; 4 | 5 | public class TemplateSettingsActivity extends PreferenceActivity { 6 | 7 | 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/mycardboarddreams/jacobsladder/template/TemplateWallpaperService.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.template; 2 | 3 | import android.content.SharedPreferences; 4 | 5 | import com.mycardboarddreams.jacobsladder.baselib.NativeGLWallpaperService; 6 | 7 | public class TemplateWallpaperService extends NativeGLWallpaperService{ 8 | 9 | public static final String LOG_TAG = TemplateWallpaperService.class.getName(); 10 | 11 | @Override 12 | protected TemplateWallpaperEngine getInstance() { 13 | return new TemplateWallpaperEngine(); 14 | } 15 | 16 | public class TemplateWallpaperEngine extends NativeGLWallpaperService.NativeGLWallpaperEngine{ 17 | 18 | @Override 19 | protected void onWallpaperResuming() { 20 | 21 | } 22 | 23 | @Override 24 | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { 25 | 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/custom_theme_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/custom_theme_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_cancel_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/ic_cancel_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_done_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/ic_done_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_save_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/ic_save_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icon_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/icon_help.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/logo_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/save_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/save_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/settings_brightness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/settings_brightness.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/settings_speed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/settings_speed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/settings_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/settings_theme.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/settings_total_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-hdpi/settings_total_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/custom_theme_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-ldpi/custom_theme_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/icon_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-ldpi/icon_help.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-ldpi/logo_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/save_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-ldpi/save_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/settings_brightness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-ldpi/settings_brightness.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/settings_speed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-ldpi/settings_speed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/settings_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-ldpi/settings_theme.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/settings_total_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-ldpi/settings_total_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/custom_theme_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/custom_theme_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_ab_back_holo_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/ic_ab_back_holo_dark.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_cancel_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/ic_cancel_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_done_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/ic_done_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_save_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/ic_save_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icon_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/icon_help.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/logo_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/save_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/save_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/settings_brightness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/settings_brightness.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/settings_speed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/settings_speed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/settings_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/settings_theme.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/settings_total_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-mdpi/settings_total_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/airplanewindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/airplanewindow.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/aquarium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/aquarium.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/arctic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/arctic.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/backstage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/backstage.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/bacterium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/bacterium.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/bananas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/bananas.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/blueultrasonic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/blueultrasonic.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/calypso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/calypso.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cube_custom_bottom_left_shade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/cube_custom_bottom_left_shade.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cube_custom_bottom_right_shade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/cube_custom_bottom_right_shade.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cube_custom_top_left_shade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/cube_custom_top_left_shade.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cube_custom_top_right_shade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/cube_custom_top_right_shade.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/custom_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/custom_theme.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/custom_theme_icon_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/custom_theme_icon_dark.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/customcolorbackdrop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/customcolorbackdrop.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/disco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/disco.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/ember.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/ember.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/emeraldforest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/emeraldforest.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/fernlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/fernlight.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/geode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/geode.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/gold.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/gotham.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/gotham.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/icon_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/icon_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/jacobsladder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/jacobsladder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/limecream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/limecream.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/limejello.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/limejello.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/marshmallow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/marshmallow.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/orpheus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/orpheus.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/paleblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/paleblue.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/selector_theme_enabled_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/sepia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/sepia.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/shadowcliffs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/shadowcliffs.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/storm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/storm.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/sunflower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/sunflower.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/swimmingpool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/swimmingpool.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/tangerine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/tangerine.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/toast_backing.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/tokyo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/tokyo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/underworld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-nodpi/underworld.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/custom_theme_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/custom_theme_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_ab_back_holo_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/ic_ab_back_holo_dark.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_cancel_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/ic_cancel_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_done_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/ic_done_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_save_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/ic_save_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icon_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/icon_help.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/logo_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/save_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/save_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/settings_brightness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/settings_brightness.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/settings_speed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/settings_speed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/settings_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/settings_theme.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/settings_total_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xhdpi/settings_total_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/custom_theme_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/custom_theme_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_cancel_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/ic_cancel_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_done_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/ic_done_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_save_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/ic_save_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icon_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/icon_help.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/iconhq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/iconhq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/lightbulb_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/lightbulb_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/logo_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/save_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/save_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/settings_brightness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/settings_brightness.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/settings_speed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/settings_speed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/settings_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/settings_theme.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/settings_total_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxhdpi/settings_total_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_cancel_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxxhdpi/ic_cancel_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_done_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxxhdpi/ic_done_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_save_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable-xxxhdpi/ic_save_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/alpha_background_tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/drawable/alpha_background_tile.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/alpha_tiled_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/preference_list_divider.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_face_square.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/layout-land/dialog_color_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 14 | 15 | 21 | 22 | 23 | 24 | 29 | 30 | 40 | 41 | 42 | 48 | 49 | 54 | 55 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /app/src/main/res/layout/custom_toast.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_color_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | 17 | 24 | 25 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 57 | 58 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /app/src/main/res/layout/font_size_widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/help_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/help_dialog_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_background_checkbox.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_create_custom_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_group_custom_colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 21 | 22 | 30 | 31 | 32 | 33 | 34 | 39 | 40 | 46 | 47 | 48 | 49 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 76 | 77 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_save_custom_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_save_custom_theme_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_select_theme_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 19 | 20 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_theme_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 22 | 23 | 27 | 28 | 37 | 43 | 44 | 45 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/layout/settings_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 12 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/mipmap-hdpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/mipmap-ldpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/mipmap-mdpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/mipmap-xhdpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/mipmap-xxhdpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/app/src/main/res/mipmap-xxxhdpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @string/jacobs_ladder 4 | La Escalera de Jacob (Gratis) 5 | 6 | La Escalera de Jacob 7 | Malvavisco 8 | Plátanos 9 | Luz de helecho 10 | Bosque Esmeralda 11 | Jalea de lima 12 | Crema de lima 13 | Azul pálido 14 | Ventana del avión 15 | Ártico 16 | Acuario 17 | Piscina 18 | Bacteria 19 | Tokio 20 | Discoteca 21 | Azul Ultrasónico 22 | Geode 23 | Sepia 24 | Calipso 25 | Tormenta 26 | Gotham 27 | Inframundo 28 | Orfeo 29 | Acantilados de la sombra 30 | Entre bastidores 31 | Oro 32 | Ascua 33 | Mandarina 34 | Girasol 35 | 36 | 37 | 38 | 39 | Establecer la Escalera de Jacob como tu Live Wallpaper. 40 | Toque dos veces en el fondo de pantalla para pausar y reanudar. 41 | Toque los cubos para moverlos. 42 | 43 | 44 | 45 | Guardar 46 | Cancelar 47 | OK 48 | Selector de color 49 | Color de fondo 50 | Reemplazar 51 | Mostrar paredes 52 | Nombre 53 | Estilo 54 | Reemplazar el estilo existente 55 | ¿Estás seguro de que quieres reemplazar este estilo? 56 | Guardado 57 | Creador 58 | Cómo usar La Escalera de Jacob 59 | Pausado. Toca dos veces para continuar. 60 | Se abre la página de configuración… 61 | Empezado. Toca dos veces para pausar. 62 | @string/custom_save_button_label 63 | 64 | @string/tokyo 65 | 66 | -------------------------------------------------------------------------------- /app/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @string/jacobs_ladder 4 | L\'Échelle de Jacob (Gratuit) 5 | 6 | L\'Échelle de Jacob 7 | Guimauve 8 | Bananes 9 | Lumière des fougères 10 | Forêt d\'émeraude 11 | Gelée de chaux 12 | Crème à la lime 13 | Bleu pâle 14 | Hublot de l\'avion 15 | Arctique 16 | Aquarium 17 | Piscine 18 | Bactérie 19 | Tokyo 20 | Disco 21 | Bleu Ultrasonique 22 | Géode 23 | Sépia 24 | Calypso 25 | Orage 26 | Gotham 27 | Pègre 28 | Orphée 29 | Ombre des falaises 30 | Dans les coulisses 31 | Or 32 | Charbon ardent 33 | Mandarine 34 | Tournesol 35 | 36 | 37 | 38 | Définir l\'Échelle de Jacob comme votre Live Wallpaper. 39 | Double-tapez sur le papier peint pour faire une pause et le reprendre. 40 | Touchez les cubes pour les faire bouger. 41 | 42 | 43 | 44 | Annuler 45 | Enregistrer 46 | Couleur de fond 47 | Créateur 48 | Remplacer 49 | Voulez-vous vraiment remplacer ce style? 50 | Remplacez un style existant. 51 | Sélecteur de couleurs 52 | Nom 53 | OK 54 | Comment utiliser l\'Échelle de Jacob 55 | Montrer les murs 56 | Modes 57 | Enregistré 58 | A repris. Double-cliquer pour faire une pause. 59 | En pause. Double-cliquer pour reprendre. 60 | Ouverture de la page des paramètres… 61 | @string/custom_save_button_label 62 | @string/tokyo 63 | 64 | -------------------------------------------------------------------------------- /app/src/main/res/values-ja/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @string/jacobs_ladder 4 | 5 | ヤコブのはしご (無償) 6 | 7 | ヤコブのはしご 8 | マシュマロ 9 | バナナ 10 | シダの光 11 | エメラルドの森 12 | ライム・ゼリー 13 | ライムクリーム 14 | ライトブルー 15 | 飛行機の窓 16 | 北極 17 | 水族館 18 | スイミングプール 19 | 細菌 20 | 東京 21 | ディスコ 22 | 青色超音波 23 | 結晶 24 | セピア 25 | カリプソ 26 | 27 | ゴッサム 28 | アンダーワールド 29 | オルフェウス 30 | 影の崖 31 | 舞台裏 32 | ゴールド 33 | 残り火 34 | タンジェリン 35 | ひまわり 36 | 37 | 38 | 39 | 40 | あなたのライブ壁紙としてJacobのはしごを設定します。 41 | 一時停止して再開するには、壁紙をダブルタップします。 42 | キューブに触れることによってキューブを移動します。 43 | 44 | 45 | 46 | 保存する 47 | キャンセルする 48 | 背景色 49 | 既存のスタイルを置き換えます 50 | カラーセレクタ 51 | 52 | 壁を表示する 53 | 一時停止。 再開するにはダブルタップしてください 54 | 再開。 ダブルタップすると一時停止します 55 | 保存されました 56 | スタイル 57 | 設定ページが開きます 58 | ページを閉じる 59 | このスタイルを置き換えてもよろしいですか? 60 | クリエイター 61 | 上書きする 62 | Jacob\'s Ladderを使用するにはどうすればいいですか? 63 | @string/custom_save_button_label 64 | @string/tokyo 65 | 66 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @string/jacobs_ladder 4 | 5 | 雅各的梯子 (免费) 6 | 7 | 雅各的梯子 8 | 棉花糖 9 | 香蕉 10 | 蕨类植物 11 | 翡翠森林 12 | 石灰果冻 13 | 石灰霜 14 | 淡蓝 15 | 飞机窗口 16 | 北极 17 | 水族馆 18 | 游泳池 19 | 20 | 东京 21 | 迪斯科 22 | 蓝色超声波 23 | 水晶 24 | 老照片 25 | Calypso 26 | 风暴 27 | 哥特 28 | 地狱 29 | Orpheus 30 | 阴影峭壁 31 | 后台 32 | 33 | 余烬 34 | 柑橘 35 | 向日葵 36 | 37 | 38 | 39 | 设置Jacob的梯子作为你的动态壁纸。 40 | 双击壁纸暂停和恢复。 41 | 触摸多维数据集以移动它们。 42 | 43 | 44 | 存储 45 | 取消 46 | 样式 47 | 背景颜色 48 | 创作者 49 | 更换 50 | 替换现有样式 51 | 名称 52 | 如何使用Jacob的梯子 53 | 显示墙壁 54 | 颜色选择器 55 | 您确定要替换此样式吗? 56 | 关闭页面 57 | 停止。 点按两次即可恢复。 58 | 开始。 点按两次即可暂停。 59 | 保存完成 60 | 等待“设置”页面。 61 | @string/custom_save_button_label 62 | @string/tokyo 63 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #FFFFFF 5 | #555555 6 | 7 | #FF222222 8 | @android:color/background_dark 9 | 10 | #FF3F3F3F 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 0dp 7 | 8 | 9 | 30dp 10 | 11 | 12 | 11 13 | 29 14 | 25 15 | 16 | 11 17 | 29 18 | 25 19 | 20 | 35 21 | 60 22 | 57 23 | 24 | 25 | 26 | 1000 27 | 4000 28 | 3500 29 | 1 30 | 10 31 | 9 32 | 33 | 0 34 | 35 | 0 36 | 10 37 | 10 38 | 39 | 1dp 40 | 45dp 41 | 135dp 42 | 43 | 44 | 45 | 78dp 46 | 10dp 47 | 48 | 15dp 49 | 10dp 50 | -25dp 51 | 52 | 25dp 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/xml/whitewallpaper.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | maven { url 'https://maven.fabric.io/public' } 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:2.2.3' 10 | classpath 'com.google.gms:google-services:3.0.0' 11 | classpath 'com.google.firebase:firebase-plugins:1.0.4' 12 | classpath 'io.fabric.tools:gradle:1.+' 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /common/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /common/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | dependencies { 4 | compile fileTree(dir: 'libs', include: ['*.jar']) 5 | } 6 | 7 | sourceCompatibility = "1.7" 8 | targetCompatibility = "1.7" 9 | -------------------------------------------------------------------------------- /common/src/main/java/com/mycardboarddreams/jacobsladder/TestProperties.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder; 2 | 3 | public class TestProperties { 4 | 5 | public static final String STATS_FILE_NAME = "stats.txt"; 6 | public static final String PATH_TO_STATS_FILE_ON_DEVICE = "/storage/emulated/0/" + STATS_FILE_NAME; 7 | 8 | 9 | public static final int TOTAL_NUMBER_OF_SAMPLES = 4000; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ykulbashian/JacobsLadder3D/0782cc85ed21809f48cda0b9a68cf98103e8d1ad/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':testdisplay', ':common' 2 | -------------------------------------------------------------------------------- /testdisplay/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /testdisplay/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | dependencies { 4 | compile fileTree(dir: 'libs', include: ['*.jar']) 5 | compile 'com.google.code.gson:gson:2.7' 6 | compile project(':common') 7 | } 8 | 9 | sourceCompatibility = "1.8" 10 | targetCompatibility = "1.8" 11 | -------------------------------------------------------------------------------- /testdisplay/src/main/java/com/mycardboarddreams/jacobsladder/AggregateStats.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder; 2 | 3 | public class AggregateStats { 4 | 5 | public DriverStats driverStats; 6 | public GoalsAggregateStats goalAggregateStats; 7 | public ArrayStats[] arrayStats; 8 | public IdentityGridStats identityGridStats; 9 | 10 | 11 | public static class DriverStats{ 12 | public boolean failedToGetToPriority; 13 | public int numCubesMovedToSelect; 14 | public int unableToGetCandidate; 15 | public int priorityCubeCouldNotMove; 16 | public int selectionWasInGoals; 17 | public int numInUntenablePosition; 18 | } 19 | 20 | public static class GoalsFrameStats{ 21 | 22 | public int claimedAsOccupied; 23 | public int claimedAsFailed; 24 | public int noNearbyGoals; 25 | public int noTargetsForNearbyGoal; 26 | public int numDeletedGoals; 27 | public int numCreatedGoals; 28 | public int numTotalGoals; 29 | public int goalsMovingAverage; 30 | 31 | } 32 | 33 | public static class GoalStats { 34 | public int id; 35 | public int filled; 36 | public int capacity; 37 | public int numRequests; 38 | public int numFailed; 39 | public int filledMovingAverage; 40 | public int cumulativeFrustration; 41 | public int expectedTargetCountInCube; 42 | public int reasonForDestruction; 43 | } 44 | 45 | public static class GoalsAggregateStats{ 46 | 47 | public GoalsFrameStats frameStats; 48 | 49 | public GoalStats[] goalStats; 50 | } 51 | 52 | public static class ArrayStats { 53 | public int filled; 54 | public int capacity; 55 | public int movingAverage; 56 | } 57 | 58 | public static class IdentityGridStats{ 59 | public int frustration; 60 | public int moveAttempts; 61 | public int numUnableToMove; 62 | public int totalAttractIdentities; 63 | public int unableToGiveTarget; 64 | public int newlyStartedToMove; 65 | public int numFloatingUnableToMove; 66 | public int numStaticIdentities; 67 | public int numCubesInAttractGoalPositions; 68 | public int numEmptyGoals; 69 | public int numPausedIdentities; 70 | public int numMovingIdentities; 71 | public int cubeReversedOnItself; 72 | public int numFloatingUnableToMoveInRepel; 73 | public int numInvalidIdents; 74 | public int numMovingInvalid; 75 | public int settingNewTarget; 76 | public int foundAdjacentTarget; 77 | public int numRandomizerFailed; 78 | public int cantMoveInAnyDirection; 79 | public int shouldntMoveInAnyDirection; 80 | 81 | public int newDirectionLeft; 82 | public int newDirectionRight; 83 | public int newDirectionTop; 84 | public int newDirectionBottom; 85 | public int newDirectionNear; 86 | public int newDirectionFar; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /testdisplay/src/main/java/com/mycardboarddreams/jacobsladder/display/DisplayResults.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.display; 2 | 3 | import com.google.gson.Gson; 4 | import com.mycardboarddreams.jacobsladder.AggregateStats; 5 | import com.mycardboarddreams.jacobsladder.TestProperties; 6 | 7 | import java.io.BufferedReader; 8 | import java.io.File; 9 | import java.io.FileReader; 10 | import java.io.IOException; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | public class DisplayResults { 15 | 16 | private static final String LOCAL_STATS_PATH = System.getProperty("user.dir"); 17 | 18 | 19 | public static void main(String args[]){ 20 | 21 | //runTests(); 22 | 23 | GraphFrame graphFrame = new GraphFrame("JacobsLadder Test Results"); 24 | 25 | callAdbCopyStatsFile(); 26 | List stats = readStatsFile(); 27 | 28 | if(stats == null) 29 | return; 30 | 31 | graphFrame.setData(stats); 32 | } 33 | 34 | private static void runTests() { 35 | System.out.println("Started tests..."); 36 | 37 | try { 38 | Process tests = 39 | Runtime.getRuntime().exec(LOCAL_STATS_PATH + "/gradlew connectedAndroidTest"); 40 | tests.waitFor(); 41 | } catch (IOException | InterruptedException e) { 42 | e.printStackTrace(); 43 | return; 44 | } 45 | 46 | System.out.println("Finished tests"); 47 | } 48 | 49 | private static void callAdbCopyStatsFile(){ 50 | System.out.println("Copying file over"); 51 | 52 | int result = 0; 53 | 54 | try { 55 | Process p = 56 | Runtime.getRuntime().exec("adb pull " + TestProperties.PATH_TO_STATS_FILE_ON_DEVICE + " " + LOCAL_STATS_PATH 57 | ); 58 | result = p.waitFor(); 59 | } catch (IOException | InterruptedException e) { 60 | e.printStackTrace(); 61 | return; 62 | } 63 | 64 | if(result != 0) 65 | System.out.println("Got non-zero result :("); 66 | 67 | System.out.println("Finished copying file"); 68 | } 69 | 70 | private static List readStatsFile() { 71 | 72 | File fileIn = new File(LOCAL_STATS_PATH + "/" + TestProperties.STATS_FILE_NAME); 73 | 74 | BufferedReader reader = null; 75 | 76 | List allStats = new ArrayList<>(); 77 | 78 | try { 79 | 80 | reader = new BufferedReader(new FileReader(fileIn), 81 | TestProperties.TOTAL_NUMBER_OF_SAMPLES*1100); 82 | 83 | String line; 84 | 85 | while ((line = reader.readLine()) != null) 86 | { 87 | AggregateStats stats; 88 | try { 89 | stats = new Gson().fromJson(line, AggregateStats.class); 90 | } catch(Exception e){ 91 | System.out.println("Gson is unable to parse: " + line); 92 | continue; 93 | } 94 | allStats.add(stats); 95 | } 96 | } catch (IOException e1) { 97 | e1.printStackTrace(); 98 | } 99 | finally{ 100 | try { 101 | if(reader != null) 102 | reader.close(); 103 | } catch (IOException e) { 104 | e.printStackTrace(); 105 | } 106 | } 107 | 108 | return allStats; 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /testdisplay/src/main/java/com/mycardboarddreams/jacobsladder/display/DrawableMapping.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.display; 2 | 3 | import java.awt.Color; 4 | import java.util.HashMap; 5 | 6 | public abstract class DrawableMapping extends HashMap{ 7 | 8 | private static final long serialVersionUID = 1L; 9 | 10 | public abstract Color getGraphColor(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testdisplay/src/main/java/com/mycardboarddreams/jacobsladder/display/GraphStrategy.java: -------------------------------------------------------------------------------- 1 | package com.mycardboarddreams.jacobsladder.display; 2 | 3 | public interface GraphStrategy { 4 | public float newValueFraction(T stat); 5 | } 6 | --------------------------------------------------------------------------------