예제 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);



            SetContentView(Chip8Android.Resource.Layout.Main);
            SetClickHandler(Resource.Id.button0);
            SetClickHandler(Resource.Id.button1);
            SetClickHandler(Resource.Id.button2);
            SetClickHandler(Resource.Id.button3);
            SetClickHandler(Resource.Id.button4);
            SetClickHandler(Resource.Id.button5);
            SetClickHandler(Resource.Id.button6);
            SetClickHandler(Resource.Id.button7);
            SetClickHandler(Resource.Id.button8);
            SetClickHandler(Resource.Id.button9);
            SetClickHandler(Resource.Id.buttonA);
            SetClickHandler(Resource.Id.buttonB);
            SetClickHandler(Resource.Id.buttonC);
            SetClickHandler(Resource.Id.buttonD);
            SetClickHandler(Resource.Id.buttonE);
            SetClickHandler(Resource.Id.buttonF);

            Chip8View view = (Chip8View)FindViewById(Resource.Id.chip8view);

            var memory = new Memory();

            memory.InitializeInterpreterBuffer();
            int appno = 2;
            var apps  = new string[] {
                "IBM Logo.ch8",
                "Brix.ch8",
                "Keypad Test.ch8",
                "Trip8 Demo.ch8"
            };

            var stream = Assets.Open(apps[appno]);

            byte[] buffer = new byte[3584];
            stream.Read(buffer, 0, 3584);
            memory.LoadProgram(buffer);
            keyboard = new KeyboardHandler();
            var chip8 = new CPU(memory, view, keyboard);

            timer          = new System.Timers.Timer(1);
            timer.Elapsed += (sender, e) => chip8.Clock();
            timer.Enabled  = true;

//			GridView view = (GridView)FindViewById(Resource.Id.gridview);
//			view.Adapter = new ImageAdapter(this.BaseContext);
        }
예제 #2
0
파일: MainActivity.cs 프로젝트: perfp/Chip8
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Chip8Android.Resource.Layout.Main);
            SetClickHandler(Resource.Id.button0);
            SetClickHandler(Resource.Id.button1);
            SetClickHandler(Resource.Id.button2);
            SetClickHandler(Resource.Id.button3);
            SetClickHandler(Resource.Id.button4);
            SetClickHandler(Resource.Id.button5);
            SetClickHandler(Resource.Id.button6);
            SetClickHandler(Resource.Id.button7);
            SetClickHandler(Resource.Id.button8);
            SetClickHandler(Resource.Id.button9);
            SetClickHandler(Resource.Id.buttonA);
            SetClickHandler(Resource.Id.buttonB);
            SetClickHandler(Resource.Id.buttonC);
            SetClickHandler(Resource.Id.buttonD);
            SetClickHandler(Resource.Id.buttonE);
            SetClickHandler(Resource.Id.buttonF);

            Chip8View view = (Chip8View)FindViewById(Resource.Id.chip8view);

            var memory = new Memory();
            memory.InitializeInterpreterBuffer();
            int appno = 2;
            var apps = new string[]{
                "IBM Logo.ch8",
                "Brix.ch8",
                "Keypad Test.ch8",
                "Trip8 Demo.ch8"
            };

            var stream = Assets.Open(apps[appno]);
            byte[] buffer = new byte[3584];
            stream.Read(buffer, 0, 3584);
            memory.LoadProgram(buffer);
            keyboard = new KeyboardHandler();
            var chip8 = new CPU(memory, view, keyboard);

            timer = new System.Timers.Timer(1);
            timer.Elapsed += (sender, e) => chip8.Clock();
            timer.Enabled = true;

            //			GridView view = (GridView)FindViewById(Resource.Id.gridview);
            //			view.Adapter = new ImageAdapter(this.BaseContext);
        }