x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
BilliardsGameScene.cpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\GameFactory\C2Template\BilliardsGameScene.cpp
旋转
特效
属性
历史版本
#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
网页地址
文件地址
上一页
3/19
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.