diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-03 01:43:03 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-03 01:43:03 +0000 |
commit | b4973888aeaea2dde6058bc06c3f6631349e7f3c (patch) | |
tree | 010de10692b330d7634ad3090fb94d14c101f484 /src/core/applicationinterface.cc | |
parent | 67f8a7a783e550cab8e6a77d997b31815ee8cd7e (diff) |
command buffer handling
engine function parsing
buffered client console
Diffstat (limited to 'src/core/applicationinterface.cc')
-rw-r--r-- | src/core/applicationinterface.cc | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/core/applicationinterface.cc b/src/core/applicationinterface.cc index 209a4f5..9a2cce2 100644 --- a/src/core/applicationinterface.cc +++ b/src/core/applicationinterface.cc @@ -14,6 +14,17 @@ namespace core { +// --------------- function repository ------------------------------ +extern "C" void func_print(std::stringstream &args) { + char text[MAXCMDSIZE]; + if(args.getline(text, MAXCMDSIZE)) + con_print << args << std::endl; +} + +extern "C" void func_help(std::stringstream &args) { + con_print << "This is the help function" << std::endl; +} + // --------------- signal_handler ----------------------------------- extern "C" void signal_handler(int signum) { @@ -71,10 +82,14 @@ void ApplicationInterface::init() con_debug << "Initializing core..." << std::endl; + // register our functions + func::add("print", func_print); + func::add("help", func_help); + if (game()) game()->init(); else - con_warn << "No game module found!" << std::endl; + con_warn << "No game module loaded!" << std::endl; } @@ -85,7 +100,7 @@ void ApplicationInterface::shutdown() if (game()) game()->shutdown(); else - con_warn << "No game module found!" << std::endl; + con_warn << "No game module loaded!" << std::endl; filesystem::shutdown(); } @@ -97,8 +112,12 @@ void ApplicationInterface::quit(int status) void ApplicationInterface::frame(float seconds) { - if (game()) + if (game()) { game()->frame(seconds); + } + + // execute commands in the buffer + commandbuffer::execute(); } } |