Ejemplo n.º 1
0
        public InvadersScorer(
            ICompositionRenderer renderer,
            GameContext context)
        {
            this._renderer = renderer;
            this._context  = context;

            //creates the target composition instance
            this._composition = renderer.CreateTarget();

            //create the "ship" custom character
            ((BoostHD44780)renderer).DefineCustomCharacter(
                CharCodeShip,
                new byte[8] {
                0x00, 0x04, 0x04, 0x0E, 0x1F, 0x1F, 0x1F, 0x00
            }
                );

            //create the "del" custom character
            ((BoostHD44780)renderer).DefineCustomCharacter(
                CharCodeDel,
                new byte[8] {
                0x18, 0x14, 0x14, 0x18, 0x04, 0x04, 0x07, 0x00
            }
                );

            //create the "end" custom character
            ((BoostHD44780)renderer).DefineCustomCharacter(
                CharCodeEnd,
                new byte[8] {
                0x1C, 0x14, 0x14, 0x1D, 0x06, 0x06, 0x05, 0x00
            }
                );
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            //create a led-matrix driver instance
            _renderer = new SureHT1632(
                cspin: Pins.GPIO_PIN_D10,
                clkpin: Pins.GPIO_PIN_D9);

            //creates the target composition instance
            _composition = _renderer.CreateTarget();

            //creates a series of bouncing-ball instances
            var rnd = new Random();

            for (int i = 0; i < BallCount; i++)
            {
                _renderables[i] = new Ball(rnd.Next());
            }

            //start the timer for the demo loop
            const int LoopPeriod = 50; //ms

            _clock = new Timer(
                ClockTick,
                null,
                LoopPeriod,
                LoopPeriod);

            //keep alive
            Thread.Sleep(Timeout.Infinite);
        }
Ejemplo n.º 3
0
        public InvadersGame(
            ICompositionRenderer renderer,
            GameContext context)
        {
            this._renderer = renderer;
            this._context  = context;

            //creates the target composition instance
            this._composition = renderer.CreateTarget();

            //consider the intro stage first
            this._nextStage = new GameStageIntro(context);
        }
Ejemplo n.º 4
0
        public static void Main()
        {
            //create a led-matrix driver instance
            _renderer = new SureHT1632(
                cspin: Pins.GPIO_PIN_D10,
                clkpin: Pins.GPIO_PIN_D9);

            //creates the target composition instance
            _composition = _renderer.CreateTarget();

            //start the timer for the demo loop
            const int LoopPeriod = 100; //ms

            _clock = new Timer(
                ClockTick,
                null,
                LoopPeriod,
                LoopPeriod);

            //keep alive
            Thread.Sleep(Timeout.Infinite);
        }