diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/bin/AndroidManifest.xml b/bin/AndroidManifest.xml
deleted file mode 100644
index fe22374..0000000
--- a/bin/AndroidManifest.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/bin/R.txt b/bin/R.txt
deleted file mode 100644
index 21ea0ce..0000000
--- a/bin/R.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-int attr adSize 0x7f010000
-int attr adSizes 0x7f010001
-int attr adUnitId 0x7f010002
-int attr cameraBearing 0x7f010004
-int attr cameraTargetLat 0x7f010005
-int attr cameraTargetLng 0x7f010006
-int attr cameraTilt 0x7f010007
-int attr cameraZoom 0x7f010008
-int attr mapType 0x7f010003
-int attr uiCompass 0x7f010009
-int attr uiRotateGestures 0x7f01000a
-int attr uiScrollGestures 0x7f01000b
-int attr uiTiltGestures 0x7f01000c
-int attr uiZoomControls 0x7f01000d
-int attr uiZoomGestures 0x7f01000e
-int attr useViewLifecycle 0x7f01000f
-int attr zOrderOnTop 0x7f010010
-int color common_action_bar_splitter 0x7f040009
-int color common_signin_btn_dark_text_default 0x7f040000
-int color common_signin_btn_dark_text_disabled 0x7f040002
-int color common_signin_btn_dark_text_focused 0x7f040003
-int color common_signin_btn_dark_text_pressed 0x7f040001
-int color common_signin_btn_default_background 0x7f040008
-int color common_signin_btn_light_text_default 0x7f040004
-int color common_signin_btn_light_text_disabled 0x7f040006
-int color common_signin_btn_light_text_focused 0x7f040007
-int color common_signin_btn_light_text_pressed 0x7f040005
-int color common_signin_btn_text_dark 0x7f04000a
-int color common_signin_btn_text_light 0x7f04000b
-int dimen activity_horizontal_margin 0x7f080000
-int dimen activity_vertical_margin 0x7f080001
-int drawable common_signin_btn_icon_dark 0x7f020000
-int drawable common_signin_btn_icon_disabled_dark 0x7f020001
-int drawable common_signin_btn_icon_disabled_focus_dark 0x7f020002
-int drawable common_signin_btn_icon_disabled_focus_light 0x7f020003
-int drawable common_signin_btn_icon_disabled_light 0x7f020004
-int drawable common_signin_btn_icon_focus_dark 0x7f020005
-int drawable common_signin_btn_icon_focus_light 0x7f020006
-int drawable common_signin_btn_icon_light 0x7f020007
-int drawable common_signin_btn_icon_normal_dark 0x7f020008
-int drawable common_signin_btn_icon_normal_light 0x7f020009
-int drawable common_signin_btn_icon_pressed_dark 0x7f02000a
-int drawable common_signin_btn_icon_pressed_light 0x7f02000b
-int drawable common_signin_btn_text_dark 0x7f02000c
-int drawable common_signin_btn_text_disabled_dark 0x7f02000d
-int drawable common_signin_btn_text_disabled_focus_dark 0x7f02000e
-int drawable common_signin_btn_text_disabled_focus_light 0x7f02000f
-int drawable common_signin_btn_text_disabled_light 0x7f020010
-int drawable common_signin_btn_text_focus_dark 0x7f020011
-int drawable common_signin_btn_text_focus_light 0x7f020012
-int drawable common_signin_btn_text_light 0x7f020013
-int drawable common_signin_btn_text_normal_dark 0x7f020014
-int drawable common_signin_btn_text_normal_light 0x7f020015
-int drawable common_signin_btn_text_pressed_dark 0x7f020016
-int drawable common_signin_btn_text_pressed_light 0x7f020017
-int drawable f0 0x7f020018
-int drawable f1 0x7f020019
-int drawable f2 0x7f02001a
-int drawable f3 0x7f02001b
-int drawable f4 0x7f02001c
-int drawable f5 0x7f02001d
-int drawable f6 0x7f02001e
-int drawable f7 0x7f02001f
-int drawable f8 0x7f020020
-int drawable f9 0x7f020021
-int drawable ic_launcher 0x7f020022
-int drawable ic_plusone_medium_off_client 0x7f020023
-int drawable ic_plusone_small_off_client 0x7f020024
-int drawable ic_plusone_standard_off_client 0x7f020025
-int drawable ic_plusone_tall_off_client 0x7f020026
-int drawable sprite_b 0x7f020027
-int drawable sprite_blockline 0x7f020028
-int drawable sprite_controler 0x7f020029
-int drawable sprite_freeversion 0x7f02002a
-int drawable sprite_gameover 0x7f02002b
-int drawable sprite_i1 0x7f02002c
-int drawable sprite_i1r 0x7f02002d
-int drawable sprite_i2 0x7f02002e
-int drawable sprite_i2r 0x7f02002f
-int drawable sprite_i3 0x7f020030
-int drawable sprite_i3r 0x7f020031
-int drawable sprite_i4 0x7f020032
-int drawable sprite_i4r 0x7f020033
-int drawable sprite_l1 0x7f020034
-int drawable sprite_l2 0x7f020035
-int drawable sprite_s 0x7f020036
-int drawable sprite_score 0x7f020037
-int drawable sprite_t 0x7f020038
-int drawable sprite_z 0x7f020039
-int id action_settings 0x7f050005
-int id hybrid 0x7f050004
-int id none 0x7f050000
-int id normal 0x7f050001
-int id satellite 0x7f050002
-int id terrain 0x7f050003
-int integer google_play_services_version 0x7f070000
-int menu main 0x7f0a0000
-int raw tetris_a 0x7f030000
-int string action_settings 0x7f06001b
-int string app_name 0x7f06001a
-int string auth_client_needs_enabling_title 0x7f060015
-int string auth_client_needs_installation_title 0x7f060016
-int string auth_client_needs_update_title 0x7f060017
-int string auth_client_play_services_err_notification_msg 0x7f060018
-int string auth_client_requested_by_msg 0x7f060019
-int string auth_client_using_bad_version_title 0x7f060014
-int string common_google_play_services_enable_button 0x7f060006
-int string common_google_play_services_enable_text 0x7f060005
-int string common_google_play_services_enable_title 0x7f060004
-int string common_google_play_services_install_button 0x7f060003
-int string common_google_play_services_install_text_phone 0x7f060001
-int string common_google_play_services_install_text_tablet 0x7f060002
-int string common_google_play_services_install_title 0x7f060000
-int string common_google_play_services_invalid_account_text 0x7f06000c
-int string common_google_play_services_invalid_account_title 0x7f06000b
-int string common_google_play_services_network_error_text 0x7f06000a
-int string common_google_play_services_network_error_title 0x7f060009
-int string common_google_play_services_unknown_issue 0x7f06000d
-int string common_google_play_services_unsupported_date_text 0x7f060010
-int string common_google_play_services_unsupported_text 0x7f06000f
-int string common_google_play_services_unsupported_title 0x7f06000e
-int string common_google_play_services_update_button 0x7f060011
-int string common_google_play_services_update_text 0x7f060008
-int string common_google_play_services_update_title 0x7f060007
-int string common_signin_button_text 0x7f060012
-int string common_signin_button_text_long 0x7f060013
-int string hello_world 0x7f06001c
-int style AppBaseTheme 0x7f090000
-int style AppTheme 0x7f090001
-int[] styleable AdsAttrs { 0x7f010000, 0x7f010001, 0x7f010002 }
-int styleable AdsAttrs_adSize 0
-int styleable AdsAttrs_adSizes 1
-int styleable AdsAttrs_adUnitId 2
-int[] styleable MapAttrs { 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010 }
-int styleable MapAttrs_cameraBearing 1
-int styleable MapAttrs_cameraTargetLat 2
-int styleable MapAttrs_cameraTargetLng 3
-int styleable MapAttrs_cameraTilt 4
-int styleable MapAttrs_cameraZoom 5
-int styleable MapAttrs_mapType 0
-int styleable MapAttrs_uiCompass 6
-int styleable MapAttrs_uiRotateGestures 7
-int styleable MapAttrs_uiScrollGestures 8
-int styleable MapAttrs_uiTiltGestures 9
-int styleable MapAttrs_uiZoomControls 10
-int styleable MapAttrs_uiZoomGestures 11
-int styleable MapAttrs_useViewLifecycle 12
-int styleable MapAttrs_zOrderOnTop 13
diff --git a/bin/Tetris.apk b/bin/Tetris.apk
deleted file mode 100644
index 812e818..0000000
Binary files a/bin/Tetris.apk and /dev/null differ
diff --git a/bin/classes.dex b/bin/classes.dex
deleted file mode 100644
index 71e05dd..0000000
Binary files a/bin/classes.dex and /dev/null differ
diff --git a/bin/classes/com/google/android/gms/R$attr.class b/bin/classes/com/google/android/gms/R$attr.class
deleted file mode 100644
index e52e59a..0000000
Binary files a/bin/classes/com/google/android/gms/R$attr.class and /dev/null differ
diff --git a/bin/classes/com/google/android/gms/R$color.class b/bin/classes/com/google/android/gms/R$color.class
deleted file mode 100644
index 5ca3be6..0000000
Binary files a/bin/classes/com/google/android/gms/R$color.class and /dev/null differ
diff --git a/bin/classes/com/google/android/gms/R$drawable.class b/bin/classes/com/google/android/gms/R$drawable.class
deleted file mode 100644
index 2d0848c..0000000
Binary files a/bin/classes/com/google/android/gms/R$drawable.class and /dev/null differ
diff --git a/bin/classes/com/google/android/gms/R$id.class b/bin/classes/com/google/android/gms/R$id.class
deleted file mode 100644
index 880a0bd..0000000
Binary files a/bin/classes/com/google/android/gms/R$id.class and /dev/null differ
diff --git a/bin/classes/com/google/android/gms/R$integer.class b/bin/classes/com/google/android/gms/R$integer.class
deleted file mode 100644
index addeaf7..0000000
Binary files a/bin/classes/com/google/android/gms/R$integer.class and /dev/null differ
diff --git a/bin/classes/com/google/android/gms/R$string.class b/bin/classes/com/google/android/gms/R$string.class
deleted file mode 100644
index 47150ba..0000000
Binary files a/bin/classes/com/google/android/gms/R$string.class and /dev/null differ
diff --git a/bin/classes/com/google/android/gms/R$styleable.class b/bin/classes/com/google/android/gms/R$styleable.class
deleted file mode 100644
index 0eb8070..0000000
Binary files a/bin/classes/com/google/android/gms/R$styleable.class and /dev/null differ
diff --git a/bin/classes/com/google/android/gms/R.class b/bin/classes/com/google/android/gms/R.class
deleted file mode 100644
index 6176364..0000000
Binary files a/bin/classes/com/google/android/gms/R.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/BuildConfig.class b/bin/classes/mangavalk/tetris/BuildConfig.class
deleted file mode 100644
index 626a080..0000000
Binary files a/bin/classes/mangavalk/tetris/BuildConfig.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/CanvasView$1.class b/bin/classes/mangavalk/tetris/CanvasView$1.class
deleted file mode 100644
index 7a227b7..0000000
Binary files a/bin/classes/mangavalk/tetris/CanvasView$1.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/CanvasView$2.class b/bin/classes/mangavalk/tetris/CanvasView$2.class
deleted file mode 100644
index fc492dc..0000000
Binary files a/bin/classes/mangavalk/tetris/CanvasView$2.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/CanvasView.class b/bin/classes/mangavalk/tetris/CanvasView.class
deleted file mode 100644
index f7caa1d..0000000
Binary files a/bin/classes/mangavalk/tetris/CanvasView.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/MainActivity.class b/bin/classes/mangavalk/tetris/MainActivity.class
deleted file mode 100644
index c5015cd..0000000
Binary files a/bin/classes/mangavalk/tetris/MainActivity.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$attr.class b/bin/classes/mangavalk/tetris/R$attr.class
deleted file mode 100644
index 29e8227..0000000
Binary files a/bin/classes/mangavalk/tetris/R$attr.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$color.class b/bin/classes/mangavalk/tetris/R$color.class
deleted file mode 100644
index 5ab881d..0000000
Binary files a/bin/classes/mangavalk/tetris/R$color.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$dimen.class b/bin/classes/mangavalk/tetris/R$dimen.class
deleted file mode 100644
index fd94a93..0000000
Binary files a/bin/classes/mangavalk/tetris/R$dimen.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$drawable.class b/bin/classes/mangavalk/tetris/R$drawable.class
deleted file mode 100644
index fa42f90..0000000
Binary files a/bin/classes/mangavalk/tetris/R$drawable.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$id.class b/bin/classes/mangavalk/tetris/R$id.class
deleted file mode 100644
index f462ed1..0000000
Binary files a/bin/classes/mangavalk/tetris/R$id.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$integer.class b/bin/classes/mangavalk/tetris/R$integer.class
deleted file mode 100644
index 5c896f2..0000000
Binary files a/bin/classes/mangavalk/tetris/R$integer.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$menu.class b/bin/classes/mangavalk/tetris/R$menu.class
deleted file mode 100644
index e9596cf..0000000
Binary files a/bin/classes/mangavalk/tetris/R$menu.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$raw.class b/bin/classes/mangavalk/tetris/R$raw.class
deleted file mode 100644
index c5aa7d5..0000000
Binary files a/bin/classes/mangavalk/tetris/R$raw.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$string.class b/bin/classes/mangavalk/tetris/R$string.class
deleted file mode 100644
index a1c1ea1..0000000
Binary files a/bin/classes/mangavalk/tetris/R$string.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$style.class b/bin/classes/mangavalk/tetris/R$style.class
deleted file mode 100644
index ee08e5e..0000000
Binary files a/bin/classes/mangavalk/tetris/R$style.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R$styleable.class b/bin/classes/mangavalk/tetris/R$styleable.class
deleted file mode 100644
index a14a043..0000000
Binary files a/bin/classes/mangavalk/tetris/R$styleable.class and /dev/null differ
diff --git a/bin/classes/mangavalk/tetris/R.class b/bin/classes/mangavalk/tetris/R.class
deleted file mode 100644
index bb26378..0000000
Binary files a/bin/classes/mangavalk/tetris/R.class and /dev/null differ
diff --git a/bin/dexedLibs/android-support-v4-e38fb59a248717f31affd60bf7493905.jar b/bin/dexedLibs/android-support-v4-e38fb59a248717f31affd60bf7493905.jar
deleted file mode 100644
index 1ea53e2..0000000
Binary files a/bin/dexedLibs/android-support-v4-e38fb59a248717f31affd60bf7493905.jar and /dev/null differ
diff --git a/bin/dexedLibs/google-play-services-86f775ed0e8e6e5cbc00ac77edae487f.jar b/bin/dexedLibs/google-play-services-86f775ed0e8e6e5cbc00ac77edae487f.jar
deleted file mode 100644
index d8b7b15..0000000
Binary files a/bin/dexedLibs/google-play-services-86f775ed0e8e6e5cbc00ac77edae487f.jar and /dev/null differ
diff --git a/bin/dexedLibs/google-play-services_lib-0f09ee896a674b9292f9df3250c11de4.jar b/bin/dexedLibs/google-play-services_lib-0f09ee896a674b9292f9df3250c11de4.jar
deleted file mode 100644
index bc5235c..0000000
Binary files a/bin/dexedLibs/google-play-services_lib-0f09ee896a674b9292f9df3250c11de4.jar and /dev/null differ
diff --git a/bin/jarlist.cache b/bin/jarlist.cache
deleted file mode 100644
index 0565465..0000000
--- a/bin/jarlist.cache
+++ /dev/null
@@ -1,3 +0,0 @@
-# cache for current jar dependency. DO NOT EDIT.
-# format is
-# Encoding is UTF-8
diff --git a/bin/res/crunch/drawable-hdpi/ic_launcher.png b/bin/res/crunch/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 4add5a5..0000000
Binary files a/bin/res/crunch/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/bin/res/crunch/drawable-mdpi/ic_launcher.png b/bin/res/crunch/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index e48e369..0000000
Binary files a/bin/res/crunch/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/bin/res/crunch/drawable-xhdpi/ic_launcher.png b/bin/res/crunch/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 3abc07a..0000000
Binary files a/bin/res/crunch/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/bin/res/crunch/drawable-xxhdpi/ic_launcher.png b/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index a466bd4..0000000
Binary files a/bin/res/crunch/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/bin/resources.ap_ b/bin/resources.ap_
deleted file mode 100644
index 94a837c..0000000
Binary files a/bin/resources.ap_ and /dev/null differ
diff --git a/src/mangavalk/tetris/CanvasView.java b/src/mangavalk/tetris/CanvasView.java
index 451b399..d0aedd4 100644
--- a/src/mangavalk/tetris/CanvasView.java
+++ b/src/mangavalk/tetris/CanvasView.java
@@ -3,1864 +3,54 @@ package mangavalk.tetris;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Paint.Style;
-import android.media.MediaPlayer;
-import android.os.Handler;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.Display;
import android.view.View;
-import java.util.ArrayList;
-import java.util.TimerTask;
-
public class CanvasView extends View
{
// Variabelen
Resources r;
- // Sizes
- float dpHeight;
- float dpWidth;
-
- float Height;
- float Width;
-
- // Block Array
- int[][] blockArray = new int[][]{
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
- };
-
- // Draw Array
- int[][] drawArray = new int[][]{
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
- };
-
- int[][][][] drawBlocks = new int[][][][]{
- {
- {
- {0, 0, 0, 0},
- {8, 9, 10, 11},
- {0, 0, 0, 0},
- {0, 0, 0, 0}
- },
- {
- {0, 0, 12, 0},
- {0, 0, 13, 0},
- {0, 0, 14, 0},
- {0, 0, 15, 0}
- },
- {
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {8, 9, 10, 11},
- {0, 0, 0, 0}
- },
- {
- {0, 12, 0, 0},
- {0, 13, 0, 0},
- {0, 14, 0, 0},
- {0, 15, 0, 0}
- }
- },
- {
- {
- {7, 0, 0, 0},
- {7, 7, 7, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 7, 7, 0},
- {0, 7, 0, 0},
- {0, 7, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 0, 0, 0},
- {7, 7, 7, 0},
- {0, 0, 7, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 7, 0, 0},
- {0, 7, 0, 0},
- {7, 7, 0, 0},
- {0, 0, 0, -1}
- }
- },
- {
- {
- {0, 0, 6, 0},
- {6, 6, 6, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 6, 0, 0},
- {0, 6, 0, 0},
- {0, 6, 6, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 0, 0, 0},
- {6, 6, 6, 0},
- {6, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {6, 6, 0, 0},
- {0, 6, 0, 0},
- {0, 6, 0, 0},
- {0, 0, 0, -1}
- }
- },
- {
- {
- {0, 1, 1, 0},
- {0, 1, 1, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 1, 1, 0},
- {0, 1, 1, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 1, 1, 0},
- {0, 1, 1, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 1, 1, 0},
- {0, 1, 1, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- }
- },
- {
- {
- {0, 3, 3, 0},
- {3, 3, 0, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 3, 0, 0},
- {0, 3, 3, 0},
- {0, 0, 3, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 0, 0, 0},
- {0, 3, 3, 0},
- {3, 3, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {3, 0, 0, 0},
- {3, 3, 0, 0},
- {0, 3, 0, 0},
- {0, 0, 0, -1}
- }
- },
- {
- {
- {0, 2, 0, 0},
- {2, 2, 2, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 2, 0, 0},
- {0, 2, 2, 0},
- {0, 2, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 0, 0, 0},
- {2, 2, 2, 0},
- {0, 2, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 2, 0, 0},
- {2, 2, 0, 0},
- {0, 2, 0, 0},
- {0, 0, 0, -1}
- }
- },
- {
- {
- {5, 5, 0, 0},
- {0, 5, 5, 0},
- {0, 0, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 0, 5, 0},
- {0, 5, 5, 0},
- {0, 5, 0, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 0, 0, 0},
- {5, 5, 0, 0},
- {0, 5, 5, 0},
- {0, 0, 0, -1}
- },
- {
- {0, 5, 0, 0},
- {5, 5, 0, 0},
- {5, 0, 0, 0},
- {0, 0, 0, -1}
- }
- }
- };
-
- int[] LevelSpeed = { 53, 49, 45, 41, 37, 33, 28, 22, 17, 11, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 3};
-
- int GameSpaceLeft = 4;
- int GameSpaceTop = 0;
- int GameSpaceRight = 53;
- int GameSpaceBottom = 115;//125
-
- int CurrentBlock = 0;
- int CurrentBlockPossition = 0;
-
- int NewBlock = 0;
- int NewBlockPossition = 0;
- Bitmap bitmapl1, bitmapl2, bitmapt, bitmapb, bitmaps, bitmapz, bitmapi1, bitmapi2, bitmapi3, bitmapi4,
- bitmapi1r, bitmapi2r, bitmapi3r, bitmapi4r, bitmapblockline, bitmapscore, bitmapcontroller, bitmapgameover;
-
- Bitmap Font0, Font1, Font2, Font3, Font4, Font5, Font6, Font7, Font8, Font9;
-
// Score.
public int startLevel = 0;
- int level = 0;
- int lines = 0;
- int score = 0;
-
- // Game State.
- final int GS_STOPPED = 0;
- final int GS_LOADING = 1;
- final int GS_PLAYING = 2;
- final int GS_GAMEOVER = 3;
- final int GS_PAUSED = 4;
- int GameState = GS_STOPPED;
// Add Settings.
- public boolean PayedVersion;
-
- // Timer.
- TimerTask MoveEvent = new TimerTask() {
- @Override
- public void run() {
- GoDown();
- }
- };
-
- private Handler handler = new Handler();
- private Runnable runnable = new Runnable() {
- @Override
- public void run() {
- level = ( (startLevel + lines)<=200 ? startLevel + (lines / 10) : 20 );
- int newSpeed = (int)((1000 / 59.73) * LevelSpeed[level]);
- handler.postDelayed(this, newSpeed);
- GoDown();
- }
- };
-
- MediaPlayer mp;
-
- /// Init functions
+ public boolean PayedVersion = true;
public CanvasView(Context context)
{
super(context);
super.setBackgroundColor(Color.BLACK);
-
- SpawnBlock();
-
- this.postInvalidate();
}
public void SetActivity(Activity activity)
{
- // Set Display Info.
-
- Display display = activity.getWindowManager().getDefaultDisplay();
- DisplayMetrics outMetrics = new DisplayMetrics ();
- display.getMetrics(outMetrics);
-
- r = getResources();
-
- float density = r.getDisplayMetrics().density;
-
- dpHeight = outMetrics.heightPixels / density;
- dpWidth = outMetrics.widthPixels / density;
-
- Height = outMetrics.heightPixels;
- Width = outMetrics.widthPixels;
-
- // Load Bitmap's.
- LoadSprites();
-
- LoadFont();
-
- // Initlialize.
-
- // Audio
- mp = MediaPlayer.create(activity, R.raw.tetris_a);
+ GamePlay.Instance.SetActivity(activity);
+ GamePlay.Instance.SetCanvas(this);
+ GamePlay.Instance.SetStartLevel(startLevel);
+ GamePlay.Instance.SetPayedVersion(PayedVersion);
+ GamePlay.Instance.SetGameState(GamePlay.GS_LOAD);
// Start Game.
-
- StartGame();
+ if (GamePlay.Instance.GetGameState() == GamePlay.GS_READY)
+ GamePlay.Instance.SetGameState(GamePlay.GS_START);
}
- private void StartGame()
- {
- // Clear.
- for ( int i=0; i= 0 ? blockArray[y][x] : 0))
- {
- case 0:
- break;
- case 1:
- {
- canvas.drawBitmap(bitmapb, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 2:
- {
- canvas.drawBitmap(bitmapt, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 3:
- {
- canvas.drawBitmap(bitmapz, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 5:
- {
- canvas.drawBitmap(bitmaps, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 6:
- {
- canvas.drawBitmap(bitmapl2, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 7:
- {
- canvas.drawBitmap(bitmapl1, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 8:
- {
- canvas.drawBitmap(bitmapi1, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 9:
- {
- canvas.drawBitmap(bitmapi2, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 10:
- {
- canvas.drawBitmap(bitmapi3, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 11:
- {
- canvas.drawBitmap(bitmapi4, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 12: // Rotated
- {
- canvas.drawBitmap(bitmapi1r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 13:
- {
- canvas.drawBitmap(bitmapi2r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 14:
- {
- canvas.drawBitmap(bitmapi3r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- case 15:
- {
- canvas.drawBitmap(bitmapi4r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
- break;
- }
- default:
- {
-
- Rect(canvas, map(y, 0, 18, GameSpaceTop, GameSpaceBottom), map(y+1, 0, 18, GameSpaceTop, GameSpaceBottom),
- map(x, 0, 10, GameSpaceLeft, GameSpaceRight), map(x+1, 0, 10, GameSpaceLeft, GameSpaceRight),
- Color.RED);
- break;
- }
- }
- }
- }
-
- if (GameState == GS_GAMEOVER)
- {
- canvas.drawBitmap(bitmapgameover, (int)GetRealPixelSize(DIP_W, dpWidth, GameSpaceLeft),
- (int)GetRealPixelSize(DIP_H, dpHeight, GameSpaceTop), null);
- }
- }
-
- private void ShowNextComingTetrimino(Canvas canvas)
- {
- int top = 32;
-
- for (int x=0; x<4; x++)
- {
- for (int y=0; y<4; y++)
- {
- switch(drawBlocks[NewBlock][NewBlockPossition][y][x])
- {
- case 1:
- canvas.drawBitmap(bitmapb, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 2:
- canvas.drawBitmap(bitmapt, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 3:
- canvas.drawBitmap(bitmapz, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 5:
- canvas.drawBitmap(bitmaps, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 6:
- canvas.drawBitmap(bitmapl2, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 7:
- canvas.drawBitmap(bitmapl1, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 8:
- canvas.drawBitmap(bitmapi1, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 9:
- canvas.drawBitmap(bitmapi2, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 10:
- canvas.drawBitmap(bitmapi3, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 11:
- canvas.drawBitmap(bitmapi4, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 12:
- canvas.drawBitmap(bitmapi1r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 13:
- canvas.drawBitmap(bitmapi2r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 14:
- canvas.drawBitmap(bitmapi3r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- case 15:
- canvas.drawBitmap(bitmapi4r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
- (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
- break;
- }
- }
- }
- }
-
- private void DrawScore(Canvas canvas, int Score)
- {
- int height = 104-8;
- switch ((Score / 100000) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch ((Score / 10000) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch ((Score / 1000) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch ((Score / 100) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch ((Score / 10) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch (Score % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- }
-
- private void DrawLines(Canvas canvas, int Lines)
- {
- int height = 55-4;
- switch ((Lines / 1000) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch ((Lines / 100) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch ((Lines / 10) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch (Lines % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- }
-
- private void DrawLevel(Canvas canvas, int Level)
- {
- int height = 76-6;
- switch ((Level / 10) % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- switch (Level % 10)
- {
- case 0:
- canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 1:
- canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 2:
- canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 3:
- canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 4:
- canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 5:
- canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 6:
- canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 7:
- canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 8:
- canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- case 9:
- canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
- break;
- }
- }
-
- int OldInputTime=0;
-
- /// Input
- public void sendMove(float x, float y, boolean Released)
- {
- int moveX = (int)((x / Width) * 90);
- int moveY = (int)((y / Height) * 160);
-
- if (!Released)
- {
- if (GameState != GS_GAMEOVER)
- {
- if (moveX >= 28 && moveX <= 55 && moveY >= 143 && moveY <= 155) // Start
- {
- if (GameState == GS_PLAYING)
- onPause();
- else
- {
- mp.start();
- GameState = GS_PLAYING;
- }
- }
- }
- }
-
- if (GameState == GS_PLAYING)
- {
- InputsGamePlaying(x, y, Released);
- }
-
- if (GameState == GS_GAMEOVER)
- {
- StartGame();
- }
- }
-
- private void InputsGamePlaying(float x, float y, boolean Released)
- {
- int moveX = (int)((x / Width) * 90);
- int moveY = (int)((y / Height) * 160);
-
- if (!Released)
- {
- if (moveX >= 1 && moveX <= 11 && moveY >= 122 && moveY <= 133) // Left
- {
- if(CanBlockGoLeft())
- {
- MoveBlockLeft();
- this.postInvalidate();
- }
- }
- else if (moveX >= 55 && moveX <= 70 && moveY >= 122 && moveY <= 137) // Rotate Left
- {
- RotateBlockLeft();
- this.postInvalidate();
- }
- else if (moveX >= 74 && moveX <= 88 && moveY >= 115 && moveY <= 137) // Rotate Right
- {
- RotateBlockRight();
- this.postInvalidate();
- }
- else if (moveX >= 21 && moveX <= 33 && moveY >= 122 && moveY <= 133) // Right
- {
- if(CanBlockGoRight())
- {
- MoveBlockRight();
- this.postInvalidate();
- }
- }
- }
- if (moveX >= 11 && moveX <= 21 && moveY >= 133 && moveY <= 144) // Down
- {
- if (!Released)
- {
- // Soft Drop
- if (CanBlockGoDown())
- {
- MoveBlockDown();
- this.postInvalidate();
- }
- OldInputTime = (int)System.currentTimeMillis();
- }
- else
- {
- int CurrentTime = (int)System.currentTimeMillis();
- if ((CurrentTime - OldInputTime) >= 250)
- {
- // Hard Drop
- while (CanBlockGoDown())
- {
- MoveBlockDown();
- }
- this.postInvalidate();
- }
- }
- }
- }
-
- /// Game Logic
- private void GoDown()
- {
- if (GameState == GS_PLAYING)
- {
- /// Can the Block go down?
- if (CanBlockGoDown())
- {
- MoveBlockDown();
- this.postInvalidate();
- }
- else
- {
- ParseBlockArrayToDrawArray();
-
- CheckForCompletedRows();
-
- //spawn new block
- if (!SpawnBlock())
- {
- GameState = GS_GAMEOVER;
-
- mp.stop();
- this.postInvalidate();
- }
- else
- {
- this.postInvalidate();
- }
- }
- }
- }
-
- private boolean CanBlockGoDown()
- {
- //blockArray
- for (int x=0; x<10; x++)
- {
- for (int y=0; y<18; y++)
- {
- if (blockArray[y][x] != 0)
- {
- if (y + 1 == 18)
- return false;
- else if (drawArray[y+1][x] != 0)
- return false;
- }
- }
- }
-
- return true;
- }
-
- private boolean CanBlockGoLeft()
- {
- //blockArray
- for (int y=0; y<18; y++)
- {
- for (int x=1; x<10; x++)
- {
- if (blockArray[y][x] >= 1)
- {
- if (drawArray[y][x-1] != 0)
- return false;
- }
- if (blockArray[y][0] >= 1)
- return false;
- }
- }
-
- return true;
- }
-
- private boolean CanBlockGoRight()
- {
- //blockArray
- for (int y=0; y<18; y++)
- {
- for (int x=0; x<9; x++)
- {
- if (blockArray[y][x] >= 1)
- {
- if (drawArray[y][x+1] != 0)
- return false;
- }
- if (blockArray[y][9] >= 1)
- return false;
- }
- }
-
- return true;
- }
-
- private void MoveBlockDown()
- {
- for (int x=0; x<10; x++)
- {
- for (int y=17; y>0; y--)
- {
- blockArray[y][x] = blockArray[y-1][x];
- blockArray[y-1][x] = 0;
- }
- }
- }
-
- private void MoveBlockLeft()
- {
- for (int y=0; y<18; y++)
- {
- for (int x=1; x<10; x++)
- {
- blockArray[y][x-1] = blockArray[y][x];
- blockArray[y][x] = 0;
- }
- }
- }
-
- private void MoveBlockRight()
- {
- for (int y=0; y<18; y++)
- {
- for (int x=8; x>=0; x--)
- {
- blockArray[y][x+1] = blockArray[y][x];
- blockArray[y][x] = 0;
- }
- }
- }
-
- private void RotateBlockRight()
- {
- if (drawBlocks[CurrentBlock][CurrentBlockPossition][3][3] != -1)
- {
- for (int y=0; y<18-3; y++)
- {
- for (int x=0; x<10-3; x++)
- {
- boolean foundPossition = true;
-
- for (int i=0; i<4; i++)
- {
- for (int i2=0; i2<4; i2++)
- {
- if (!(blockArray[y+i][x+i2] == drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2]))
- {
- foundPossition = false;
- }
- }
- }
-
-
- if (foundPossition)
- {
- if (CurrentBlockPossition < 3)
- CurrentBlockPossition++;
- else
- CurrentBlockPossition = 0;
- }
-
- // Test for collision !!!
- boolean Collision = false;
-
- for (int i=0; i<4; i++)
- {
- for (int i2=0; i2<4; i2++)
- {
- if (drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2] >= 1)
- {
- if (drawArray[y+i][x+i2] != 0)
- {
- Collision = true;
- }
- }
- }
- }
-
- if (!Collision)
- {
- if (foundPossition)
- {
- for (int i=0; i<4; i++)
- {
- for (int i2=0; i2<4; i2++)
- {
- blockArray[y+i][x+i2] = drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2];
- }
- }
- }
- }
- }
- }
- }
- else
- {
- for (int y=0; y<18-2; y++)
- {
- for (int x=0; x<10-2; x++)
- {
- boolean foundPossition = true;
-
- for (int i=0; i<3; i++)
- {
- for (int i2=0; i2<3; i2++)
- {
- if (!(blockArray[y+i][x+i2] == drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2]))
- {
- foundPossition = false;
- }
- }
- }
-
- if (foundPossition)
- {
- if (CurrentBlockPossition < 3)
- CurrentBlockPossition++;
- else
- CurrentBlockPossition = 0;
- }
-
- // Test for collision !!!
- boolean Collision = false;
-
- for (int i=0; i<3; i++)
- {
- for (int i2=0; i2<3; i2++)
- {
- if (drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2] >= 1)
- {
- if (drawArray[y+i][x+i2] != 0)
- {
- Collision = true;
- }
- }
- }
- }
-
- if (!Collision)
- {
- if (foundPossition)
- {
- for (int i=0; i<3; i++)
- {
- for (int i2=0; i2<3; i2++)
- {
- blockArray[y+i][x+i2] = drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2];
- }
- }
- }
- }
- }
- }
- }
- }
-
- private void RotateBlockLeft()
- {
- if (drawBlocks[CurrentBlock][CurrentBlockPossition][3][3] != -1)
- {
- for (int y=0; y<18-3; y++)
- {
- for (int x=0; x<10-3; x++)
- {
- boolean foundPossition = true;
-
- for (int i=0; i<4; i++)
- {
- for (int i2=0; i2<4; i2++)
- {
- if (!(blockArray[y+i][x+i2] == drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2]))
- {
- foundPossition = false;
- }
- }
- }
-
- // Test for collision !!!
- boolean Collision = false;
-
- if (foundPossition)
- {
- if (CurrentBlockPossition > 0)
- CurrentBlockPossition--;
- else
- CurrentBlockPossition = 3;
- }
-
- for (int i=0; i<4; i++)
- {
- for (int i2=0; i2<4; i2++)
- {
- if (drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2] != 0)
- {
- if (drawArray[y+i][x+i2] != 0)
- {
- Collision = true;
- }
- }
- }
- }
-
- if (!Collision)
- {
- if (foundPossition)
- {
- for (int i=0; i<4; i++)
- {
- for (int i2=0; i2<4; i2++)
- {
- blockArray[y+i][x+i2] = drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2];
- }
- }
- }
- }
- }
- }
- }
- else
- {
- for (int y=0; y<18-2; y++)
- {
- for (int x=0; x<10-2; x++)
- {
- boolean foundPossition = true;
-
- for (int i=0; i<3; i++)
- {
- for (int i2=0; i2<3; i2++)
- {
- if (!(blockArray[y+i][x+i2] == drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2]))
- {
- foundPossition = false;
- }
- }
- }
-
- // Test for collision !!!
- boolean Collision = false;
-
- if (foundPossition)
- {
- if (CurrentBlockPossition > 0)
- CurrentBlockPossition--;
- else
- CurrentBlockPossition = 3;
- }
-
- for (int i=0; i<3; i++)
- {
- for (int i2=0; i2<3; i2++)
- {
- if (drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2] != 0)
- {
- if (drawArray[y+i][x+i2] != 0)
- {
- Collision = true;
- }
- }
- }
- }
-
- if (!Collision)
- {
- if (foundPossition)
- {
- for (int i=0; i<3; i++)
- {
- for (int i2=0; i2<3; i2++)
- {
- blockArray[y+i][x+i2] = drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2];
- }
- }
- }
- }
- }
- }
- }
- }
-
- private void ParseBlockArrayToDrawArray()
- {
- for (int x=0; x<10; x++)
- {
- for (int y=0; y<18; y++)
- {
- drawArray[y][x] += blockArray[y][x];
- blockArray[y][x] = 0;
- }
- }
- }
-
- private void CheckForCompletedRows()
- {
- int LinesCleared = 0;
- //drawArray
- for (int y=17; y>1; y--)
- {
- boolean isComplete = true;
-
- for (int x=0; x<10; x++)
- {
- if (drawArray[y][x] == 0)
- isComplete = false;
- }
-
- if (isComplete)
- {
- for (int i=y; i>1; i--)
- for (int x=0; x<10; x++)
- {
- drawArray[i][x] = drawArray[i-1][x];
- }
- LinesCleared++;
- lines++;
- level = ( (startLevel + lines)<=200 ? startLevel + (lines / 10) : 20 );
- y++;
- }
- }
- // Do Score here
- switch (LinesCleared)
- {
- case 1:
- score += 40 * ( level + 1 );
- break;
- case 2:
- score += 100 * ( level + 1 );
- break;
- case 3:
- score += 300 * ( level + 1 );
- break;
- case 4:
- score += 1200 * ( level + 1 );
- break;
- }
- }
-
- ArrayList Tetrimino;
- private void CheckTetriminoSpawnArray()
- {
- // Pseudo random
- if (Tetrimino == null || Tetrimino.size() <= 0)
- {
- Tetrimino = new ArrayList();
- do{
- int newTetrimino = (int)(Math.random() * (7));
- if (!Tetrimino.contains(newTetrimino))
- Tetrimino.add(newTetrimino);
- }while (Tetrimino.size() < 7);
- }
- }
-
-
- private boolean SpawnBlock()
- {
- CheckTetriminoSpawnArray();
-
- CurrentBlock = NewBlock;
- CurrentBlockPossition = NewBlockPossition;
-
- NewBlock = Tetrimino.get(0);
- Tetrimino.remove(0);
- NewBlockPossition = 0;
-
- for (int x=0; x<4; x++)
- {
- for (int y=0; y<4; y++)
- {
- if (drawBlocks[CurrentBlock][CurrentBlockPossition][y][x] != 0)
- if (drawArray[y][x+3] != 0)
- return false;
- }
- }
-
- for (int x=0; x<4; x++)
- {
- for (int y=0; y<4; y++)
- {
- if (drawBlocks[CurrentBlock][CurrentBlockPossition][y][x] >= 0)
- blockArray[y][x+3] = drawBlocks[CurrentBlock][CurrentBlockPossition][y][x];
- }
- }
-
- return true;
- }
-
- /// other logic
-
- private void Rect(Canvas canvas, float Top, float Bottom, float Left, float Right, int Color)
- {
- Paint paint = new Paint();
- paint.setAntiAlias(true);
- paint.setColor(Color);
- paint.setStyle(Style.FILL);
-
- canvas.drawRect(
- GetRealPixelSize(DIP_W, dpWidth, Left),
- GetRealPixelSize(DIP_H, dpHeight, Top),
- GetRealPixelSize(DIP_W, dpWidth, Right),
- GetRealPixelSize(DIP_H, dpHeight, Bottom), paint);
- }
-
- final static int DIP_H = 0;
- final static int DIP_W = 1;
-
- private float GetRealPixelSize(int wH, float dpWH, double DIP)
- {
- if (wH == DIP_H)
- return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float)(dpWH * ( DIP / 160 )), r.getDisplayMetrics());
- else if (wH == DIP_W)
- return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float)(dpWH * ( DIP / 90 )), r.getDisplayMetrics());
- else
- return 0;
- }
-
- float map(float x, float in_min, float in_max, float out_min, float out_max)
- {
- return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
- }
-
}
diff --git a/src/mangavalk/tetris/GamePlay.java b/src/mangavalk/tetris/GamePlay.java
new file mode 100644
index 0000000..1c6fd4c
--- /dev/null
+++ b/src/mangavalk/tetris/GamePlay.java
@@ -0,0 +1,1939 @@
+package mangavalk.tetris;
+
+import android.app.Activity;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Paint.Style;
+import android.media.MediaPlayer;
+import android.os.Handler;
+import android.util.DisplayMetrics;
+import android.util.TypedValue;
+import android.view.Display;
+
+import java.util.ArrayList;
+import java.util.TimerTask;
+
+public class GamePlay implements GameStateInterface
+{
+ // Instance.
+ public static GameStateInterface Instance = new GamePlay();
+
+ // GameState.
+ protected int GameState = GS_STOPPED;
+
+ // Methods.
+ @Override
+ public void DrawFrame(Canvas canvas) {
+ DrawGameSpace(canvas);
+ }
+
+ @Override
+ public void onPause()
+ {
+ mp.pause();
+
+ GameState = GS_PAUSED;
+ }
+
+ @Override
+ public void SendMove(float x, float y, boolean pointerUp) {
+ int moveX = (int)((x / Width) * 90);
+ int moveY = (int)((y / Height) * 160);
+
+ if (!pointerUp)
+ {
+ if (GameState != GS_GAMEOVER)
+ {
+ if (moveX >= 28 && moveX <= 55 && moveY >= 143 && moveY <= 155) // Start
+ {
+ if (GameState == GS_PLAYING)
+ onPause();
+ else
+ {
+ mp.start();
+ GameState = GS_PLAYING;
+ }
+ }
+ }
+ }
+
+ if (GameState == GS_PLAYING)
+ {
+ InputsGamePlaying(x, y, pointerUp);
+ }
+
+ if (GameState == GS_GAMEOVER)
+ {
+ StartGame();
+ }
+ }
+
+ @Override
+ public void SetGameState(int gameState) {
+ GameState = gameState;
+
+ switch(GameState)
+ {
+ case GS_LOAD:
+ {
+ Load();
+ break;
+ }
+ case GS_START:
+ {
+ StartGame();
+ break;
+ }
+ }
+ }
+
+ // Set
+ @Override
+ public void SetCanvas(CanvasView _CanvasView)
+ {
+ canvasView = _CanvasView;
+ }
+
+ @Override
+ public void SetActivity(Activity _Activity)
+ {
+ activity = _Activity;
+ }
+
+ @Override
+ public void SetStartLevel(int StartLevel)
+ {
+ startLevel = StartLevel;
+ }
+
+ @Override
+ public void SetPayedVersion(boolean payedVersion)
+ {
+ PayedVersion = payedVersion;
+ }
+
+ // Get
+ @Override
+ public int GetGameState()
+ {
+ return GameState;
+ }
+
+ // Internal.
+ CanvasView canvasView;
+ Activity activity = null;
+
+ // Variabelen
+ Resources r;
+
+ // Sizes
+ float dpHeight;
+ float dpWidth;
+
+ float Height;
+ float Width;
+
+ // Block Array
+ int[][] blockArray = new int[][]{
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ };
+
+ // Draw Array
+ int[][] drawArray = new int[][]{
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ };
+
+ int[][][][] drawBlocks = new int[][][][]{
+ {
+ {
+ {0, 0, 0, 0},
+ {8, 9, 10, 11},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0}
+ },
+ {
+ {0, 0, 12, 0},
+ {0, 0, 13, 0},
+ {0, 0, 14, 0},
+ {0, 0, 15, 0}
+ },
+ {
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {8, 9, 10, 11},
+ {0, 0, 0, 0}
+ },
+ {
+ {0, 12, 0, 0},
+ {0, 13, 0, 0},
+ {0, 14, 0, 0},
+ {0, 15, 0, 0}
+ }
+ },
+ {
+ {
+ {7, 0, 0, 0},
+ {7, 7, 7, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 7, 7, 0},
+ {0, 7, 0, 0},
+ {0, 7, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 0, 0, 0},
+ {7, 7, 7, 0},
+ {0, 0, 7, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 7, 0, 0},
+ {0, 7, 0, 0},
+ {7, 7, 0, 0},
+ {0, 0, 0, -1}
+ }
+ },
+ {
+ {
+ {0, 0, 6, 0},
+ {6, 6, 6, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 6, 0, 0},
+ {0, 6, 0, 0},
+ {0, 6, 6, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 0, 0, 0},
+ {6, 6, 6, 0},
+ {6, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {6, 6, 0, 0},
+ {0, 6, 0, 0},
+ {0, 6, 0, 0},
+ {0, 0, 0, -1}
+ }
+ },
+ {
+ {
+ {0, 1, 1, 0},
+ {0, 1, 1, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 1, 1, 0},
+ {0, 1, 1, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 1, 1, 0},
+ {0, 1, 1, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 1, 1, 0},
+ {0, 1, 1, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ }
+ },
+ {
+ {
+ {0, 3, 3, 0},
+ {3, 3, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 3, 0, 0},
+ {0, 3, 3, 0},
+ {0, 0, 3, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 0, 0, 0},
+ {0, 3, 3, 0},
+ {3, 3, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {3, 0, 0, 0},
+ {3, 3, 0, 0},
+ {0, 3, 0, 0},
+ {0, 0, 0, -1}
+ }
+ },
+ {
+ {
+ {0, 2, 0, 0},
+ {2, 2, 2, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 2, 0, 0},
+ {0, 2, 2, 0},
+ {0, 2, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 0, 0, 0},
+ {2, 2, 2, 0},
+ {0, 2, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 2, 0, 0},
+ {2, 2, 0, 0},
+ {0, 2, 0, 0},
+ {0, 0, 0, -1}
+ }
+ },
+ {
+ {
+ {5, 5, 0, 0},
+ {0, 5, 5, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 0, 5, 0},
+ {0, 5, 5, 0},
+ {0, 5, 0, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 0, 0, 0},
+ {5, 5, 0, 0},
+ {0, 5, 5, 0},
+ {0, 0, 0, -1}
+ },
+ {
+ {0, 5, 0, 0},
+ {5, 5, 0, 0},
+ {5, 0, 0, 0},
+ {0, 0, 0, -1}
+ }
+ }
+ };
+
+ int[] LevelSpeed = { 53, 49, 45, 41, 37, 33, 28, 22, 17, 11, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 3};
+
+ // Parameters.
+ int GameSpaceLeft = 4;
+ int GameSpaceTop = 0;
+ int GameSpaceRight = 53;
+ int GameSpaceBottom = 115;
+
+ // Tetrmino.
+ int CurrentBlock = 0;
+ int CurrentBlockPossition = 0;
+
+ int NewBlock = 0;
+ int NewBlockPossition = 0;
+
+ // Sprites.
+ Bitmap bitmapl1, bitmapl2, bitmapt, bitmapb, bitmaps, bitmapz, bitmapi1, bitmapi2, bitmapi3, bitmapi4,
+ bitmapi1r, bitmapi2r, bitmapi3r, bitmapi4r, bitmapblockline, bitmapscore, bitmapcontroller, bitmapgameover;
+
+ Bitmap Font0, Font1, Font2, Font3, Font4, Font5, Font6, Font7, Font8, Font9;
+
+ // Audio.
+ MediaPlayer mp;
+
+ // Score.
+ int startLevel = 0;
+ int level = 0;
+ int lines = 0;
+ int score = 0;
+
+ // Add Settings.
+ boolean PayedVersion;
+
+ // Timer.
+ TimerTask MoveEvent = new TimerTask() {
+ @Override
+ public void run() {
+ GoDown();
+ }
+ };
+
+ private Handler handler = new Handler();
+ private Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ level = ( (startLevel + lines)<=200 ? startLevel + (lines / 10) : 20 );
+ int newSpeed = (int)((1000 / 59.73) * LevelSpeed[level]);
+ handler.postDelayed(this, newSpeed);
+ GoDown();
+ }
+ };
+
+
+ // Methods.
+
+ // Inputs.
+ int OldInputTime=0;
+
+ // Methods.
+ private void StartGame()
+ {
+ // Clear.
+ for ( int i=0; i= 0 ? blockArray[y][x] : 0))
+ {
+ case 0:
+ break;
+ case 1:
+ {
+ canvas.drawBitmap(bitmapb, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 2:
+ {
+ canvas.drawBitmap(bitmapt, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 3:
+ {
+ canvas.drawBitmap(bitmapz, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 5:
+ {
+ canvas.drawBitmap(bitmaps, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 6:
+ {
+ canvas.drawBitmap(bitmapl2, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 7:
+ {
+ canvas.drawBitmap(bitmapl1, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 8:
+ {
+ canvas.drawBitmap(bitmapi1, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 9:
+ {
+ canvas.drawBitmap(bitmapi2, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 10:
+ {
+ canvas.drawBitmap(bitmapi3, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 11:
+ {
+ canvas.drawBitmap(bitmapi4, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 12: // Rotated
+ {
+ canvas.drawBitmap(bitmapi1r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 13:
+ {
+ canvas.drawBitmap(bitmapi2r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 14:
+ {
+ canvas.drawBitmap(bitmapi3r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ case 15:
+ {
+ canvas.drawBitmap(bitmapi4r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 10, GameSpaceLeft, GameSpaceRight)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 18, GameSpaceTop, GameSpaceBottom)), null);
+ break;
+ }
+ default:
+ {
+
+ Rect(canvas, map(y, 0, 18, GameSpaceTop, GameSpaceBottom), map(y+1, 0, 18, GameSpaceTop, GameSpaceBottom),
+ map(x, 0, 10, GameSpaceLeft, GameSpaceRight), map(x+1, 0, 10, GameSpaceLeft, GameSpaceRight),
+ Color.RED);
+ break;
+ }
+ }
+ }
+ }
+
+ if (GameState == GS_GAMEOVER)
+ {
+ canvas.drawBitmap(bitmapgameover, (int)GetRealPixelSize(DIP_W, dpWidth, GameSpaceLeft),
+ (int)GetRealPixelSize(DIP_H, dpHeight, GameSpaceTop), null);
+ }
+ }
+
+ private void ShowNextComingTetrimino(Canvas canvas)
+ {
+ int top = 32;
+
+ for (int x=0; x<4; x++)
+ {
+ for (int y=0; y<4; y++)
+ {
+ switch(drawBlocks[NewBlock][NewBlockPossition][y][x])
+ {
+ case 1:
+ canvas.drawBitmap(bitmapb, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 2:
+ canvas.drawBitmap(bitmapt, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 3:
+ canvas.drawBitmap(bitmapz, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 5:
+ canvas.drawBitmap(bitmaps, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 6:
+ canvas.drawBitmap(bitmapl2, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 7:
+ canvas.drawBitmap(bitmapl1, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 8:
+ canvas.drawBitmap(bitmapi1, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 9:
+ canvas.drawBitmap(bitmapi2, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 10:
+ canvas.drawBitmap(bitmapi3, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 11:
+ canvas.drawBitmap(bitmapi4, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 12:
+ canvas.drawBitmap(bitmapi1r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 13:
+ canvas.drawBitmap(bitmapi2r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 14:
+ canvas.drawBitmap(bitmapi3r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ case 15:
+ canvas.drawBitmap(bitmapi4r, (int)GetRealPixelSize(DIP_W, dpWidth, map(x, 0, 4, GameSpaceRight + 4 + 9, GameSpaceRight + 4 + 9 + (map(1, 0, 10, GameSpaceLeft, GameSpaceRight) - map(0, 0, 10, GameSpaceLeft, GameSpaceRight)) * 4)),
+ (int)GetRealPixelSize(DIP_H, dpHeight, map(y, 0, 4, (GameSpaceBottom - top), (GameSpaceBottom - top) + ((map(1, 0, 18, GameSpaceTop, GameSpaceBottom) - map(0, 0, 18, GameSpaceTop, GameSpaceBottom)) * 4))), null);
+ break;
+ }
+ }
+ }
+ }
+
+ private void DrawScore(Canvas canvas, int Score)
+ {
+ int height = 104-8;
+ switch ((Score / 100000) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6-5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch ((Score / 10000) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch ((Score / 1000) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch ((Score / 100) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch ((Score / 10) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch (Score % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ }
+
+ private void DrawLines(Canvas canvas, int Lines)
+ {
+ int height = 55-4;
+ switch ((Lines / 1000) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch ((Lines / 100) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch ((Lines / 10) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch (Lines % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ }
+
+ private void DrawLevel(Canvas canvas, int Level)
+ {
+ int height = 76-6;
+ switch ((Level / 10) % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ switch (Level % 10)
+ {
+ case 0:
+ canvas.drawBitmap(Font0, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 1:
+ canvas.drawBitmap(Font1, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 2:
+ canvas.drawBitmap(Font2, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 3:
+ canvas.drawBitmap(Font3, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 4:
+ canvas.drawBitmap(Font4, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 5:
+ canvas.drawBitmap(Font5, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 6:
+ canvas.drawBitmap(Font6, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 7:
+ canvas.drawBitmap(Font7, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 8:
+ canvas.drawBitmap(Font8, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ case 9:
+ canvas.drawBitmap(Font9, GetRealPixelSize(DIP_W, dpWidth, GameSpaceRight+4+6+5+5+5), GetRealPixelSize(DIP_H, dpHeight, GameSpaceBottom - height), null);
+ break;
+ }
+ }
+
+ // Input
+ public void sendMove(float x, float y, boolean Released)
+ {
+ int moveX = (int)((x / Width) * 90);
+ int moveY = (int)((y / Height) * 160);
+
+ if (!Released)
+ {
+ if (GameState != GS_GAMEOVER)
+ {
+ if (moveX >= 28 && moveX <= 55 && moveY >= 143 && moveY <= 155) // Start
+ {
+ if (GameState == GS_PLAYING)
+ onPause();
+ else
+ {
+ mp.start();
+ GameState = GS_PLAYING;
+ }
+ }
+ }
+ }
+
+ if (GameState == GS_PLAYING)
+ {
+ InputsGamePlaying(x, y, Released);
+ }
+
+ if (GameState == GS_GAMEOVER)
+ {
+ StartGame();
+ }
+ }
+
+ private void InputsGamePlaying(float x, float y, boolean Released)
+ {
+ int moveX = (int)((x / Width) * 90);
+ int moveY = (int)((y / Height) * 160);
+
+ if (!Released)
+ {
+ if (moveX >= 1 && moveX <= 11 && moveY >= 122 && moveY <= 133) // Left
+ {
+ if(CanBlockGoLeft())
+ {
+ MoveBlockLeft();
+ canvasView.postInvalidate();
+ }
+ }
+ else if (moveX >= 55 && moveX <= 70 && moveY >= 122 && moveY <= 137) // Rotate Left
+ {
+ RotateBlockLeft();
+ canvasView.postInvalidate();
+ }
+ else if (moveX >= 74 && moveX <= 88 && moveY >= 115 && moveY <= 137) // Rotate Right
+ {
+ RotateBlockRight();
+ canvasView.postInvalidate();
+ }
+ else if (moveX >= 21 && moveX <= 33 && moveY >= 122 && moveY <= 133) // Right
+ {
+ if(CanBlockGoRight())
+ {
+ MoveBlockRight();
+ canvasView.postInvalidate();
+ }
+ }
+ }
+ if (moveX >= 11 && moveX <= 21 && moveY >= 133 && moveY <= 144) // Down
+ {
+ if (!Released)
+ {
+ // Soft Drop
+ if (CanBlockGoDown())
+ {
+ MoveBlockDown();
+ canvasView.postInvalidate();
+ }
+ OldInputTime = (int)System.currentTimeMillis();
+ }
+ else
+ {
+ int CurrentTime = (int)System.currentTimeMillis();
+ if ((CurrentTime - OldInputTime) >= 250)
+ {
+ // Hard Drop
+ while (CanBlockGoDown())
+ {
+ MoveBlockDown();
+ }
+ canvasView.postInvalidate();
+ }
+ }
+ }
+ }
+
+ // Game Logic
+ private void GoDown()
+ {
+ if (GameState == GS_PLAYING)
+ {
+ /// Can the Block go down?
+ if (CanBlockGoDown())
+ {
+ MoveBlockDown();
+ canvasView.postInvalidate();
+ }
+ else
+ {
+ ParseBlockArrayToDrawArray();
+
+ CheckForCompletedRows();
+
+ //spawn new block
+ if (!SpawnBlock())
+ {
+ GameState = GS_GAMEOVER;
+
+ mp.stop();
+ canvasView.postInvalidate();
+ }
+ else
+ {
+ canvasView.postInvalidate();
+ }
+ }
+ }
+ }
+
+ private boolean CanBlockGoDown()
+ {
+ //blockArray
+ for (int x=0; x<10; x++)
+ {
+ for (int y=0; y<18; y++)
+ {
+ if (blockArray[y][x] != 0)
+ {
+ if (y + 1 == 18)
+ return false;
+ else if (drawArray[y+1][x] != 0)
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private boolean CanBlockGoLeft()
+ {
+ //blockArray
+ for (int y=0; y<18; y++)
+ {
+ for (int x=1; x<10; x++)
+ {
+ if (blockArray[y][x] >= 1)
+ {
+ if (drawArray[y][x-1] != 0)
+ return false;
+ }
+ if (blockArray[y][0] >= 1)
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean CanBlockGoRight()
+ {
+ //blockArray
+ for (int y=0; y<18; y++)
+ {
+ for (int x=0; x<9; x++)
+ {
+ if (blockArray[y][x] >= 1)
+ {
+ if (drawArray[y][x+1] != 0)
+ return false;
+ }
+ if (blockArray[y][9] >= 1)
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private void MoveBlockDown()
+ {
+ for (int x=0; x<10; x++)
+ {
+ for (int y=17; y>0; y--)
+ {
+ blockArray[y][x] = blockArray[y-1][x];
+ blockArray[y-1][x] = 0;
+ }
+ }
+ }
+
+ private void MoveBlockLeft()
+ {
+ for (int y=0; y<18; y++)
+ {
+ for (int x=1; x<10; x++)
+ {
+ blockArray[y][x-1] = blockArray[y][x];
+ blockArray[y][x] = 0;
+ }
+ }
+ }
+
+ private void MoveBlockRight()
+ {
+ for (int y=0; y<18; y++)
+ {
+ for (int x=8; x>=0; x--)
+ {
+ blockArray[y][x+1] = blockArray[y][x];
+ blockArray[y][x] = 0;
+ }
+ }
+ }
+
+ private void RotateBlockRight()
+ {
+ if (drawBlocks[CurrentBlock][CurrentBlockPossition][3][3] != -1)
+ {
+ for (int y=0; y<18-3; y++)
+ {
+ for (int x=0; x<10-3; x++)
+ {
+ boolean foundPossition = true;
+
+ for (int i=0; i<4; i++)
+ {
+ for (int i2=0; i2<4; i2++)
+ {
+ if (!(blockArray[y+i][x+i2] == drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2]))
+ {
+ foundPossition = false;
+ }
+ }
+ }
+
+
+ if (foundPossition)
+ {
+ if (CurrentBlockPossition < 3)
+ CurrentBlockPossition++;
+ else
+ CurrentBlockPossition = 0;
+ }
+
+ // Test for collision !!!
+ boolean Collision = false;
+
+ for (int i=0; i<4; i++)
+ {
+ for (int i2=0; i2<4; i2++)
+ {
+ if (drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2] >= 1)
+ {
+ if (drawArray[y+i][x+i2] != 0)
+ {
+ Collision = true;
+ }
+ }
+ }
+ }
+
+ if (!Collision)
+ {
+ if (foundPossition)
+ {
+ for (int i=0; i<4; i++)
+ {
+ for (int i2=0; i2<4; i2++)
+ {
+ blockArray[y+i][x+i2] = drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for (int y=0; y<18-2; y++)
+ {
+ for (int x=0; x<10-2; x++)
+ {
+ boolean foundPossition = true;
+
+ for (int i=0; i<3; i++)
+ {
+ for (int i2=0; i2<3; i2++)
+ {
+ if (!(blockArray[y+i][x+i2] == drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2]))
+ {
+ foundPossition = false;
+ }
+ }
+ }
+
+ if (foundPossition)
+ {
+ if (CurrentBlockPossition < 3)
+ CurrentBlockPossition++;
+ else
+ CurrentBlockPossition = 0;
+ }
+
+ // Test for collision !!!
+ boolean Collision = false;
+
+ for (int i=0; i<3; i++)
+ {
+ for (int i2=0; i2<3; i2++)
+ {
+ if (drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2] >= 1)
+ {
+ if (drawArray[y+i][x+i2] != 0)
+ {
+ Collision = true;
+ }
+ }
+ }
+ }
+
+ if (!Collision)
+ {
+ if (foundPossition)
+ {
+ for (int i=0; i<3; i++)
+ {
+ for (int i2=0; i2<3; i2++)
+ {
+ blockArray[y+i][x+i2] = drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void RotateBlockLeft()
+ {
+ if (drawBlocks[CurrentBlock][CurrentBlockPossition][3][3] != -1)
+ {
+ for (int y=0; y<18-3; y++)
+ {
+ for (int x=0; x<10-3; x++)
+ {
+ boolean foundPossition = true;
+
+ for (int i=0; i<4; i++)
+ {
+ for (int i2=0; i2<4; i2++)
+ {
+ if (!(blockArray[y+i][x+i2] == drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2]))
+ {
+ foundPossition = false;
+ }
+ }
+ }
+
+ // Test for collision !!!
+ boolean Collision = false;
+
+ if (foundPossition)
+ {
+ if (CurrentBlockPossition > 0)
+ CurrentBlockPossition--;
+ else
+ CurrentBlockPossition = 3;
+ }
+
+ for (int i=0; i<4; i++)
+ {
+ for (int i2=0; i2<4; i2++)
+ {
+ if (drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2] != 0)
+ {
+ if (drawArray[y+i][x+i2] != 0)
+ {
+ Collision = true;
+ }
+ }
+ }
+ }
+
+ if (!Collision)
+ {
+ if (foundPossition)
+ {
+ for (int i=0; i<4; i++)
+ {
+ for (int i2=0; i2<4; i2++)
+ {
+ blockArray[y+i][x+i2] = drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for (int y=0; y<18-2; y++)
+ {
+ for (int x=0; x<10-2; x++)
+ {
+ boolean foundPossition = true;
+
+ for (int i=0; i<3; i++)
+ {
+ for (int i2=0; i2<3; i2++)
+ {
+ if (!(blockArray[y+i][x+i2] == drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2]))
+ {
+ foundPossition = false;
+ }
+ }
+ }
+
+ // Test for collision !!!
+ boolean Collision = false;
+
+ if (foundPossition)
+ {
+ if (CurrentBlockPossition > 0)
+ CurrentBlockPossition--;
+ else
+ CurrentBlockPossition = 3;
+ }
+
+ for (int i=0; i<3; i++)
+ {
+ for (int i2=0; i2<3; i2++)
+ {
+ if (drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2] != 0)
+ {
+ if (drawArray[y+i][x+i2] != 0)
+ {
+ Collision = true;
+ }
+ }
+ }
+ }
+
+ if (!Collision)
+ {
+ if (foundPossition)
+ {
+ for (int i=0; i<3; i++)
+ {
+ for (int i2=0; i2<3; i2++)
+ {
+ blockArray[y+i][x+i2] = drawBlocks[CurrentBlock][CurrentBlockPossition][i][i2];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void ParseBlockArrayToDrawArray()
+ {
+ for (int x=0; x<10; x++)
+ {
+ for (int y=0; y<18; y++)
+ {
+ drawArray[y][x] += blockArray[y][x];
+ blockArray[y][x] = 0;
+ }
+ }
+ }
+
+ private void CheckForCompletedRows()
+ {
+ int LinesCleared = 0;
+ //drawArray
+ for (int y=17; y>1; y--)
+ {
+ boolean isComplete = true;
+
+ for (int x=0; x<10; x++)
+ {
+ if (drawArray[y][x] == 0)
+ isComplete = false;
+ }
+
+ if (isComplete)
+ {
+ for (int i=y; i>1; i--)
+ for (int x=0; x<10; x++)
+ {
+ drawArray[i][x] = drawArray[i-1][x];
+ }
+ LinesCleared++;
+ lines++;
+ level = ( (startLevel + lines)<=200 ? startLevel + (lines / 10) : 20 );
+ y++;
+ }
+ }
+ // Do Score here
+ switch (LinesCleared)
+ {
+ case 1:
+ score += 40 * ( level + 1 );
+ break;
+ case 2:
+ score += 100 * ( level + 1 );
+ break;
+ case 3:
+ score += 300 * ( level + 1 );
+ break;
+ case 4:
+ score += 1200 * ( level + 1 );
+ break;
+ }
+ }
+
+ ArrayList Tetrimino;
+ private void CheckTetriminoSpawnArray()
+ {
+ // Pseudo random
+ if (Tetrimino == null || Tetrimino.size() <= 0)
+ {
+ Tetrimino = new ArrayList();
+ do{
+ int newTetrimino = (int)(Math.random() * (7));
+ if (!Tetrimino.contains(newTetrimino))
+ Tetrimino.add(newTetrimino);
+ }while (Tetrimino.size() < 7);
+ }
+ }
+
+
+ private boolean SpawnBlock()
+ {
+ CheckTetriminoSpawnArray();
+
+ CurrentBlock = NewBlock;
+ CurrentBlockPossition = NewBlockPossition;
+
+ NewBlock = Tetrimino.get(0);
+ Tetrimino.remove(0);
+ NewBlockPossition = 0;
+
+ for (int x=0; x<4; x++)
+ {
+ for (int y=0; y<4; y++)
+ {
+ if (drawBlocks[CurrentBlock][CurrentBlockPossition][y][x] != 0)
+ if (drawArray[y][x+3] != 0)
+ return false;
+ }
+ }
+
+ for (int x=0; x<4; x++)
+ {
+ for (int y=0; y<4; y++)
+ {
+ if (drawBlocks[CurrentBlock][CurrentBlockPossition][y][x] >= 0)
+ blockArray[y][x+3] = drawBlocks[CurrentBlock][CurrentBlockPossition][y][x];
+ }
+ }
+
+ return true;
+ }
+
+ // other logic
+ private void Rect(Canvas canvas, float Top, float Bottom, float Left, float Right, int Color)
+ {
+ Paint paint = new Paint();
+ paint.setAntiAlias(true);
+ paint.setColor(Color);
+ paint.setStyle(Style.FILL);
+
+ canvas.drawRect(
+ GetRealPixelSize(DIP_W, dpWidth, Left),
+ GetRealPixelSize(DIP_H, dpHeight, Top),
+ GetRealPixelSize(DIP_W, dpWidth, Right),
+ GetRealPixelSize(DIP_H, dpHeight, Bottom), paint);
+ }
+
+ final static int DIP_H = 0;
+ final static int DIP_W = 1;
+
+ private float GetRealPixelSize(int wH, float dpWH, double DIP)
+ {
+ if (wH == DIP_H)
+ return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float)(dpWH * ( DIP / 160 )), r.getDisplayMetrics());
+ else if (wH == DIP_W)
+ return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float)(dpWH * ( DIP / 90 )), r.getDisplayMetrics());
+ else
+ return 0;
+ }
+
+ float map(float x, float in_min, float in_max, float out_min, float out_max)
+ {
+ return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
+ }
+
+}
diff --git a/src/mangavalk/tetris/GameStateInterface.java b/src/mangavalk/tetris/GameStateInterface.java
new file mode 100644
index 0000000..28c8042
--- /dev/null
+++ b/src/mangavalk/tetris/GameStateInterface.java
@@ -0,0 +1,38 @@
+package mangavalk.tetris;
+
+import android.app.Activity;
+import android.graphics.Canvas;
+
+public interface GameStateInterface
+{
+ // GameState Parameters
+ final int GS_STOPPED = 0;
+ final int GS_LOADING = 1;
+ final int GS_PLAYING = 2;
+ final int GS_GAMEOVER = 3;
+ final int GS_PAUSED = 4;
+ final int GS_START = 5;
+ final int GS_LOAD = 6;
+ final int GS_READY = 7;
+
+ // Methods.
+ public void DrawFrame(Canvas canvas);
+
+ public void SendMove(float x,float y, boolean pointerUp);
+
+ public void SetGameState(int gameState);
+
+ public void onPause();
+
+ // SetParameters.
+ public void SetActivity(Activity activity);
+
+ public void SetCanvas(CanvasView _CanvasView);
+
+ public void SetStartLevel(int startLevel);
+
+ public void SetPayedVersion(boolean payedVersion);
+
+ // Get
+ public int GetGameState();
+}
diff --git a/src/mangavalk/tetris/MainActivity.java b/src/mangavalk/tetris/MainActivity.java
index 25c80c9..14f141b 100644
--- a/src/mangavalk/tetris/MainActivity.java
+++ b/src/mangavalk/tetris/MainActivity.java
@@ -71,7 +71,7 @@ public class MainActivity extends Activity
@Override
public void onResume() {
super.onResume();
- canvasClass.onResume();
+ //canvasClass.onResume();
}
@Override