Exemple #1
0
        public static bool Init()
        {
            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);

            int sx = (graphics.Screen.Width / 2) - ((96 * 2) + (16 * 2));
            int sy = (graphics.Screen.Height / 2) - (96 / 2);

            playButton   = new SampleButton(sx + 0, sy - 24, 96, 48);
            stopButton   = new SampleButton(sx + 112, sy - 24, 96, 48);
            pauseButton  = new SampleButton(sx + 224, sy - 24, 96, 48);
            resumeButton = new SampleButton(sx + 336, sy - 24, 96, 48);
            volumeSlider = new SampleSlider(sx + 88, sy + 96, 256, 48);

            volTextPosX = (sx + 88) - 96;
            volTextPosY = (sy + 96) + 12;

            playButton.SetText("Play");
            stopButton.SetText("Stop");
            pauseButton.SetText("Pause");
            resumeButton.SetText("Resume");

            bgm       = new Bgm("/Application/Sample/Audio/BgmPlayerSample/GAME_BGM_01.mp3");
            bgmPlayer = bgm.CreatePlayer();

            return(true);
        }
Exemple #2
0
        public static bool Init()
        {
            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);

            connectButton = new SampleButton(48, 48, 256, 64);
            connectButton.SetText("Connect");

            connectState = ConnectState.None;

            return(true);
        }
Exemple #3
0
        public static bool Init()
        {
            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);

            serverButton = new SampleButton(32, 32, 128, 48);
            clientButton = new SampleButton(32 + (SampleDraw.Width / 2), 32, 128, 48);

            serverButton.SetText(tcpServer.buttonString);
            clientButton.SetText(tcpClient.buttonString);

            return(true);
        }
            public SoundButton(int id, int pixelX, int pixelY)
            {
                textSprite   = new SampleSprite("SE " + id, 0xffffffff, SampleDraw.CurrentFont, pixelX - 64, pixelY + 12);
                playButton   = new SampleButton(pixelX, pixelY, 96, 48);
                stopButton   = new SampleButton(pixelX + 112, pixelY, 96, 48);
                volumeSlider = new SampleSlider(pixelX + 224, pixelY, 256, 48);

                playButton.SetText("Play");
                stopButton.SetText("Stop");

                sound       = new Sound(soundName[id]);
                soundPlayer = sound.CreatePlayer();
            }
Exemple #5
0
        public static bool Init()
        {
            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);

            int rectW = 256;
            int rectH = 64;
            int rectX = (SampleDraw.Width - rectW) / 2;
            int rectY = (SampleDraw.Height - 24 - rectH * 3) / 2;

            browserButton = new SampleButton(rectX, rectY, rectW, rectH);

            browserButton.SetText("Browser");

            return(true);
        }
Exemple #6
0
        public static bool Init()
        {
            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);

            int rectW = SampleDraw.Width / 2;
            int rectH = 32;
            int rectX = (SampleDraw.Width - rectW) / 2;
            int rectY = (SampleDraw.Height - 24) / 2;

            button = new SampleButton(rectX, rectY, rectW, rectH);
            button.SetText("InputText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle);

            dialog = null;

            return(true);
        }
Exemple #7
0
        // use objects intialize.
        private static void SetupObjects()
        {
            int sx   = (screenWidth - (BUTTON_NO * 192)) / 2;
            int soff = (192 - 96) / 2;

            button0 = new SampleButton(sx + (192 * 0) + soff, 128, 128, 48);
            button1 = new SampleButton(sx + (192 * 1) + soff, 128, 128, 48);
            button2 = new SampleButton(sx + (192 * 2) + soff, 128, 128, 48);

            button0.SetText(BUTTON_LOAD);
            button1.SetText(BUTTON_SAVE);
            button2.SetText(BUTTON_DELETE);

            string label = "";

            dialogXPos      = (screenWidth - 480) / 2;
            inputTextButton = new SampleButton(dialogXPos, 256, 480, 32);
            inputTextButton.SetText(label, SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle);
            dialog = null;
        }
Exemple #8
0
        public static bool Init()
        {
            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);


            inputTextButton = new SampleButton(32, 64, 480, 32);
            copyButton      = new SampleButton(544, 64, 96, 32);
            pasteButton     = new SampleButton(32, 240, 96, 32);
            copyTextButton  = new SampleButton(160, 240, 480, 32);

            copyTextButton.ButtonColor = 0xff7f7f7f;

            inputTextButton.SetText("InputText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle);
            copyButton.SetText("Copy");
            pasteButton.SetText("Paste");
            copyTextButton.SetText("CopyText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle);

            dialog = null;

            return(true);
        }
        // use objects intialize.
        private static void SetupObjects()
        {
            int sx   = (screenWidth - (BUTTON_NO * 128)) / 2;
            int soff = (128 - 96) / 2;

            button0 = new SampleButton(sx + (128 * 0) + soff, 128, 96, 48);
            button1 = new SampleButton(sx + (128 * 1) + soff, 128, 96, 48);
            button2 = new SampleButton(sx + (128 * 2) + soff, 128, 96, 48);
            button3 = new SampleButton(sx + (128 * 3) + soff, 128, 96, 48);

            if (0 == persistentMemoryData[STATE_ADDR_BUTTON0])
            {
                button0.SetText(BUTTON_RELEASE);
                button0.ButtonColor = DISABLE_COLOR;
            }
            else
            {
                button0.SetText(BUTTON_PRESS);
                button0.ButtonColor = ENABLE_COLOR;
            }

            if (0 == persistentMemoryData[STATE_ADDR_BUTTON1])
            {
                button1.SetText(BUTTON_RELEASE);
                button1.ButtonColor = DISABLE_COLOR;
            }
            else
            {
                button1.SetText(BUTTON_PRESS);
                button1.ButtonColor = ENABLE_COLOR;
            }

            if (0 == persistentMemoryData[STATE_ADDR_BUTTON2])
            {
                button2.SetText(BUTTON_RELEASE);
                button2.ButtonColor = DISABLE_COLOR;
            }
            else
            {
                button2.SetText(BUTTON_PRESS);
                button2.ButtonColor = ENABLE_COLOR;
            }

            if (0 == persistentMemoryData[STATE_ADDR_BUTTON3])
            {
                button3.SetText(BUTTON_RELEASE);
                button3.ButtonColor = DISABLE_COLOR;
            }
            else
            {
                button3.SetText(BUTTON_PRESS);
                button3.ButtonColor = ENABLE_COLOR;
            }

            // for slider setting
            byte[] byteArray = new byte[4];
            for (int i = 0; i < 4; i++)
            {
                byteArray[i] = persistentMemoryData[STATE_ADDR_SLIDER + i];
            }
            float rate = BitConverter.ToSingle(byteArray, 0);

            sx          = (screenWidth - 384) / 2;
            slider      = new SampleSlider(sx, 360, 384, 48);
            slider.Rate = rate;
            oldRate     = rate;

            // for text dialog setting
            byte[] byteArrayD0 = new byte[4];
            for (int i = 0; i < 4; i++)
            {
                byteArrayD0[i] = persistentMemoryData[STATE_ADDR_STRING_NO + i];
            }
            int len      = BitConverter.ToInt32(byteArrayD0, 0);
            int readSize = len * 2;

            byte[] byteArrayD1 = new byte[readSize];
            for (int i = 0; i < readSize; i++)
            {
                byteArrayD1[i] = persistentMemoryData[STATE_ADDR_STRING + i];
            }

            string label = "";

            if (len != 0)
            {
                label = System.Text.Encoding.Unicode.GetString(byteArrayD1);
            }

            sx = (screenWidth - 480) / 2;
            inputTextButton = new SampleButton(sx, 256, 480, 32);
            inputTextButton.SetText(label, SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle);
            dialog = null;
        }