예제 #1
0
        public void Init(ApplicationDesc desc)
        {
            OS.CurrentApplication = this;
            CurrentApplication = this;
            theEvent = new ApplicationEvent();

            if (desc.FrameSize.Width == 0 || desc.FrameSize.Height == 0) FrameSize = new Size2(512, 512);
            else FrameSize = desc.FrameSize;
        }
예제 #2
0
 public void UpdateEvent(ApplicationEvent theEvent)
 {
     if (theEvent.Type == ApplicationEventTypes.Touch)
     {
         for (int i = 0; i != ApplicationEvent.TouchCount; ++i)
         {
             touchOn[i] = theEvent.TouchesOn[i];
             var loc = theEvent.TouchLocations[i];
             touchLocations[i] = new Vector2(loc.X, input.application.FrameSize.Height-loc.Y);
         }
     }
 }
예제 #3
0
        public void Init(ApplicationDesc desc)
        {
            theEvent = new ApplicationEvent();

            var frame = desc.FrameSize;
            if (frame.Width == 0 || frame.Height == 0) frame = (OS.ScreenSize.ToVector2() / 1.5f).ToSize2();

            //X11.XInitThreads();// Only needed for multi threaded applications.
            dc = X11.XOpenDisplay(IntPtr.Zero);
            if (dc == IntPtr.Zero)
            {
                Debug.ThrowError("Window", "Cannot open Display");
            }

            sc = X11.XDefaultScreen(dc);
            Handle = X11.XCreateSimpleWindow(dc, X11.XRootWindow(dc, sc), 0, 0, (uint)frame.Width, (uint)frame.Height, 0, X11.XBlackPixel(dc, sc), X11.XWhitePixel(dc, sc));

            X11.XSelectInput(dc, Handle, X11.ExposureMask | X11.KeyPressMask | X11.KeyReleaseMask | X11.ButtonPressMask | X11.ButtonReleaseMask);

            // Enable Capture of close box
            var normalHint = X11.XInternAtom(dc, "WM_NORMAL_HINTS", false);
            var deleteHint = X11.XInternAtom(dc, "WM_DELETE_WINDOW", false);
            X11.XSetWMProtocols(dc, Handle, new IntPtr[]{normalHint, deleteHint}, 2);
            X11.XStoreName(dc, Handle, desc.Name);

            // Size
            if (desc.Type == ApplicationTypes.Frame || desc.Type == ApplicationTypes.FrameSizable || desc.Type == ApplicationTypes.Box)
            {
                unsafe
                {
                    var sizeHints = new X11.XSizeHints();

                    var flags = X11.XSizeHintsFlags.PPosition;
                    if (desc.Type != ApplicationTypes.FrameSizable)
                    {
                        flags |= X11.XSizeHintsFlags.PMinSize | X11.XSizeHintsFlags.PMaxSize;
                        sizeHints.min_width  = sizeHints.max_width  = frame.Width;
                        sizeHints.min_height = sizeHints.max_height = frame.Height;
                    }
                    sizeHints.flags = (IntPtr)flags;

                    X11.XSetNormalHints(dc, Handle, &sizeHints);
                }
            }

            // Position
            if (desc.StartPosition == ApplicationStartPositions.CenterCurrentScreen)
            {
                var screenSize = OS.ScreenSize;
                X11.XMoveWindow(dc, Handle, (screenSize.Width-frame.Width) / 2, (screenSize.Height-frame.Height) / 2);
            }
        }
예제 #4
0
		public CoreMetroWindow(ApplicationI application, CoreWindow window, ApplicationEvent theEvent, bool coreApp)
		{
			this.window = window;
			this.application = application;
			this.theEvent = theEvent;
			this.coreApp = coreApp;

			window.SizeChanged += sizeChanged;
			
			window.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 0);
			window.PointerMoved += pointerMoved;
			window.PointerPressed += pointerPressed;
			window.PointerReleased += pointerReleased;
			window.PointerWheelChanged += pointerWheelChanged;
			window.KeyDown += keyDown;
			window.KeyUp += keyUp;
		}
예제 #5
0
 private void updateEvent(ApplicationEvent theEvent)
 {
     if (theEvent == null) return;
     if (UpdateEventCallback != null) UpdateEventCallback(theEvent);
 }
예제 #6
0
 public void Init(ApplicationDesc desc)
 {
     theEvent = new ApplicationEvent();
     source   = new CoreWindowApplicationSource(this);
 }
예제 #7
0
        public void updateEvent(ApplicationEvent theEvent)
        {
            switch (theEvent.Type)
            {
                case ApplicationEventTypes.LeftMouseDown:
                    leftOn = true;
                    currentPosition = theEvent.CursorPosition;
                    break;

                case ApplicationEventTypes.LeftMouseUp:
                    leftOn = false;
                    currentPosition = theEvent.CursorPosition;
                    break;

                case ApplicationEventTypes.MiddleMouseDown:
                     middleOn = true;
                     currentPosition = theEvent.CursorPosition;
                     break;

                case ApplicationEventTypes.MiddleMouseUp:
                    middleOn = false;
                    currentPosition = theEvent.CursorPosition;
                    break;

                case ApplicationEventTypes.RightMouseDown:
                    rightOn = true;
                    currentPosition = theEvent.CursorPosition;
                    break;

                case ApplicationEventTypes.RightMouseUp:
                    rightOn = false;
                    currentPosition = theEvent.CursorPosition;
                    break;

                case ApplicationEventTypes.MouseMove:
                    currentPosition = theEvent.CursorPosition;
                    break;

                case ApplicationEventTypes.ScrollWheel:
                    scrollWheelVelocity = theEvent.ScrollWheelVelocity;
                    scollWheelChanged = true;
                    currentPosition = theEvent.CursorPosition;
                    break;
            }
        }
예제 #8
0
 public void Init(ApplicationDesc desc)
 {
     this.desc = desc;
     theEvent  = new ApplicationEvent();
 }
예제 #9
0
 public void Init(ApplicationDesc desc)
 {
     OS.CurrentApplication = this;
     this.desc = desc;
     theEvent = new ApplicationEvent();
     OS.time = new Time(0);
     OS.time.Start();
 }
예제 #10
0
        public GLView(AndroidApplication application)
            : base(application)
        {
            this.application = application;
            this.theEvent = application.theEvent;

            SetEGLContextClientVersion(2);
            SetEGLConfigChooser(true);//8, 8, 8, 8, 16, 0);
            renderer = new GLRenderer(application);
            SetRenderer(renderer);
        }
예제 #11
0
		public void Init(ApplicationDesc desc)
		{
			theEvent = new ApplicationEvent();
			source = new CoreWindowApplicationSource(this);
		}
예제 #12
0
        public void UpdateEvent(ApplicationEvent theEvent)
        {
            switch (theEvent.Type)
            {
                case ApplicationEventTypes.KeyDown:
                    keys[theEvent.KeyCode] = true;
                    break;

                case ApplicationEventTypes.KeyUp:
                    keys[theEvent.KeyCode] = false;
                    break;
            }
        }
예제 #13
0
 private void handleEvent(ApplicationEvent applicationEvent)
 {
     if (HandleEvent != null) HandleEvent(applicationEvent);
 }
예제 #14
0
        public void UpdateEvent(ApplicationEvent theEvent)
        {
            switch (theEvent.Type)
            {
                case ApplicationEventTypes.LeftMouseDown: leftOn = true; break;
                case ApplicationEventTypes.LeftMouseUp: leftOn = false; break;

                case ApplicationEventTypes.MiddleMouseDown: middleOn = true; break;
                case ApplicationEventTypes.MiddleMouseUp: middleOn = false; break;

                case ApplicationEventTypes.RightMouseDown: rightOn = true; break;
                case ApplicationEventTypes.RightMouseUp: rightOn = false; break;

                case (ApplicationEventTypes.ScrollWheel):
                    scrollWheelVelocity = theEvent.ScrollWheelVelocity;
                    scollWheelChanged = true;
                    break;
            }
        }
예제 #15
0
		private void handleEvent(ApplicationEvent theEvent)
		{
			if (coreApp) ((CoreWindowApplication)application).handleEvent(theEvent);
			else ((XAMLApplication)application).handleEvent(theEvent);
		}
예제 #16
0
        private void updateEvent(ApplicationEvent theEvent)
        {
            switch (theEvent.Type)
            {
                case ApplicationEventTypes.KeyDown:
                    keys[theEvent.KeyCode] = true;
                    break;

                case ApplicationEventTypes.KeyUp:
                    keys[theEvent.KeyCode] = false;
                    break;

                case ApplicationEventTypes.Unkown:
                    keys[theEvent.KeyCode] = !keys[theEvent.KeyCode];
                    break;
            }
        }
예제 #17
0
 internal void handleEvent(ApplicationEvent applicationEvent)
 {
     if (HandleEvent != null) HandleEvent(applicationEvent);
 }
예제 #18
0
 public void Init(ApplicationDesc desc)
 {
     this.desc = desc;
     theEvent = new ApplicationEvent();
 }