资源简介
便宜实惠
代码片段和文件信息
package me.deathjockey.tod;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.List;
public class InputHandler implements KeyListener {
public class Key {
public int presses absorbs;
public boolean down pressed;
public Key() {
keys.add(this);
}
public void toggle(boolean pressed) {
if(pressed != down) {
down = pressed;
}
if(pressed) {
presses++;
}
}
public void tick() {
if(absorbs < presses) {
absorbs++;
pressed = true;
} else {
pressed = false;
}
}
}
public List keys = new ArrayList();
public Key up = new Key();
public Key down = new Key();
public Key left = new Key();
public Key right = new Key();
public Key enter = new Key();
public Key use_rod = new Key();
public Key cursor_up = new Key();
public Key cursor_down = new Key();
public Key confirm = new Key();
public Key escape = new Key();
public InputHandler(TowerComponent game) {
game.addKeyListener(this);
}
@Override
public void keyPressed(KeyEvent e) {
toggle(e true);
}
@Override
public void keyReleased(KeyEvent e) {
toggle(e false);
}
@Override
public void keyTyped(KeyEvent e) {
}
public void toggle(KeyEvent ke boolean pressed) {
int k = ke.getKeyCode();
if(k == KeyEvent.VK_UP) up.toggle(pressed);
if(k == KeyEvent.VK_DOWN) down.toggle(pressed);
if(k == KeyEvent.VK_LEFT) left.toggle(pressed);
if(k == KeyEvent.VK_RIGHT) right.toggle(pressed);
if(k == KeyEvent.VK_W) up.toggle(pressed);
if(k == KeyEvent.VK_S) down.toggle(pressed);
if(k == KeyEvent.VK_A) left.toggle(pressed);
if(k == KeyEvent.VK_D) right.toggle(pressed);
if(k == KeyEvent.VK_2) cursor_up.toggle(pressed);
if(k == KeyEvent.VK_8) cursor_down.toggle(pressed);
if(k == KeyEvent.VK_SPACE) confirm.toggle(pressed);
if(k == KeyEvent.VK_ESCAPE) escape.toggle(pressed);
if(k == KeyEvent.VK_ENTER) enter.toggle(pressed);
if(k == KeyEvent.VK_L) use_rod.toggle(pressed);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\
文件 545 2012-12-24 09:09 Tower-of-the-Deathmaster-master\.classpath
文件 383 2012-12-24 09:09 Tower-of-the-Deathmaster-master\.project
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\.settings\
文件 587 2012-12-24 09:09 Tower-of-the-Deathmaster-master\.settings\org.eclipse.jdt.core.prefs
文件 1083 2012-12-24 09:09 Tower-of-the-Deathmaster-master\README.md
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\
文件 1000 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\InputHandler$Key.class
文件 2170 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\InputHandler.class
文件 844 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\Towerap
文件 7753 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\TowerComponent.class
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\dy\
文件 9576 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\dy\DynamicsLoader.class
文件 1824 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\dy\xm
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\
文件 1351 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Combat.class
文件 4148 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Door.class
文件 4184 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Entity.class
文件 3685 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Item.class
文件 3100 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Level.class
文件 1627 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\NPC.class
文件 6037 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Pla
文件 2469 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Shop.class
文件 1579 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Stairs.class
文件 2218 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\level\Tile.class
目录 0 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\screen\
文件 3293 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\screen\Art.class
文件 3060 2012-12-24 09:09 Tower-of-the-Deathmaster-master\bin\me\deathjockey\tod\screen\Bitmap.class
............此处省略66个文件信息
相关资源
- 数据库 Javaweb有界面 学生管理系统
- JAVA OA平台源码转载SPRING BOOT....
- Echarts+ajax+java+mysql实现饼图+折线图+柱
- 临沂大学javaweb应用程序期末上机试题
- 学生档案管理系统
- 使用java实现的仿QQ登陆以及文件传输
- Java调用百度人脸识别
- 农产品质量安全追溯系统
- 尚硅谷全套视频打包地址不对外最新
- 酒店客房管理系统毕业设计
- exe4j-64位java-4.5.2.zip
- java资费管理系统
- Java实现员工信息管理系统
- 学生选课(数据库课程设计)(java
- java调用openssl生成证书
- 在线投稿系统
- java 多个多页的tif文件转pdf方法
- 2019牛客网上面试题库java篇附带解析与
- 2019牛客网上面试题库java篇附带解析与
- java web毕业论文模板
- java实现的小电子相册源码+文档
- java网络相册
- javaweb酒店客房预订系统
- java中国象棋源代码
- itextpdf在已有pdf指定页及位置添加图片
- java之NIO中文版
- 酒店订单管理系统(Jsp+servlet+mysql)
- java+毕业设计+进销存管理系统+源码
- java web 18种登录页面模板
- java搜索引擎
评论
共有 条评论