protected override void OnUpdate(double deltaTime) { if (loaded == 1) { string doorsAtlasPath = FileUtil.CURRENT_DIRECTORY + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Assets" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Images" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Doors" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "doors.png"; doorsAtlas = new TextureAtlas(TextureUtil.BitmapFromBytes(FileUtil.Read(doorsAtlasPath, 0)), 64, 24); } else if (loaded == 2) { string foodAtlasPath = FileUtil.CURRENT_DIRECTORY + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Assets" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Images" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Doors" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "food.png"; string foodAtlasXmlPath = FileUtil.CURRENT_DIRECTORY + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Assets" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Images" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Doors" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "food.xml"; foodAtlasXml.Load(foodAtlasXmlPath); foodAtlas = new TextureAtlas(TextureUtil.BitmapFromBytes(FileUtil.Read(foodAtlasPath, 0)), foodAtlasXml); } else if (loaded == 3) { string mainFontPath = FileUtil.CURRENT_DIRECTORY + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Assets" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Fonts" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Doors" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "neuropol x rg.ttf"; FontUtil.AddFont("main", FileUtil.Read(mainFontPath, 0)); } else if (loaded > 3) { gameRegistry = ServiceLocator.GetService <GameDoorRegistry>(); gameRegistry.SetRegister("doors", doorsAtlas); gameRegistry.SetRegister("food", foodAtlas); loadingText.Text = "Done!"; loadingText.X = Window.Width / 2.0d - loadingText.Width / 2.0d; loadingText.Y = Window.Height / 2.0d - loadingText.Height / 2.0d; //Window.SwapStates(this, new IntroState()); Window.SwapStates(this, new GameState()); } loaded++; }
//public //private protected override void OnEnter() { //provideExceptionHandler(); //provideGameAnalytics(); //throw new Exception("Test 1.0.0.0"); IGameEngine gameEngine = ServiceLocator.GetService <IGameEngine>(); //gameEngine.DrawSync = false; //gameEngine.UpdateInterval = (1.0d / 65.0d) / 1000.0d; //gameEngine.DrawInterval = (1.0d / 65.0d) / 1000.0d; /*graphicsWindow = new Window(1280, 720, "Graphics Test", WindowStyle.Titlebar | WindowStyle.Close | WindowStyle.Resize, false, true, 16); * graphicsWindow.AddState(new GraphicsTestState());*/ /*physicsWindow = new Window(1280, 720, "Physics Test", WindowStyle.Titlebar | WindowStyle.Close, true, true, 16); * physicsWindow.AddState(new PhysicsTestState());*/ /*inputWindow = new Window(1280, 720, "Input Test", WindowStyle.Titlebar | WindowStyle.Close, true, true, 16); * inputWindow.AddState(new InputTestState());*/ /*clientServerWindow = new Window(1280, 720, "Client/Server Test", WindowStyle.Titlebar | WindowStyle.Close, true, true, 16); * clientServerWindow.AddState(new ClientServerTestState());*/ /*audioWindow = new Window(1280, 720, "Audio Test", WindowStyle.Titlebar | WindowStyle.Close, true, true, 16); * audioWindow.AddState(new AudioTestState());*/ /*cryptoWindow = new Window(1280, 720, "Crypto Test", WindowStyle.Titlebar | WindowStyle.Close, true, true, 16); * cryptoWindow.AddState(new CryptoTestState());*/ string pixelFontPath = FileUtil.CURRENT_DIRECTORY + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + ".." + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Assets" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "Fonts" + FileUtil.DIRECTORY_SEPARATOR_CHAR + "ARCADECLASSIC.TTF"; FontUtil.AddFont("pixel", FileUtil.Read(pixelFontPath, 0)); gameDoorsWindow = new Window(1280, 720, "Baking For Doors", WindowStyle.Titlebar | WindowStyle.Close); gameDoorsWindow.AddState(new GameDoorInitState()); }