登录
首页 » Android » Android 拍照本地图片上传 图片裁切

Android 拍照本地图片上传 图片裁切

于 2022-04-13 发布 文件大小:1.62 MB
0 50
下载积分: 2 下载次数: 1

代码说明:

Android本地图片和拍照图片上传作为头像,剪一下,防止测试的时候上传的文件太大,仿微信图片上传,带有拍照,并可以放大缩小预览PhotoSuperCopy,安卓拍照或选择图片上传服务器 解成bitmap,方便裁剪,调用相机拍照后的照片存储的路径,取到绝对路径,上传图片,实际上是将图片流以字符串形式存储下来。

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Android游戏源码仿别碰白块儿游戏
    模仿本项目是模仿别踩白块项目,第 一个比较完善,这个相对比较简单,源码也不多适合新手学习借鉴。别踩白块儿曾经在app store里全球40多个国家、地区免费游戏榜登顶榜首,超过一百个国家或地区排名前十。说明还是一款非常经典耐玩广受欢迎的小游戏。
    2023-07-13 11:50:03下载
    积分:1
  • Android Notification Toast用法演示范例
    Android Notification消息框 Toast弹出框用法演示范例,本例中关于 Toast弹出框的演示,演示了适时的 Toast和长时间的 Toast,关于Notification的定义,则演示了高级Notification的用法,自定义4种Notification的用法:带声音的Notification、振动的Notification、声音+振动的Notification,最后清除Notification,看似简单的一些Notification应用,实际在日常编程中经常用到的。演示各个Notification及Toast的具体功能,请下载本源码后,运行APK文件,如图所示的效果。
    2022-06-27 16:38:17下载
    积分:1
  • Android演示了简单播放音乐文件的过程
    Android演示了简单播放音乐文件的过程,演示了用户单击停止播放、播放和暂停三个按钮后的程序处理方法,并结合UI实现了提示。本播放程序可设置是否循环播放。   测试时,请将测试的mp3文件放在res的raw文件夹下,并修改代码中对应的mp3文件名。
    2023-02-02 02:40:03下载
    积分:1
  • Androd 源代码
    是一款直播APP,非常好的源码分享。是移动应用的非常出色的代表,源代码凝练出色,界面设计合理精美,是凝聚作者的多年开发经验制作而成。运用的技术都是当下最流行的,非常好的代表应用。各种功能一应俱全,适合各阶段开发者学习与应用,能够非常好的借鉴与应用。
    2022-03-18 02:08:25下载
    积分:1
  • MyAppWeixin
    仿微信界面,有摇一摇功能,此款软件用来学习android非常有用。(Imitation of micro letter interface, a wave function, this software is very useful to study the android. )
    2013-08-11 20:24:27下载
    积分:1
  • android 打飞机游戏 源码下载
    import com.pic.SpriteCmd.MainState;import android.app.Activity;import android.content.Context;import android.graphics.Bitmap;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.graphics.Rect;import android.graphics.drawable.BitmapDrawable;import android.hardware.Sensor;import android.hardware.SensorEvent;import android.hardware.SensorEventListener;import android.hardware.SensorManager;import android.media.MediaPlayer;import android.os.Bundle;import android.view.MotionEvent;import android.view.View;import android.widget.Button;import android.widget.EditText;import android.widget.TextView;public class PictureView extends View implements Runnable,SensorEventListener{private Context context;private  int scrWidth;//屏幕的宽度private  int scrHeight;//屏幕的高度private  int MainTime = 0; //主计时器private  Bitmap imgBackground = null;//背景图片private  Bitmap imgBackground2 = null;private ButtonUtil ButtonStart = null;//开始按钮private ButtonUtil ButtonHelp = null;//帮助按钮private ButtonUtil ButtonScore = null;private ButtonUtil ButtonDetail = null;private  Bitmap imgStart = null;//开始按钮对应的图片private  Bitmap imgHelp = null;//帮助按钮对应的图片private  Bitmap imgScore = null;private  Bitmap imgDetail = null;private ButtonUtil ButtonFirst = null;//选关界面第一关对应按钮private ButtonUtil ButtonSecond = null;//选关界面第二关对应按钮private Bitmap imgFirst = null;//第一关对应图片private Bitmap imgSecond = null;//第二关对应图片private Bitmap imgHelpDisplay = null;//帮助图片private Bitmap imgScoreDisplay = null;//高分图片private Bitmap imgDetailDisplay = null;private ButtonUtil ButtonReturn = null;//返回按钮private Bitmap imgReturn = null;//返回按钮对应图片private ButtonUtil ButtonSound = null;//声音开关按钮private Bitmap imgSoundOn = null;//开声音对应图片private Bitmap imgSoundOff = null;//关声音对应图片private Boolean is_SoundOn = true;//声音是否开private Boolean is_LeverUp = false;//是否过关private int DeadEnemyCnt = 0;//敌人死亡计数器     当死亡敌人个数达到某个数时   过关private int LeverCnt = 0;//过关界面的计数器private static MediaPlayer mediaPlayer = null;//声音播放对象public enum GameState//游戏状态{GAMESTATE_MENU, //菜单GAMESTATE_LEVELGUIDE, //关数提示,显示第一关,第二关 。。GAMESTATE_HELP, GAMESTATE_SCORE,GAMESTATE_DETAIL,GAMESTATE_GAME, //游戏}public  GameState GameState; // 游戏状态public static final int STAR_NUM = 30;public SpriteCmd rgSpriteCmd = new SpriteCmd();////主角SpriteCmd类对象实例化public SpriteCmd rgCmdStar[] = new SpriteCmd[30];//星星对象public SpriteCmd rgBulletCmd[] = new SpriteCmd[20];//主角子弹对象public SpriteCmd rgEnemy1Cmd = new SpriteCmd();//敌人1的SpriteCmd类对象public SpriteCmd rgEnemy2Cmd = new SpriteCmd();//敌人2对象public SpriteCmd rgEnemy3Cmd = new SpriteCmd();//敌人3对象public SpriteCmd rgEnemy4Cmd = new SpriteCmd();public SpriteCmd rgEnemy5Cmd = new SpriteCmd();public SpriteCmd rgBombCmds[] = new SpriteCmd[5];//敌人死亡时候爆炸的对象private int LeverNum;//关数计数器public Bitmap imgPlane;//主角飞机对应图片public Bitmap imgStar;//星星对应图片public Bitmap imgBullet;//子弹图片public Bitmap imgEnemy1;//敌人1对应图片public Bitmap imgEnemy2;//敌人2对象图片public Bitmap imgEnemy3;public Bitmap imgEnemy4;public Bitmap imgEnemy5;public Bitmap imgBomb; //炸弹对应图片public Bitmap imgPassLerver;//过关图片public SpriteCmd rgGameover = new SpriteCmd();public Bitmap imgBloodBg;//血量框图片public Bitmap imgBlood;//血量图片public boolean IsRightKeyRealess = true;//右键是否释放public boolean IsLeftKeyRealess = true;//左键是否释放public boolean IsUpKeyRealess = true;//上键是否释放public boolean IsDownKeyRealess = true;//下键是否释放private SensorManager sm;//传感器管理器private Sensor sensor;//重力传感器对象public float x_sensor = 0;//重力传感器x方向的位置偏移public float y_sensor = 0;//重力传感器y方向的位置偏移public float z_sensor = 0;//重力传感器z方向的位置偏移public SpriteCmd rgBackground1 = new SpriteCmd();//背景对象1public SpriteCmd rgBackground2 = new SpriteCmd();//背景对象2public SpriteCmd rgLerver = new SpriteCmd();//“恭喜过关”对象public SpriteCmd rgBloodBg = new SpriteCmd();//“血量框”对象public SpriteCmd rgBlood = new SpriteCmd();//“血量”对象public boolean  Is_exit = false;//是否退出游戏public PictureView(Context context){      super(context);//调用父类的构造方法      MainTime = 0; // 主计时清零      sm = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);  sensor = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);// 得到一个重力传感器实例  sm.registerListener(this, sensor, SensorManager.SENSOR_DELAY_GAME);      new Thread(this).start(); //启动线程    通过start()方法找到run()方法      this.context = context;      Is_exit = false;      }public void TurnToMenu()//进入菜单{imgBackground =((BitmapDrawable)getResources().getDrawable(R.drawable.bg1)).getBitmap();//背景图片if (imgStart == null){imgStart = ((BitmapDrawable)getResources().getDrawable(R.drawable.start)).getBitmap();//“开始游戏”的图片}if (imgHelp == null){imgHelp = ((BitmapDrawable)getResources().getDrawable(R.drawable.help)).getBitmap();//“游戏帮助”的图片}if (imgScore == null){imgScore = ((BitmapDrawable)getResources().getDrawable(R.drawable.score)).getBitmap();//“高分”的图}if (imgDetail == null){imgDetail = ((BitmapDrawable)getResources().getDrawable(R.drawable.detail)).getBitmap();//“信息”的图}if (imgReturn == null){imgReturn = ((BitmapDrawable)getResources().getDrawable(R.drawable.back)).getBitmap();//“返回”的图片}ButtonStart = new ButtonUtil(imgStart,(scrWidth - imgStart.getWidth())/2,100);//把“开始游戏”的图片与按钮绑定ButtonHelp = new ButtonUtil(imgHelp,(scrWidth - imgHelp.getWidth())/2,200);ButtonScore = new ButtonUtil(imgScore,(scrWidth - imgScore.getWidth())/2,300);ButtonDetail = new ButtonUtil(imgDetail,(scrWidth - imgDetail.getWidth())/2,400);ButtonReturn = new ButtonUtil(imgReturn,scrWidth - imgReturn.getWidth() - 10,scrHeight - 50);//把“返回”的图片与按钮绑定GameState = GameState.GAMESTATE_MENU; //状态转换成菜单状态}public void TurnToLeverGuide()//进入选关{ReleaseImage(imgBackground);imgBackground =((BitmapDrawable)getResources().getDrawable(R.drawable.bg2)).getBitmap();//背景图片if (imgFirst == null){imgFirst = ((BitmapDrawable)getResources().getDrawable(R.drawable.firstlever)).getBitmap();//“第1关”的图片}if (imgSecond == null){imgSecond = ((BitmapDrawable)getResources().getDrawable(R.drawable.secondlever)).getBitmap();//“第2关”的图片}ButtonFirst = new ButtonUtil(imgFirst,(scrWidth - imgFirst.getWidth())/2,150);ButtonSecond = new ButtonUtil(imgSecond,(scrWidth - imgSecond.getWidth())/2,300);GameState = GameState.GAMESTATE_LEVELGUIDE;}public void TurnToHelp()//进入帮助{if (imgHelpDisplay == null){imgHelpDisplay = ((BitmapDrawable)getResources().getDrawable(R.drawable.helpdisplay)).getBitmap();}GameState = GameState.GAMESTATE_HELP;}public void TurnToScore()//进入高分榜{if (imgScoreDisplay == null){TextView a=new TextView(context);a.setText("a");//imgScoreDisplay = ((BitmapDrawable)getResources().getDrawable(R.drawable.scoredisplay)).getBitmap();}GameState = GameState.GAMESTATE_SCORE;}public void TurnToDetail()//进入信息{if (imgDetailDisplay == null){imgDetailDisplay = ((BitmapDrawable)getResources().getDrawable(R.drawable.detaildisplay)).getBitmap();}GameState = GameState.GAMESTATE_DETAIL;}public void TurnToGame()//进入游戏{   LoadResource();InitLever();//GameState = GameState.GAMESTATE_GAME;//////////为背景图定义了SpriteCmd类的两个对象,为背景图设定两个位置同时画出来//// rgBackground1.x = 0;rgBackground1.y = -scrHeight;rgBackground1.unLayer = 0;rgBackground1.unWidth = scrWidth;  //背景图的宽度设为全屏rgBackground1.unHeight = scrHeight;//背景图的宽度设为全屏rgBackground2.x = 0;rgBackground2.y = 0;rgBackground2.unLayer = 0;rgBackground2.unWidth = scrWidth;//背景图的宽度设为全屏rgBackground2.unHeight = scrHeight; //背景图的宽度设为全屏///////////////////////////////////////////////////////////// imgSoundOn =((BitmapDrawable)getResources().getDrawable(R.drawable.bgsoundon)).getBitmap();imgSoundOff =((BitmapDrawable)getResources().getDrawable(R.drawable.bgsoundoff)).getBitmap();ButtonSound = new ButtonUtil(imgSoundOn,10,scrHeight - 20);rgLerver.unWidth = 200;rgLerver.unHeight = 40;rgLerver.unLayer = 255;rgGameover.unWidth = 200;rgGameover.unHeight = 40;rgGameover.unLayer = 255;rgBloodBg.unWidth = 100;rgBloodBg.unHeight = 32;rgBloodBg.unLayer = 0;rgBloodBg.x = 0;rgBloodBg.y = 0;rgBlood.unWidth = 96;rgBlood.unHeight = 14;rgBlood.unLayer = 0;rgBlood.x = rgBloodBg.x;rgBlood.y = rgBloodBg.y   10;mediaPlayer = MediaPlayer.create(context, R.raw.game);    mediaPlayer.start();    mediaPlayer.setLooping(true);is_LeverUp = false;}void InitLever(){int i;switch (LeverNum) {case 1:   //第一关rgSpriteCmd.unWidth = 36;rgSpriteCmd.unHeight = 34;rgSpriteCmd.x = (scrWidth - rgSpriteCmd.unWidth)/2;rgSpriteCmd.y = scrHeight - rgSpriteCmd.unHeight;rgSpriteCmd.unLayer = 0;rgSpriteCmd.unSpriteIndex = 0;rgSpriteCmd.CurrentState = MainState.enSTAND;rgSpriteCmd.WalkCount = 0;rgSpriteCmd.IsHurt = false;rgSpriteCmd.IsLeftStop = false;rgSpriteCmd.IsRight = false;rgSpriteCmd.IsTopStop = false;rgSpriteCmd.IsDownStop = false;//敌人初始化rgEnemy1Cmd.unWidth = 35;rgEnemy1Cmd.unHeight = 30;rgEnemy1Cmd.unLayer = 255;rgEnemy3Cmd.unWidth = 35;rgEnemy3Cmd.unHeight = 30;rgEnemy3Cmd.unLayer = 255;rgEnemy3Cmd.IsRight = false;rgEnemy4Cmd.unWidth = 35;rgEnemy4Cmd.unHeight = 30;rgEnemy4Cmd.unLayer = 255;rgEnemy4Cmd.IsRight = false;break;case 2:  //第二关rgSpriteCmd.unWidth = 36;rgSpriteCmd.unHeight = 34;rgSpriteCmd.x = (scrWidth - rgSpriteCmd.unWidth)/4;rgSpriteCmd.y = scrHeight - rgSpriteCmd.unHeight;rgSpriteCmd.unLayer = 0;rgSpriteCmd.unSpriteIndex = 0;rgSpriteCmd.CurrentState = MainState.enSTAND;rgSpriteCmd.WalkCount = 0;rgSpriteCmd.IsHurt = false;rgSpriteCmd.IsLeftStop = false;rgSpriteCmd.IsRight = false;rgSpriteCmd.IsTopStop = false;rgSpriteCmd.IsDownStop = false;//敌人初始化rgEnemy1Cmd.unWidth = 35;rgEnemy1Cmd.unHeight = 30;rgEnemy1Cmd.unLayer = 255;rgEnemy2Cmd.unWidth = 35;rgEnemy2Cmd.unHeight = 30;rgEnemy2Cmd.unLayer = 255;rgEnemy3Cmd.unWidth = 35;rgEnemy3Cmd.unHeight = 30;rgEnemy3Cmd.unLayer = 255;rgEnemy3Cmd.IsRight = false;rgEnemy4Cmd.unWidth = 35;rgEnemy4Cmd.unHeight = 30;rgEnemy4Cmd.unLayer = 255;rgEnemy5Cmd.unWidth = 35;rgEnemy5Cmd.unHeight = 30;rgEnemy5Cmd.unLayer = 255;rgEnemy5Cmd.IsRight = false;break;default:break;}////星星的初始化///////////////////////////////for (i = 0; i < STAR_NUM; i  = 1){rgCmdStar[i] = new SpriteCmd();//每颗星星都实例化SpriteCmd类对象}for (i = 0; i < STAR_NUM; i  = 2) //偶数个星星的图片索引值为0{rgCmdStar[i].unSpriteIndex = 0;}for (i = 1; i < STAR_NUM; i  = 2) //基数个星星的图片索引值为1{rgCmdStar[i].unSpriteIndex = 1;}for (i = 0; i < STAR_NUM; i   ){rgCmdStar[i].unWidth = 3; //每颗星星图片的宽度和高度rgCmdStar[i].unHeight = 3;rgCmdStar[i].x = scrWidth/STAR_NUM*i   10;//每颗星星图片绘制在屏幕上的位置rgCmdStar[i].y = scrHeight/STAR_NUM*i;} //////////////每颗子弹实例化SpriteCmd类对象,初始化////////for(i=0;i scrHeight) {//到达地图下边界rgSpriteCmd.IsDownStop = true;rgSpriteCmd.y = scrHeight - rgSpriteCmd.unHeight;}else {rgSpriteCmd.IsDownStop = false;}////主机与敌机的碰撞判断及处理///////////////////////////////if ((CheckHitEnemy(rgSpriteCmd, rgEnemy1Cmd) || CheckHitEnemy(rgSpriteCmd, rgEnemy2Cmd)|| CheckHitEnemy(rgSpriteCmd, rgEnemy3Cmd)) || CheckHitEnemy(rgSpriteCmd, rgEnemy4Cmd)|| CheckHitEnemy(rgSpriteCmd, rgEnemy5Cmd)&& !rgSpriteCmd.IsHurt) {rgSpriteCmd.CurrentState = MainState.enHURT;rgSpriteCmd.ProtectCount = 18;rgSpriteCmd.IsHurt = true;rgBlood.unWidth -= 19;if (rgBlood.unWidth < 0) {rgBlood.unWidth = 96;}}/////主机子弹与敌机1的碰撞////////////////////////////////for(i=0;i -1 && y_sensor < 1) {rgSpriteCmd.CurrentState = MainState.enSTAND;}else {rgSpriteCmd.unSpriteIndex = 0;rgSpriteCmd.y  = 10;}}else if (rgSpriteCmd.CurrentState == MainState.enHURT) {rgSpriteCmd.unSpriteIndex = MainTime%2 - 1; rgSpriteCmd.ProtectCount--;if (rgSpriteCmd.ProtectCount == 0) {rgSpriteCmd.CurrentState = MainState.enSTAND;rgSpriteCmd.IsHurt = false;}}}   ///////把图片画成全屏///////////////////////////////////////////public  void DisplayImage(Canvas canvas, Bitmap bitmap,int width, int height){    if(bitmap!=null)    {    Rect scrRect = new Rect(); //绘制区域在屏幕上的矩形范围        scrRect.left = 0; //绘制区域左上角顶点在屏幕上的x坐标        scrRect.top = 0; //绘制区域左上角顶点在屏幕上的y坐标        scrRect.right = scrWidth;//width; //绘制区域右下角顶点在屏幕上的x坐标        scrRect.bottom = scrHeight;//height; //绘制区域右下角顶点在屏幕上的y坐标        Rect imgRect = new Rect(); //绘制区域在图片上的矩形范围        imgRect.left = 0; //绘制区域左上角顶点距离图片左上角的x坐标        imgRect.top = 0; //绘制区域左上角顶点距离图片左上角的y坐标        imgRect.right = 0   width; //绘制区域右下角顶点距离图片左上角的x坐标        imgRect.bottom = 0   height; //绘制区域右下角顶点距离图片左上角的y坐标        canvas.drawBitmap(bitmap, imgRect, scrRect, null); //绘制图片    }    }///////////////////////////////////////////////////////////////////////////  ////////画精灵(相对于屏幕的相对位置)//////////////////////public   void DrawSprites(Canvas canvas, Bitmap bitmap, SpriteCmd spriteCmd){if (spriteCmd.unLayer != 255) {DisplayImage(canvas, bitmap, //要画的图片spriteCmd.x, //图片左上角画在屏幕上的x位置spriteCmd.y, //图片左上角画在屏幕上的y位置spriteCmd.unWidth, //图片的宽度spriteCmd.unHeight, //图片的高度0, //要画的图片在整个图片中的x方向位置spriteCmd.unSpriteIndex * spriteCmd.unHeight); //要画的图片在整个图片中的y方向位置}}//画图片//参数依次为画布Canvas对象,位图对象,在屏幕上的x坐标,在屏幕上的y坐标,//绘制的宽度,绘制的高度,在图片上的x坐标,在图片上的y坐标public  void DisplayImage(Canvas canvas, Bitmap bitmap, int scrX, int scrY, int width, int height, int imgX, int imgY){if(bitmap!=null){Rect scrRect = new Rect(); //绘制区域在屏幕上的矩形范围scrRect.left = scrX; //绘制区域左上角顶点在屏幕上的x坐标scrRect.top = scrY; //绘制区域左上角顶点在屏幕上的y坐标scrRect.right = scrX   width; //绘制区域右下角顶点在屏幕上的x坐标scrRect.bottom = scrY   height; //绘制区域右下角顶点在屏幕上的y坐标Rect imgRect = new Rect(); //绘制区域在图片上的矩形范围imgRect.left = imgX; //绘制区域左上角顶点距离图片左上角的x坐标imgRect.top = imgY; //绘制区域左上角顶点距离图片左上角的y坐标imgRect.right = imgX   width; //绘制区域右下角顶点距离图片左上角的x坐标imgRect.bottom = imgY   height; //绘制区域右下角顶点距离图片左上角的y坐标canvas.drawBitmap(bitmap, imgRect, scrRect, null); //绘制图片}}//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////触屏事件////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////public boolean onTouchEvent(MotionEvent event){switch (event.getAction()){case MotionEvent.ACTION_DOWN: // 当触摸到屏幕IsRightKeyRealess = false;IsLeftKeyRealess = false;IsUpKeyRealess = false;IsDownKeyRealess = false;switch (GameState){case GAMESTATE_MENU:onTouchEventInMenu(event); // 菜单界面的触屏事件处理break;case GAMESTATE_LEVELGUIDE:onTouchEventLeverGuide(event);// 选关界面的触屏事件处理break;case GAMESTATE_HELP:onTouchEventHelp(event);// 帮助界面的触屏事件处理break;case GAMESTATE_SCORE:onTouchEventScore(event);// 分数界面的触屏事件处理break;case GAMESTATE_DETAIL:onTouchEventHelp(event);// 信息界面的触屏事件处理break;case GAMESTATE_GAME:onTouchEventInGame(event);// 游戏界面的触屏事件处理break;default:break;}return true;case MotionEvent.ACTION_UP:// 当手抬起,离开屏幕IsRightKeyRealess = true;IsLeftKeyRealess = true;IsUpKeyRealess = true;IsDownKeyRealess = true;return true;default:break;} return super.onTouchEvent(event);}public void onTouchEventInMenu(MotionEvent event)// 菜单界面的触屏事件处理{float x, y;x = event.getX();y = event.getY();if (ButtonStart.isClick(x, y)) {TurnToLeverGuide();}else if (ButtonHelp.isClick(x, y)) {TurnToHelp();}else if (ButtonScore.isClick(x, y)) {TurnToScore();}else if (ButtonDetail.isClick(x, y)) {TurnToDetail();}else if (ButtonReturn.isClick(x, y)) {Is_exit = true;CloseGame();}}public void onTouchEventLeverGuide(MotionEvent event)// 选关界面的触屏事件处理{float x, y;x = event.getX();y = event.getY();if (ButtonReturn.isClick(x, y)) {TurnToMenu();}else if (ButtonFirst.isClick(x, y)) {LeverNum = 1;TurnToGame();}else if (ButtonSecond.isClick(x, y)) {LeverNum = 2;TurnToGame();}}public void onTouchEventHelp(MotionEvent event)// 帮助界面的触屏事件处理{float x, y;x = event.getX();y = event.getY();if (ButtonReturn.isClick(x, y)) {TurnToMenu();}}public void onTouchEventScore(MotionEvent event)// 帮助界面的触屏事件处理{float x, y;x = event.getX();y = event.getY();if (ButtonReturn.isClick(x, y)) {TurnToMenu();}}public void onTouchEventInGame(MotionEvent event)// 游戏界面的触屏事件处理{float x, y;x = event.getX();y = event.getY();//////处理返回键/////////////////////////////// if (ButtonReturn.isClick(x, y)) {TurnToMenu();mediaPlayer.pause();}/////////////////////////////////////////// ///////////////声音处理///////////////////////////else if(ButtonSound.isClick(x, y)){if (is_SoundOn) {ButtonSound.setButtonPic(imgSoundOff);is_SoundOn = false;mediaPlayer.pause();}else {ButtonSound.setButtonPic(imgSoundOn);is_SoundOn = true;    mediaPlayer.start();    mediaPlayer.setLooping(true);}}/////////////////////////////////////////////////////////////////根据触摸点的位置判断主角飞机的运动状态////////////////////if ((x- rgSpriteCmd.x - rgSpriteCmd.unWidth/2) > (y - rgSpriteCmd.y - rgSpriteCmd.unHeight / 2)&& (x- rgSpriteCmd.x - rgSpriteCmd.unWidth/2) > -(y - rgSpriteCmd.y - rgSpriteCmd.unHeight / 2)&& !rgSpriteCmd.IsRigtStop && rgSpriteCmd.CurrentState != MainState.enHURT &&!ButtonSound.isClick(x, y)){rgSpriteCmd.CurrentState = MainState.enWALKRIGHT;//向右走}else if ((x - rgSpriteCmd.x - rgSpriteCmd.unWidth / 2 < (y - rgSpriteCmd.y - rgSpriteCmd.unHeight / 2)) && (x- rgSpriteCmd.x - rgSpriteCmd.unWidth/2) < -(y - rgSpriteCmd.y - rgSpriteCmd.unHeight / 2)&& !rgSpriteCmd.IsLeftStop && rgSpriteCmd.CurrentState != MainState.enHURT &&!ButtonSound.isClick(x, y)){rgSpriteCmd.CurrentState = MainState.enWALKLEFT;//向左走}else if ((y - rgSpriteCmd.y - rgSpriteCmd.unHeight / 2) = (x - rgSpriteCmd.x - rgSpriteCmd.unWidth / 2) && (y - rgSpriteCmd.y - rgSpriteCmd.unHeight / 2) >= -(x - rgSpriteCmd.x - rgSpriteCmd.unWidth / 2)&& !rgSpriteCmd.IsDownStop && rgSpriteCmd.CurrentState != MainState.enHURT &&!ButtonSound.isClick(x, y)){rgSpriteCmd.CurrentState = MainState.enWALKDOWN;//向下走}}/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public Boolean  CheckHitEnemy(SpriteCmd Cmd,SpriteCmd SpCmd) {if (Cmd.unLayer!=255 && SpCmd.unLayer != 255) {if (Cmd.x   Cmd.unWidth > SpCmd.x && Cmd.x < SpCmd.x   SpCmd.unWidth &&    Cmd.y   Cmd.unHeight > SpCmd.y && Cmd.y < SpCmd.y   SpCmd.unHeight) {return true;}} return false;}/////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void onAccuracyChanged(Sensor sensor, int accuracy) {// TODO Auto-generated method stub}public void onSensorChanged(SensorEvent event) {// TODO Auto-generated method stubx_sensor = event.values[0]; // 手机横向翻滚// x>0 说明当前手机左翻 x0 说明当前手机下翻 y0 手机屏幕朝上 z
    2015-07-02下载
    积分:1
  • 开发手机通讯录
    这是开发手机通讯录的文件,可以添加联系人,删除联系人,查找联系人等功能
    2022-10-29 05:15:07下载
    积分:1
  • java 微信公众号地理位置获取
    java 微信公众号地理位置获取
    2018-08-17下载
    积分:1
  • android-upload-service-master
    说明:  以前做的android的FTP demo,功能没有完全实现,上传和下载的限速是虚拟的(The FTP demo of Android has not been fully implemented. The speed limit of upload and download is virtual)
    2020-06-25 21:00:02下载
    积分:1
  • 关于android手势的例子
    一个简单的android手势的应用,使用gesture的最基本的用法,这个工程就介绍了一下
    2022-05-29 08:48:37下载
    积分:1
  • 696518资源总数
  • 104225会员总数
  • 32今日下载