本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例7: Apply
public void Apply(RenderTarget rt)
{
View.Center = actualPosition;
rt.SetView(View);
}
示例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);
}
示例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];
//.........这里部分代码省略.........
示例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}";
}
示例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));
}
示例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);
}