00001 // ===================================================================================== 00002 // Filename: ContextActor.cpp 00003 // Description: 00004 // Version: 1.0 00005 // Created: 03/30/2007 10:02:24 PM EDT 00006 // Revision: none 00007 // Compiler: gcc 3.4.6 00008 // 00009 // Author: John P. Feltz 00010 // Email: jfeltz@gmail.com 00011 // License: Copyright (c) 2006-2007, John P. Feltz 00012 // This program is free software; you can redistribute it and/or 00013 // modify it under the terms of the GNU General Public License as 00014 // published by the Free Software Foundation, version 2 of the 00015 // License. 00016 // This program is distributed in the hope that it will be 00017 // useful, but WITHOUT ANY WARRANTY; without even the implied 00018 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00019 // PURPOSE. 00020 // See the GNU General Public License version 2 for more details. 00021 // 00022 // ===================================================================================== 00023 00024 #include <System.h> 00025 #include <InputSequencer.h> 00026 #include <InputNode.h> 00027 #include <InputContext.h> 00028 #include <ContextActor.h> 00029 00030 namespace cmil { 00031 ContextActor::ContextActor(System* const sys) : m_quit(false), m_context(new defaultContext(sys)) {}; 00032 00033 std::string ContextActor::getName() const { 00034 return "ContextActor"; 00035 }; 00036 00037 InputContext* ContextActor::getContext() { 00038 return m_context; 00039 }; 00040 00041 void ContextActor::setContext(InputContext* const context) { 00042 if(context) 00043 m_context = context; 00044 else 00045 log_error("setContext() attemptted to assign null context"); 00046 }; 00047 00048 void ContextActor::quit() { 00049 m_quit = true; 00050 }; 00051 00052 bool ContextActor::getQuit() const { 00053 return m_quit; 00054 }; 00055 00057 void ContextActor::captureNormal( ModAction* action ) { 00058 m_context->captureNormal(action); 00059 }; 00060 00061 Ev::Sequence* ContextActor::getCaptured() const { 00062 return m_context->getCaptured(); 00063 }; 00064 00065 bool ContextActor::addCombo(const Ev& event) { 00066 return m_context->addCombo(event); 00067 }; 00068 00069 bool ContextActor::addNormal(const Ev& event) { 00070 return m_context->addNormal(event); 00071 }; 00072 00073 bool ContextActor::removeNormal(const Ev& event) { 00074 return m_context->removeNormal(event); 00075 }; 00076 00077 void ContextActor::update(const InputData& input) { 00078 m_context->update(input); 00079 }; 00080 00081 void ContextActor::update(const ModData& input) { 00082 m_context->update(input); 00083 }; 00084 }