当前位置: 首页>>代码示例>>C#>>正文


C# GuiRenderer类代码示例

本文整理汇总了C#中GuiRenderer的典型用法代码示例。如果您正苦于以下问题:C# GuiRenderer类的具体用法?C# GuiRenderer怎么用?C# GuiRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GuiRenderer类属于命名空间,在下文中一共展示了GuiRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnRenderUI

        protected override void OnRenderUI( GuiRenderer renderer )
        {
            base.OnRenderUI( renderer );

            Vec2 size = new Vec2( 232, 335 );
            //size *= 1.0f + Time * .015f;
            size /= new Vec2( 768.0f * renderer.AspectRatio, 768.0f );

            Rect rectangle = new Rect( -size / 2, size / 2 ) + new Vec2( .3f, .5f );

            float alpha = 0;

            if( Time > 1 && Time <= 2 )
                alpha = Time - 1;
            else if( Time > 2 && Time <= lifeTime - 2 - 2 )
                alpha = 1;
            else if( Time >= lifeTime - 2 - 2 && Time < lifeTime - 1 )
                alpha = 1 - ( Time - ( lifeTime - 2 - 2 ) ) / 3;

            if( alpha != 0 )
            {
                renderer.AddQuad( rectangle, new Rect( 0, 0, 1, 1 ), productTexture,
                    new ColorValue( 1, 1, 1, alpha ) );
            }
        }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:25,代码来源:ProductLogoWindow.cs

示例2: GameForm

        public GameForm()
        {
            this.FormWidth = this.Width;
            this.FormHeight = this.Height;

            this.InitializeComponent();

            this.ProgresiveBarTimer = new Timer();
            this.ProgresiveBarTimer.Interval = TimeForPlayerTurn * 1000;
            this.ProgresiveBarTimer.Tick += this.ProgresiveBarTimerTick;

            this.updateControlsTimer.Start();
            this.updateControlsTimer.Interval = 2000;
            this.updateControlsTimer.Tick += this.UpdateControlsTick;

            this.InitializeControlsArrays();

            IRenderer renderer = new GuiRenderer(this);

            IInputHandlerer inputHandlerer = new GuiInputHandlerer(this);

            this.gameEngine = new GameEngine(renderer, inputHandlerer);

            try
            {
                this.gameEngine.GameInit();
            }
            catch (InputValueException ex)
            {
                renderer.ShowMessage(ex.Message);
            }
        }
开发者ID:TheAppleTeam,项目名称:HQC_TeamWork,代码行数:32,代码来源:GameForm.cs

示例3: OnAfterRenderUIWithChildren

        protected override void OnAfterRenderUIWithChildren( GuiRenderer renderer )
        {
            base.OnAfterRenderUIWithChildren( renderer );

            //disable custom shader mode
            if( IsCustomShaderModeEnabled() )
                renderer.PopCustomShaderMode();
        }
开发者ID:Eneth,项目名称:GAO,代码行数:8,代码来源:GuiTestWindow.cs

示例4: DrawTarget

        protected override void DrawTarget( GuiRenderer renderer )
        {
            //disable target drawing in demo mode
            if( demoMode && !FreeCameraEnabled )
                return;

            base.DrawTarget( renderer );
        }
开发者ID:whztt07,项目名称:SDK,代码行数:8,代码来源:VillageDemoGameWindow.cs

示例5: PerspectiveViewControl_RenderUI

        void PerspectiveViewControl_RenderUI(GuiRenderer renderer)
        {
            if (_camera != null)
                Nameplates.RenderObjectsTips(renderer, _camera);
            string text = "FPS: " + Perspective.Fps
                        + "    loc: " + renderTarget.CameraPosition.ToString(0)
                        + "    dir: " + renderTarget.CameraDirection.ToString(0)
                        + "    mouse: " + _mouseIntersection.ToString(2)
                        + "    over: " + _worldViewModel.MouseOverEntity;

            renderer.AddText(text, new Vec2(.01f, .01f), HorizontalAlign.Left,
                VerticalAlign.Top, new ColorValue(1, 1, 1));
        }
开发者ID:timothypratley,项目名称:Strive.NET,代码行数:13,代码来源:PerspectiveView.xaml.cs

示例6: DrawDebug

        public void DrawDebug(Rect r, GuiRenderer renderer)
        {
            Rect[] rs = new Rect[5];
            rs[0] = new Rect(Utils.TR(r, new Vec2(0.05f, 0.375f)), Utils.TR(r, new Vec2(0.30f, 0.625f)));
            rs[4] = new Rect(Utils.TR(r, new Vec2(0.05f, 0.05f)), Utils.TR(r, new Vec2(0.30f, 0.30f)));
            rs[2] = new Rect(Utils.TR(r, new Vec2(0.05f, 0.70f)), Utils.TR(r, new Vec2(0.30f, 0.95f)));
            rs[3] = new Rect(Utils.TR(r, new Vec2(0.375f, 0.375f)), Utils.TR(r, new Vec2(0.625f, 0.625f)));
            rs[1] = new Rect(Utils.TR(r, new Vec2(0.70f, 0.375f)), Utils.TR(r, new Vec2(0.95f, 0.625f)));

            for (int i = 0; i < aerofoils.Length; i++)
                aerofoils[i].DrawDebug(rs[i], renderer);

            float speed = awesomeAircraft.mainBody.LinearVelocity.Length();
            renderer.AddText("speed:" + speed.ToString(), r.LeftTop);
        }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:15,代码来源:FlightModel.cs

示例7: OnRenderUI

        protected override void OnRenderUI( GuiRenderer renderer )
        {
            base.OnRenderUI( renderer );

            Vec2 size = new Vec2( 523.0f / 1024.0f, 235.0f / 768.0f );

            Rect rectangle = new Rect( -size / 2, size / 2 ) + new Vec2( .5f, .5f );

            float alpha = 0;

            if( Time > 2 && Time <= 3 )
                alpha = Time - 2;
            else if( Time > 3 && Time <= lifeTime - 2 - 2 )
                alpha = 1;
            else if( Time >= lifeTime - 2 - 2 && Time < lifeTime - 1 )
                alpha = 1 - ( Time - ( lifeTime - 2 - 2 ) ) / 3;

            if( alpha != 0 )
                renderer.AddQuad( rectangle, new Rect( 0, 0, 1, 1 ), engineTexture,
                    new ColorValue( 1, 1, 1, alpha ) );
        }
开发者ID:huytd,项目名称:fosproject,代码行数:21,代码来源:EngineLogoWindow.cs

示例8: OnRenderUI

        protected override void OnRenderUI( GuiRenderer renderer )
        {
            base.OnRenderUI( renderer );

            Vec2 size = new Vec2( 512, 215.0f );
            size *= 1.0f + Time * .015f;
            size /= new Vec2( 768.0f * renderer.AspectRatio, 768.0f );

            Rect rectangle = new Rect( -size , size  ) + new Vec2( .5f, .5f );

            float alpha = 0;

            if( Time > 2 && Time <= 3 )
                alpha = Time - 2;
            else if( Time > 3 && Time <= lifeTime - 2 - 2 )
                alpha = 1;
            else if( Time >= lifeTime - 2 - 2 && Time < lifeTime - 1 )
                alpha = 1 - ( Time - ( lifeTime - 2 - 2 ) ) / 3;

            if( alpha != 0 )
                renderer.AddQuad( rectangle, new Rect( 0, 0, 1, 1 ), engineTexture,
                    new ColorValue( 1, 1, 1, alpha ) );
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:23,代码来源:EngineLogoWindow.cs

示例9: Draw2DRectangles

		void Draw2DRectangles( GuiRenderer renderer )
		{
			Rect rect = new Rect( .01f, .9f, .25f, .99f );
			renderer.AddQuad( rect, new ColorValue( .5f, .5f, .5f, .5f ) );

			Rect rect2 = rect;
			rect2.Expand( new Vec2( .005f / renderer.AspectRatio, .005f ) );
			renderer.AddRectangle( rect2, new ColorValue( 1, 1, 0 ) );

			AddTextWithShadow( renderer, fontMedium, "2D GUI Drawing", rect.GetCenter(), HorizontalAlign.Center,
				VerticalAlign.Center, new ColorValue( 1, 1, 1 ) );
		}
开发者ID:whztt07,项目名称:NeoAxisCommunity,代码行数:12,代码来源:MainForm.cs

示例10: OnRenderUI

        protected override void OnRenderUI( GuiRenderer renderer )
        {
            base.OnRenderUI( renderer );

            if( activePage != null )
                activePage.OnUpdate();
        }
开发者ID:Eneth,项目名称:GAO,代码行数:7,代码来源:EngineProfilerWindow.cs

示例11: OnRenderScreenUI

		public override void OnRenderScreenUI( GuiRenderer renderer )
		{
			base.OnRenderScreenUI( renderer );

			if( drawTextOnScreen )
			{
				renderer.AddText( "Add-on Example!", new Vec2( .5f, .9f ), HorizontalAlign.Center, VerticalAlign.Top,
					new ColorValue( 1, 0, 0 ) );
				renderer.AddQuad( new Rect( .3f, .94f, .7f, .95f ), new ColorValue( 1, 1, 0 ) );
			}
		}
开发者ID:whztt07,项目名称:NeoAxisCommunity,代码行数:11,代码来源:MapEditorAddonImpl.cs

示例12: DrawHUD

        void DrawHUD( GuiRenderer renderer )
        {
            if( selectMode && selectDraggedMouse )
            {
                Rect rect = new Rect( selectStartPos );
                rect.Add( EngineApp.Instance.MousePosition );

                Vec2i windowSize = EngineApp.Instance.VideoMode.Size;
                Vec2 thickness = new Vec2( 1.0f / (float)windowSize.X, 1.0f / (float)windowSize.Y );

                renderer.AddQuad( new Rect( rect.Left, rect.Top + thickness.Y,
                    rect.Right, rect.Top + thickness.Y * 2 ), new ColorValue( 0, 0, 0, .5f ) );
                renderer.AddQuad( new Rect( rect.Left, rect.Bottom,
                    rect.Right, rect.Bottom + thickness.Y ), new ColorValue( 0, 0, 0, .5f ) );
                renderer.AddQuad( new Rect( rect.Left + thickness.X, rect.Top,
                    rect.Left + thickness.X * 2, rect.Bottom ), new ColorValue( 0, 0, 0, .5f ) );
                renderer.AddQuad( new Rect( rect.Right, rect.Top,
                    rect.Right + thickness.X, rect.Bottom ), new ColorValue( 0, 0, 0, .5f ) );

                renderer.AddQuad( new Rect( rect.Left, rect.Top,
                    rect.Right, rect.Top + thickness.Y ), new ColorValue( 0, 1, 0, 1 ) );
                renderer.AddQuad( new Rect( rect.Left, rect.Bottom - thickness.Y,
                    rect.Right, rect.Bottom ), new ColorValue( 0, 1, 0, 1 ) );
                renderer.AddQuad( new Rect( rect.Left, rect.Top,
                    rect.Left + thickness.X, rect.Bottom ), new ColorValue( 0, 1, 0, 1 ) );
                renderer.AddQuad( new Rect( rect.Right - thickness.X, rect.Top,
                    rect.Right, rect.Bottom ), new ColorValue( 0, 1, 0, 1 ) );
            }
        }
开发者ID:huytd,项目名称:fosproject,代码行数:29,代码来源:RTSGameWindow.cs

示例13: Minimap_RenderUI

        //Draw minimap
        void Minimap_RenderUI( EControl sender, GuiRenderer renderer )
        {
            Rect screenMapRect = sender.GetScreenRectangle();

            Bounds initialBounds = Map.Instance.InitialCollisionBounds;
            Rect mapRect = new Rect( initialBounds.Minimum.ToVec2(), initialBounds.Maximum.ToVec2() );

            Vec2 mapSizeInv = new Vec2( 1, 1 ) / mapRect.Size;

            //draw units
            Vec2 screenPixel = new Vec2( 1, 1 ) / new Vec2( EngineApp.Instance.VideoMode.Size.ToVec2() );

            foreach( Entity entity in Map.Instance.Children )
            {
                RTSUnit unit = entity as RTSUnit;
                if( unit == null )
                    continue;

                Rect rect = new Rect( unit.MapBounds.Minimum.ToVec2(), unit.MapBounds.Maximum.ToVec2() );

                rect -= mapRect.Minimum;
                rect.Minimum *= mapSizeInv;
                rect.Maximum *= mapSizeInv;
                rect.Minimum = new Vec2( rect.Minimum.X, 1.0f - rect.Minimum.Y );
                rect.Maximum = new Vec2( rect.Maximum.X, 1.0f - rect.Maximum.Y );
                rect.Minimum *= screenMapRect.Size;
                rect.Maximum *= screenMapRect.Size;
                rect += screenMapRect.Minimum;

                //increase 1 pixel
                rect.Maximum += new Vec2( screenPixel.X, -screenPixel.Y );

                ColorValue color;

                if( playerFaction == null || unit.Intellect == null || unit.Intellect.Faction == null )
                    color = new ColorValue( 1, 1, 0 );
                else if( playerFaction == unit.Intellect.Faction )
                    color = new ColorValue( 0, 1, 0 );
                else
                    color = new ColorValue( 1, 0, 0 );

                renderer.AddQuad( rect, color );
            }

            //Draw camera borders
            {
                Camera camera = RendererWorld.Instance.DefaultCamera;

                if( camera.Position.Z > 0 )
                {

                    Plane groundPlane = new Plane( 0, 0, 1, 0 );

                    Vec2[] points = new Vec2[ 4 ];

                    for( int n = 0; n < 4; n++ )
                    {
                        Vec2 p = Vec2.Zero;

                        switch( n )
                        {
                        case 0: p = new Vec2( 0, 0 ); break;
                        case 1: p = new Vec2( 1, 0 ); break;
                        case 2: p = new Vec2( 1, 1 ); break;
                        case 3: p = new Vec2( 0, 1 ); break;
                        }

                        Ray ray = camera.GetCameraToViewportRay( p );

                        float scale;
                        groundPlane.RayIntersection( ray, out scale );

                        Vec3 pos = ray.GetPointOnRay( scale );
                        if( ray.Direction.Z > 0 )
                            pos = ray.Origin + ray.Direction.GetNormalize() * 10000;

                        Vec2 point = pos.ToVec2();

                        point -= mapRect.Minimum;
                        point *= mapSizeInv;
                        point = new Vec2( point.X, 1.0f - point.Y );
                        point *= screenMapRect.Size;
                        point += screenMapRect.Minimum;

                        points[ n ] = point;
                    }

                    for( int n = 0; n < 4; n++ )
                        renderer.AddLine( points[ n ], points[ ( n + 1 ) % 4 ], new ColorValue( 1, 1, 1 ),
                            screenMapRect );
                }
            }
        }
开发者ID:huytd,项目名称:fosproject,代码行数:94,代码来源:RTSGameWindow.cs

示例14: RenderScreenUI

        public void RenderScreenUI(GuiRenderer renderer)
        {
            for (int viewIndex = 0; viewIndex < views.Count; viewIndex++)
            {
                View view = views[viewIndex];

                //draw view on screen
                if (view.Opacity > 0)
                {
                    renderer.PushTextureFilteringMode(GuiRenderer.TextureFilteringModes.Point);
                    renderer.AddQuad(view.Rectangle, new Rect(0, 0, 1, 1), view.Texture,
                        new ColorValue(1, 1, 1, view.Opacity), true);
                    renderer.PopTextureFilteringMode();
                }

                //draw debug info
                if (drawDebugInfo)
                {
                    Viewport screenViewport = renderer.ViewportForScreenGuiRenderer;
                    Vec2 pixelOffset = 1.0f / screenViewport.DimensionsInPixels.Size.ToVec2();
                    ColorValue color = new ColorValue(1, 1, 0);
                    renderer.AddRectangle(new Rect(
                        view.Rectangle.LeftTop + pixelOffset,
                        view.Rectangle.RightBottom - pixelOffset * 2),
                        color);
                    renderer.AddLine(view.Rectangle.LeftTop, view.Rectangle.RightBottom, color);
                    renderer.AddLine(view.Rectangle.RightTop, view.Rectangle.LeftBottom, color);

                    if (debugFont == null)
                        debugFont = FontManager.Instance.LoadFont("Default", .03f);

                    string sizeString = "";
                    if (view.Texture != null)
                        sizeString = string.Format("{0}x{1}", view.Texture.Size.X, view.Texture.Size.Y);
                    string text = string.Format("View {0}, {1}", viewIndex, sizeString);
                    Vec2 position = new Vec2(view.Rectangle.Right - pixelOffset.X * 5, view.Rectangle.Top);
                    AddTextWithShadow(renderer, debugFont, text, position, HorizontalAlign.Right,
                        VerticalAlign.Top, new ColorValue(1, 1, 1));
                }
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:41,代码来源:MultiViewRenderingManager.cs

示例15: DrawPlayerInformation

        /// <summary>
        /// To draw some information of a player
        /// </summary>
        /// <param name="renderer"></param>
        void DrawPlayerInformation( GuiRenderer renderer )
        {
            if( GetRealCameraType() == CameraType.Free )
                return;

            if( IsCutSceneEnabled() )
                return;

            //debug draw an influences.
            {
                float posy = .8f;

                foreach( Entity entity in GetPlayerUnit().Children )
                {
                    Influence influence = entity as Influence;
                    if( influence == null )
                        continue;

                    renderer.AddText( influence.Type.Name, new Vec2( .7f, posy ),
                        HorizontalAlign.Left, VerticalAlign.Center );

                    int count = (int)( (float)influence.RemainingTime * 2.5f );
                    if( count > 50 )
                        count = 50;
                    string str = "";
                    for( int n = 0; n < count; n++ )
                        str += "I";

                    renderer.AddText( str, new Vec2( .85f, posy ),
                        HorizontalAlign.Left, VerticalAlign.Center );

                    posy -= .025f;
                }
            }
        }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:39,代码来源:ActionGameWindow.cs


注:本文中的GuiRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。