예제 #1
0
파일: Cmd.cs 프로젝트: optimus-code/Q2Sharp
        public static void AddCommand(String cmd_name, xcommand_t function)
        {
            cmd_function_t cmd;

            if ((Cvar.VariableString(cmd_name)).Length > 0)
            {
                Com.Printf("Cmd_AddCommand: " + cmd_name + " already defined as a var\\n");
                return;
            }

            for (cmd = cmd_functions; cmd != null; cmd = cmd.next)
            {
                if (cmd_name.Equals(cmd.name))
                {
                    Com.Printf("Cmd_AddCommand: " + cmd_name + " already defined\\n");
                    return;
                }
            }

            cmd           = new cmd_function_t();
            cmd.name      = cmd_name;
            cmd.function  = function;
            cmd.next      = cmd_functions;
            cmd_functions = cmd;
        }
예제 #2
0
        public virtual void Shutdown()
        {
            if (oldDisplayMode != null)
            {
                try
                {
                    if (window.IsFullscreen)
                    {
                        unsafe
                        {
                            GLFW.SetWindowSize(window.WindowPtr, oldDisplayMode.Value.Width, oldDisplayMode.Value.Height);
                        }
                    }
                    window.WindowState = WindowState.Normal;
                }
                catch (Exception e)
                {
                    e.PrintStackTrace();
                }
            }

            if (window != null)
            {
                window.Dispose();
            }

            post_init = false;
            callback  = INIT_CALLBACK;
        }
예제 #3
0
        /*
         * ============
         * Cmd_AddCommand
         * ============
         */
        public static void      Cmd_AddCommand(string cmd_name, xcommand_t function)
        {
            cmd_function_t cmd;

            if (host.host_initialized)          // because hunk allocation would get stomped
            {
                sys_linux.Sys_Error("Cmd_AddCommand after host_initialized");
            }

            // fail if the command is a variable name
            if (cvar_t.Cvar_VariableString(cmd_name).Length != 0)
            {
                console.Con_Printf("Cmd_AddCommand: " + cmd_name + " already defined as a var\n");
                return;
            }

            // fail if the command already exists
            for (cmd = cmd_functions; cmd != null; cmd = cmd.next)
            {
                if (cmd_name.CompareTo(cmd.name) == 0)
                {
                    console.Con_Printf("Cmd_AddCommand: " + cmd_name + " already defined\n");
                    return;
                }
            }

            cmd           = new cmd_function_t();
            cmd.name      = cmd_name;
            cmd.function  = function;
            cmd.next      = cmd_functions;
            cmd_functions = cmd;
        }
예제 #4
0
    /*
     * ============
     * Cmd_AddCommand
     * ============
     */
    static void Cmd_AddCommand(string cmd_name, xcommand_t function)
    {
        // fail if the command already exists
        foreach (cmd_function_t cmd in cmd_functions)
        {
            if (cmd.name == cmd_name)
            {
                if (function != null)
                {
                    Com_Printf("Cmd_AddCommand: %s already defined\n", cmd_name);
                }

                return;
            }
        }

        cmd_function_t newcmd = new cmd_function_t();

        newcmd.name     = cmd_name;
        newcmd.function = function;

        cmd_functions.Add(newcmd);
    }
예제 #5
0
        // void	Cmd_ExecuteString (char *text, cmd_source_t src);
        // Parses a single line of text into arguments and tries to execute it.
        // The text can come from the command buffer, a remote client, or stdin.
        //
        // A complete command line has been parsed, so try to execute it
        // FIXME: lookupnoadd the token to speed search?
        public static void ExecuteString(string text, cmd_source_t src)
        {
            _Source = src;

            TokenizeString(text);

            // execute the command line
            if (_Argc <= 0)
            {
                return;     // no tokens
            }

            // check functions
            xcommand_t handler = Find(_Argv[0]); // must search with comparison like Q_strcasecmp()

            if (handler != null)
            {
                handler();
            }
            else
            {
                // check alias
                string alias = FindAlias(_Argv[0]); // must search with compare func like Q_strcasecmp
                if (!String.IsNullOrEmpty(alias))
                {
                    Cbuf.InsertText(alias);
                }
                else
                {
                    // check cvars
                    if (!Cvar.Command())
                    {
                        Con.Print("Unknown command \"{0}\"\n", _Argv[0]);
                    }
                }
            }
        }
예제 #6
0
        // Cmd_AddCommand()
        // called by the init functions of other parts of the program to
        // register commands and functions to call for them.
        public static void Add(string name, xcommand_t function)
        {
            // ??? because hunk allocation would get stomped
            if (Host.IsInitialized)
            {
                Sys.Error("Cmd.Add after host initialized!");
            }

            // fail if the command is a variable name
            if (Cvar.Exists(name))
            {
                Con.Print("Cmd.Add: {0} already defined as a var!\n", name);
                return;
            }

            // fail if the command already exists
            if (Exists(name))
            {
                Con.Print("Cmd.Add: {0} already defined!\n", name);
                return;
            }

            _Functions.Add(name, function);
        }
예제 #7
0
 public virtual void UpdateScreen(xcommand_t callback)
 {
     callback.Execute();
 }
예제 #8
0
 public virtual void UpdateScreen(xcommand_t callback)
 {
     this.callback = callback;
     //window.Display();
 }
예제 #9
0
 public virtual void UpdateScreen()
 {
     this.callback = INIT_CALLBACK;
     //window.Display();
 }
예제 #10
0
 public JoglDriver( )
 {
     INIT_CALLBACK = new Anonymousxcommand_t(this);
 }
예제 #11
0
        // Cmd_AddCommand()
        // called by the init functions of other parts of the program to
        // register commands and functions to call for them.
        public static void Add(string name, xcommand_t function)
        {
            // ??? because hunk allocation would get stomped
            if (Host.IsInitialized)
                Sys.Error("Cmd.Add after host initialized!");

            // fail if the command is a variable name
            if (Cvar.Exists(name))
            {
                Con.Print("Cmd.Add: {0} already defined as a var!\n", name);
                return;
            }

            // fail if the command already exists
            if (Exists(name))
            {
                Con.Print("Cmd.Add: {0} already defined!\n", name);
                return;
            }

            _Functions.Add(name, function);
        }
예제 #12
0
        /*
        ============
        Cmd_AddCommand
        ============
        */
        public static void Cmd_AddCommand(string cmd_name, xcommand_t function)
        {
            cmd_function_t	cmd;

            if (host.host_initialized)	// because hunk allocation would get stomped
                sys_linux.Sys_Error ("Cmd_AddCommand after host_initialized");

            // fail if the command is a variable name
            if (cvar_t.Cvar_VariableString(cmd_name).Length != 0)
            {
                console.Con_Printf("Cmd_AddCommand: " + cmd_name + " already defined as a var\n");
                return;
            }

            // fail if the command already exists
            for (cmd=cmd_functions ; cmd != null ; cmd=cmd.next)
            {
                if (cmd_name.CompareTo(cmd.name) == 0)
                {
                    console.Con_Printf ("Cmd_AddCommand: " + cmd_name + " already defined\n");
                    return;
                }
            }

            cmd = new cmd_function_t();
            cmd.name = cmd_name;
            cmd.function = function;
            cmd.next = cmd_functions;
            cmd_functions = cmd;
        }