예제 #1
0
    public Sprite (float dx, float dy, int color, int width, int height,
      Picture.Format pf) {
      
      x = window.width/2;
      y = window.height/2;
      this.dx = dx;
      this.dy = dy;
      this.color = color;
      this.width = width;
      this.height = height;

      pixmap = new Pixmap (display.default_root, width, height, 
        pf.depth ());
      picture = render.create_picture (pixmap, pf,
        Picture.Attributes.EMPTY); 

      if (sprite_gc == null)
        sprite_gc = new GC (pixmap);      
    
      sprite_gc.set_foreground (0);
      pixmap.rectangle (sprite_gc, 0, 0, width, height, true);
      sprite_gc.set_foreground (color);
      pixmap.arc (sprite_gc, 0, 0, width, height, 0, 360*64, true);


      for (int i=0; i<8; i++) {
        sprite_gc.set_foreground (divide_color (color, 1<<(7-i)));
        pixmap.arc (sprite_gc, i, i, width-2*i, height-2*i, 
          0, 360*64, true);
      }
    }
예제 #2
0
            public Sprite(float dx, float dy, int color, int width, int height,
                          Picture.Format pf)
            {
                x           = window.width / 2;
                y           = window.height / 2;
                this.dx     = dx;
                this.dy     = dy;
                this.color  = color;
                this.width  = width;
                this.height = height;

                pixmap = new Pixmap(display.default_root, width, height,
                                    pf.depth());
                picture = render.create_picture(pixmap, pf,
                                                Picture.Attributes.EMPTY);

                if (sprite_gc == null)
                {
                    sprite_gc = new GC(pixmap);
                }

                sprite_gc.set_foreground(0);
                pixmap.rectangle(sprite_gc, 0, 0, width, height, true);
                sprite_gc.set_foreground(color);
                pixmap.arc(sprite_gc, 0, 0, width, height, 0, 360 * 64, true);


                for (int i = 0; i < 8; i++)
                {
                    sprite_gc.set_foreground(divide_color(color, 1 << (7 - i)));
                    pixmap.arc(sprite_gc, i, i, width - 2 * i, height - 2 * i,
                               0, 360 * 64, true);
                }
            }