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


C# RenderTarget.SetView方法代码示例

本文整理汇总了C#中RenderTarget.SetView方法的典型用法代码示例。如果您正苦于以下问题:C# RenderTarget.SetView方法的具体用法?C# RenderTarget.SetView怎么用?C# RenderTarget.SetView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderTarget的用法示例。


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

示例1: Draw

 public override void Draw(RenderTarget target, RenderStates states)
 {
     if (View != null)
     {
         target.SetView(View);
         target.Draw(BorderRect);
         target.SetView(target.DefaultView);
     }
     else
     {
         target.Draw(BorderRect);
     }
 }
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:13,代码来源:Frame.cs

示例2: Draw

 public override void Draw(RenderTarget rt, RenderStates states)
 {
     if (View != null)
     {
         rt.SetView(View);
         rt.Draw(Text);
         rt.SetView(rt.DefaultView);
     }
     else
     {
         rt.SetView(rt.DefaultView);
         rt.Draw(Text);
     }
 }
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:14,代码来源:Label.cs

示例3: Draw

 public static void Draw(RenderTarget surface)
 {
     if (EntityToFollow != null)
     {
         surface.SetView (new View(EntityToFollow.GetPosition (), surface.GetView ().Size));
     }
     surface.Clear (BackgroundColor);
     foreach (Entity e in Entities)
         e._Draw (surface);
 }
开发者ID:Phyxius,项目名称:SomeZombieGame,代码行数:10,代码来源:EntityManager.cs

示例4: Apply

        public void Apply(RenderTarget rt)
        {
            var center = Position;
            var offset = 0.25f * Zoom;
            center.X += offset;
            center.Y += offset;

            View.Center = center;
            rt.SetView(View);
        }
开发者ID:Rohansi,项目名称:Programe,代码行数:10,代码来源:Camera.cs

示例5: Render

 public void Render(TimeSpan delta, RenderTarget target, UISceneManager ui)
 {
     ui.CurrentScene = scene;
     bg.Scale = new Vector2f(1280, 1);
     target.Draw(bg);
     bgBack.Position = new Vector2f(player.PhysObj.Position.X * 0.1f, 720);
     target.Draw(bgBack);
     bgFore.Position = new Vector2f(player.PhysObj.Position.X * 0.2f, 720);
     target.Draw(bgFore);
     if (settings.EnableClouds)
     {
         total += delta;
         if (total > TimeSpan.FromSeconds(0.1))
         {
             t += 0.005f;
             GenerateClouds();
             total = TimeSpan.Zero;
         }
         RenderUI(delta, target);
     }
     View v = target.GetView();
     var vx = player.PhysObj.Position * 10;
     v.Center = new Vector2f(vx.X, vx.Y);
     v.Zoom(1.6f);
     target.SetView(v);
     world.Render(target);
     target.Draw(portal);
     player.Render(delta, target);
     View vi = target.GetView();
     vi.Center = new Vector2f(640, 360);
     vi.Zoom(0.625f);
     target.SetView(vi);
 }
开发者ID:WebFreak001,项目名称:LD-30,代码行数:33,代码来源:InGameView.cs

示例6: Apply

        public void Apply(RenderTarget rt)
        {
            var center = ActualPosition;

            if (RoundPosition)
            {
                var pxSize = 1 * Zoom;
                center.X = Utility.RoundToNearest(ActualPosition.X, pxSize);
                center.Y = Utility.RoundToNearest(ActualPosition.Y, pxSize);
            }

            // offset fixes texture coord rounding
            var offset = 0.25f * Zoom; 
            center.X += offset;
            center.Y += offset;

            View.Center = center;
            rt.SetView(View);
        }
开发者ID:DatZach,项目名称:Californium,代码行数:19,代码来源:Camera.cs

示例7: Apply

 public void Apply(RenderTarget rt)
 {
     View.Center = actualPosition;
     rt.SetView(View);
 }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:5,代码来源:Camera.cs

示例8: Draw

        public override void Draw(RenderTarget target, RenderStates states)
        {
            target.Clear(Color.Black);

            target.SetView(_view);

            _game._mouseLight.SetPosition(target.MapPixelToCoords(InputHandler.MousePosition));
            _game.Map.Draw(target, states);
            if (_fpsToggle)
                _msFLabel.Draw(target, states);
        }
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:11,代码来源:GameScreen.cs

示例9: Render

        public override void Render(RenderTarget target)
        {
            //Setting view to camera position
            View view = target.GetView();
            view.Center = new Vector2f((int) CameraPosition.X, (int) CameraPosition.Y);
            target.SetView(view);

            var screenBounds = new FloatRect
            {
                Left = view.Center.X - (view.Size.X / 2),
                Top = view.Center.Y - (view.Size.Y / 2),
                Width = view.Size.X,
                Height = view.Size.Y
            };

            //Drawing map/tiles
            map.Render(target, screenBounds, Fog);

            RenderRallypoints(target);

            //Draw selected unit circles
            const float selectCircleRadius = 20;
            var selectedCircle = new CircleShape(selectCircleRadius);
            selectedCircle.OutlineColor = new Color(100, 255, 100, 200);
            selectedCircle.OutlineThickness = 5;
            selectedCircle.FillColor = new Color(0, 0, 0, 0);
            selectedCircle.Origin = new Vector2f(selectCircleRadius, selectCircleRadius);

            if (selectedUnits != null)
            {
                foreach (EntityBase entityBase in selectedUnits)
                {
                    selectedCircle.Position = entityBase.Position;
                    target.Draw(selectedCircle);
                }
            }

            var debugHPText = new Text();
            debugHPText.Scale = new Vector2f(.6f, .6f);
            debugHPText.Color = new Color(255, 255, 255, 100);
            var readOnly = new Dictionary<ushort, EntityBase>(entities);

            foreach (EntityBase entityBase in readOnly.Values)
            {
                if (entityBase.GetBounds().Intersects(screenBounds))
                {
                    if (Fog != null)
                    {
                        var coords = map.ConvertCoords(entityBase.Position);
                        entityBase.Render(target, Fog.Grid[(int) coords.X, (int) coords.Y].CurrentState);
                        if (Fog.Grid[(int)coords.X, (int)coords.Y].CurrentState == FOWTile.TileStates.CurrentlyViewed)
                        {
                            entityBase.HasBeenViewed = true;
                        }

                        debugHPText.Color = new Color(255, 255, 255, 200);
                        debugHPText.DisplayedString = "HP: " + entityBase.Health.ToString();
                        debugHPText.Origin = new Vector2f(debugHPText.GetGlobalBounds().Width/2,
                                                          debugHPText.GetGlobalBounds().Height);
                        debugHPText.Position = entityBase.Position;

                        target.Draw(debugHPText);
                        if (entityBase is BuildingBase)
                        {
                            var buildingCast = (BuildingBase) entityBase;
                            if (buildingCast.IsProductingUnit)
                            {
                                debugHPText.Color = new Color(255, 255, 0, 100);
                                debugHPText.DisplayedString = buildingCast.UnitBuildCompletePercent.ToString();
                                debugHPText.Position += new Vector2f(0, 50);
                                target.Draw(debugHPText);
                            }
                        }
                    }
                }
            }

            var readOnlyEffect = new List<EffectBase>(Effects);
            foreach (EffectBase effectBase in readOnlyEffect)
            {
                effectBase.Render(target);
            }

            if (releaseSelect)
            {
                var rect = new FloatRect(controlBoxP1.X, controlBoxP1.Y, controlBoxP2.X - controlBoxP1.X,
                                         controlBoxP2.Y - controlBoxP1.Y);
                var rectangle = new RectangleShape(new Vector2f(rect.Width, rect.Height));
                rectangle.Position = new Vector2f(rect.Left, rect.Top);
                rectangle.FillColor = new Color(100, 200, 100, 100);
                target.Draw(rectangle);
            }

            //Draw Alerts
            const int ALERTXOFFSET = 10;
            const int ALERTYMULTIPLE = 60;
            const int ALERTYOFFSET = 20;
            for (int i = 0; i < alerts.Count; i++)
            {
                HUDAlert alert = alerts[i];
//.........这里部分代码省略.........
开发者ID:Austech,项目名称:HGlueSim,代码行数:101,代码来源:StandardMelee.cs

示例10: Render

        public void Render(RenderTarget app) {
            if (!initalized) Init(app);
            app.Clear(Color.Transparent);

            world = CalcView(app);

            app.SetView(world);
            level.Draw(app, RenderStates.Default);
            foreach (GameObject o in objects) o.Draw(this, app, RenderStates.Default);
            player.Draw(app, RenderStates.Default);

            app.SetView(gui);
            infoText.Draw(app, RenderStates.Default);

            app.SetView(world);

            frames.Tick();
			InfoText = $"FPS: {frames.CurrentRate}, PSS: {physics.CurrentRate}";
        }
开发者ID:tilpner,项目名称:hp,代码行数:19,代码来源:Game.cs

示例11: Draw

        public void Draw(RenderTarget target, RenderStates states) {
            View view = new View(target.GetView());

            View bgView = new View(view);
            bgView.Center = v2f(bgView.Size.X + bgView.Center.X * 0.5F, bgView.Center.Y);
            target.SetView(bgView);
            background.Draw(target, states);
            
            target.SetView(view);
            DrawBlocks(target, states, CalcVisibleBounds(target));
        }
开发者ID:tilpner,项目名称:hp,代码行数:11,代码来源:Game.cs

示例12: Draw

        public override void Draw(RenderTarget window)
        {
            if (Map == null || !GetMapIsUpdated())
                return;

            window.SetView(GameRoot.MapView);

            Map.Draw(window);

            foreach (WorldObject wObj in ObjectToDraw)
                wObj.Draw(window);

            foreach (Widget widget in WidgetToDraw)
                if (widget.IsVisible)
                    widget.Draw(window);

            window.SetView(window.DefaultView);

            base.Draw(window);
        }
开发者ID:eickegao,项目名称:Blazera,代码行数:20,代码来源:MapBox.cs


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