Example #1
0
        /// <summary>
        /// Initialises a new TackEngine instance using the given parameters
        /// </summary>
        /// <param name="_windowWidth">The width of the window</param>
        /// <param name="_windowHeight">The height of the window</param>
        /// <param name="_updatesPerSec">The targeted amount of update cycles per second</param>
        /// <param name="_framesPerSec">The targeted amount of frames rendered per second</param>
        /// <param name="_vsync">Whether v-sync should be enable. If true, will ignore _framesPerSec argument</param>
        /// <param name="_windowName">The title of the window</param>
        /// <param name="_st">The method called on engine startup</param>
        /// <param name="_up">The method called every update cycle</param>
        /// <param name="_guirend">The method called every time a frame is rendered</param>
        /// <param name="_clos">The method called on engine shutdown</param>
        public static void Init(int _windowWidth, int _windowHeight, int _updatesPerSec, int _framesPerSec, bool _vsync, string _windowName, EngineDelegates.OnStart _st, EngineDelegates.OnUpdate _up, EngineDelegates.OnGUIRender _guirend, EngineDelegates.OnClose _clos)
        {
            TackConsole activeConsoleInstance = new TackConsole();

            activeConsoleInstance.OnStart();

            TackConsole.EngineLog(EngineLogType.Message, "Starting TackEngine.");
            TackConsole.EngineLog(EngineLogType.Message, string.Format("EngineVersion: {0}", GetEngineVersion().ToString()));

            // Create new window
            NewGameWindow(_windowWidth, _windowHeight, _updatesPerSec, _framesPerSec, _windowName, _st, _up, _guirend, _clos, activeConsoleInstance);

            if (_vsync)
            {
                currentWindow.VSync = OpenTK.VSyncMode.On;
            }
            else
            {
                currentWindow.VSync = OpenTK.VSyncMode.Off;
            }

            currentWindow.Run(_updatesPerSec, _framesPerSec);

            TackConsole.EngineLog(EngineLogType.Message, "Stopping Tackengine\n\n");
            activeConsoleInstance.OnClose();
        }