Ejemplo n.º 1
0
 /**
  * 游戏背景绘制
  *
  * @param g
  */
 protected void background(GLEx g) {
   switch (backgroundMode) {
     case BACK_STAR_MODE:
       if (starColor != null) {
         g.setColor(starColor);
       }
       g.glBegin(GL.GL_LINES);
       for (int j = 0; j < dot_size; this.count = (this.count + 1) % dot_size) {
         int index = this.dot[this.count] % 3;
         g.glVertex2f(dot[count] - index, getHeight() - j * 10);
         g.glVertex2f(dot[count] + index, getHeight() - j * 10);
         g.glVertex2f(dot[count], getHeight() - j * 10 - index);
         g.glVertex2f(dot[count], getHeight() - j * 10 + index);
         ++j;
       }
       g.glEnd();
       if (starColor != null) {
         g.resetColor();
       }
       break;
     case BACK_SCROLL_MODE:
       if (scroll != null) {
         scroll.createUI(g);
       }
       break;
     case BACK_OTHER_MODE:
       drawOtherBackground(g);
       break;
     case BACK_EMPTY_MODE:
     default:
       break;
   }
 }