예제 #1
0
        /// <summary>
        /// Setup OpenGL and load resources here.
        /// </summary>
        /// <param name="e">Not used.</param>
        protected override void OnLoad(EventArgs e)
        {
            GL.ClearColor(System.Drawing.Color.MidnightBlue);

            Platform.Platform.Init(new Platform.Windows.WindowsPlatform());
            Loader.LoaderBase.Init(new Platform.Windows.FileLoader());

            //m_Renderer = new Gwen.Renderer.OpenTK.OpenTKGL10();
            //m_Renderer = new Gwen.Renderer.OpenTK.OpenTKGL20();
            m_Renderer = new Gwen.Renderer.OpenTK.OpenTKGL40();

            m_Skin             = new Gwen.Skin.TexturedBase(m_Renderer, "DefaultSkin.png", "DefaultSkinDefinition.xml");
            m_Skin.DefaultFont = new Font(m_Renderer, "Arial", 11);
            m_Canvas           = new Canvas(m_Skin);
            m_Input            = new Gwen.Renderer.OpenTK.Input.OpenTK(this);
            m_Input.Initialize(m_Canvas);

            m_Canvas.SetSize(Width, Height);
            m_Canvas.ShouldDrawBackground = true;
            m_Canvas.BackgroundColor      = new Color(255, 150, 170, 170);

            if (Configuration.RunningOnMacOS)
            {
                m_Canvas.Scale = 1.5f;
            }

            m_UnitTest = new Gwen.UnitTest.UnitTest(m_Canvas);

            m_Stopwatch.Restart();
            m_LastTime = 0;
        }
예제 #2
0
        // This gets called when the drawing surface is ready
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Platform.Platform.Init(new Platform.Android.AndroidPlatform());
            Loader.LoaderBase.Init(new Platform.Android.AssetLoader());

            m_Renderer         = new Gwen.Renderer.Android.OpenTK.OpenTK(false);
            m_Skin             = new Gwen.Skin.TexturedBase(m_Renderer, "DefaultSkin.png", "DefaultSkinDefinition.xml");
            m_Skin.DefaultFont = new Font(m_Renderer, "Arial", 11);
            m_Canvas           = new Canvas(m_Skin);
            m_Input            = new Gwen.Renderer.Android.OpenTK.Input.OpenTK(this);
            m_Input.Initialize(m_Canvas);

            m_Canvas.SetSize(Width, Height);
            m_Canvas.ShouldDrawBackground = true;
            m_Canvas.BackgroundColor      = new Color(255, 150, 170, 170);

            m_UnitTest = new Gwen.UnitTest.UnitTest(m_Canvas);

            m_Stopwatch.Restart();
            m_LastTime = 0;

            // Run the render loop
            Run();
        }
예제 #3
0
        void SetupGL()
        {
            EAGLContext.SetCurrentContext(context);

            var view = (GLKView)View;

            Platform.Platform.Init(new Platform.iOS());

            m_Renderer                    = new Gwen.Renderer.iOS.OpenTK.OpenTK(false);
            m_Skin                        = new Gwen.Skin.TexturedBase(m_Renderer, "DefaultSkin.png");
            m_Skin.DefaultFont            = new Font(m_Renderer, "Arial", 13);
            m_Canvas                      = new Canvas(m_Skin);
            m_Canvas.ShouldDrawBackground = true;
            m_Canvas.BackgroundColor      = new Color(255, 150, 170, 170);

            m_Canvas.Scale = 1.5f;

            m_UnitTest = new Gwen.UnitTest.UnitTest(m_Canvas);

            m_Stopwatch.Restart();
            m_LastTime = 0;
        }
예제 #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            Platform.Platform.Init(new Gwen.Platform.MonoGame.MonoGamePlatform());
            Loader.LoaderBase.Init(new Gwen.Loader.MonoGame.MonoGameAssetLoader(Content));

            m_Renderer = new Gwen.Renderer.MonoGame.MonoGame(GraphicsDevice, Content, Content.Load <Effect>("GwenEffect"));
            m_Renderer.Resize(m_Graphics.PreferredBackBufferWidth, m_Graphics.PreferredBackBufferHeight);

            m_Skin             = new Gwen.Skin.TexturedBase(m_Renderer, "Skins/DefaultSkin", "Skins/DefaultSkinDefinition");
            m_Skin.DefaultFont = new Font(m_Renderer, "Arial", 11);
            m_Canvas           = new Canvas(m_Skin);
            m_Input            = new Gwen.Renderer.MonoGame.Input.MonoGame(this);
            m_Input.Initialize(m_Canvas);

            m_Canvas.SetSize(m_Graphics.PreferredBackBufferWidth, m_Graphics.PreferredBackBufferHeight);
            m_Canvas.ShouldDrawBackground = true;
            m_Canvas.BackgroundColor      = new Color(255, 150, 170, 170);

            m_UnitTest = new Gwen.UnitTest.UnitTest(m_Canvas);

            m_Time = 0;
        }
예제 #5
0
        private void GlForm_Load(object sender, EventArgs e)
        {
            glControl.InitializeContexts();
            Gl.glClearColor(1f, 0f, 0f, 1f);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Gl.glOrtho(0, glControl.Width, glControl.Height, 0, -1, 1);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glViewport(0, 0, glControl.Width, glControl.Height);

            renderer = new Gwen.Renderer.Tao();
            skin = new Gwen.Skin.TexturedBase(renderer, "DefaultSkin.png");
            canvas = new Canvas(skin);
            canvas.SetSize(glControl.Width, glControl.Height);
            canvas.ShouldDrawBackground = true;
            canvas.BackgroundColor = Color.FromArgb(255, 150, 170, 170);
            canvas.KeyboardInputEnabled = true;
            canvas.MouseInputEnabled = true;

            test = new UnitTest.UnitTest(canvas);

            stopwatch.Restart();
            lastTime = 0;
        }
예제 #6
0
        private void GlForm_Load(object sender, EventArgs e)
        {
            glControl.InitializeContexts();
            Gl.glClearColor(1f, 0f, 0f, 1f);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Gl.glOrtho(0, glControl.Width, glControl.Height, 0, -1, 1);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glViewport(0, 0, glControl.Width, glControl.Height);

            renderer = new Gwen.Renderer.Tao();
            skin     = new Gwen.Skin.TexturedBase(renderer, "DefaultSkin.png");
            canvas   = new Canvas(skin);
            canvas.SetSize(glControl.Width, glControl.Height);
            canvas.ShouldDrawBackground = true;
            canvas.BackgroundColor      = Color.FromArgb(255, 150, 170, 170);
            canvas.KeyboardInputEnabled = true;
            canvas.MouseInputEnabled    = true;

            test = new UnitTest.UnitTest(canvas);

            stopwatch.Restart();
            lastTime = 0;
        }
예제 #7
0
//         GwenExample()  // originally Dispose
//         {
//             if (canvas != null) canvas.Dispose();
//             if (skin != null) skin.Dispose();
//             if (renderer != null) renderer.Dispose();            
//         }

        /// <summary>
        /// Occurs when a key is pressed.
        /// </summary>
        /// <param name="sender">The KeyboardDevice which generated this event.</param>
        /// <param name="e">The key that was pressed.</param>
//         void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e)
//         {
//             /*if (e.Key == global::OpenTK.Input.Key.Escape)
//                 Exit();
//             else if (e.Key == global::OpenTK.Input.Key.AltLeft)
//                 altDown = true;
//             else if (altDown && e.Key == global::OpenTK.Input.Key.Enter)
//                 if (WindowState == WindowState.Fullscreen)
//                     WindowState = WindowState.Normal;
//                 else
//                     WindowState = WindowState.Fullscreen;*/
// 
//             input.ProcessKeyDown(e);
//         }
// 
//         void Keyboard_KeyUp(object sender, KeyboardKeyEventArgs e)
//         {
//             altDown = false;
//             input.ProcessKeyUp(e);
//         }
// 
//         void Mouse_ButtonDown(object sender, MouseButtonEventArgs args)
//         {
//             input.ProcessMouseMessage(args);
//         }
// 
//         void Mouse_ButtonUp(object sender, MouseButtonEventArgs args)
//         {
//             input.ProcessMouseMessage(args);
//         }
// 
//         void Mouse_Move(object sender, MouseMoveEventArgs args)
//         {
//             input.ProcessMouseMessage(args);
//         }
// 
//         void Mouse_Wheel(object sender, MouseWheelEventArgs args)
//         {
//             input.ProcessMouseMessage(args);
//         }

        public override void RefreshFromProducers()
        {
            if (App.Canvas != null)
            {
                test = new Gwen.UnitTest.UnitTest(App.Canvas);
            }
            

//             Keyboard.KeyDown += Keyboard_KeyDown;
//             Keyboard.KeyUp += Keyboard_KeyUp;
// 
//             Mouse.ButtonDown += Mouse_ButtonDown;
//             Mouse.ButtonUp += Mouse_ButtonUp;
//             Mouse.Move += Mouse_Move;
//             Mouse.WheelChanged += Mouse_Wheel;            
        }