public TackGameWindow(int _width, int _height, string _n, EngineDelegates.OnStart _strtFunc, EngineDelegates.OnUpdate _updtFunc, EngineDelegates.OnGUIRender _guiRendFunc, EngineDelegates.OnClose _onCloseFunc, TackConsole consoleHandle) : base(_width, _height, GraphicsMode.Default, _n) { onStartFunction = _strtFunc; onUpdateFunction = _updtFunc; onGUIRenderFunction = _guiRendFunc; onCloseFunction = _onCloseFunc; mTackConsole = consoleHandle; ActiveInstance = this; }
/// <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(); }
private static void NewGameWindow(int _w, int _h, int _u_s, int _f_s, string _n, EngineDelegates.OnStart _s, EngineDelegates.OnUpdate _u, EngineDelegates.OnGUIRender _r, EngineDelegates.OnClose _c, TackConsole consoleInstance) { if (currentWindow == null) { currentWindow = new TackGameWindow(_w, _h, _n, _s, _u, _r, _c, consoleInstance); TackConsole.EngineLog(EngineLogType.Message, "Successfully created new CustomGameWindow instance"); return; } TackConsole.EngineLog(EngineLogType.Error, "There is already a CustomGameWindow instance running in this session"); }