导航:首页 > 源码编译 > Jack人体仿真源码

Jack人体仿真源码

发布时间:2023-07-05 09:46:52

㈠ 自己可以编译安卓源码

用最新的Ubuntu 16.04,请首先确保自己已经安装了Git.没安装的同学可以通过以下命令进行安装:

sudo apt-get install git git config –global user.email “[email protected]” git config –global user.name “test”

其中[email protected]为你自己的邮箱.

简要说明

android源码编译的四个流程:1.源码下载;2.构建编译环境;3.编译源码;4运行.下文也将按照该流程讲述.

源码下载

由于某墙的原因,这里我们采用国内的镜像源进行下载.
目前,可用的镜像源一般是科大和清华的,具体使用差不多,这里我选择清华大学镜像进行说明.(参考:科大源,清华源)

repo工具下载及安装

通过执行以下命令实现repo工具的下载和安装

mkdir ~/binPATH=~/bin:$PATHcurl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repochmod a+x ~/bin/repo

补充说明
这里,我来简单的介绍下repo工具,我们知道AOSP项目由不同的子项目组成,为了方便进行管理,Google采用Git对AOSP项目进行多仓库管理.在聊repo工具之前,我先带你来聊聊多仓库项目:

我们有个非常庞大的项目Pre,该项目由很多个子项目R1,R2,...Rn等组成,为了方便管理和协同开发,我们为每个子项目创立自己的仓库,整个项目的结构如下:


这里写图片描述

执行完该命令后,再使用make命令继续编译.某些情况下,当你执行jack-admin kill-server时可能提示你命令不存在,此时去你去out/host/linux-x86/bin/目录下会发现不存在jack-admin文件.如果我是你,我就会重新repo sync下,然后从头来过.

错误三:使用emulator时,虚拟机停在黑屏界面,点击无任何响应.此时,可能是kerner内核问题,解决方法如下:
执行如下命令:

  • ./out/host/linux-x86/bin/emulator -partition-size 1024 -kernel ./prebuilts/qemu-kernel/arm/kernel-qemu-armv7

  • 通过使用kernel-qemu-armv7内核 解决模拟器等待黑屏问题.而-partition-size 1024 则是解决警告: system partion siez adjusted to match image file (163 MB >66 MB)

    如果你一开始编译的版本是aosp_arm-eng,使用上述命令仍然不能解决等待黑屏问题时,不妨编译aosp_arm64-eng试试.

    结束吧

    到现在为止,你已经了解了整个android编译的流程.除此之外,我也简单的说明android源码的多仓库管理机制.下面,不妨自己动手尝试一下.

    ㈡ keil怎样看编译产生的汇编代码

    在成功编译的前提下,按Ctrl+F5,或依次点击菜单栏的“Debug”>>“Start/StopDebugSession”,切换到调试界面。

    调试界面下,依次点击菜单栏的“View”>>“DisassemblyWindow”,即可打开反汇编窗口,其中包含有混排的源代码以及编译生成的汇编代码,如图所示。

    注意经过优化后,源代码与汇编代码并不一定一致。

    ㈢ 谁能给我一个手机游戏的源代码啊

    这个地址也有,不过直接给你吧,这样比较好
    先给你看看主要的类吧

    package Game;

    import DreamBubbleMidlet;

    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.Hashtable;

    import javax.microedition.lci.Graphics;
    import javax.microedition.lci.Image;
    import javax.microedition.lci.game.GameCanvas;
    import javax.microedition.lci.game.LayerManager;
    import javax.microedition.lci.game.Sprite;

    public class Game extends GameCanvas implements Runnable {

    protected DreamBubbleMidlet dreamBubbleMidlet;

    protected Graphics g;
    protected Image loadingImage;
    protected Image pauseImage;
    protected Image cursorImage;
    protected Image jackStateImage;
    protected Image johnStateImage;
    protected Image numberImage;

    protected Sprite cursor;
    protected Sprite number;
    protected LayerManager cursorManager;
    protected LayerManager numberManager;

    protected Hashtable bombTable;
    protected Map map;
    protected LayerManager gameLayerManager;
    protected Role player;
    protected Sprite playerGhost;

    protected int screenWidth;
    protected int screenHeight;
    protected int delay = 50;
    protected int[][] bornPlace;
    protected int chooseIndex;
    protected int stageIndex = 1;
    protected int gameClock;
    protected int loadPercent;

    protected boolean isPause;
    protected boolean isEnd;
    protected boolean isPlaying;
    protected boolean isLoading;

    protected Thread mainThread;

    public Game(DreamBubbleMidlet dreamBubbleMidlet) {
    super(false);
    this.setFullScreenMode(true);
    this.dreamBubbleMidlet = dreamBubbleMidlet;

    this.screenWidth = this.getWidth();
    this.screenHeight = this.getHeight();

    try {
    this.loadingImage = Image.createImage("/Game/Loading.png");
    this.pauseImage = Image.createImage("/Game/Pause.png");
    this.cursorImage = Image.createImage("/Game/Cursor.png");
    this.jackStateImage = Image.createImage("/State/JackState.png");
    this.johnStateImage = Image.createImage("/State/JohnState.png");
    this.numberImage = Image.createImage("/State/Number.png");
    } catch (IOException e) {
    e.printStackTrace();
    }

    this.g = this.getGraphics();
    }

    public void loadStage(int stage) {
    this.isEnd = false;
    this.isPause = false;
    this.isPlaying = false;
    this.gameLayerManager = new LayerManager();
    this.cursorManager = new LayerManager();
    this.numberManager = new LayerManager();
    this.bombTable = new Hashtable();
    this.cursor = new Sprite(this.cursorImage, 32, 32);
    this.number = new Sprite(this.numberImage, 12, 10);
    this.loadPercent = 20;
    sleep();

    loadMap(stage);
    this.loadPercent = 40;
    sleep();

    loadPlayer();
    this.loadPercent = 60;
    sleep();

    this.gameLayerManager.append(map.getBombLayer());
    this.gameLayerManager.append(map.getBuildLayer());
    this.gameLayerManager.append(map.getToolLayer());
    this.gameLayerManager.append(map.getFloorLayer());
    this.gameLayerManager.setViewWindow(0, -5, screenWidth,
    Global.MAP_HEIGHT + 5);
    this.cursorManager.append(cursor);
    this.numberManager.append(number);
    this.loadPercent = 80;
    sleep();

    this.loadPercent = 100;
    sleep();
    isPlaying = true;
    }

    public void run() {
    while (!isEnd) {
    long beginTime = System.currentTimeMillis();
    this.drawScreen();
    long endTime = System.currentTimeMillis();
    if (endTime - beginTime < this.delay) {
    try {
    Thread.sleep(this.delay - (endTime - beginTime));
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    }
    }
    }

    public void loadMap(int stage) {
    switch (stage) {
    case 0:
    this.map = new Map(Global.MAP_BLOCK);
    this.bornPlace = Global.MAP_BLOCK_BORNPLACE;
    break;
    case 1:
    this.map = new Map(Global.MAP_FACTORY);
    this.bornPlace = Global.MAP_FACTORY_BORNPLACE;
    break;
    case 2:
    this.map = new Map(Global.MAP_FOREST);
    this.bornPlace = Global.MAP_FOREST_BORNPLACE;
    break;
    case 3:
    this.map = new Map(Global.MAP_PIRATE);
    this.bornPlace = Global.MAP_PIRATE_BORNPLACE;
    break;
    case 4:
    this.map = new Map(Global.MAP_FAUBOURG);
    this.bornPlace = Global.MAP_FAUBOURG_BORNPLACE;
    break;
    }
    }

    public void loadPlayer() {
    this.player = SingleGameRole.createSingleGameRole(this, Global.JACK,
    this.bornPlace[0][0], this.bornPlace[0][1]);
    this.gameLayerManager.append(player);
    try {
    this.playerGhost = new Sprite(Image.createImage("/Character/Jack.png"),
    this.player.width, this.player.height);
    this.gameLayerManager.append(playerGhost);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }

    public void playerUpdate() {
    if(!this.player.isAlive)
    this.playerGhost.setVisible(false);
    this.playerGhost.setFrame(this.player.getFrame());
    this.player.updateRole();
    }

    public void bombUpdate() {
    Enumeration enu = this.bombTable.keys();
    while (enu.hasMoreElements()) {
    String key = (String) enu.nextElement();
    Bomb bomb = (Bomb) (bombTable.get(key));

    if (bomb.isvisable) {
    bomb.update();
    } else {
    bombTable.remove(key);
    bomb = null;
    }
    }
    }

    public void mapUpdate() {
    this.map.update();
    }

    public void drawScreen() {
    if (gameClock < 10000)
    gameClock++;
    else
    gameClock = 0;
    if (!this.isLoading) {
    if (!isPause) {
    this.operate();
    this.bombUpdate();
    this.playerUpdate();
    this.mapUpdate();
    g.setColor(0x000000);
    g.fillRect(0, 0, getWidth(), getHeight());
    this.drawState();
    gameLayerManager.paint(g, 0, this.screenHeight
    - Global.MAP_HEIGHT - 5);
    } else {
    this.drawPauseFrame();
    }
    } else {
    this.drawLoadingFrame();
    }
    this.flushGraphics();
    }

    public void drawFailScreen() {

    }

    public void drawState() {
    if (this.player.type == Global.JACK) {
    g.drawImage(jackStateImage, 60, 5, Graphics.TOP | Graphics.LEFT);
    }
    if (this.player.type == Global.JOHN) {
    g.drawImage(johnStateImage, 60, 5, Graphics.TOP | Graphics.LEFT);
    }

    this.number.setFrame(this.player.bombNums);
    this.numberManager.paint(g, 101, 15);
    this.number.setFrame(this.player.speed);
    this.numberManager.paint(g, 133, 15);
    this.number.setFrame(this.player.power);
    this.numberManager.paint(g, 165, 15);
    }

    protected void drawPauseFrame() {
    g.setColor(0x000000);
    g.fillRect(0, 0, getWidth(), getHeight());
    this.drawState();
    if (gameClock % 5 == 0)
    this.cursor.setFrame((this.cursor.getFrame() + 1) % 4);
    this.gameLayerManager.paint(g, 0, this.screenHeight - Global.MAP_HEIGHT
    - 5);
    this.cursorManager.paint(g, screenWidth / 2 - pauseImage.getWidth() / 2
    - 32, screenHeight / 2 - pauseImage.getHeight() / 2
    + this.chooseIndex * 33 + 24);
    g.drawImage(pauseImage, screenWidth / 2, screenHeight / 2,
    Graphics.HCENTER | Graphics.VCENTER);
    }

    protected void drawLoadingFrame() {
    g.setColor(66, 70, 246);
    g.fillRect(0, 0, screenWidth, screenHeight);

    g.drawImage(loadingImage, screenWidth / 2, 2 * screenHeight / 5,
    Graphics.HCENTER | Graphics.VCENTER);

    g.setColor(0, 255, 0);
    g.fillRect((screenWidth - 120) / 2, 2 * screenHeight / 3,
    (this.loadPercent * 120) / 100, 10);

    g.setColor(255, 0, 0);
    g.drawRect((screenWidth - 120) / 2, 2 * screenHeight / 3, 120, 10);
    }

    public void showMe() {
    new Loading(this.stageIndex);
    if (this.mainThread == null) {
    mainThread = new Thread(this);
    mainThread.start();
    }
    this.dreamBubbleMidlet.show(this);
    }

    public void operate() {
    int keyStates = getKeyStates();
    this.playerGhost.setPosition(this.player.xCoodinate, this.player.yCoodinate);
    if ((keyStates & DOWN_PRESSED) != 0) {
    this.player.walk(Global.SOUTH);
    } else {
    if ((keyStates & UP_PRESSED) != 0) {
    this.player.walk(Global.NORTH);
    } else {
    if ((keyStates & RIGHT_PRESSED) != 0) {
    this.player.walk(Global.EAST);
    } else {
    if ((keyStates & LEFT_PRESSED) != 0) {
    this.player.walk(Global.WEST);
    }
    }
    }
    }
    }

    protected void keyPressed(int key) {
    if (!this.isPlaying)
    return;
    if (!this.isPause && key == -7) {// 右键
    this.chooseIndex = 0;
    this.pauseGame();
    return;
    }
    if (key == 35) {// #键
    this.nextStage();
    return;
    }
    if (key == 42) {// *键
    this.preStage();
    return;
    }
    if (this.isPause) {
    switch (key) {
    case -1:
    case -3:
    if (this.chooseIndex == 0)
    this.chooseIndex = 2;
    else
    this.chooseIndex = (this.chooseIndex - 1) % 3;
    break;
    case -2:
    case -4:
    this.chooseIndex = (this.chooseIndex + 1) % 3;
    break;
    case -5:// 确认键
    case -6:// 左软键
    switch (chooseIndex) {
    case 0:
    this.continueGame();
    break;
    case 1:
    this.restart();
    break;
    case 2:
    this.endGame();
    break;
    }
    break;
    default:
    break;
    }
    } else {
    switch (key) {
    case 53:
    case -5:// 确认键
    this.player.setBomb(this.player.getRow(), this.player.getCol());
    break;
    }
    }
    }

    public void restart() {
    new Loading(this.stageIndex);
    }

    public void continueGame() {
    this.isPause = false;
    this.player.play();
    }

    public void pauseGame() {
    this.isPause = true;
    this.player.stop();
    }

    public void endGame() {
    this.isEnd = true;
    this.mainThread = null;
    System.gc();
    try {
    Thread.sleep(500);
    } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    this.dreamBubbleMidlet.menu.showMe();
    }

    public void nextStage() {
    if (this.stageIndex < 4) {
    this.stageIndex++;
    }
    new Loading(this.stageIndex);
    }

    public void preStage() {
    if (this.stageIndex > 0) {
    this.stageIndex--;
    }
    new Loading(this.stageIndex);
    }

    class Loading implements Runnable {
    private Thread innerThread;
    private int stageIndex;

    public Loading(int stageIndex) {
    this.stageIndex = stageIndex;
    innerThread = new Thread(this);
    innerThread.start();
    }

    public void run() {
    isLoading = true;
    loadPercent = 0;
    System.gc();
    loadStage(stageIndex);
    isLoading = false;
    }
    }

    public void sleep() {
    try {
    Thread.sleep(100);
    } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    }

    这个是游戏主体类

    下面是游戏的人物类

    package Game;

    import javax.microedition.lci.Image;
    import javax.microedition.lci.game.Sprite;

    public abstract class Role extends Sprite {

    /**
    * 人物的基本属性
    */
    protected int type;
    protected int xCoodinate;
    protected int yCoodinate;
    protected int row;
    protected int col;
    protected int width;
    protected int height;
    protected int speed;
    protected int status;
    protected boolean isCanOperate = false;
    protected boolean isAlive = true;

    /**
    * 人物放置炸弹的基本属性
    */
    protected int power;
    protected int bombNums;

    protected int characterClock = 0;
    protected int deadTime = 0;

    protected Game game;

    protected Role(Image image, int width, int Height, Game game) {
    super(image, width, Height);
    this.game = game;
    }

    /**
    * 人物拾起道具
    * @param tool
    */
    public abstract void pickupTool(int tool);
    /**
    * 碰撞检测以及坐标的改变,如果对行走条件有特殊需求,既可以在这里写自己的条件
    * @param direction
    */
    public abstract void collisionCheck(int direction);

    public void updateRole() {
    if (this.characterClock < 10000) {
    this.characterClock++;
    } else {
    this.characterClock = 100;
    }

    int row = this.getRow();
    int col = this.getCol();

    if (this.isAlive) {

    int tool = this.game.map.getToolLayer().getCell(col, row);

    if (tool > 0) {
    this.pickupTool(tool);
    this.game.map.getToolLayer().setCell(col, row, 0);
    }

    if (this.game.map.hasFeature(row, col, Global.DEADLY)) {
    this.isAlive = false;
    return;
    }

    if (this.status == Global.BORN
    && this.characterClock > Global.BORN_TIME) {
    this.status = Global.SOUTH;
    this.setFrame(Global.SOUTH * 6);
    this.isCanOperate = true;
    }

    if (this.status == Global.BORN) {
    if (this.characterClock % 2 == 0)
    this.setFrame(Global.BORN * 6 + (this.getFrame() - 1) % 4);
    return;
    }

    } else {
    this.isCanOperate = false;
    if (this.deadTime <= 20) {
    this.deadTime++;
    } else {
    this.deadTime = 100;
    this.setVisible(false);
    return;
    }

    if (this.characterClock % 2 == 0) {
    if (this.getFrame() < Global.DEAD * 6) {
    this.setFrame(Global.DEAD * 6);
    } else {
    if (this.getFrame() < 29) {
    this.setFrame(this.getFrame() + 1);
    } else {
    if (this.characterClock % 4 == 0) {
    this.setFrame(29);
    this.setVisible(true);
    } else {
    this.setVisible(false);
    }
    }
    }
    }
    }
    }

    public void walk(int direction) {
    if (!isAlive)
    return;
    if (!isCanOperate)
    return;
    if(direction==9) return;
    this.collisionCheck(direction);

    if (this.characterClock % 2 == 0) {
    if (this.status == direction) {
    this.setFrame(this.status * 6 + (this.getFrame() + 1) % 6);
    } else {
    this.status = direction;
    this.setFrame(this.status * 6);
    }
    }
    this.setPosition(xCoodinate, yCoodinate);
    }

    public void stop() {
    this.isCanOperate = false;
    }

    public void play() {
    this.isCanOperate = true;
    }

    public abstract void setBomb(int row, int col);

    public void increaseBomb() {
    if (this.bombNums < Global.MAX_BOMB_NUMBER)
    this.bombNums++;
    }

    public int getRow() {
    return getRow(getBottomY(yCoodinate) - Global.MAP_CELL / 2);
    }

    public int getCol() {
    return getCol(xCoodinate + Global.MAP_CELL / 2);
    }

    protected int getBottomY(int y) {
    return y + this.height - 1;
    }

    protected int getRightX(int x) {
    return x + Global.MAP_CELL - 1;
    }

    protected int getPreY(int y) {
    return getBottomY(y) + 1 - Global.MAP_CELL;
    }

    protected int getRow(int x) {
    return x / Global.MAP_CELL;
    }

    protected int getCol(int y) {
    return y / Global.MAP_CELL;
    }
    }

    我的QQ是609419340

    看不明白的可以随时来问我哦,还可以当时传给你撒

    阅读全文

    与Jack人体仿真源码相关的资料

    热点内容
    dvd光盘存储汉子算法 浏览:757
    苹果邮件无法连接服务器地址 浏览:962
    phpffmpeg转码 浏览:671
    长沙好玩的解压项目 浏览:144
    专属学情分析报告是什么app 浏览:564
    php工程部署 浏览:833
    android全屏透明 浏览:737
    阿里云服务器已开通怎么办 浏览:803
    光遇为什么登录时服务器已满 浏览:302
    PDF分析 浏览:484
    h3c光纤全工半全工设置命令 浏览:143
    公司法pdf下载 浏览:381
    linuxmarkdown 浏览:350
    华为手机怎么多选文件夹 浏览:683
    如何取消命令方块指令 浏览:349
    风翼app为什么进不去了 浏览:778
    im4java压缩图片 浏览:362
    数据查询网站源码 浏览:150
    伊克塞尔文档怎么进行加密 浏览:892
    app转账是什么 浏览:163