axiosengine 

AxiosCommandConsole


Info about Axios Command Console

AxiosCommandConsole

AxiosCommandConsole is a sample class to make XNACC easy to use with Axios.

Windows

The CommandConsole won't work on WP7/Xbox 360 (currently, this may change in the future) and thus require #if WINDOWS if you are developing crossplatform games. The following is an example of how to get it into your game.

Sample code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#if WINDOWS
    class GameConsole : AxiosCommandConsole
    {
        public static void attachConsole(AxiosGameScreen gs)
        {
            GameConsole c;
            c = Cache.Instance.get<GameConsole>("commandconsole");
            if (c == null)
            {
                c = new GameConsole(gs);
                c.KeepRunning = true;
                Cache.Instance.set("commandconsole", c);
                gs.AddGameObject(c);
            }
            else
            {
                gs.Console = c;
                c.GameScreen = gs;
            }
        }
        public GameConsole(AxiosGameScreen gameScreen)
            : base(gameScreen)
        {
            //LoadDefault();
            PreCommandExecutedEvent += new EventHandler<CommandConsoleEventArgs>(GameConsole_PreCommandExecutedEvent);
        }
 
        void GameConsole_PreCommandExecutedEvent(object sender, XNACC.Console.CommandConsoleBase.CommandConsoleEventArgs e)
        {
            Console.WriteLine(e.CmdLine.ToString());
        }
 
        protected override void LoadContent()
        {
            LoadDefault();
            base.LoadContent();
        }
 
    }
#endif

Inside of your activate method use the following code too attach to that screen:

1
2
3
#if WINDOWS
            GameConsole.attachConsole(this);
#endif

Restricting commands

Inside of the constructor add whatever commands you want to remove to the RestrictedCommands list. Example:

1
2
3
4
5
public GameConsole(AxiosGameScreen gameScreen)
    : base(gameScreen)
{
    RestrictedCommands.AddRange(new string[] {"help"});
}

Created: 10 years 22 days ago
by Natalie Adams

Updated: 10 years 5 days ago
by Natalie Adams

Old Revisions

Page rendered in 0.07759s using 124 queries.