Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ActionManager.cpp

Go to the documentation of this file.
00001 
00002 /*
00003     TSGL - Teddy Space Game Library
00004     Copyright (C) 2002 Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021     $Id: ActionManager.cpp,v 1.1 2002/01/08 20:47:04 tksuoran Exp $
00022 */
00023 
00024 
00025 #include "config.h"
00026 #include "Teddy/SpaceGame/ActionManager.h"
00027 #include "Teddy/SpaceGame/PlayerShip.h"
00028 #include "Teddy/SpaceGame/FrontCamera.h"
00029 #include "Teddy/SpaceGame/Hud.h"
00030 #include "Teddy/SpaceGame/Root.h"
00031 #include "Teddy/SpaceGame/Scanner.h"
00032 #include "Teddy/SpaceGame/Sight.h"
00033 #include "Teddy/SpaceGame/ShipCamera.h"
00034 #include "Teddy/Graphics/Features.h"
00035 #include "Teddy/Graphics/View.h"
00036 #include "Teddy/Materials/Material.h"
00037 #include "Teddy/Models/Mesh.h"
00038 #include "Teddy/PhysicalComponents/Layer.h"
00039 #include "Teddy/Scenes/Camera.h"
00040 #include "Teddy/Scenes/Scene.h"
00041 #include "Teddy/SysSupport/Messages.h"
00042 using namespace Teddy::Materials;
00043 using namespace Teddy::Scenes;
00044 
00045 
00046 namespace Teddy     {
00047 namespace SpaceGame {
00048 
00049 
00050 #define TRANSLATE_SCALE   1.0f
00051 #define ROTATE_SCALE      0.3f
00052 #define distance_delta    0.01f
00053 #define SCALE            1.00f
00054 
00055 
00057 ActionManager::ActionManager( Root *root ){
00058     this->root = root;
00059 //isplayHelp();
00060 }
00061 
00062 
00064 void ActionManager::quit(){
00065     exit( 0 );
00066 }
00067 
00068 
00069 #if 0
00070 
00071 void ActionManager::displayExtensions(){
00072 /*  con << ": OpenGL driver information:" << endl;
00073     con << ": " << view->getVendor  () << endl;
00074     con << ": " << view->getRenderer() << endl;
00075     con << ": " << view->getVersion () << endl;
00076     con << ": OpenGL extensions:" << endl;*/
00077     char *start;
00078     char *i;
00079     start = i = root->getUserInterface()->getView()->getExtensions();
00080     while( *i != '\0' ){
00081         if( *i==' ' ){
00082             *i = '\0';
00083 //          con << ": " << start << endl;
00084             start = ++i;
00085             continue;
00086         }
00087         i++;
00088     }
00089     int width  = 0;
00090     int height = 0;
00091 //  view->getMaxViewportDims( width, height );
00092 /*  con << ": Maximum texture size:  " << view->getMaxTextureSize() << endl;
00093     con << ": Maximum lights:        " << view->getMaxLights     () << endl;
00094     con << ": Maximum viewport dims: " << width << " x " << height  << endl;
00095 */
00096 }
00097 #endif
00098 
00099 
00101 void ActionManager::scannerCycle(){
00102     root->getUserInterface()->getScanner()->cycle();
00103 }
00104 
00105 
00106 void ActionManager::blendOff(){
00107     root->getUserInterface()->getView()->disable( BLEND );
00108 }
00109 
00110 void ActionManager::blendOn(){
00111     root->getUserInterface()->getView()->enable( BLEND );
00112 }
00113 
00114 
00115 void ActionManager::renderModePoint(){
00116     //con << ": Polygon Mode Point" << endl;
00117     root->getUserInterface()->getActiveProjection()->getMaster()->setMode( RENDER_MODE_POINT );
00118 }
00119 
00120 
00121 void ActionManager::renderModeLine(){
00122     //con << ": Polygon Mode Line" << endl;
00123     root->getUserInterface()->getActiveProjection()->getMaster()->setMode( RENDER_MODE_LINE );
00124 }
00125 
00126 
00127 void ActionManager::renderModeFill(){
00128     //con << ": Polygon Mode Fill" << endl;
00129     root->getUserInterface()->getActiveProjection()->getMaster()->setMode( RENDER_MODE_FILL );
00130 }
00131 
00132 
00133 void ActionManager::renderModeFillOutline(){
00134     //con << ": Polygon Mode Fill Outline" << endl;
00135     root->getUserInterface()->getActiveProjection()->getMaster()->setMode( RENDER_MODE_FILL_OUTLINE );
00136 }
00137 
00138 
00139 void ActionManager::cullFaceEnable(){
00140     //con << ": Master Face Culling Enabled" << endl;
00141     root->getUserInterface()->getActiveProjection()->getMaster()->enableOptions( RENDER_OPTION_CULL_FACE_M );
00142 }
00143 
00144 
00145 void ActionManager::cullFaceDisable(){
00146     //con << ": Master Face Culling Disabled" << endl;
00147     root->getUserInterface()->getActiveProjection()->getMaster()->disableOptions( RENDER_OPTION_CULL_FACE_M );
00148 }
00149 
00150 
00151 void ActionManager::depthTestEnable(){
00152     //con << ": Master Depth Test Enabled" << endl;
00153     root->getUserInterface()->getActiveProjection()->getMaster()->enableOptions( RENDER_OPTION_DEPTH_TEST_M );
00154 }
00155 
00156 
00157 void ActionManager::depthTestDisable(){
00158     //con << ": Master Depth Test Disabled" << endl;
00159     root->getUserInterface()->getActiveProjection()->getMaster()->disableOptions( RENDER_OPTION_DEPTH_TEST_M );
00160 }
00161 
00162 
00163 void ActionManager::lightingOn(){
00164 //  con << ": Master Lighting Enabled (simple)" << endl;
00165     root->getUserInterface()->getActiveProjection()->getMaster()->setLighting( RENDER_LIGHTING_SIMPLE );
00166 }
00167 
00168 
00169 void ActionManager::lightingOff(){
00170 //  con << ": Master Lighting Disabled (color)" << endl;
00171     root->getUserInterface()->getActiveProjection()->getMaster()->setLighting( RENDER_LIGHTING_COLOR );
00172 }
00173 
00174 
00175 void ActionManager::fovNormal(){
00176     float fov = root->getUserInterface()->getActiveProjection()->getCamera()->getFov() - 5;
00177     if( fov > 0 ){
00178 //      con << ": Field of Vision " << fov << " degrees" << endl;
00179         root->getUserInterface()->getActiveProjection()->getCamera()->setFov( fov );
00180     }
00181 }
00182 
00183 
00184 void ActionManager::fovWide(){
00185     float fov = root->getUserInterface()->getActiveProjection()->getCamera()->getFov() + 5;
00186     if( fov < 180 ){
00187 //      con << ": Field of Vision " << fov << " degrees" << endl;
00188         root->getUserInterface()->getActiveProjection()->getCamera()->setFov( fov );
00189     }
00190 }
00191 
00192 
00193 void ActionManager::antialiseOn(){
00194 //  con << ": Line Smooth Hint Nicest" << endl;
00195     root->getUserInterface()->getActiveProjection()->enableOptions( RENDER_OPTION_LINE_SMOOTH_M );
00196 }
00197 
00198 
00199 void ActionManager::antialiseOff(){
00200 //  con << ": Line Smooth Hint Fastest" << endl;
00201     root->getUserInterface()->getActiveProjection()->disableOptions( RENDER_OPTION_LINE_SMOOTH_M );
00202 }
00203 
00204 
00205 };  //  namespace SpaceGame
00206 };  //  namespace Teddy
00207