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); }
internal TackConsole() { // Set the static instance ActiveInstance = this; m_logPath = string.Format("logs/log_{0}_{1}_{2}.txt", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year); if (!Directory.Exists(Directory.GetCurrentDirectory() + "/logs")) { Directory.CreateDirectory(Directory.GetCurrentDirectory() + "/logs"); } mInputFieldStyle = new InputFieldStyle(); mInputFieldStyle.BackgroundColour = new Colour4b(100, 100, 100, 190); mInputFieldStyle.FontColour = new Colour4b(0, 0, 0, 255); mInputFieldStyle.SpriteTexture = Sprite.DefaultSprite; mInputFieldStyle.FontSize = 10f; mInputFieldStyle.VerticalAlignment = VerticalAlignment.Middle; mInputFieldStyle.FontFamilyId = 0; //TackGUI.LoadFontFromFile(Environment.GetFolderPath(Environment.SpecialFolder.Fonts) + "\\cour.ttf"); mInputFieldStyle.Scrollable = false; mActivationKey = KeyboardKey.Tilde; mConsoleUIStyle = new TextAreaStyle() { BackgroundColour = new Colour4b(0, 0, 0, 190), FontColour = new Colour4b(0, 255, 0, 255), FontFamilyId = TackGUI.GetFontFamilyId("Courier New"), FontSize = 10f, VerticalAlignment = VerticalAlignment.Top, ScrollPosition = 0, Scrollable = true }; mCaretBoxStyle = new BoxStyle() { Colour = new Colour4b(255, 0, 0, 255), }; mConsoleInputField = null; mConsoleTextArea = null; mConsoleGUIActive = true; }
internal void OnUpdate() { if (mConsoleTextArea == null) { mConsoleTextArea = new GUITextArea() { Bounds = new RectangleShape(5, 5, TackEngine.ScreenWidth - 10, 400), NormalStyle = new GUITextArea.GUITextAreaStyle() { Colour = new Colour4b(0, 0, 0, 255), Texture = Sprite.DefaultSprite, FontColour = new Colour4b(0, 255, 0, 255), FontSize = 9f, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left }, HoverStyle = new GUITextArea.GUITextAreaStyle() { Colour = new Colour4b(0, 0, 0, 255), Texture = Sprite.DefaultSprite, FontColour = new Colour4b(0, 255, 0, 255), FontSize = 9f, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left }, Text = "", Active = true }; } if (mConsoleInputField == null) { mConsoleInputField = new GUIInputField() { Bounds = new RectangleShape(5, 415, TackEngine.ScreenWidth - 10, 25), Text = "", Active = true }; mConsoleInputField.OnSubmit += ProcessCommand; } mConsoleTextArea.Active = mConsoleGUIActive; mConsoleInputField.Active = mConsoleGUIActive; mConsoleTextArea.Bounds = new RectangleShape(5, 5, TackEngine.ScreenWidth - 10, 400); mConsoleInputField.Bounds = new RectangleShape(5, 410, TackEngine.ScreenWidth - 10, 25); // Check to see if user wants to display the TackConsole GUI if (TackInput.InputActiveKeyDown(mActivationKey)) { mConsoleGUIActive = !mConsoleGUIActive; } if (TackInput.KeyDown(KeyboardKey.PageDown)) { if (mConsoleUIStyle.ScrollPosition < mMessages.Count - 1) { mConsoleUIStyle.ScrollPosition += 1.0f; } } if (TackInput.KeyDown(KeyboardKey.PageUp)) { if (mConsoleUIStyle.ScrollPosition > 0) { mConsoleUIStyle.ScrollPosition -= 1.0f; } } //mInputString = mInputField.InputString; }