Esempio n. 1
0
 public final void paint(Graphics g) {
   // g.drawImage(image, x, y, 0);
   // TODO draw frame
   if (this.isVisible()) {
     int nbFramesPerLine = image.getWidth() / frameWidth;
     int frameX = (frame % nbFramesPerLine) * frameWidth;
     int frameY = (frame / nbFramesPerLine) * frameHeight;
     g.drawRegion(image, frameX, frameY, frameWidth, frameHeight, 0, x, y, 0);
   }
 }
Esempio n. 2
0
 public static int draw(final Graphics g, final int x, final int y, final char ch) {
   if (ch >= '0' && ch <= '9') {
     int iy = (ch - '0') * fh;
     g.drawRegion(dig, 0, iy, fw, fh, 0, x, y, 0);
     return fw + 2;
   } else if (ch == hrs) {
     g.drawRegion(dig, 0, 360, fw - 2, fh, 0, x, y, 0);
   } else if (ch == min) {
     g.drawRegion(dig, 0, 396, fw - 2, fh - 3, 0, x, y + 1, 0);
   } else if (ch == sec) {
     g.drawRegion(dig, 0, 429, fw - 2, fh - 3, 0, x, y + 1, 0);
   } else if (ch == kh) {
     g.drawRegion(dig, 0, 462, fw - 2, fh - 3, 0, x, y + 1, 0);
   } else if (ch == km) {
     g.drawRegion(dig, 0, 525, fw - 2, fh - 3, 0, x, y + 1, 0);
   } else {
     g.setColor(0);
     if (ch == ':') {
       g.fillRect(x, y + 7, 5, 5);
       g.fillRect(x, y + 23, 5, 5);
     } else if (ch == '.') {
       g.fillRect(x + 1, y + fh - 5, 5, 5);
       return 7;
     } else if (ch == '_') {
       g.fillRect(x + 1, y + fh - 5, fw, 5);
       return fw + 2;
     } else return fw;
   }
   return fw - 4;
 }
Esempio n. 3
0
 private void drawMap(Graphics g) {
   g.setColor(0);
   g.fillRect(0, 0, gd.screenWidth, gd.screenHeight);
   //        System.out.println("x:" + gd.curMap.x);
   //        System.out.println("y:" + gd.curMap.y);
   g.drawRegion(
       gd.curMap.image,
       gd.curMap.x,
       gd.curMap.y,
       gd.curMap.image.getWidth() < gd.screenWidth ? gd.curMap.image.getWidth() : gd.screenWidth,
       gd.curMap.image.getHeight() < gd.screenHeight
           ? gd.curMap.image.getHeight()
           : gd.screenHeight,
       0,
       0,
       0,
       0);
 }