/// <summary> /// Setup OpenGL and load resources here. /// </summary> /// <param name="e">Not used.</param> protected override void OnLoad(EventArgs e) { //fontPath = Path.Combine(_directoryHandler["Fonts"].FullName, "./Chamgagne Limousines/Champagne & Limousines Italic.ttf"); //fontPath = Path.Combine(_directoryHandler["Fonts"].FullName, "./Ostrich Sans/OstrichSans-Black.otf"); var menuFontPath = Path.Combine(_directoryHandler["Fonts"].FullName, "./Oswald-Bold.ttf"); var versionFontPath = _directoryHandler.Locate("Fonts", "./Oswald-Regular.ttf"); var bodyFontPath = _directoryHandler.Locate("Fonts", "./Open Sans/OpenSans-Light.ttf"); var largeBodyFontPath = _directoryHandler.Locate("Fonts", "./Open Sans/OpenSans-Regular.ttf"); //var selectedFontPath = _directoryHandler.Locate("Fonts", "./Open Sans/OpenSans-Bold.ttf"); var selectedFontPath = Path.Combine(_directoryHandler["Fonts"].FullName, "./Oswald-Bold.ttf"); Console.WriteLine("Initializing"); Console.WriteLine("Creating game camera"); var gameCamera = new Camera(prefWidth, prefHeight, Width, Height, Mouse); gameCamera.CameraBounds = gameCamera.OriginalBounds = new Polygon(new Vector2(-prefWidth * 10, -prefHeight * 10), (int)prefWidth * 20, (int)(prefHeight * 20)); // Register OSX codecs if running on OSX if (PlatformDetection.RunningPlatform() == Platform.MacOSX) { Console.WriteLine("Registering OSX Audio codecs"); CSCore.OSXCoreAudio.OSXAudio.RegisterCodecs(); } Console.WriteLine("Creating font library"); var fontLibrary = new FontLibrary(); Console.WriteLine("Loading fonts"); // Default font var gameFont = new QFont(bodyFontPath, 18, new QFontBuilderConfiguration() { SuperSampleLevels = 2 }); fontLibrary.AddFont(new GameFont(gameFont, GameFontType.Default, new Vector2(Width, Height))); // Menu font fontLibrary.AddFont( new GameFont(new QFont(menuFontPath, 50, new QFontBuilderConfiguration(true)), GameFontType.Menu, new Vector2(Width, Height))); // Menu World font fontLibrary.AddFont( new GameFont(new QFont(menuFontPath, 70, new QFontBuilderConfiguration(true) { SuperSampleLevels = 2, PageMaxTextureSize = 8192, Characters = CharacterSet.BasicSet }), "menuworld", new Vector2(Width, Height))); // Heading font fontLibrary.AddFont( new GameFont(new QFont(menuFontPath, 20, new QFontBuilderConfiguration(true) { SuperSampleLevels = 2 }), GameFontType.Heading, new Vector2(Width, Height))); // Large body font fontLibrary.AddFont( new GameFont(new QFont(largeBodyFontPath, 25, new QFontBuilderConfiguration() { SuperSampleLevels = 1 }), "largebody", new Vector2(Width, Height))); // Version text font fontLibrary.AddFont( new GameFont(new QFont(versionFontPath, 15, new QFontBuilderConfiguration()), "versiontext", new Vector2(Width, Height))); // Selected text font (song browser fontLibrary.AddFont( new GameFont(new QFont(selectedFontPath, 34, new QFontBuilderConfiguration() { SuperSampleLevels = 2, Characters = CharacterSet.General }), "selected", new Vector2(Width, Height))); Console.WriteLine("Creating scene manager"); _gameSceneManager = new SceneManager(this, gameCamera, fontLibrary, bodyFontPath, _directoryHandler, _gameSettings, DebugMode); _gameSceneManager.AddScene(new MenuScene(), null); Console.WriteLine("Checking for first run scene"); if ((bool)ServiceLocator.Settings["FirstRun"]) { _gameSceneManager.AddScene(new FirstRunScene(), null); } Console.WriteLine("Setting up input system callbacks"); Keyboard.KeyDown += (o, args) => InputSystem.KeyDown(args); Keyboard.KeyUp += (o, args) => InputSystem.KeyUp(args); Mouse.ButtonDown += (o, args) => InputSystem.MouseDown(args); Mouse.ButtonUp += (o, args) => InputSystem.MouseUp(args); Mouse.WheelChanged += (o, args) => InputSystem.MouseWheelChanged(args); Mouse.Move += (o, args) => InputSystem.MouseMoved(args); Console.WriteLine("Setting clear color"); GL.ClearColor(Color.Black); Console.WriteLine("Creating stopwatch"); _watch = new Stopwatch(); Console.WriteLine("Finished OnLoad"); }