Exemple #1
0
        public SkiaController()
        {
            CanvasView = new SKCanvasView();
            CanvasView.PaintSurface += canvasView_PaintSurface;
            ControllerContentView    = CanvasView;
            canvasInfoProvider       = new CanvasInfoProvider();
            SkiaBehaviourEngine      = new SkiaBehaviourEngine(canvasInfoProvider);
            SkiaInputManager skiaInputManager = SkiaBehaviourEngine.Instantiate <SkiaInputManager>();

            exit = false;
            Device.StartTimer(TimeSpan.FromSeconds(1 / 60f), () => { CanvasView.InvalidateSurface(); return(!exit); });
        }
Exemple #2
0
        public MainPage()
        {
            this.InitializeComponent();

            //CanvasView = new SKXamlCanvas();
            InputManager        = new InputManager(TouchRect);
            _CanvasInfoProvider = new CanvasInfoProvider();
            SkiaBehaviourEngine = new SkiaBehaviourEngine(_CanvasInfoProvider);
            _ControlPanel       = new KeyboardControllerPanel(SkiaBehaviourEngine);
            SkiaInputManager skiaInputManager = SkiaBehaviourEngine.Instantiate <SkiaInputManager>();

            skiaInputManager.InputManager = InputManager;
            TouchRect.SizeChanged        += CanvasView_SizeChanged;
            DispatcherTimer dispatcherTimer = new DispatcherTimer();

            dispatcherTimer.Tick    += DispatcherTimer_Tick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 16);
            dispatcherTimer.Start();
            System.Diagnostics.Debug.WriteLine("init:" + Thread.CurrentThread.ManagedThreadId);
        }
        public override void Start()
        {
            RectButton rectButton = SkiaBehaviourEngine.Instantiate <RectButton>();

            rectButton.RectTransform.AnchorMax = new SKPoint(0, 0);
            rectButton.RectTransform.AnchorMin = new SKPoint(0, 0);
            rectButton.RectTransform.OffsetMax = new SKPoint(1000, 1000);
            rectButton.RectTransform.OffsetMin = new SKPoint(500, 250);

            ColorJoystick colorJoystick = SkiaBehaviourEngine.Instantiate <ColorJoystick>();

            colorJoystick.RectTransform.AnchorMax = new SKPoint(0, 0);
            colorJoystick.RectTransform.AnchorMin = new SKPoint(0, 0);
            colorJoystick.RectTransform.OffsetMax = new SKPoint(2000, 500);
            colorJoystick.RectTransform.OffsetMin = new SKPoint(500, 250);

            /*
             * RectButton rectButton = SkiaBehaviourEngine.Instantiate<RectButton>();
             * rectButton.RectTransform.AnchorMin = new SKPoint(0, 0);
             * rectButton.RectTransform.AnchorMax = new SKPoint(0, 0);
             * rectButton.RectTransform.OffsetMin = new SKPoint(33.49999f, 33);
             * rectButton.RectTransform.OffsetMax = new SKPoint(143.9f, 80);*/

            RectButton rectButton2 = SkiaBehaviourEngine.Instantiate <RectButton>();

            rectButton2.RectTransform.AnchorMin = new SKPoint(1, 0);
            rectButton2.RectTransform.AnchorMax = new SKPoint(1, 0);
            rectButton2.RectTransform.OffsetMin = new SKPoint(-148.9f, 27.79999f);
            rectButton2.RectTransform.OffsetMax = new SKPoint(-38.49998f, 74.79999f);
            RectButton rectButton3 = SkiaBehaviourEngine.Instantiate <RectButton>();

            rectButton3.RectTransform.AnchorMin = new SKPoint(0.5f, 1);
            rectButton3.RectTransform.AnchorMax = new SKPoint(0.5f, 1);
            rectButton3.RectTransform.OffsetMin = new SKPoint(-47.8f, -102.4f);
            rectButton3.RectTransform.OffsetMax = new SKPoint(62.59999f, -55.40002f);
        }