00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00060 }
00061
00062
00064 void ActionManager::quit(){
00065 exit( 0 );
00066 }
00067
00068
00069 #if 0
00070
00071 void ActionManager::displayExtensions(){
00072
00073
00074
00075
00076
00077 char *start;
00078 char *i;
00079 start = i = root->getUserInterface()->getView()->getExtensions();
00080 while( *i != '\0' ){
00081 if( *i==' ' ){
00082 *i = '\0';
00083
00084 start = ++i;
00085 continue;
00086 }
00087 i++;
00088 }
00089 int width = 0;
00090 int height = 0;
00091
00092
00093
00094
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
00117 root->getUserInterface()->getActiveProjection()->getMaster()->setMode( RENDER_MODE_POINT );
00118 }
00119
00120
00121 void ActionManager::renderModeLine(){
00122
00123 root->getUserInterface()->getActiveProjection()->getMaster()->setMode( RENDER_MODE_LINE );
00124 }
00125
00126
00127 void ActionManager::renderModeFill(){
00128
00129 root->getUserInterface()->getActiveProjection()->getMaster()->setMode( RENDER_MODE_FILL );
00130 }
00131
00132
00133 void ActionManager::renderModeFillOutline(){
00134
00135 root->getUserInterface()->getActiveProjection()->getMaster()->setMode( RENDER_MODE_FILL_OUTLINE );
00136 }
00137
00138
00139 void ActionManager::cullFaceEnable(){
00140
00141 root->getUserInterface()->getActiveProjection()->getMaster()->enableOptions( RENDER_OPTION_CULL_FACE_M );
00142 }
00143
00144
00145 void ActionManager::cullFaceDisable(){
00146
00147 root->getUserInterface()->getActiveProjection()->getMaster()->disableOptions( RENDER_OPTION_CULL_FACE_M );
00148 }
00149
00150
00151 void ActionManager::depthTestEnable(){
00152
00153 root->getUserInterface()->getActiveProjection()->getMaster()->enableOptions( RENDER_OPTION_DEPTH_TEST_M );
00154 }
00155
00156
00157 void ActionManager::depthTestDisable(){
00158
00159 root->getUserInterface()->getActiveProjection()->getMaster()->disableOptions( RENDER_OPTION_DEPTH_TEST_M );
00160 }
00161
00162
00163 void ActionManager::lightingOn(){
00164
00165 root->getUserInterface()->getActiveProjection()->getMaster()->setLighting( RENDER_LIGHTING_SIMPLE );
00166 }
00167
00168
00169 void ActionManager::lightingOff(){
00170
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
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
00188 root->getUserInterface()->getActiveProjection()->getCamera()->setFov( fov );
00189 }
00190 }
00191
00192
00193 void ActionManager::antialiseOn(){
00194
00195 root->getUserInterface()->getActiveProjection()->enableOptions( RENDER_OPTION_LINE_SMOOTH_M );
00196 }
00197
00198
00199 void ActionManager::antialiseOff(){
00200
00201 root->getUserInterface()->getActiveProjection()->disableOptions( RENDER_OPTION_LINE_SMOOTH_M );
00202 }
00203
00204
00205 };
00206 };
00207