Пример #1
0
 public LPad(int x, int y, LTexturePack p, float scale): base(x, y, (int)(p.GetEntry("fore").Width() * scale), (int)(p
             .GetEntry("fore").Height() * scale))
 {
    
     this.offsetX = 6 * scale;
     this.offsetY = 6 * scale;
     this.pack = p;
     this.dotWidth = (int)(p.GetEntry("dot").Width() * scale);
     this.dotHeight = (int)(p.GetEntry("dot").Height() * scale);
     this.baseWidth = (int)(p.GetEntry("fore").Width() * scale);
     this.baseHeight = (int)(p.GetEntry("fore").Height() * scale);
     this.backWidth = (int)(p.GetEntry("back").Width() * scale);
     this.backHeight = (int)(p.GetEntry("back").Height() * scale);
     this.centerX = (baseWidth - dotWidth) / 2 + offsetX;
     this.centerY = (baseHeight - dotHeight) / 2 + offsetY;
     this.scale_pad = scale;
     p.SetFormat(Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR);
 }
Пример #2
0
        public EmulatorButtons(EmulatorListener el, int w, int h, float scale)
        {
            this.emulatorListener = el;
            if (pack == null) {
                pack = new LTexturePack();
                pack.PutImage(XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "e1.png"));
                pack.PutImage(XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "e2.png"));
                pack.Pack(Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR);
            }
            RectBox.Rect2i bounds = pack.GetEntry(0).getBounds();
            this.dpad = new LTextureRegion(pack.GetTexture(), bounds.left,
                    bounds.top, bounds.right, bounds.bottom);
            bounds = pack.GetEntry(1).getBounds();
            this.buttons = new LTextureRegion(pack.GetTexture(), bounds.left,
                    bounds.top, bounds.right, bounds.bottom);
            this.width = w;
            this.height = h;

            if (scale <= 0f) {
                this.up = new EmulatorButton(dpad, 40, 40, 40, 0, true, 60, 60);
                this.left = new EmulatorButton(dpad, 40, 40, 0, 40, true, 60, 60);
                this.right = new EmulatorButton(dpad, 40, 40, 80, 40, true, 60, 60);
                this.down = new EmulatorButton(dpad, 40, 40, 40, 80, true, 60, 60);

                this.triangle = new EmulatorButton(buttons, 48, 48, 48, 0, true,
                        68, 68);
                this.square = new EmulatorButton(buttons, 48, 48, 0, 48, true, 68,
                        68);
                this.circle = new EmulatorButton(buttons, 48, 48, 96, 48, true, 68,
                        68);
                this.cancel = new EmulatorButton(buttons, 48, 48, 48, 96, true, 68,
                        68);
            } else {

                this.up = new EmulatorButton(dpad, 40, 40, 40, 0, true,
                        (int) (60 * scale), (int) (60 * scale));
                this.left = new EmulatorButton(dpad, 40, 40, 0, 40, true,
                        (int) (60 * scale), (int) (60 * scale));
                this.right = new EmulatorButton(dpad, 40, 40, 80, 40, true,
                        (int) (60 * scale), (int) (60 * scale));
                this.down = new EmulatorButton(dpad, 40, 40, 40, 80, true,
                        (int) (60 * scale), (int) (60 * scale));

                this.triangle = new EmulatorButton(buttons, 48, 48, 48, 0, true,
                        (int) (68 * scale), (int) (68 * scale));
                this.square = new EmulatorButton(buttons, 48, 48, 0, 48, true,
                        (int) (68 * scale), (int) (68 * scale));
                this.circle = new EmulatorButton(buttons, 48, 48, 96, 48, true,
                        (int) (68 * scale), (int) (68 * scale));
                this.cancel = new EmulatorButton(buttons, 48, 48, 48, 96, true,
                        (int) (68 * scale), (int) (68 * scale));
            }

            if (dpad != null) {
                dpad.Dispose();
                dpad = null;
            }
            if (buttons != null) {
                buttons.Dispose();
                buttons = null;
            }
            this.visible = true;

            this.SetLocation(0, 0);
        }
Пример #3
0
 public void Dispose()
 {
     if (pack != null) {
         pack.Dispose();
         pack = null;
     }
     if (batch != null) {
         batch.Dispose();
         batch = null;
     }
 }
Пример #4
0
		public TileMap(Field2D field, int mWidth, int mHeight, Loon.Core.Graphics.Opengl.LTexture.Format format) {
			this.field = field;
			this.maxWidth = mWidth;
			this.maxHeight = mHeight;
			this.offset = new Vector2f(0, 0);
			this.imgPack = new LTexturePack();
			this.format = format;
			this.lastOffsetX = -1;
			this.lastOffsetY = -1;
			this.active = true;
			this.dirty = true;
			this.visible = true;
			imgPack.SetFormat(format);
		}
Пример #5
0
		public void SetImagePack(string file) {
			if (imgPack != null) {
				imgPack.Dispose();
				imgPack = null;
			}
			this.active = false;
			this.dirty = true;
			imgPack = new LTexturePack(file);
			imgPack.Packed(format);
		}