本文整理汇总了C#中SFML.Graphics.RenderWindow.ResetGLStates方法的典型用法代码示例。如果您正苦于以下问题:C# RenderWindow.ResetGLStates方法的具体用法?C# RenderWindow.ResetGLStates怎么用?C# RenderWindow.ResetGLStates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.RenderWindow
的用法示例。
在下文中一共展示了RenderWindow.ResetGLStates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Console.Title = "Tetraquark Console";
Running = true;
const string ConfigFile = "cfg.yaml";
if (File.Exists(ConfigFile)) {
Console.WriteLine("Loading config file {0}", ConfigFile);
Settings.Load(File.ReadAllText(ConfigFile));
}
GameWatch = new Stopwatch();
GameWatch.Start();
PackMgr.Mount("Default.zip");
string[] Files = PackMgr.GetFiles();
for (int i = 0; i < Files.Length; i++) {
if (Files[i].StartsWith("resources/fonts/"))
ResourceMgr.Register<Font>(PackMgr.OpenFile(Files[i]), Path.GetFileNameWithoutExtension(Files[i]));
else if (Files[i].StartsWith("resources/textures/"))
ResourceMgr.Register<Texture>(PackMgr.OpenFile(Files[i]), Path.GetFileNameWithoutExtension(Files[i]));
}
Scales.Init(new Vector2f(ResX, ResY));
// OpenTK
ToolkitOptions TOpt = ToolkitOptions.Default;
TOpt.Backend = PlatformBackend.PreferNative;
TOpt.EnableHighResolution = true;
Toolkit.Init(TOpt);
// SFML
VideoMode VMode = new VideoMode((uint)Scales.XRes, (uint)Scales.YRes, (uint)BitsPerPixel);
ContextSettings CSet = new ContextSettings((uint)DepthBits, (uint)StencilBits);
CSet.MajorVersion = 4;
CSet.MinorVersion = 2;
CSet.AntialiasingLevel = (uint)Samples;
Styles S = Styles.None;
if (Border)
S |= Styles.Titlebar | Styles.Close;
RenderWindow RWind = new RenderWindow(VMode, "Tetraquark", S, CSet);
RWind.Closed += (Snd, E) => Running = false;
RWind.SetKeyRepeatEnabled(false);
// OpenTK
IWindowInfo WindInfo = Utilities.CreateWindowsWindowInfo(RWind.SystemHandle);
var GfxMode = new GraphicsMode(new ColorFormat(BitsPerPixel), DepthBits, StencilBits, Samples, new ColorFormat(0));
var GfxCtx = new GraphicsContext(GfxMode, WindInfo, (int)CSet.MajorVersion, (int)CSet.MinorVersion,
GfxCtxFlags.Default);
GfxCtx.MakeCurrent(WindInfo);
GfxCtx.LoadAll();
RWind.ResetGLStates();
//GL.Enable(EnableCap.FramebufferSrgb);
Renderer.Init(RWind);
Stopwatch Clock = new Stopwatch();
Clock.Start();
while (Running) {
RWind.DispatchEvents();
while (Clock.ElapsedMilliseconds < 10)
;
float Dt = (float)Clock.ElapsedMilliseconds / 1000;
Clock.Restart();
Renderer.Update(Dt);
Renderer.Draw(RWind);
RWind.Display();
}
RWind.Close();
RWind.Dispose();
Console.WriteLine("Flushing configs");
File.WriteAllText(ConfigFile, Settings.Save());
Environment.Exit(0);
}