public static void RendererSetVSync(string[] args)
        {
            if (args.Length == 1)
            {
                TackConsole.EngineLog(EngineLogType.Message, "Value: " + (TackEngine.currentWindow.VSync == OpenTK.VSyncMode.Off ? "Off" : "On"));
                return;
            }

            if (args.Length == 2)
            {
                if (bool.TryParse(args[1], out bool result))
                {
                    if (result)
                    {
                        TackEngine.currentWindow.VSync = OpenTK.VSyncMode.On;
                        TackConsole.EngineLog(EngineLogType.Message, "Set renderer.v-sync to value: On");
                    }
                    else
                    {
                        TackEngine.currentWindow.VSync = OpenTK.VSyncMode.Off;
                        TackConsole.EngineLog(EngineLogType.Message, "Set renderer-v-sync to value: Off");
                    }
                }
                else
                {
                    TackConsole.EngineLog(EngineLogType.Error, "Couldn't convert '{0}' to type: bool", args[1]);
                }

                return;
            }

            TackConsole.EngineLog(EngineLogType.Error, "Incorrect number of args for command: " + args[0]);
        }
        public static void EnableDebugDrawCommand(string[] args)
        {
            if (args.Length == 1)
            {
                TackConsole.EngineLog(EngineLogType.Message, "Value: " + TackPhysics.GetInstance().ShouldDebugDrawBodies);
                return;
            }

            if (args.Length == 2)
            {
                if (bool.TryParse(args[1], out bool res))
                {
                    TackPhysics.GetInstance().ShouldDebugDrawBodies = res;
                    TackConsole.EngineLog(EngineLogType.Message, "Set {0} to Value: {1}", args[0], res);
                }
                else
                {
                    TackConsole.EngineLog(EngineLogType.Error, "Failed to convert '{0}' to a boolean value", args[1]);
                }

                return;
            }

            TackConsole.EngineLog(EngineLogType.Error, "Incorrect number of arguments for command: " + args[0]);
        }
        public static void AddSprite(Sprite _sprite, bool _debugMsgs = true)
        {
            if (_sprite.Id <= 0)
            {
                if (_debugMsgs)
                {
                    TackConsole.EngineLog(EngineLogType.Error, "Cannot add Sprite with id lower than 1 to SpriteManager");
                }
                return;
            }

            if (loadedSprites.Contains(_sprite))
            {
                if (_debugMsgs)
                {
                    TackConsole.EngineLog(EngineLogType.Error, string.Format("Sprite with id '{0}' cannot be added because it is already in SpriteManager", _sprite.Id));
                }
                return;
            }

            loadedSprites.Add(_sprite);
            if (_debugMsgs)
            {
                TackConsole.EngineLog(EngineLogType.Message, string.Format("Added new Sprite with id '{0}' to SpriteManager", _sprite.Id));
            }
        }
Beispiel #4
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();
        }
        public static void ChangeAudioMasterVolume(string[] args)
        {
            if (args.Length == 1)
            {
                TackConsole.EngineLog(EngineLogType.Message, "Value: " + Audio.AudioManager.MasterVolume.ToString("0.000"));
                return;
            }

            if (args.Length == 2)
            {
                if (float.TryParse(args[1], out float res))
                {
                    Audio.AudioManager.MasterVolume = res;
                    TackConsole.EngineLog(EngineLogType.Message, "Changed audiomanager.mastervolume to value: " + Audio.AudioManager.MasterVolume);
                    return;
                }
                else
                {
                    TackConsole.EngineLog(EngineLogType.Error, "Couldn't convert '{0}' to float", args[1]);
                    return;
                }
            }

            TackConsole.EngineLog(EngineLogType.Error, "Incorrect number of args for command: " + args[1]);
        }
Beispiel #6
0
        private int CompileSubShader(string source, ShaderType type)
        {
            if (type != ShaderType.VertexShader && type != ShaderType.FragmentShader)
            {
                TackConsole.EngineLog(Engine.EngineLogType.Error, "Cannot compile sub-shader of unknown type.");
                return(-1);
            }

            // Compile shader
            int subShaderId = GL.CreateShader(type);

            // Set the shader source
            GL.ShaderSource(subShaderId, source);

            // Compile shader
            GL.CompileShader(subShaderId);

            GL.GetShaderInfoLog(subShaderId, out string logStr);

            if (logStr != "")
            {
                TackConsole.EngineLog(Engine.EngineLogType.Error, logStr);
                return(-1);
            }

            TackConsole.EngineLog(Engine.EngineLogType.Message, "Successfully complied sub-shader. Type: {0}, Lines: {1}.", type.ToString(), source.Count(x => x == '\n'));
            return(subShaderId);
        }
Beispiel #7
0
 internal static void RemoveTackObject(TackObject _obj)
 {
     if (ActiveInstance.mTackObjects.Contains(_obj))
     {
         ActiveInstance.mTackObjects.Remove(_obj);
         TackConsole.EngineLog(EngineLogType.Message, string.Format("Removed TackObject with name '{0}' from TackObjectManager", _obj.Name));
     }
 }
Beispiel #8
0
        /// <summary>
        /// Loads the audio data into memory
        /// </summary>
        public void Create()
        {
            mAudioId = AL.GenBuffer();
            AL.BufferData(mAudioId, AudioManager.GetSoundFormat(mChannelNum, mBitsPerSample), mAudioData, mAudioData.Length, mSampleNum);

            TackConsole.EngineLog(EngineLogType.Message, string.Format("Loaded and new AudioClip into memory. AudioId={0}", mAudioId));

            AudioManager.AddAudioClip(this);
        }
Beispiel #9
0
        /// <summary>
        /// Sets the active FontFamily
        /// </summary>
        /// <param name="_familyIndex">The index of the FontFamily</param>
        public static void SetActiveFontFamily(int _familyIndex)
        {
            if (_familyIndex < ActiveInstance.m_fontCollection.Families.Length)
            {
                ActiveInstance.m_activeFontFamily = ActiveInstance.m_fontCollection.Families[_familyIndex];

                TackConsole.EngineLog(EngineLogType.Message, "Set the active FontFamily. Name: {0}, FamilyIndex: {1}", ActiveInstance.m_activeFontFamily.Name, _familyIndex);
            }

            TackConsole.EngineLog(EngineLogType.Error, "The specfied family index is outside the bounds of the font collection Families array");
        }
        public void OnStart()
        {
            Stopwatch timer = new Stopwatch();

            timer.Start();

            mAudioContext = new AudioContext();

            TackConsole.EngineLog(EngineLogType.ModuleStart, "", timer.ElapsedMilliseconds);
            timer.Stop();
        }
        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;
        }
Beispiel #12
0
        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");
        }
Beispiel #13
0
        // CONSTRUCTORS

        public TackObject()
        {
            gameObjectHash = CreateTackObjectHash();
            mName          = "New GameObject";
            mPosition      = new Vector2f();
            mScale         = new Vector2f();
            mRotation      = 0;

            TackObjectManager.AddTackObject(this);

            TackConsole.EngineLog(EngineLogType.Message, string.Format("Create new TackObject at position ({0}, {1}) with name '{2}' and hash '{3}'", mPosition.X, mPosition.Y, mName, gameObjectHash));
        }
Beispiel #14
0
        /// <summary>
        /// Sets the active FontFamily
        /// </summary>
        /// <param name="_familyName">the Name of the FontFamily</param>
        public static void SetActiveFontFamily(string _familyName)
        {
            for (int i = 0; i < ActiveInstance.m_fontCollection.Families.Length; i++)
            {
                if (ActiveInstance.m_fontCollection.Families[i].Name == _familyName)
                {
                    SetActiveFontFamily(i);
                    return;
                }
            }

            TackConsole.EngineLog(EngineLogType.Error, string.Format("No FontFamily with name: {0} was found in the font collection", _familyName));
        }
Beispiel #15
0
        /// <summary>
        /// Loads a font file into the font collection. Returns the position of the new font family.
        /// </summary>
        /// <param name="_fileName"></param>
        /// <returns></returns>
        public static int LoadFontFromFile(string _fileName)
        {
            if (!File.Exists(_fileName))
            {
                TackConsole.EngineLog(EngineLogType.Error, string.Format("Could not locate file at path: {0}", _fileName));
                return(-1);
            }

            ActiveInstance.m_fontCollection.AddFontFile(_fileName);

            TackConsole.EngineLog(EngineLogType.Message, string.Format("Added new font with name: {0} to the TackGUI font collection at index: {1}", ActiveInstance.m_fontCollection.Families[ActiveInstance.m_fontCollection.Families.Length - 1].Name, ActiveInstance.m_fontCollection.Families.Length - 1));
            return(ActiveInstance.m_fontCollection.Families.Length - 1);
        }
Beispiel #16
0
 internal static bool AddTackObject(TackObject _obj)
 {
     if (ActiveInstance.mTackObjects.Contains(_obj))
     {
         TackConsole.EngineLog(EngineLogType.Error, "Could not add TackObject with name '{0}' and hash '{1}' because TackObjectManager already contains this TackObject");
         return(false);
     }
     else
     {
         ActiveInstance.mTackObjects.Add(_obj);
         return(true);
     }
 }
 public static void ConsolePrintOperationsOfCommandclass(string[] args)
 {
     if (args.Length == 2)
     {
         TackConsole.EngineLog(EngineLogType.Message, "Operations of Commandclass: " + args[1]);
         foreach (TackCommand command in TackConsole.GetLoadedTackCommands())
         {
             if (command.CommandCallString.StartsWith(args[1]))
             {
                 TackConsole.EngineLog(EngineLogType.Message, "      {0} {1} ({2} overloads)", command.CommandCallString.Remove(0, (args[1].Length + 1)), command.CommandArgList.FirstOrDefault(), command.CommandArgList.Count - 1);
             }
         }
     }
 }
        public static void TackObjectListAllObjects(string[] args)
        {
            TackConsole.EngineLog(EngineLogType.Message, "Loaded TackObjects:\n");
            TackConsole.EngineLog(EngineLogType.Message, string.Format("{0,-20} | {1,-20} | {2,5}", "Name", "IsActive", "Hash"));
            TackConsole.EngineLog(EngineLogType.Message, "--------------------------------------------------------------");

            Objects.TackObject[] tackObjects = Objects.TackObjectManager.GetAllTackObjects();

            for (int i = 0; i < tackObjects.Length; i++)
            {
                TackConsole.EngineLog(EngineLogType.Message, string.Format("{0,-20} | {1,-20} | {2,5}", tackObjects[i].Name, true, tackObjects[i].GetHash()));
            }

            TackConsole.EngineLog(EngineLogType.Message, "--------------------------------------------------------------");
        }
        /// <summary>
        /// Gets the sound format from the specified channels and bits. Will return ALFormat.Mono8 as default
        /// </summary>
        /// <param name="channels">The number of channels</param>
        /// <param name="bits">The number of bits</param>
        /// <returns></returns>
        public static ALFormat GetSoundFormat(int channels, int bits)
        {
            switch (channels)
            {
            case 1:
                return(bits == 8 ? ALFormat.Mono8 : ALFormat.Mono16);

            case 2:
                return(bits == 8 ? ALFormat.Stereo8 : ALFormat.Stereo16);

            default:
                TackConsole.EngineLog(EngineLogType.Error, "The specified sound format is not supported.");
                return(ALFormat.Mono8);
            }
        }
        public static void HelpCommmand(string[] args)
        {
            if (args.Length == 1)
            {
                TackConsole.EngineLog(EngineLogType.Message, "Commands:");

                foreach (TackCommand command in TackConsole.GetLoadedTackCommands())
                {
                    TackConsole.EngineLog(EngineLogType.Message, "     " + command.CommandCallString);
                }

                return;
            }

            if (args.Length == 2)
            {
                TackCommand com = null;

                foreach (TackCommand command in TackConsole.GetLoadedTackCommands())
                {
                    if (args[1] == command.CommandCallString)
                    {
                        com = command;
                    }
                }

                if (com != null)
                {
                    TackConsole.EngineLog(EngineLogType.Message, com.CommandCallString + ":");

                    foreach (string overloadArgs in com.CommandArgList)
                    {
                        if (overloadArgs != "")
                        {
                            TackConsole.EngineLog(EngineLogType.Message, "     [" + overloadArgs + "]");
                        }
                        else
                        {
                            TackConsole.EngineLog(EngineLogType.Message, "     [No Args]");
                        }
                    }
                }

                return;
            }

            //TackConsole.EngineLog(EngineLogType.Message, "The TackCommand with call string '" + thisCommandData.GetCallString() + "' has no definition that takes " + args.Length + " arguments");
        }
Beispiel #21
0
        public Shader(string shaderName, TackShaderType type, string vertexSoure, string fragmentSource)
        {
            Name = shaderName;
            Type = type;

            TackConsole.EngineLog(Engine.EngineLogType.Message, "Starting compilation and linking of shader with name: " + Name);

            // Create shader program
            int shaderProgram = GL.CreateProgram();

            // Generate subshader ids
            int vertShaderId = CompileSubShader(vertexSoure, ShaderType.VertexShader);
            int fragShaderId = CompileSubShader(fragmentSource, ShaderType.FragmentShader);

            if (vertShaderId == -1 || fragShaderId == -1)
            {
                CompiledAndLinked = false;
                Id = -1;
                return;
            }

            // Link shaders to the shader program
            GL.AttachShader(shaderProgram, vertShaderId);
            GL.AttachShader(shaderProgram, fragShaderId);
            GL.LinkProgram(shaderProgram);

            GL.GetProgramInfoLog(shaderProgram, out string progLogStr);

            if (progLogStr != "")
            {
                TackConsole.EngineLog(Engine.EngineLogType.Error, progLogStr);
                Id = -1;
                CompiledAndLinked = false;
                return;
            }

            Uniforms = GetShaderUniformVars();

            TackConsole.EngineLog(Engine.EngineLogType.Message, "Successfully created shader program with Id: {0}. Name: \"{1}\". SupportsBatchRendering: {2}", Id, Name, SupportsBatchRendering);

            GL.DeleteShader(vertShaderId);
            GL.DeleteShader(fragShaderId);

            Id = shaderProgram;
            CompiledAndLinked = true;
        }
        /// <summary>
        /// Adds and AudioClip to the AudioManager
        /// </summary>
        /// <param name="_clip"></param>
        /// <param name="_debugMsgs"></param>
        internal static void AddAudioClip(AudioClip _clip, bool _debugMsgs = true)
        {
            if (ActiveInstance.mAudioClips.Contains(_clip))
            {
                if (_debugMsgs)
                {
                    TackConsole.EngineLog(EngineLogType.Error, string.Format("AudioManager cannot add AudioClip beause it is already in the list. AudioId=" + _clip.AudioId.ToString()));
                }
                return;
            }

            ActiveInstance.mAudioClips.Add(_clip);
            if (_debugMsgs)
            {
                TackConsole.EngineLog(EngineLogType.Message, string.Format("Added AudioClip to AudioManager. AudioId={0}", _clip.AudioId));
            }
        }
Beispiel #23
0
        public static int GetFontFamilyId(string familyName)
        {
            if (ActiveInstance == null)
            {
                return(0);
            }

            for (int i = 0; i < ActiveInstance.m_fontCollection.Families.Length; i++)
            {
                if (ActiveInstance.m_fontCollection.Families[i].Name == familyName)
                {
                    return(i);
                }
            }

            TackConsole.EngineLog(EngineLogType.Error, string.Format("No FontFamily with name: {0} was found in the font collection", familyName));
            return(-1);
        }
        /// <summary>
        /// Removes a clip from the AudioManager
        /// </summary>
        /// <param name="_clip"></param>
        /// <param name="_debugMsgs"></param>
        internal static void RemoveAudioClip(AudioClip _clip, bool _debugMsgs = true)
        {
            if (!ActiveInstance.mAudioClips.Contains(_clip))
            {
                if (_debugMsgs)
                {
                    TackConsole.EngineLog(EngineLogType.Error, string.Format("Trying to remove AudioClip with id '{0}' but it doesn't exist in AudioManager", _clip.AudioId));
                }
                return;
            }

            AL.DeleteBuffer(_clip.AudioId);
            ActiveInstance.mAudioClips.Remove(_clip);
            if (_debugMsgs)
            {
                TackConsole.EngineLog(EngineLogType.Message, string.Format("Removed AudioClip with id '{0}' from AudioManager", _clip.AudioId));
            }
        }
        public void OnStart()
        {
            Stopwatch timer = new Stopwatch();

            timer.Start();

            /*
             * mShaderProgramIds.Add("shaders.default_object_shader", ShaderFunctions.CompileAndLinkShaders(Properties.Resources.DefaultVertexShader, Properties.Resources.DefaultFragmentShader));
             * TackConsole.EngineLog(EngineLogType.Message, "Successfully registered shader with name 'shaders.default_object_shader'");
             * mShaderProgramIds.Add("shaders.default_gui_shader", ShaderFunctions.CompileAndLinkShaders(Properties.Resources.DefaultVertexShader, Properties.Resources.GUIFragmentShader));
             * TackConsole.EngineLog(EngineLogType.Message, "Successfully registered shader with name 'shaders.default_gui_shader'");
             */

            /*
             * m_defaultWorldShader = new Shader("shaders.default_world_shader", TackShaderType.World, System.IO.File.ReadAllText("tackresources/shaders/world/default_world_vertex_shader.vs"),
             *                                                                                      System.IO.File.ReadAllText("tackresources/shaders/world/default_world_fragment_shader.fs"));
             *
             */

            m_defaultWorldShader = new Shader("shaders.default_world_shader", TackShaderType.World, System.IO.File.ReadAllText("tackresources/shaders/world/default_world_vertex_shader.vs"),
                                              System.IO.File.ReadAllText("tackresources/shaders/world/default_world_fragment_shader.fs"));

            mVertexData       = new float[4];
            mRenderFpsCounter = false;

            m_guiInstance = new TackGUI();
            m_guiInstance.OnStart();

            m_fpsCounterTextArea = new GUITextArea()
            {
                Active      = true,
                Bounds      = new RectangleShape(5, 5, 50, 50),
                NormalStyle = new GUITextArea.GUITextAreaStyle()
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top,
                    FontSize            = 12f,
                    Colour = new Colour4b(0, 0, 0, 0)
                }
            };

            timer.Stop();
            TackConsole.EngineLog(EngineLogType.ModuleStart, "", timer.ElapsedMilliseconds);
        }
        public static void RemoveSprite(Sprite _sprite, bool _debugMsgs = true)
        {
            if (!loadedSprites.Contains(_sprite))
            {
                if (_debugMsgs)
                {
                    TackConsole.EngineLog(EngineLogType.Error, string.Format("Trying to remove Sprite with id '{0}' but it doesn't exist in SpriteManager", _sprite.Id));
                }
                return;
            }

            GL.DeleteTexture(_sprite.Id);
            loadedSprites.Remove(_sprite);

            if (_debugMsgs)
            {
                TackConsole.EngineLog(EngineLogType.Message, string.Format("Removed Sprite with id '{0}' from SpriteManager", _sprite.Id));
            }
        }
        public static void OnClose()
        {
            foreach (Sprite sp in loadedSprites)
            {
                GL.DeleteTexture(sp.Id);
                TackConsole.EngineLog(EngineLogType.Message, string.Format("Deleted (OpenGL) Sprite texture with id '{0}'", sp.Id));
            }

            loadedSprites.Clear();

            if (loadedSprites.Count == 0)
            {
                TackConsole.EngineLog(EngineLogType.Message, "Successfully deleted all Sprites from SpriteManager");
            }
            else
            {
                TackConsole.EngineLog(EngineLogType.Error, string.Format("Failed to delete all Sprites. Number left in SpriteManager: {0}", loadedSprites.Count));
            }
        }
        public static void TackObjectGetInfo(string[] args)
        {
            if (args.Length == 2)
            {
                // Try and get the TackObject by treating args[1] has a name
                TackObject calledObject = TackObject.Get(args[1]);

                // If there is no TackObject with name that is equal to args[1]
                //  - Treat args[1] as a hash and look for TackObject based on hash
                if (calledObject == null)
                {
                    calledObject = TackObject.GetUsingHash(args[1]);
                }

                // If there is no TackObject with name OR hash equal to args[1], return
                if (calledObject == null)
                {
                    TackConsole.EngineLog(EngineLogType.Error, "There is no TackObject that has name/hash with value: " + args[1]);
                    return;
                }

                TackConsole.EngineLog(EngineLogType.Message, "TackObject Info");
                TackConsole.EngineLog(EngineLogType.Message, "--------------------------------------");
                TackConsole.EngineLog(EngineLogType.Message, "Name: {0:-20}", calledObject.Name);
                TackConsole.EngineLog(EngineLogType.Message, "Hash: {0:-20}", calledObject.GetHash());
                TackConsole.EngineLog(EngineLogType.Message, "Position: {0:-20}", calledObject.Position.ToString());
                TackConsole.EngineLog(EngineLogType.Message, "Scale: {0:-20}", calledObject.Scale.ToString());
                TackConsole.EngineLog(EngineLogType.Message, "Rotation: {0:-20}", calledObject.Rotation);
                TackConsole.EngineLog(EngineLogType.Message, "Components ({0}):", calledObject.GetComponents().Length);

                TackComponent[] components = calledObject.GetComponents();

                foreach (TackComponent comp in components)
                {
                    TackConsole.EngineLog(EngineLogType.Message, "          - {0}", comp.GetType().Name);
                }

                return;
            }

            TackConsole.EngineLog(EngineLogType.Error, "Incorrect number of arguments for command: " + args[0]);
        }
        public static void ChangeBackgroundColour(string[] args)
        {
            if (args.Length == 1)
            {
                TackConsole.EngineLog(EngineLogType.Message, "Value: " + TackEngineLib.Renderer.TackRenderer.BackgroundColour.ToString());
                return;
            }

            if (args.Length == 4)
            {
                if (byte.TryParse(args[1], out byte r))
                {
                    if (byte.TryParse(args[2], out byte g))
                    {
                        if (byte.TryParse(args[3], out byte b))
                        {
                            TackEngineLib.Renderer.TackRenderer.BackgroundColour = new Colour4b(r, g, b);
                            TackConsole.EngineLog(EngineLogType.Message, "Set tackrenderer.backgroundColour to value: " + Renderer.TackRenderer.BackgroundColour.ToString());
                        }
                        else
                        {
                            TackConsole.EngineLog(EngineLogType.Error, "Failed to convert '{0}' to type: byte", args[3]);
                            return;
                        }
                    }
                    else
                    {
                        TackConsole.EngineLog(EngineLogType.Error, "Failed to convert '{0}' to type: byte", args[2]);
                        return;
                    }
                }
                else
                {
                    TackConsole.EngineLog(EngineLogType.Error, "Failed to convert '{0}' to type: byte", args[1]);
                    return;
                }
                return;
            }

            TackConsole.EngineLog(EngineLogType.Error, "Incorrect number of arguments for command: " + args[0]);
        }
        public void OnClose()
        {
            foreach (AudioClip clip in mAudioClips)
            {
                int id = clip.AudioId;
                AL.DeleteBuffer(clip.AudioId);
                TackConsole.EngineLog(EngineLogType.Message, string.Format("Deleted AudioClip from AudioManager. AudioId={0}", id));
            }

            mAudioClips.Clear();

            if (mAudioClips.Count == 0)
            {
                TackConsole.EngineLog(EngineLogType.Message, "Successfully removed all AudioClips from AudioManager");
            }

            TackConsole.EngineLog(EngineLogType.Message, "Closing this instance of AudioManager");

            mAudioContext.Dispose();
            mAudioContext = null;
        }