Пример #1
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            *  Modules added in the Program.gadgeteer designer view are used by typing
            *  their name followed by a period, e.g.  button.  or  camera.
            *
            *  Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
            *   button.ButtonPressed +=<tab><tab>
            *
            *  If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
            *   GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
            *   timer.Tick +=<tab><tab>
            *   timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.

            Debug.Print("Program Started");
            Breakout    breakout    = new Breakout(9);
            AnalogInput analogInput = breakout.CreateAnalogInput(GT.Socket.Pin.Three);

            while (true)
            {
                Debug.Print("Voltage: " + analogInput.ReadVoltage().ToString());
                Thread.Sleep(500);
            }

            /*
             * GT.Timer timer = new GT.Timer(500);
             * timer.Tick += timer_Tick;
             * timer.Start();
             */
        }
Пример #2
0
        private void Awake()
        {
            breakout = new Breakout();
            Generate();

            var instructionsText = InstantiateControl<TextControl>(leftPanel);
            instructionsText.Initialize("Use A/D or Left/Right to move");

            var wallWidthSlider = InstantiateControl<SliderControl>(leftPanel);
            wallWidthSlider.Initialize("Wall width", 1, 20, wallWidth, value => wallWidth = value);

            var wallHeightSlider = InstantiateControl<SliderControl>(leftPanel);
            wallHeightSlider.Initialize("Wall height", 1, 20, wallHeight, value => wallHeight = value);

            var wallHeightOffsetSlider = InstantiateControl<SliderControl>(leftPanel);
            wallHeightOffsetSlider.Initialize("Wall height offset", 1, 10, wallHeightOffset,
                value => wallHeightOffset = value);

            var paddleWidthSlider = InstantiateControl<SliderControl>(leftPanel);
            paddleWidthSlider.Initialize("Paddle width", 1, 10, paddleWidth, value => paddleWidth = value);

            var ballSizeSlider = InstantiateControl<SliderControl>(leftPanel);
            ballSizeSlider.Initialize("Ball size", 0.5f, 3f, ballSize, value => ballSize = value);

            var ballVelocitySlider = InstantiateControl<SliderControl>(leftPanel);
            ballVelocitySlider.Initialize("Ball velocity", 1, 20, ballVelocityMagnitude,
                value => ballVelocityMagnitude = value);

            var generateButton = InstantiateControl<ButtonControl>(leftPanel);
            generateButton.Initialize("Generate", Generate);
        }
Пример #3
0
        private void Awake()
        {
            breakout = new Breakout(mainCamera);
            Generate();

            InstantiateControl<TextControl>(leftPanel).Initialize("Use A/D or Left/Right to move");

            InstantiateControl<SliderControl>(leftPanel)
                .Initialize("Wall width", 1, 20, wallWidth, value =>
                {
                    wallWidth = value;
                    Generate();
                });

            InstantiateControl<SliderControl>(leftPanel)
                .Initialize("Wall height", 1, 20, wallHeight, value =>
                {
                    wallHeight = value;
                    Generate();
                });

            InstantiateControl<SliderControl>(leftPanel)
                .Initialize("Wall height offset", 1, 10, wallHeightOffset, value =>
                {
                    wallHeightOffset = value;
                    Generate();
                });

            InstantiateControl<SliderControl>(leftPanel)
                .Initialize("Paddle width", 1, 10, paddleWidth, value =>
                {
                    paddleWidth = value;
                    Generate();
                });

            InstantiateControl<SliderControl>(leftPanel)
                .Initialize("Ball size", 0.5f, 3f, ballSize, value =>
                {
                    ballSize = value;
                    Generate();
                });

            InstantiateControl<SliderControl>(leftPanel)
                .Initialize("Ball velocity", 1, 20, ballVelocityMagnitude, value =>
                {
                    ballVelocityMagnitude = value;
                    Generate();
                });

            InstantiateControl<ButtonControl>(leftPanel).Initialize("Generate", Generate);
        }
Пример #4
0
        private void Awake()
        {
            breakout = new Breakout(mainCamera);
            Generate();

            InstantiateControl <TextControl>(leftPanel).Initialize("Use A/D or Left/Right to move");

            InstantiateControl <SliderControl>(leftPanel)
            .Initialize("Wall width", 1, 20, config.wallWidth, value =>
            {
                config.wallWidth = value;
                Generate();
            });

            InstantiateControl <SliderControl>(leftPanel)
            .Initialize("Wall height", 1, 20, config.wallHeight, value =>
            {
                config.wallHeight = value;
                Generate();
            });

            InstantiateControl <SliderControl>(leftPanel)
            .Initialize("Wall height offset", 1, 10, config.wallHeightOffset, value =>
            {
                config.wallHeightOffset = value;
                Generate();
            });

            InstantiateControl <SliderControl>(leftPanel)
            .Initialize("Paddle width", 1, 10, config.paddleWidth, value =>
            {
                config.paddleWidth = value;
                Generate();
            });

            InstantiateControl <SliderControl>(leftPanel)
            .Initialize("Ball size", 0.5f, 3f, config.ballSize, value =>
            {
                config.ballSize = value;
                Generate();
            });

            InstantiateControl <SliderControl>(leftPanel)
            .Initialize("Ball velocity", 1, 20, config.ballVelocityMagnitude, value =>
            {
                config.ballVelocityMagnitude = value;
                Generate();
            });

            InstantiateControl <ButtonControl>(leftPanel).Initialize("Generate", Generate);
        }
Пример #5
0
        private void Awake()
        {
            breakout = new Breakout();
            Generate();

            var instructionsText = InstantiateControl <TextControl>(leftPanel);

            instructionsText.Initialize("Use A/D or Left/Right to move");

            var wallWidthSlider = InstantiateControl <SliderControl>(leftPanel);

            wallWidthSlider.Initialize("Wall width", 1, 20, wallWidth, value => wallWidth = value);

            var wallHeightSlider = InstantiateControl <SliderControl>(leftPanel);

            wallHeightSlider.Initialize("Wall height", 1, 20, wallHeight, value => wallHeight = value);

            var wallHeightOffsetSlider = InstantiateControl <SliderControl>(leftPanel);

            wallHeightOffsetSlider.Initialize("Wall height offset", 1, 10, wallHeightOffset,
                                              value => wallHeightOffset = value);

            var paddleWidthSlider = InstantiateControl <SliderControl>(leftPanel);

            paddleWidthSlider.Initialize("Paddle width", 1, 10, paddleWidth, value => paddleWidth = value);

            var ballSizeSlider = InstantiateControl <SliderControl>(leftPanel);

            ballSizeSlider.Initialize("Ball size", 0.5f, 3f, ballSize, value => ballSize = value);

            var ballVelocitySlider = InstantiateControl <SliderControl>(leftPanel);

            ballVelocitySlider.Initialize("Ball velocity", 1, 20, ballVelocityMagnitude,
                                          value => ballVelocityMagnitude = value);

            var generateButton = InstantiateControl <ButtonControl>(leftPanel);

            generateButton.Initialize("Generate", Generate);
        }
Пример #6
0
 static void Main()
 {
     using (var game = new Breakout())
             game.Run();
 }