public static void Main(string[] args) { var game = new BlueberryGame (640, 480, "Example project", false, 0); PrefabMgr.Load("Content//Prefabs.xml",System.Reflection.Assembly.GetAssembly(typeof(MainClass))); DataGameFrame frame = new DataGameFrame("Content//GameFrames//GameplayFrame"); game.SetFrame (frame); game.Run (60.0, 60.0); }
public BlueberryGame(int width, int height, string name, bool fullscreen, double contextVersion = 0) { _current = this; if (contextVersion == 0) { int major = (int)contextVersion; int minor = (int)((contextVersion - major) * 10); _window = new GameWindow(width, height, GraphicsMode.Default, name, fullscreen ? GameWindowFlags.Fullscreen : GameWindowFlags.Default, DisplayDevice.Default); } else { int major = (int)contextVersion; int minor = (int)((contextVersion - major) * 10); _window = new GameWindow(width, height, GraphicsMode.Default, name, fullscreen ? GameWindowFlags.Fullscreen : GameWindowFlags.Default, DisplayDevice.Default, major, minor, #if DEBUG GraphicsContextFlags.Default); #else GraphicsContextFlags.ForwardCompatible); #endif } #if DEBUG new DiagnosticsCenter(); #endif #if (WAV || OGG) new AudioManager(16, 8, 4096, true); #endif VSync = VSyncMode.Off; InputMgr.Init(_window); //_window.VSync = VSyncMode.On; _window.UpdateFrame += InternalUpdate; _window.RenderFrame += InternalRender; _window.Load += (a, b)=>Load(); Capabilities.Test(); if (Capabilities.Framebuffers == GLExtensionSupport.Core) { GL.GenFramebuffers(1, out _framebuffer); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); } else if (Capabilities.Framebuffers == GLExtensionSupport.Extension) { GL.Ext.GenFramebuffers(1, out _framebuffer); GL.Ext.BindFramebuffer(FramebufferTarget.Framebuffer, 0); } GL.ClearColor(Color4.CornflowerBlue); GL.Viewport(0, 0, width, height); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); }