[Opal-commits] opal/samples/playpen main.cpp,NONE,1.1 playpen.sln,NONE,1.1 playpen.vcproj,NONE,1.1
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:26:33
|
Update of /cvsroot/opal/opal/samples/playpen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/samples/playpen Added Files: main.cpp playpen.sln playpen.vcproj Log Message: implemented InclineSensor; added code for Ogre sample apps --- NEW FILE: main.cpp --- #include <time.h> #include "../src/BaseOpalApp.h" namespace playpen { class PlaypenApp : public BaseOpalApp { public: PlaypenApp() : BaseOpalApp() { mUseShadows = true; } ~PlaypenApp() {} protected: virtual void createScene() { // Setup shadows. if (mUseShadows) { mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); } else { mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); } // Set the ambient light level. mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); // Create a light source. Ogre::Light* light = mSceneMgr->createLight("light0"); light->setType(Ogre::Light::LT_POINT); light->setPosition(-80.0, 30.0, -10.0); // Load models, create physical objects, etc. here. } virtual bool appFrameStarted(opal::real dt) { // Do per-frame application specific things here. // Return true to continue looping. return true; } virtual bool processUnbufferedKeyInput(Ogre::Real dt) { // Check if we should quit looping. if(mInputDevice->isKeyDown(KC_ESCAPE) || mInputDevice->isKeyDown(KC_Q)) { return false; } // The following code can be used to update a camera's position. if (mInputDevice->isKeyDown(KC_LEFT)) { // Move camera left. } else if (mInputDevice->isKeyDown(KC_RIGHT)) { // Move camera right. } else if (mInputDevice->isKeyDown(KC_UP)) { // Move camera forward. } else if (mInputDevice->isKeyDown(KC_DOWN)) { // Move camera backward. } else { // Stop camera motion if necessary. } // Toggle shadows. if( mInputDevice->isKeyDown(KC_S)) { mUseShadows = !mUseShadows; if (mUseShadows) { mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); } else { mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); } // Set this to keep from handling the key press // continually while it is down. mTimeUntilNextToggle = 0.5; } // Toggle HUD. if (mInputDevice->isKeyDown(KC_H) && mTimeUntilNextToggle <= 0) { mStatsOn = !mStatsOn; showDebugOverlay(mStatsOn); mTimeUntilNextToggle = 1; } // Handy screenshot saving procedure. if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0) { char tmp[20]; sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots); ExampleApplication::mWindow->writeContentsToFile(tmp); ExampleApplication::mWindow->setDebugText(String("Wrote ") + tmp); // Set this to keep from handling the key press // continually while it is down. mTimeUntilNextToggle = 0.5; } // Return true to continue looping. return true; } virtual bool processUnbufferedMouseInput(Ogre::Real dt) { // The following code checks the mouse button state. if (true == mInputDevice->getMouseButton(0)) { // The left mouse button is down. } else { // The left mouse button is up. } // The following code checks how far the mouse has move since // the last poll. This data can be used to rotate the camera // around its X and Y axes (yaw and pitch, respectively). Ogre::Real rotX = -mInputDevice->getMouseRelativeX(); Ogre::Real rotY = -mInputDevice->getMouseRelativeY(); // Return true to continue looping. return true; } private: /// Used to toggle shadows on and off. bool mUseShadows; }; } int main(int argc, char **argv) { srand(time(NULL)); SET_TERM_HANDLER; playpen::PlaypenApp app; try { app.go(); } catch(Ogre::Exception& e) { std::cerr << "An exception has occured: " << e.getFullDescription().c_str() << std::endl; } return 0; } --- NEW FILE: playpen.sln --- Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "playpen", "playpen.vcproj", "{79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}.Debug.ActiveCfg = Debug|Win32 {79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}.Debug.Build.0 = Debug|Win32 {79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}.Release.ActiveCfg = Release|Win32 {79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal --- NEW FILE: playpen.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="playpen" ProjectGUID="{79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="ogremain_d.lib opal-ode_d.lib" OutputFile="$(OutDir)/playpen.exe" LinkIncremental="2" AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/playpen.pdb" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" GlobalOptimizations="TRUE" InlineFunctionExpansion="2" FavorSizeOrSpeed="1" AdditionalIncludeDirectories="" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="ogremain.lib opal-ode.lib" OutputFile="$(OutDir)/playpen.exe" LinkIncremental="1" AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> <File RelativePath=".\main.cpp"> </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> |