コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }