j2me设计论文-俄罗斯方块内容摘要:
((leftpre_left)*box_size, (toppre_top)*box_size)。 (g, box_size, [colorIndex])。 } else { // just changed: (left*box_size, top*box_size)。 (g, box_size)。 // draw new position: (g, box_size, [colorIndex])。 // make prev=current until next change: previousShape=currentShape。 } } public Shape getNextShape() { return [nextShapeIndex]。 }}/*package。 import .*。 /** * To represent the container of all boxes.*/public final class Background implements Storable { public static final int EMPTY = 99。 // holds width amp。 height: private int width。 private int height。 // holds boxes, EMPTY or color_index: private int[][] boxes。 // holds the rows that can be removed. private boolean[] removingRows。 // make sure cannot instanciate from outside: public Background(int width, int height) { = width。 = height。 = new boolean[height]。 = new int[width][height]。 } public int getWidth() { return。 } public int getHeight() { return。 } /** * Clean all boxes and can start a new game. */ public void init() { for(int i=0。 iwidth。 i++) { for(int j=0。 jheight。 j++) boxes[i][j] = EMPTY。 } for(int i=0。 iheight。 i++) removingRows[i] = false。 } public byte[] getRecordData() { byte[] data = new byte[width*height]。 int offset = 0。 for(int r=0。 rheight。 r++) { for(int c=0。 cwidth。 c++) { data[offset] = (byte)boxes[c][r]。 offset++。 } } return data。 } public int setRecordData(byte[] data, int offset) { if(()width*height) return (1)。 for(int r=0。 rheight。 r++) { for(int c=0。 cwidth。 c++) { boxes[c][r] = data[offset]。 offset++。 } } return width*height。 } /** * Detect if there is a collition between two 4x4 area. * @param active The ActiveShape object. * @return True if there is a collition. */ public boolean collidesWith(ActiveShape active) { int[] data = ().getData()。 int left = ()。 int top = ()。 for(int i1=top, i2=0。 i1top+4。 i1++, i2++) { for(int j1=left, j2=0。 j1left+4。 j1++, j2++) { if(i1=0 amp。 amp。 i1height amp。 amp。 j1=0 amp。 amp。 j1width) if(data[4*i2+j2]==1 amp。 amp。 boxes[j1][i1]!=EMPTY) return true。 } } return false。 } public int[][] getBoxes() { return boxes。 } /** * Merge the ActiveShape to the Background. * @param active The ActiveShape object. */ public void merge(ActiveShape active) { int left = ()。 int top = ()。 int box。 for(int i=0。 i4。 i++) { for(int j=0。 j4。 j++) { box = ().getData()[i*4+j]。 if(box==1) { [left+j][top+i] = ()。 } } } } /** * Mark all rows that can be removed. */ public boolean[] markRemovingRows() { // mark all rows if it can be removed: for(int i=0。 iheight。 i++) { removingRows[i] = true。 for(int j=0。 jwidth。 j++) { if(boxes[j][i]==EMPTY) { removingRows[i] = false。 break。 } } } return removingRows。 } public int doRemove() { int r = height 1。 int i = height 1。 for(i=height1。 i=0。 i) { while(r=0 amp。 amp。 removingRows[r]) r。 if(r==(1)) break。 copyRow(r, i)。 r。 } for(int j=i。 j=0。 j) for(int n=0。 nwidth。 n++) boxes[n][j] = EMPTY。 return i+1。 } private void copyRow(int src, int dest) { for(int j=0。 jwidth。 j++) boxes[j][dest] = boxes[j][src]。 } private void moveDown(int removing) { for(int i=removing。 i0。 i) { // copy row[i1] to row[i]: for(int j=0。 jwidth。 j++) { boxes[j][i] = boxes[j][i1]。 } } // clean the top row: for(int j=0。 jwidth。 j++) boxes[j][0] = EMPTY。 } public void paint(Graphics g, int box_size) { (0xffffff)。 // white (0, 0, box_size*width+2, box_size*height+2)。 (0)。 (1, 1, box_size*width, box_size*height)。 (1, 1)。 // draw each boxes: for(int i=0。 iwidth。 i++) { for(int j=0。 jheight。 j++) { int color_index = boxes[i][j]。 if(color_index!=EMPTY) { ()。 (i*box_size, j*box_size, box_size, box_size)。 ([color_index])。 (i*box_size+1, j*box_size+1, box_size2, box_size2)。 } } } }}package。 public final class Colors { public static final int[] ALL_COLORS = { 0xff0000, 0xffff00, 0xff00ff, 0x00ff00, 0x00ffff, 0x0000ff, 0xffffff, 0xaa0000, 0xaaaa00, 0xaa00aa, 0x00aa00, 0x00aaaa, 0x0000aa, 0xaaaaaa }。 public static int indexOfColor(int color) { for(int i=0。 i。 i++) { if(ALL_COLORS[i]==color) return i。 } return 0。 }}package。 import .*。 import .*。 public final class MyCanvas extends Canvas implements Runnable,。j2me设计论文-俄罗斯方块
相关推荐
甚至对非常简单的查询 , 其选项也非常复杂。 而 JDBC 恰好相反 , 其尽量保证简单功能的简便性 , 而同时在必要时允许使用高级功能。 4. 启用纯 Java 需要象 JDBC 这样的 Java API 发送 SQL 语句时 , 连接一旦建立 , 就可用来向它所涉及的数据库传送 SQL 语句。 JDBC 对可被发送的SQL语句类型不加任何限制。 这就提供了很大的灵活性 ,
式 5下面是铜线在不同温度下的线径和所能承受的最大 电流 7幽城精剂觉斜与编迈灸赏伊箭注苔赐疾燥秒札虐焚阎嚎伸糯码廊逆撑唇杉欣毅哟粪茁淹缓溺锑诀聂耙蜗界桃曳鹏舷陶潦沈辅柱捶估适珍析剂漳尤痔 注意事项 ......................... 39 常用速查电工手册常用电工实用手册 因为专心 所以专业常用速查电工手册目 录一、功率电流快速计算公式,导线截面积与电流的关系
性的意见 ◎ 关心顾客的利益,急顾客所急 ◎ 帮助顾客作出正确的楼盘选择 ◎ 耐心地倾听顾客的意见和要求 ◎ 记住老顾客的偏好 第 0 页 共 100 页 销售人员的任务与个人素质、性格的关系 销售人员的任务 有关个人的素质和性格 确定未来顾客需要 创造力、机智、想象力、见闻广博、分析技巧 说明楼盘如何配合未来顾客需要 语言能力、文字好、知识丰富、热情 获得未来顾客的合约 说服能力、机智、坚定
and(MenuCommand)。 setCommandListener(this)。 } if( m_TextSp == null ){ //创建图形文字对象 try{ Image img = (/demo/)。 m_TextSp = new Sprite(img, 82, 25)。 本科课程设计论文 11 (41, 23)。 int x = getWidth()/2。 int y =
开位,龙义线送电 无问题。 联系省调 , 核对 220KV 故障录波器定值正确后投入。 合上龙义线 22161 及 22166 刀闸,合上 220KVI 母线 PT 刀闸。 合上龙义线2216 开关。 1 主变送电方案 将 1 主变 2201 分接头均置于“ 9”位置;检查保护投入情况。 检查 01 号主变高压侧 2201 开关、 22020 刀闸、 01