コード例 #1
0
        /// <summary>
        /// Called when [realized].
        /// </summary>
        /// <param name="o">The o.</param>
        /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void OnRealized(object o, EventArgs args)
        {
            this.WindowsHandler = gdk_win32_drawable_get_handle(this.GdkWindow.Handle);

            this.gameApp = new GameApp(this.WidthRequest, this.HeightRequest);
            this.gameApp.Configure(WindowsHandler);

            this.AddEvents((int)
                           (EventMask.ButtonPressMask
                            | EventMask.ButtonReleaseMask
                            | EventMask.KeyPressMask
                            | EventMask.KeyReleaseMask
                            | EventMask.PointerMotionMask
                            | EventMask.ScrollMask));

            this.GdkWindow.Background = new Gdk.Color(0, 0, 0);

            this.isInitialized = true;

            // 60 fps
            GLib.Timeout.Add(16, new GLib.TimeoutHandler(OnTimer));
        }
コード例 #2
0
ファイル: WaveWidget.cs プロジェクト: 123asd123A/Samples
        /// <summary>
        /// Called when [realized].
        /// </summary>
        /// <param name="o">The o.</param>
        /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param>         
        private void OnRealized(object o, EventArgs args)
        {
            this.WindowsHandler = gdk_win32_drawable_get_handle(this.GdkWindow.Handle);

            this.gameApp = new GameApp(this.WidthRequest, this.HeightRequest);
            this.gameApp.Configure(WindowsHandler);

            this.AddEvents((int)
                            (EventMask.ButtonPressMask
                            | EventMask.ButtonReleaseMask
                            | EventMask.KeyPressMask
                            | EventMask.KeyReleaseMask
                            | EventMask.PointerMotionMask
                            | EventMask.ScrollMask));

            this.GdkWindow.Background = new Gdk.Color(0, 0, 0);

            this.isInitialized = true;

            // 60 fps
            GLib.Timeout.Add(16, new GLib.TimeoutHandler(OnTimer));
        }