// This gets called when the drawing surface is ready (=on startup and when the app regains focus)
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            MakeCurrent();

            if (SparrowSharpApp.Root == null)
            {
                SparrowSharpApp.Start((uint)Size.Width, (uint)Size.Height, _rootClass);
            }
            // Run the render loop
            Run();
        }
        private void HandleLoad(object sender, EventArgs e)
        {
            // setup settings, load textures, sounds
            GL.Disable(EnableCap.CullFace);
            GL.Disable(EnableCap.DepthTest);
            GL.Disable(EnableCap.Dither);
            GL.Enable(EnableCap.Blend);

            FramebufferErrorCode status = GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer);

            if (status != FramebufferErrorCode.FramebufferComplete)
            {
                Console.WriteLine("Framebuffer error: " + status);
            }
            SparrowSharpApp.NativeWindow = this;
            SparrowSharpApp.Start((uint)Width, (uint)Height, _rootClass);
        }
Exemplo n.º 3
0
        public void TestRoot()
        {
            SparrowSharpApp.Start(12, 12, typeof(Sprite));

            Sprite root       = new Sprite();
            Sprite child      = new Sprite();
            Sprite grandChild = new Sprite();

            root.AddChild(child);
            child.AddChild(grandChild);

            Assert.AreEqual(root, grandChild.Root, "Wrong root " + grandChild.Root);

            SparrowSharpApp.Stage.AddChild(root);

            Assert.AreEqual(SparrowSharpApp.Stage, grandChild.Root, "Wrong root " + grandChild.Root);

            SparrowSharpApp.Stage.RemoveAllChildren();
            SparrowSharpApp.Destroy();
        }
 public OpenGLViewController(string nibName, NSBundle bundle) : base(nibName, bundle)
 {
     _onLoadedAction = (width, height) => SparrowSharpApp.Start(width, height, typeof(Benchmark));
 }
 protected void SetUp()
 {
     SparrowSharpApp.Start(12, 12, typeof(Sprite));
     testRoot = new Sprite();
     SparrowSharpApp.Stage.AddChild(testRoot);
 }