public Color(string color) { r = 255; g = 255; b = 255; a = 255; if ("" == color) { return; } try { string[] colors = color.Split(' '); if (colors.Length >= 3) { r = Convert.ToByte(colors[0]); g = Convert.ToByte(colors[1]); b = Convert.ToByte(colors[2]); if (colors.Length == 4) { this.a = Convert.ToByte(colors[3]); } } } catch { EngineLog.Get().Error("Error converting " + color + " to Color", "Color"); } }
public static bool Initialize(out string message) { message = ""; try { Instance = ReadJson(); if (Instance != null) { EngineLog.Write(EngineLogLevel.Startup, "Successfully read Network config."); return(true); } if (!Write(out var pConfig)) { message = "Failed to create default NetworkConfiguration."; return(false); } pConfig.WriteJson(); EngineLog.Write(EngineLogLevel.Startup, "Successfully created Network config."); message = "No NetworkConfiguration found! Please edit generated config."; return(false); } catch (Exception ex) { EngineLog.Write(EngineLogLevel.Exception, "Failed to load Network config:\n {0}", ex); message = $"Failed to load NetworkConfiguration:\n {ex.StackTrace}"; return(false); } }
public static void Initialize() { var stopwatch = new Stopwatch(); stopwatch.Start(); InternalInstance = new ServerMain(); InternalInstance.WriteConsoleLogo(); EngineLog.Write(EngineLogLevel.Startup, "Starting LoginServer"); // Configuration if (!NetworkConfiguration.Initialize(out var netConfigMsg)) { throw new StartupException(netConfigMsg); } NetConfig = NetworkConfiguration.Instance; if (!DatabaseConfiguration.Initialize(out var dbConfigMsg)) { throw new StartupException(dbConfigMsg); } DbConfig = DatabaseConfiguration.Instance; if (!LoginConfiguration.Initialize(out var loginConfigMsg)) { throw new StartupException(loginConfigMsg); } LoginConfig = LoginConfiguration.Instance; // Database if (!DB.AddManager(DatabaseType.Account, DatabaseConfiguration.Instance)) { throw new StartupException("Database connection failure! See above error."); } // Handlers StoreHandlers(); // Networking WorldServer.Listen(NetConfig.LoginNetConfig.S2SListenIP, (ushort)NetConfig.LoginNetConfig.S2SListenPort); ClientServer.Listen(NetConfig.LoginNetConfig.ListenIP, (ushort)NetConfig.LoginNetConfig.ListenPort); // TODO: gamelogserver // GameLogServer.Connect(NetConfig.GameLogNetConfig.S2SListenIP, (ushort)NetConfig.GameLogNetConfig.S2SListenPort); stopwatch.Stop(); EngineLog.Write(EngineLogLevel.Startup, $"Time taken to start: {stopwatch.ElapsedMilliseconds}ms"); // Main server loop new Thread(() => { while (true) { Update(Time.Milliseconds); Thread.Sleep(10); } }).Start(); // Console commands? }
public int LoadFont(string ttfFile, int size) { font = SdlTtf.TTF_OpenFont(ttfFile, size); if (IntPtr.Zero == font) { EngineLog.Get().Error("Error loading " + ttfFile + ": " + SdlTtf.TTF_GetError(), "Font"); return(1); } EngineLog.Get().Info(ttfFile + " loaded", "Font"); return(0); }
public GameManager() { root = null; renderWindow = null; viewport = null; log = null; timer = null; inputMgr = null; keyboard = null; mouse = null; appStateMgr = null; soundMgr = null; VideoMode = new NameValuePairList(); isEditMode = false; isCheatMode = false; loadingData = new LoadingData(LoadingType.NONE, null, null, null); GlobalValueTable = new Dictionary <string, object>(); }
public void BindTexture() { if (texId == 0) { //Gl.glGenTextures(1, new int[] { texId }); int[] textureAr = new int[1]; Gl.glGenTextures(1, textureAr); texId = textureAr[0]; } Gl.glBindTexture(Gl.GL_TEXTURE_2D, texId); Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR); Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR); int err = Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_RGB, 128, 128, Gl.GL_RGB, Gl.GL_UNSIGNED_BYTE, map); if (err != 0) { EngineLog.Get().Error("Error binding texture (" + texId + "): " + Glu.gluErrorString(err), ToString()); } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); log4net.Config.XmlConfigurator.Configure(); API.Common.LegacyFormVersionNeeded += Common_LegacyFormVersionNeeded; API.Common.IsSnapshotNeeded += Common_IsSnapshotNeeded; API.Common.VersionNeeded += Common_VersionNeeded; API.Common.SnapshotNumberNeeded += Common_SnapshotNumberNeeded; EngineLog el = new EngineLog(); el.Info("RCSE - Intergrated Application Routine", ""); el.Info("RCSE - Starting", ""); RCSEApplication app = new RCSEApplication(); el.Info("RCSE - Application Created", ""); app.Launching(args); el.Info("RCSE - Application Running", ""); }
public GameManager() { root = null; renderWindow = null; viewport = null; log = null; timer = null; inputMgr = null; keyboard = null; mouse = null; trayMgr = null; appStateMgr = null; soundMgr = null; AllGameObjects = new Dictionary <int, GameObject>(); GameHashMap = new Dictionary <string, uint>(); videoMode = new NameValuePairList(); isEditMode = false; isCheatMode = false; loadingData = new LoadingData(LoadingType.NONE, null, null, null); }
public int RunSQL(DatabaseType type, string sql, params object[] parameters) { using (var mClient = DB.GetDatabaseClient(type)) { var sqlString = new StringBuilder(); // Fix for floating point problems on some languages sqlString.AppendFormat(CultureInfo.GetCultureInfo("en-US").NumberFormat, sql, parameters); SqlCommand sqlCommand = null; try { sqlCommand = new SqlCommand(sqlString.ToString()); sqlCommand.Parameters.AddRange(parameters); mClient.mCommand = sqlCommand; return(mClient.ExecuteNonQuery()); } catch (SqlException ex) { EngineLog.Write(ex, $"Failed to Execute Query {sqlCommand?.CommandText}"); return(0); } } }
public int LoadModel(string file) { if (modelList.ContainsKey(file)) { return(0); } BinaryReader binReader; binReader = new BinaryReader(File.Open(file, FileMode.Open)); // ToDo: Error handling Model model = new Model(); model.file = file; ModelMaterial modelMaterial = new ModelMaterial(); ModelObject modelObject = new ModelObject(); long fileLenght = binReader.BaseStream.Length; while (binReader.BaseStream.Position < fileLenght) { ushort chunkId = binReader.ReadUInt16(); uint chunkLen = binReader.ReadUInt32(); switch (chunkId) { case 0x4d4d: // Main break; case 0x3d3d: // Editor break; case 0x4000: // Object model.objectList.Add(modelObject); modelObject = new ModelObject(); modelObject.vertexList.Clear(); modelObject.faceList.Clear(); modelObject.normalList.Clear(); modelObject.texcoordList.Clear(); modelObject.name = ReadNames(ref binReader, 20); break; case 0x4100: break; case 0x4110: // Vertices ushort lenv = binReader.ReadUInt16(); for (int i = 0; i < lenv; i++) { Vector3 vec = new Vector3(); vec.x = binReader.ReadSingle(); vec.y = binReader.ReadSingle(); vec.z = binReader.ReadSingle(); modelObject.vertexList.Add(vec); } break; case 0x4120: // Faces ushort lenf = binReader.ReadUInt16(); for (int i = 0; i < lenf; i++) { ModelFace modelFace = new ModelFace(); modelFace.vertexIndex[0] = binReader.ReadUInt16(); modelFace.vertexIndex[1] = binReader.ReadUInt16(); modelFace.vertexIndex[2] = binReader.ReadUInt16(); binReader.ReadUInt16(); modelObject.faceList.Add(modelFace); } break; case 0x4130: // Material information modelObject.materialName = ReadNames(ref binReader, 20); binReader.BaseStream.Seek(chunkLen - 6 - modelObject.materialName.Length, SeekOrigin.Current); break; case 0x4140: // Texture coordinates ushort lent = binReader.ReadUInt16(); for (int i = 0; i < lent; i++) { ModelTextureCoord modelTc = new ModelTextureCoord(); modelTc.u = binReader.ReadSingle(); modelTc.v = binReader.ReadSingle(); modelObject.texcoordList.Add(modelTc); } break; case 0xAFFF: // Material model.materialList.Add(modelMaterial); modelMaterial = new ModelMaterial(); break; case 0xA000: modelMaterial.name = ReadNames(ref binReader, 20); break; case 0xA200: break; case 0xA300: modelMaterial.textureName = ReadNames(ref binReader, 20); break; default: binReader.BaseStream.Seek(chunkLen - 6, SeekOrigin.Current); break; } } binReader.Close(); model.objectList.Add(modelObject); model.materialList.Add(modelMaterial); model.objectList.RemoveAt(0); model.materialList.RemoveAt(0); foreach (ModelMaterial modelMat in model.materialList) { int pos = file.LastIndexOf("/", file.Length); string tmpStr = file.Substring(0, pos + 1) + modelMat.textureName; modelMat.textureName = tmpStr; LightFireCS.Graphics.TextureManager.Get().LoadTextureFromFile(modelMat.textureName); } Console.WriteLine("Objects: " + model.objectList.Count); Console.WriteLine("Materials: " + model.materialList.Count); int faces = 0; foreach (ModelObject mdlObj in model.objectList) { faces += mdlObj.faceList.Count; } Console.WriteLine("Faces: " + faces); modelList.Add(file, model); EngineLog.Get().Info(file + " loaded", "Model manager"); return(0); }
private bool InitRender(string wndTitle, ref GameConfigXml gameOptions) { root = Root.Singleton == null ? new Root() : Root.Singleton; root.FrameStarted += new FrameListener.FrameStartedHandler(frameStarted); log = EngineLogManager.Instance.CreateLog("./Log/Engine.log"); rendererLog = LogManager.Singleton.CreateLog("./Log/Mogre.log", true, true, false); rendererLog.SetDebugOutputEnabled(true); RenderSystem rs = null; IniConfigFileParser parser = new IniConfigFileParser(); if (gameOptions == null) { gameOptions = GameConfigXml.Load("game.xml", root); } defaultRenderSystemName = gameOptions.GraphicConfig.CurrentRenderSystem; var renderParams = gameOptions.GraphicConfig[gameOptions.GraphicConfig.CurrentRenderSystem]; if (!string.IsNullOrEmpty(defaultRenderSystemName)) { var videModeRenderParam = renderParams.Where(o => o.Name == "Video Mode").First(); rs = root.GetRenderSystemByName(defaultRenderSystemName); string strVideoMode = Regex.Match( videModeRenderParam.Value, "[0-9]{3,4} x [0-9]{3,4}").Value; VideoMode["Width"] = strVideoMode.Split('x')[0].Trim(); VideoMode["Height"] = strVideoMode.Split('x')[1].Trim(); } var ogreConfigMap = rs.GetConfigOptions(); if (rs != null && renderParams != null) { foreach (var kpl in renderParams) { string renderParamKey = kpl.Name; string renderParamValue = kpl.Value; //Validate the render parameter if (!ogreConfigMap[renderParamKey].possibleValues.Contains(renderParamValue)) { renderParamValue = ogreConfigMap[renderParamKey].possibleValues[0]; } rs.SetConfigOption(renderParamKey, renderParamValue); } root.RenderSystem = rs; } renderWindow = root.Initialise(true, wndTitle); IntPtr hwnd; renderWindow.GetCustomAttribute("WINDOW", out hwnd); Helper.SetRenderWindowIcon(new System.Drawing.Icon(Path.Combine(Environment.CurrentDirectory, "app.ico")), hwnd); viewport = renderWindow.AddViewport(null); ColourValue cv = new ColourValue(0.5f, 0.5f, 0.5f); viewport.BackgroundColour = cv; viewport.Camera = null; int hWnd = 0; renderWindow.GetCustomAttribute("WINDOW", out hWnd); inputMgr = MOIS.InputManager.CreateInputSystem((uint)hWnd); keyboard = (Keyboard)inputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true); mouse = (Mouse)inputMgr.CreateInputObject(MOIS.Type.OISMouse, true); keyMouseManager = new InputKeyMouseManager(); keyMouseManager.SomeKeyPressd += KeyMouseManager_SomeKeyPressd; MouseState_NativePtr mouseState = mouse.MouseState; mouseState.width = viewport.ActualWidth; mouseState.height = viewport.ActualHeight; foreach (var resource in gameOptions.ResourcesConfig.Resources) { foreach (var resLoc in resource.ResourceLocs) { ResourceGroupManager.Singleton.AddResourceLocation(resLoc, resource.Type, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); } } foreach (var keyMapper in gameOptions.InputConfig.Mappers) { KeyMapperManager.Instance.AddKeyMapper(keyMapper.GameKeyCode, keyMapper.GetKeyCollections()); } if (!LocateSystem.Instance.IsInit) { LocateSystem.Instance.InitLocateSystem(LocateSystem.Instance.ConvertReadableStringToLocate(gameOptions.LocateConfig.CurrentLocate)); } SkinManager.Instance.LoadSkin("Default.skn"); ResourceGroupManager.Singleton.AddResourceLocation( string.Format("./Media/Engine/Fonts/{0}/", LocateSystem.Instance.Locate.ToString()), "FileSystem", "General"); TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); UIManager.Instance.Init("AMOFTrayMgr", renderWindow, mouse, new UIListener()); timer = new Timer(); timer.Reset(); renderWindow.IsActive = true; this.gameOptions = gameOptions; log.LogMessage("Game Started!"); return(true); }
private int LoadTextureFromFile(string file, int oldId) { if (textureList.ContainsKey(file) && oldId == -1) { return(0); } int imageId = 0; Il.ilGenImages(1, out imageId); Il.ilBindImage(imageId); if (!Il.ilLoadImage(file)) { Il.ilDeleteImages(1, ref imageId); EngineLog.Get().Error("Error loading " + file + " (DevIL: " + Il.ilGetError() + ")", "Texture manager"); return(-1); } if (file.ToUpper().LastIndexOf(".TGA") == 0) { Ilu.iluFlipImage(); } Texture tex = new Texture(); tex.width = Il.ilGetInteger(Il.IL_IMAGE_WIDTH); tex.height = Il.ilGetInteger(Il.IL_IMAGE_HEIGHT); tex.bpp = Il.ilGetInteger(Il.IL_IMAGE_BITS_PER_PIXEL); IntPtr Ptr = Il.ilGetData(); Gl.glPushAttrib(Gl.GL_TEXTURE_BIT); if (oldId == -1) { //Gl.glGenTextures(1, new int[] { tex.id }); int[] texture = new int[1]; Gl.glGenTextures(1, texture); tex.id = texture[0]; } else { tex.id = oldId; } Gl.glBindTexture(Gl.GL_TEXTURE_2D, tex.id); Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_NEAREST); Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR); int texType = Gl.GL_RGB; if (file.ToUpper().LastIndexOf(".TGA") != -1) { texType = Gl.GL_BGR; } if (tex.bpp == 32) { texType = Gl.GL_RGBA; } if (file.ToUpper().LastIndexOf(".TGA") != -1 && tex.bpp == 32) { texType = Gl.GL_BGRA; } int texDestType = Gl.GL_RGB; if (tex.bpp == 32) { texDestType = Gl.GL_RGBA; } Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, texDestType, tex.width, tex.height, texType, Gl.GL_UNSIGNED_BYTE, Ptr); Gl.glPopAttrib(); if (oldId == -1) { textureList.Add(file, tex); } EngineLog.Get().Info(file + " loaded", "Texture manager"); return(0); }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { EngineLog.Write(EngineLogLevel.Exception, e.ExceptionObject.ToString()); }
public int CreateDevice(int width, int height, int colorDepth, bool fullscreen) { this.width = width; this.height = height; this.colorDepth = colorDepth; this.fullscreen = fullscreen; videoFlags = Sdl.SDL_OPENGL | Sdl.SDL_GL_DOUBLEBUFFER | Sdl.SDL_RESIZABLE | Sdl.SDL_HWPALETTE; if (Sdl.SDL_Init(Sdl.SDL_INIT_VIDEO) < 0) { EngineLog.Get().Error("Error init SDL: " + Sdl.SDL_GetError(), "Graphics"); Sdl.SDL_Quit(); return(-1); } if (-1 == SdlTtf.TTF_Init()) { EngineLog.Get().Error("Error init SDL TTF: " + SdlTtf.TTF_GetError(), "Graphics"); return(-1); } else { EngineLog.Get().Info("SDL TTF initialized", "Graphics"); } if (this.fullscreen) { videoFlags |= Sdl.SDL_FULLSCREEN | Sdl.SDL_ANYFORMAT; EngineLog.Get().Info("Switching to Fullscreen", "Graphics"); } else { EngineLog.Get().Info("Switching to Window", "Graphics"); } IntPtr videoInfoPtr = Sdl.SDL_GetVideoInfo(); if (IntPtr.Zero == videoInfoPtr) { EngineLog.Get().Error("GetVideoInfo failed", "Graphics"); return(1); } Sdl.SDL_VideoInfo videoInfo = (Sdl.SDL_VideoInfo)Marshal.PtrToStructure( videoInfoPtr, typeof(Sdl.SDL_VideoInfo)); // This doesn't work /*if(1 == videoInfo.hw_available) * { * EngineLog.Get().Info("Hardware Surface", "Graphics"); * videoFlags |= Sdl.SDL_HWSURFACE; * } else { * EngineLog.Get().Warn("Software Surface", "Graphics"); * videoFlags |= Sdl.SDL_SWSURFACE; * }*/ videoFlags |= Sdl.SDL_HWSURFACE; if (1 == videoInfo.blit_hw) { EngineLog.Get().Info("Hardware Blitting", "Graphics"); videoFlags |= Sdl.SDL_HWACCEL; } else { EngineLog.Get().Warn("No Hardware Blitting", "Graphics"); } Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_RED_SIZE, 5); Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_GREEN_SIZE, 5); Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_BLUE_SIZE, 5); Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_DEPTH_SIZE, 16); Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_DOUBLEBUFFER, 1); sdlSurface = Sdl.SDL_SetVideoMode(width, height, colorDepth, videoFlags); if (0 == sdlSurface.ToInt32()) { EngineLog.Get().Error("Set video mode: " + Sdl.SDL_GetError(), "Graphics"); return(1); } else { EngineLog.Get().Info("Set video mode to " + width + "x" + height + "x" + colorDepth, "Graphics"); } Gl.glShadeModel(Gl.GL_SMOOTH); Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); Gl.glClearDepth(1.0f); Gl.glEnable(Gl.GL_DEPTH_TEST); Gl.glDepthFunc(Gl.GL_LEQUAL); Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST); Gl.glEnable(Gl.GL_TEXTURE_2D); Gl.glEnable(Gl.GL_CULL_FACE); Gl.glCullFace(Gl.GL_BACK); string glVendor = Gl.glGetString(Gl.GL_VENDOR); string glVersion = Gl.glGetString(Gl.GL_VERSION); string glVideoCard = Gl.glGetString(Gl.GL_RENDERER); string glExt = Gl.glGetString(Gl.GL_EXTENSIONS); EngineLog.Get().Info("OpenGL Vendor: " + glVendor, "Graphics"); EngineLog.Get().Info("OpenGL Version " + glVersion, "Graphics"); EngineLog.Get().Info("OpenGL Renderer: " + glVideoCard, "Graphics"); EngineLog.Get().Info("OpenGL Extensions: " + glExt, "Graphics"); if (!Gl.IsExtensionSupported("GL_ARB_multitexture")) { EngineLog.Get().Error("Extension GL_ARB_multitexture not supported!", "Graphics"); return(1); } // New TAO Framwork loads all extensions on startup /*if(false == GlExtensionLoader.LoadExtension("GL_ARB_multitexture")) * { * EngineLog.Get().Error("Load OpenGL Extension: GL_ARB_multitexture", "Graphics"); * return 1; * }*/ isRunning = true; isOrtho = false; fpsTime = Sdl.SDL_GetTicks(); frameTime = Sdl.SDL_GetTicks(); ResizeWindow(width, height); return(0); }
private bool InitRender(string wndTitle, ref Dictionary <string, string> gameOptions) { root = Root.Singleton == null ? new Root() : Root.Singleton; root.FrameStarted += new FrameListener.FrameStartedHandler(frameStarted); log = EngineLogManager.Instance.CreateLog("./Log/Engine.log"); rendererLog = LogManager.Singleton.CreateLog("./Log/Mogre.log", true, true, false); rendererLog.SetDebugOutputEnabled(true); RenderSystem rs = null; IniConfigFileParser parser = new IniConfigFileParser(); if (gameOptions == null) { gameOptions = new Dictionary <string, string>(); IniConfigFile cf = (IniConfigFile)parser.Load("Game.cfg"); var sections = cf.Sections; foreach (var section in sections) { foreach (var kpl in section.KeyValuePairs) { gameOptions.Add(kpl.Key, kpl.Value); } } cf = (IniConfigFile)parser.Load("ogre.cfg"); sections = cf.Sections; string renderSystem = null; foreach (var section in sections) { if (section.Name == "") { foreach (var kpl in section.KeyValuePairs) { renderSystem = kpl.Value; gameOptions.Add(kpl.Key, kpl.Value); } } else if (section.Name == renderSystem) { foreach (var kpl in section.KeyValuePairs) { gameOptions.Add("Render Params_" + kpl.Key, kpl.Value); } } } } defaultRenderSystemName = gameOptions.Where(o => o.Key == "Render System").First().Value; var renderParams = gameOptions.Where(o => o.Key.StartsWith("Render Params")); if (!string.IsNullOrEmpty(defaultRenderSystemName)) { var videModeRenderParam = renderParams.Where(o => o.Key == "Render Params_Video Mode").First(); rs = root.GetRenderSystemByName(defaultRenderSystemName); string strVideoMode = Regex.Match( videModeRenderParam.Value, "[0-9]{3,4} x [0-9]{3,4}").Value; videoMode["Width"] = strVideoMode.Split('x')[0].Trim(); videoMode["Height"] = strVideoMode.Split('x')[1].Trim(); } var ogreConfigMap = rs.GetConfigOptions(); if (rs != null && renderParams != null) { foreach (var kpl in renderParams) { string renderParamKey = kpl.Key.Split('_')[1]; string renderParamValue = kpl.Value; //Validate the render parameter if (!ogreConfigMap[renderParamKey].possibleValues.Contains(renderParamValue)) { renderParamValue = ogreConfigMap[renderParamKey].possibleValues[0]; } rs.SetConfigOption(renderParamKey, renderParamValue); } root.RenderSystem = rs; } renderWindow = root.Initialise(true, wndTitle); viewport = renderWindow.AddViewport(null); ColourValue cv = new ColourValue(0.5f, 0.5f, 0.5f); viewport.BackgroundColour = cv; viewport.Camera = null; int hWnd = 0; renderWindow.GetCustomAttribute("WINDOW", out hWnd); inputMgr = InputManager.CreateInputSystem((uint)hWnd); keyboard = (Keyboard)inputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true); mouse = (Mouse)inputMgr.CreateInputObject(MOIS.Type.OISMouse, true); mouse.MouseMoved += new MouseListener.MouseMovedHandler(mouseMoved); mouse.MousePressed += new MouseListener.MousePressedHandler(mousePressed); mouse.MouseReleased += new MouseListener.MouseReleasedHandler(mouseReleased); keyboard.KeyPressed += new KeyListener.KeyPressedHandler(keyPressed); keyboard.KeyReleased += new KeyListener.KeyReleasedHandler(keyReleased); MouseState_NativePtr mouseState = mouse.MouseState; mouseState.width = viewport.ActualWidth; mouseState.height = viewport.ActualHeight; string secName, typeName, archName; IniConfigFile conf = new IniConfigFile(); conf = (IniConfigFile)parser.Load("resources.cfg"); for (int i = 0; i < conf.Sections.Count; i++) { secName = conf.Sections[i].Name; for (int j = 0; j < conf.Sections[i].KeyValuePairs.Count; j++) { typeName = conf.Sections[i].KeyValuePairs[j].Key; archName = conf.Sections[i].KeyValuePairs[j].Value; ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName); } } if (!LocateSystem.Singleton.IsInit) { LocateSystem.Singleton.InitLocateSystem(LocateSystem.Singleton.ConvertLocateShortStringToLocateInfo(gameOptions.Where(o => o.Key == "CurrentLocate").First().Value)); } ResourceGroupManager.Singleton.AddResourceLocation( string.Format("./Media/Engine/Fonts/{0}/", LocateSystem.Singleton.Locate.ToString()), "FileSystem", "General"); TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); trayMgr = new SdkTrayManager("AMOFTrayMgr", renderWindow, mouse, new SdkTrayListener()); timer = new Timer(); timer.Reset(); renderWindow.IsActive = true; this.gameOptions = gameOptions; log.LogMessage("Game Started!"); return(true); }