x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
BilliardsGameScene.cpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\GameFactory\C2Template\BilliardsGameScene.cpp
Girar
Efecto
Propiedad
Historial
#include "BilliardsGameScene.h" #include "EntitySelector.h" //#include "..\SkinnedEntity.h" #include "Ball.h" #include "CueBall.h" //#include "ScriptEngine.h" //#include "luabind/luabind.hpp" BilliardsGameScene::BilliardsGameScene(const String& resourceName, SceneManager* pSceneManager, RenderWindow* renderWindow, Camera* camera, NxPhysicsSDK* pPhysicSDK, NxScene* pPhysicScene): GameScene(resourceName,pSceneManager,renderWindow,camera,pPhysicSDK,pPhysicScene){ CueBall* theCueBall = new CueBall(); theCueBall->SetPosition(Vec3(2,0,3)); for (int x=-1;x<=1;x++) for (int y=-1;y<=1;y++){ Ball* ball = new Ball(); ball->SetPosition(Vec3(-2,0,3)+Vec3(x*1.2f,y*1.2f,0)); } CueController* cueController = new CueController(); } BilliardsGameScene::~BilliardsGameScene(){ } CueController::CueController(){} CueController::~CueController(){} void CueController::FrameMove(Real elapsedTime, RMouse* mouse, RKeyboard* keyboard){ static bool mouseLeftIsDown = false; if (mouse->IsButtonDown(OIS::MouseButtonID::MB_Left)){//fire the ball if (!mouseLeftIsDown){ //this is a click Vec3 from, direction; GameScene::GetSingleton()->_GetRayCameraToViewport(Vec3(mouse->GetX(),mouse->GetY(),0.0f),from,direction); Vec3 hitPos; PhysicalEventHandler* object = GameScene::GetSingleton()->RayCastClosest(from,direction,&hitPos); if (object!=NULL){ CueBall::GetSingleton()->MoveTo(hitPos); } } mouseLeftIsDown = true; }else{ mouseLeftIsDown = false; } static bool spaceDown = false; if (keyboard->IsKeyDown(OIS::KeyCode::KC_SPACE)){//reset the cue ball if (!spaceDown){ CueBall::GetSingleton()->SetPosition(Vec3(2,0,3)); spaceDown = true; } }else{ spaceDown = false; } static bool _1Down = false; if (keyboard->IsKeyDown(OIS::KeyCode::KC_1)){//spawn more ball if (!_1Down){ Vec3 from, direction; GameScene::GetSingleton()->_GetRayCameraToViewport(Vec3(mouse->GetX(),mouse->GetY(),0.0f),from,direction); Vec3 hitPos; PhysicalEventHandler* object = GameScene::GetSingleton()->RayCastClosest(from,direction,&hitPos); if (object!=NULL){//hit Ball* ball = new Ball(); ball->SetPosition(hitPos+Vec3(0,0,1)); } _1Down = true; } }else{ _1Down = false; } }
BilliardsGameScene.cpp
Dirección de la página
Dirección del archivo
Anterior
3/19
Siguiente
Descargar
( 2 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.