示例#1
0
        public EmulatorButtons(EmulatorListener el, int w, int h, float scale)
        {
            this.emulatorListener = el;
            this.dpad             = XNAConfig.LoadTexture("e1.png");
            this.buttons          = XNAConfig.LoadTexture("e2.png");

            this.width  = w;
            this.height = h;

            if (scale <= 1f)
            {
                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);
        }
示例#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 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));
            }

            this.up._monitor       = new up_monitor(el);
            this.left._monitor     = new left_monitor(el);
            this.right._monitor    = new right_monitor(el);
            this.down._monitor     = new down_monitor(el);
            this.triangle._monitor = new triangle_monitor(el);
            this.square._monitor   = new square_monitor(el);
            this.circle._monitor   = new circle_monitor(el);
            this.cancel._monitor   = new cancel_monitor(el);
            if (dpad != null)
            {
                dpad.Dispose();
                dpad = null;
            }
            if (buttons != null)
            {
                buttons.Dispose();
                buttons = null;
            }
            this.visible = true;

            this.SetLocation(0, 0);
        }
        public EmulatorButtons(EmulatorListener el, int w, int h, float scale)
        {
            this.emulatorListener = el;
            this.dpad = XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "e1.png");
            this.buttons = XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "e2.png");

            this.width = w;
            this.height = h;

            if (scale <= 1f)
            {
                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);
        }