本文整理汇总了C#中SFML.Graphics.View.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# View.Reset方法的具体用法?C# View.Reset怎么用?C# View.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.View
的用法示例。
在下文中一共展示了View.Reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Log.GlobalLevel = Log.Level.Debug;
RenderWindow app = new RenderWindow(new VideoMode(800, 600), "HP!",
Styles.Default, new ContextSettings(0, 0, 4));
app.SetFramerateLimit(60);
app.Closed += delegate { app.Close(); };
app.SetVisible(true);
app.SetActive(true);
L.I("Assuming assets in \"assets\"");
Assets assets = new Assets("assets");
LoadAnimations(assets);
Level level1 = assets.Level("level1.json");
Game game = new Game(assets, level1);
var view = new View();
int lastFrameTime = Environment.TickCount;
while (app.IsOpen) {
app.DispatchEvents();
float aspect = (float)app.Size.X / app.Size.Y;
float targetWidth = 20, targetHeight = targetWidth / aspect;
view.Reset(new FloatRect(0, 0, targetWidth, targetHeight));
app.SetView(view);
int ticks = Environment.TickCount;
float delta = (ticks - lastFrameTime) / 1000F;
lastFrameTime = ticks;
game.Update(delta);
game.Render(app);
app.Display();
}
}