Example #1
0
        public override void showOnScreen(
            RenderObject descendant = null,
            Rect rect         = null,
            TimeSpan?duration = null,
            Curve curve       = null
            )
        {
            if (!this.offset.allowImplicitScrolling)
            {
                base.showOnScreen(
                    descendant: descendant,
                    rect: rect,
                    duration: duration,
                    curve: curve
                    );
            }

            Rect newRect = RenderViewport.showInViewport(
                descendant: descendant,
                viewport: this,
                offset: this.offset,
                rect: rect,
                duration: duration,
                curve: curve);

            base.showOnScreen(
                rect: newRect,
                duration: duration,
                curve: curve);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainPlugin"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public MainPlugin(string name)
            : base(name)
        {
            ViewParameters = new RenderViewport("ViewParameters");
            ViewParameters.RegisterParameter(GlobalKeys.Time);
            ViewParameters.RegisterParameter(GlobalKeys.TimeStep);

            Parameters.AddSources(ViewParameters);
            //Parameters.RegisterParameter(TransformationKeys.ViewProjection);
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainPlugin"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 public MainPlugin(string name)
     : base(name)
 {
     ViewParameters = new RenderViewport("ViewParameters");
     ViewParameters.RegisterParameter(GlobalKeys.Time);
     ViewParameters.RegisterParameter(GlobalKeys.TimeStep);
     
     Parameters.AddSources(ViewParameters);
     //Parameters.RegisterParameter(TransformationKeys.ViewProjection);
 }
Example #4
0
 internal Window(string title, int width, int height, World world = null)
 {
     _requestedSize = new Size(width, height);
     // World Init
     World = world ?? new World();
     // Native window and Render Context init
     NativeWindow = new NativeWindow(width, height, title, GameWindowFlags.Default, GraphicsMode.Default,
                                     DisplayDevice.Default)
     {
         Visible = true, Location = new Point(50, 50)
     };
     DpiScale = NativeWindow.Width / (float)width;
     if (_renderContextNeedsInit)
     {
         RenderContext.Initialize(NativeWindow.WindowInfo);
         _renderContextNeedsInit = false;
     }
     // Cameras
     GuiCamera = new ACamera
     {
         IsOrthographic     = true,
         Viewport           = new Rectangle(0, 0, UnscaledSize.Width, UnscaledSize.Height),
         OrthographicBounds = new Rectangle(0, 0, UnscaledSize.Width, UnscaledSize.Height),
         NearZPlane         = -100,
         FarZPlane          = 100,
         ClearBufferMast    = ClearBufferMask.DepthBufferBit
     };
     MainCamera = new ACamera
     {
         AspectRatio = (UnscaledSize.Width / (float)UnscaledSize.Height),
         Viewport    = new Rectangle(0, 0, UnscaledSize.Width, UnscaledSize.Height),
         ClearColor  = Color.CornflowerBlue
     };
     // Main Gui GuiElement
     MainGuiElement = new MainGuiElement(this)
     {
         Children = new List <GuiElement>
         {
             new GuiElement
             {
                 BackgroundColor = Color.DarkRed,
                 Width           = (SFixed)300,
                 MouseEnter      = elem => elem.BackgroundColor = Color.White,
                 MouseLeave      = elem => elem.BackgroundColor = Color.DarkRed,
                 ChildAlignment  = ChildAlignments.Column,
                 Children        = new List <GuiElement>
                 {
                     new GuiElement
                     {
                         BackgroundColor = Color.DarkMagenta,
                         Height          = (SFixed)200,
                         MouseEnter      = elem => elem.BackgroundColor = Color.White,
                         MouseLeave      = elem => elem.BackgroundColor = Color.DarkMagenta,
                     }
                 }
             },
             new GuiElement {
                 Width = new SFill()
             },
             new GuiElement {
                 BackgroundColor = Color.DarkGreen, Width = (SFixed)400
             }
         }
     };
     MainGuiElement.LayoutChildren(new Rectangle(0, 0, NativeWindow.Width, NativeWindow.Height));
     // Event Handler Registration
     RegisterEventHandlers();
     // Viewport
     _viewport = new RenderViewport(NativeWindow.WindowInfo, new GLForwardPipeline(World, MainCamera),
                                    new GLForwardPipeline(MainGuiElement, GuiCamera));
 }