Author SHA1 Message Date
Administrator a7dd68476d sprite cleanup and new sprites added.
code made compatible with not samsung devices again.
added pause menu.
bugfix in startlevel.
2014-04-22 13:23:47 +02:00
Administrator fa997fb77a cleanup 2014-04-17 14:32:25 +02:00
Administrator c4cc0517f6 gameover working again 2014-04-17 12:22:29 +02:00
Administrator 02e82c05ff sprite fix 2014-04-16 15:00:52 +02:00
Administrator f1892374b1 working again after update. 2014-04-16 14:17:52 +02:00
Administrator cfe631f701 Merge branch 'Development' of mangavalk.tk:mangavalk/android-tetris into Development 2014-02-27 11:42:25 +01:00
Administrator 04e712d7aa comment 2014-02-27 11:40:07 +01:00
Administrator f23c11eb7d Added Sprites folder 2014-02-27 11:38:36 +01:00
MangaValk 82024f82c2 Merge branch 'Development2' into 'Development'
Development
2014-02-27 11:37:29 +01:00
Administrator 774d72fab1 Added Sprites folder 2014-02-27 11:36:15 +01:00
Administrator 4abaed8982 Added Sprites folder 2014-02-27 11:33:16 +01:00
Administrator 58a708298c no comment 2014-02-21 17:08:48 +01:00
Administrator 0a1020377b Load and Start implemented. 2014-02-21 13:14:55 +01:00
Administrator 1feeb75883 test 2014-02-21 12:45:19 +01:00
Administrator ba1f705224 change gamestate implementation. 2014-02-21 12:44:15 +01:00
Administrator 5ffbb6a4a5 menu 2014-02-21 11:56:48 +01:00
Administrator 3a65b804df cleanup 2014-02-21 11:47:41 +01:00
Administrator c83775a756 menu functionality 2014-02-21 10:02:16 +01:00
Administrator 9a00f4e61a menu placeholder 2014-02-20 17:04:40 +01:00
Administrator 2d8dc8022e example menu 2014-02-20 12:13:55 +01:00
Administrator 3cca9c29f2 Gamemenu intergration. 2014-02-20 12:09:10 +01:00
Administrator 3cbc26b42d Gamemenu intergration. pause function working again. 2014-02-20 11:44:48 +01:00
Administrator 812308b869 intergration of switchable abstract classes 2014-02-19 17:10:52 +01:00
Administrator f79361c06a abstract class implementation 2014-02-19 16:43:38 +01:00
Administrator 915abd8853 changed implementation a little from interface to abstract. 2014-02-19 16:39:28 +01:00
Administrator adb19d7e82 GameStateInterface added and GamePlay moved to GamePlay(GameStateInterface) class. 2014-02-19 12:07:08 +01:00
Administrator a303e6afc6 GameStage intergration and cleanup 2014-02-18 15:55:17 +01:00
Administrator e01836e91c intergration GameStage Pipeline 2014-02-18 10:39:07 +01:00
Administrator 1a34673859 First start of adding GameStage Pipeline 2014-02-17 11:32:57 +01:00
Administrator a29b118488 a little function cleanup 2014-02-17 10:20:41 +01:00
Administrator 36424e3465 added screenshot 2014-02-15 17:51:56 +01:00
Administrator 53d03abf8e Cleanup 2014-02-15 09:55:31 +01:00
115 changed files with 3241 additions and 2914 deletions
+1
View File
@@ -0,0 +1 @@
/bin
Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

-38
View File
@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mangavalk.tetris"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity
android:name="mangavalk.tetris.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>
-148
View File
@@ -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
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-3
View File
@@ -1,3 +0,0 @@
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.
+1
View File
@@ -107,6 +107,7 @@ public final class R {
public static final int common_google_play_services_update_title = 0x7f060007;
public static final int common_signin_button_text = 0x7f060012;
public static final int common_signin_button_text_long = 0x7f060013;
public static final int location_client_powered_by_google = 0x7f06001a;
}
public static final class styleable {
public static final int[] AdsAttrs = { 0x7f010000, 0x7f010001, 0x7f010002 };
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
+172
View File
@@ -0,0 +1,172 @@
package mangavalk.tetris;
import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.Color;
import android.media.MediaPlayer;
public class GameMenu extends GameStateInterface
{
// GameState.
protected int GameState = GS_STOPPED;
public GameMenu(Activity activity)
{
super(activity);
}
// Methods.
@Override
public void DrawFrame(Canvas canvas)
{
switch(GameState)
{
case GS_MENU_READY:
{
ShowMenu(canvas);
break;
}
case GS_PAUSED:
{
ShowPauseMenu(canvas);
break;
}
case GS_GAMEOVER:
{
ShowGameOverMenu(canvas);
break;
}
}
}
@Override
public void SendMove(float x, float y, boolean pointerUp)
{
switch(GameState)
{
case GS_MENU_READY:
{
if (!pointerUp)
{
SetGameState(GS_MENU_START, false);
}
break;
}
case GS_PAUSED:
{
if (!pointerUp)
{
SetGameState(GS_RESUME, false);
}
break;
}
case GS_GAMEOVER:
{
SetGameState(GS_MENU_READY, false);
canvasView.postInvalidate();
break;
}
}
}
@Override
public void SetGameState(int gameState, boolean isPostBack)
{
GameState = gameState;
switch(GameState)
{
/*case GS_LOAD:
{
Load();
break;
}*/
/*case GS_READY:
{
canvasView.postInvalidate();
break;
}*/
case GS_PAUSED:
{
canvasView.postInvalidate();
break;
}
case GS_GAMEOVER:
{
canvasView.postInvalidate();
break;
}
}
if (!isPostBack)
canvasView.OnGameStateChanged(GameState);
}
@Override
public void onPause() {
// TODO Auto-generated method stub
}
// Set
@Override
public int GetGameState()
{
return GameState;
}
@Override
public void SetPayedVersion(boolean payedVersion) {
// TODO Auto-generated method stub
}
// Internal.
// Audio.
MediaPlayer mp;
// TODO game state
@Override
public void Load()
{
// Load Bitmap's.
//LoadSprites();
//LoadFont();
// Initlialize.
// Audio
mp = MediaPlayer.create(activity, R.raw.tetris_a);
}
@Override
public void Start()
{
GameState = GS_MENU_READY;
canvasView.postInvalidate();
}
// Draw functions.
private void ShowMenu(Canvas canvas)
{
Rect(canvas, 0f, 160f, 0f, 90f, Color.BLUE);
}
private void ShowPauseMenu(Canvas canvas)
{
Rect(canvas, 0f, 160f, 0f, 90f, Color.RED);
}
private void ShowGameOverMenu(Canvas canvas)
{
Rect(canvas, 0f, 160f, 0f, 90f, Color.parseColor("lime"));
}
@Override
public void SendMove(int angle, int speed) {
// TODO Auto-generated method stub
}
}
+1
View File
@@ -13,3 +13,4 @@
# Project target.
target=android-19
android.library.reference.1=../../../../Desktop/adt-bundle-windows-x86_64-20131030/adt-bundle-windows-x86_64-20131030/sdk/extras/google/google_play_services/libproject/google-play-services_lib
android.library=false
Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 904 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,127 @@
package mangavalk.tetris;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Display;
public abstract class GameStateInterface
{
// GameState Parameters
final static int GS_STOPPED = 0;
final static int GS_LOADING = 1;
final static int GS_PLAYING = 2;
final static int GS_GAMEOVER = 3;
final static int GS_PAUSED = 4;
final static int GS_START = 5;
final static int GS_LOAD = 6;
final static int GS_READY = 7;
final static int GS_RESUME = 8;
final static int GS_MENU_START = 9;
final static int GS_MENU_READY = 10;
// Variabelen.
protected CanvasView canvasView;
protected Activity activity = null;
// Constructer.
public GameStateInterface(Activity _activity)
{
activity = _activity;
// Set Display Info.
Display display = activity.getWindowManager().getDefaultDisplay();
DisplayMetrics outMetrics = new DisplayMetrics ();
display.getMetrics(outMetrics);
r = activity.getResources();
float density = r.getDisplayMetrics().density;
dpHeight = outMetrics.heightPixels / density;
dpWidth = outMetrics.widthPixels / density;
Height = outMetrics.heightPixels;
Width = outMetrics.widthPixels;
}
// Methods.
public abstract void DrawFrame(Canvas canvas);
public abstract void SendMove(float x,float y, boolean pointerUp);
public abstract void SetGameState(int gameState, boolean isPostBack);
// New Game State Methods.
public abstract void Load();
public abstract void Start();
public abstract void onPause();
// SetParameters.
public void SetCanvas(CanvasView _CanvasView)
{
canvasView = _CanvasView;
}
public void SetActivity(Activity _Activity)
{
activity = _Activity;
}
public abstract void SetPayedVersion(boolean payedVersion);
// Get
public abstract int GetGameState();
// other logic
// Variabelen.
Resources r;
// Display
float dpHeight;
float dpWidth;
float Height;
float Width;
protected 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;
protected 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;
}
protected 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;
}
public abstract void SendMove(int angle, int speed);
}
+193 -137
View File
@@ -1,137 +1,193 @@
package mangavalk.tetris;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import android.app.Activity;
import android.graphics.PointF;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.widget.FrameLayout;
public class MainActivity extends Activity
{
CanvasView canvasClass;
private AdView adView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout ll;
ll = new FrameLayout(this);
// Create the adView.
adView = new AdView(this);
adView.setAdUnitId("ca-app-pub-2360519718191877/5428392148");
adView.setAdSize(AdSize.BANNER);
// Initiate a generic request.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("D23CD70B20EE4AF169D112010B8DC97E") // Htc One X
.addTestDevice("029011F06A23EB6FFF862E44CC792EF2") // Nexus 7 tablet
.build();
canvasClass = new CanvasView(this);
canvasClass.PayedVersion = true; // Set payment status
canvasClass.startLevel = 0;
if (!canvasClass.PayedVersion)
{
// Load the adView with the ad request.
adView.loadAd(adRequest);
}
ll.addView(canvasClass);
// Add the adView to it.
FrameLayout.LayoutParams adsParams =new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT, android.view.Gravity.TOP|android.view.Gravity.CENTER_HORIZONTAL);
ll.addView(adView, adsParams);
setContentView(ll);
mActivePointers = new SparseArray<PointF>();
canvasClass.SetActivity(this);
}
@Override
public void onPause() {
super.onPause();
canvasClass.onPause();
}
@Override
public void onResume() {
super.onResume();
canvasClass.onResume();
}
@Override
public void onBackPressed()
{
super.onBackPressed();
canvasClass.onPause();
}
private SparseArray<PointF> mActivePointers;
@Override
public boolean onTouchEvent(MotionEvent e) {
// MotionEvent reports input details from the touch screen
// and other input controls. In this case, you are only
// interested in events where the touch position changed.
// get pointer index from the event object
int pointerIndex = e.getActionIndex();
// get pointer ID
int pointerId = e.getPointerId(pointerIndex);
// get masked (not specific to a pointer) action
int maskedAction = e.getActionMasked();
switch (maskedAction) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN: {
// We have a new pointer. Lets add it to the list of pointers
PointF f = new PointF();
f.x = e.getX(pointerIndex);
f.y = e.getY(pointerIndex);
canvasClass.sendMove(f.x, f.y, false);
mActivePointers.put(pointerId, f);
break;
}
case MotionEvent.ACTION_MOVE: { // a pointer was moved
break;
}
case MotionEvent.ACTION_UP:
for (int size = e.getPointerCount(), i = 0; i < size; i++) {
PointF point = mActivePointers.get(e.getPointerId(i));
if (point != null) {
point.x = e.getX(i);
point.y = e.getY(i);
canvasClass.sendMove(point.x, point.y, true);
}
}
break;
case MotionEvent.ACTION_POINTER_UP:
break;
case MotionEvent.ACTION_CANCEL: {
// TODO use data
break;
}
}
return true;
}
}
package mangavalk.tetris;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.samsung.android.sdk.SsdkUnsupportedException;
import com.samsung.android.sdk.gesture.Sgesture;
import com.samsung.android.sdk.gesture.SgestureHand;
import com.samsung.android.sdk.gesture.SgestureHand.Info;
import android.app.Activity;
import android.graphics.PointF;
import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.WindowManager;
import android.widget.FrameLayout;
public class MainActivity extends Activity
{
CanvasView canvasClass;
private AdView adView;
private Sgesture mGesture;
private SgestureHand mHand;
private boolean SamsungDevice = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Gesture. Samsung only
mGesture = new Sgesture();
try {
mGesture.initialize(this);
SamsungDevice = true;
} catch (IllegalArgumentException e) {
//Error Handling
Log.d("MangaValk", "mark1");
SamsungDevice = false;
} catch (SsdkUnsupportedException e2) {
//Error Handling
Log.d("MangaValk", "mark2");
SamsungDevice = false;
}
if (SamsungDevice)
{
if(mGesture.isFeatureEnabled(Sgesture.TYPE_HAND_PRIMITIVE)){
mHand = new SgestureHand(Looper.getMainLooper(), mGesture);
mHand.start(Sgesture.TYPE_HAND_PRIMITIVE, mChangeListener);
}
}
FrameLayout ll;
ll = new FrameLayout(this);
// Create the adView.
adView = new AdView(this);
adView.setAdUnitId("ca-app-pub-2360519718191877/5428392148");
adView.setAdSize(AdSize.BANNER);
// Initiate a generic request.
AdRequest adRequest = new AdRequest.Builder() // Add S5
//.addTestDevice("D23CD70B20EE4AF169D112010B8DC97E") // Htc One X
.addTestDevice("029011F06A23EB6FFF862E44CC792EF2") // Nexus 7 tablet
.addTestDevice("2CA96A8B6B805B3323F65A934FB31DC7") // Samsung Galaxy S5
.build();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
canvasClass = new CanvasView(this);
canvasClass.PayedVersion = true; // Set payment status
canvasClass.startLevel = 0;
//if (!canvasClass.PayedVersion)
//{
// Load the adView with the ad request.
adView.loadAd(adRequest);
//}
ll.addView(canvasClass);
// Add the adView to it.
FrameLayout.LayoutParams adsParams =new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT, android.view.Gravity.TOP|android.view.Gravity.CENTER_HORIZONTAL);
ll.addView(adView, adsParams);
setContentView(ll);
mActivePointers = new SparseArray<PointF>();
canvasClass.SetActivity(this);
}
private final SgestureHand.ChangeListener mChangeListener =
new SgestureHand.ChangeListener() {
@Override
public void onChanged(Info info) {
Log.d("gesture", "Hand : angle = " + info.getAngle());
// do something with data
canvasClass.sendMove(info.getAngle(), info.getSpeed());
}
};
@Override
public void onPause() {
super.onPause();
canvasClass.onPause();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onBackPressed()
{
super.onBackPressed();
canvasClass.onPause();
}
private SparseArray<PointF> mActivePointers;
@Override
public boolean onTouchEvent(MotionEvent e) {
// MotionEvent reports input details from the touch screen
// and other input controls. In this case, you are only
// interested in events where the touch position changed.
// get pointer index from the event object
int pointerIndex = e.getActionIndex();
// get pointer ID
int pointerId = e.getPointerId(pointerIndex);
// get masked (not specific to a pointer) action
int maskedAction = e.getActionMasked();
switch (maskedAction) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN: {
// We have a new pointer. Lets add it to the list of pointers
PointF f = new PointF();
f.x = e.getX(pointerIndex);
f.y = e.getY(pointerIndex);
canvasClass.sendMove(f.x, f.y, false);
mActivePointers.put(pointerId, f);
break;
}
case MotionEvent.ACTION_MOVE: { // a pointer was moved
break;
}
case MotionEvent.ACTION_UP:
for (int size = e.getPointerCount(), i = 0; i < size; i++) {
PointF point = mActivePointers.get(e.getPointerId(i));
if (point != null) {
point.x = e.getX(i);
point.y = e.getY(i);
canvasClass.sendMove(point.x, point.y, true);
}
}
break;
case MotionEvent.ACTION_POINTER_UP:
break;
case MotionEvent.ACTION_CANCEL: {
// TODO use data
break;
}
}
return true;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Some files were not shown because too many files have changed in this diff Show More