Paddle::Paddle(const b2Vec2 &position, std::shared_ptr<Walls> walls) : Entity("Paddle", Type::PADDLE), _body(nullptr), _fixture(nullptr) { // First, create the body itself b2BodyDef bodyDef; bodyDef.position = position; bodyDef.linearDamping = 4; bodyDef.type = b2_dynamicBody; bodyDef.userData = this; _body = Physics::createBody(bodyDef); // Now create the body fixture b2PolygonShape box; box.SetAsBox(DIMENSIONS.x / 2, DIMENSIONS.y / 2); b2FixtureDef fixtureDef; fixtureDef.shape = &box; fixtureDef.density = 1; fixtureDef.friction = 0.05; fixtureDef.restitution = 0; fixtureDef.filter.categoryBits = getType(); fixtureDef.filter.maskBits = Type::BARRIER | Type::BALL | Type::CURSOR; _fixture = _body->CreateFixture(&fixtureDef); // Set up a prismatic joint to restrict movement b2PrismaticJointDef jointDef; jointDef.Initialize(_body, walls->_body, position, b2Vec2(1, 0)); jointDef.collideConnected = true; Physics::getWorld().CreateJoint(&jointDef); // Finally, set up keyboard control events registerEvents(); }
KeyMonitor::KeyMonitor(QObject* parent) : QObject(parent), m_modifiers(Qt::NoModifier) { if (registerEvents()) { getModifiers(); } }
void CloseIisuServer::setup() { // We need to specify where is located the iisu dll and it's configuration file. // in this sample we'll use the SDK's environment variable. string dllLocation = getenv("IISU_SDK_DIR") ; dllLocation+="/bin" ; // get the working context Context& context = Context::Instance(); // create an iisu configuration IisuHandle::Configuration iisuConfiguration(dllLocation.c_str(),"iisu_config.xml"); // you can customize the configuration here // create the handle according to the configuration structure Return<IisuHandle*> retHandle = context.createHandle(iisuConfiguration); if(retHandle.failed()) { cerr << "Failed to get iisu handle!" << endl << "Error " << retHandle.getErrorCode() << ": " << retHandle.getDescription().ptr() << endl; getchar(); exit(0); } // get the iisu handle m_iisuHandle = retHandle.get(); // create device configuration Device::Configuration deviceConfiguration ; // you can customize the configuration here // create the device according to the configuration structure Return<Device*> retDevice = m_iisuHandle->initializeDevice(deviceConfiguration); if(retDevice.failed()) { cerr << "Failed to create device!" << endl << "Error " << retDevice.getErrorCode() << ": " << retDevice.getDescription().ptr() << endl; getchar(); exit(0); } // get the device m_device = retDevice.get(); registerEvents() ; initIisu() ; SK::Result devStart = m_device->start(); if(devStart.failed()) { cerr << "Failed to start device!" << endl << "Error " << devStart.getErrorCode() << ": " << devStart.getDescription().ptr() << endl; getchar(); exit(0); } }
void Mesh2Cloud::init() { //m_mesh->request_vertex_status(); //m_mesh->request_face_status(); //m_mesh->request_vertex_normals(); //m_mesh->request_face_normals(); SingleMesh::init(); m_mesh->update_face_normals(); MultiPointCloud::init(); addProperties(); registerEvents(); }
EditorManager::EditorManager(wxAuiNotebook* notebook) : mEditorNotebook(notebook), mActiveEditor(NULL) { registerEvents(); if(mEditorNotebook != NULL) { Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler(EditorManager::OnPageChanged)); Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler(EditorManager::OnPageClosed)); mEditorNotebook->PushEventHandler(this); } }
/** * Main workhorse function, starts up the server listening on a port and * loops over the libevent handler. */ void TNonblockingServer::serve() { registerEvents(NULL); // Run the primary (listener) IO thread loop in our main thread; this will // only return when the server is shutting down. ioThreads_[0]->run(); // Ensure all threads are finished before exiting serve() for (uint32_t i = 0; i < ioThreads_.size(); ++i) { ioThreads_[i]->join(); GlobalOutput.printf("TNonblocking: join done for IO thread #%d", i); } }
int main(int argc, char** argv) { QApplication app(argc, argv); ::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleMock(&argc, argv); qRegisterMetaType<QModelIndex>("QModelIndex"); SIM::createEventHub(); SIM::setImageStorage(imagestorage); //SIM::setImageStorage(&imagestorage); SIM::createCommandHub(); registerEvents(); int ret = RUN_ALL_TESTS(); #ifdef WIN32 getchar(); #endif return ret; }
int main(int argc, char** argv) { QApplication app(argc, argv); ::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleMock(&argc, argv); SIM::createEventHub(); StubObjects::StubImageStorage imagestorage; SIM::setImageStorage(&imagestorage); SIM::createCommandHub(); SIM::createContactList(); registerEvents(); int ret = RUN_ALL_TESTS(); #ifdef WIN32 getchar(); #endif return ret; }
void TNonblockingIOThread::run() { if (eventBase_ == NULL) registerEvents(); GlobalOutput.printf("TNonblockingServer: IO thread #%d entering loop...", number_); if (useHighPriority_) { setCurrentThreadHighPriority(true); } // Run libevent engine, never returns, invokes calls to eventHandler event_base_loop(eventBase_, 0); if (useHighPriority_) { setCurrentThreadHighPriority(false); } // cleans up our registered events cleanupEvents(); GlobalOutput.printf("TNonblockingServer: IO thread #%d run() done!", number_); }
void TNonblockingIOThread::run() { threadId_ = Thread::get_current(); assert(eventBase_ == 0); eventBase_ = event_base_new(); // Print some libevent stats if (number_ == 0) { GlobalOutput.printf("TNonblockingServer: using libevent %s method %s", event_get_version(), event_base_get_method(eventBase_)); } registerEvents(); GlobalOutput.printf("TNonblockingServer: IO thread #%d entering loop...", number_); if (useHighPriority_) { setCurrentThreadHighPriority(true); } // Run libevent engine, never returns, invokes calls to eventHandler event_base_loop(eventBase_, 0); if (useHighPriority_) { setCurrentThreadHighPriority(false); } // cleans up our registered events cleanupEvents(); GlobalOutput.printf("TNonblockingServer: IO thread #%d run() done!", number_); }
TechniqueController::TechniqueController(Technique* technique) : mParentController(NULL), mTechnique(technique) { registerEvents(); }
TechniqueController::TechniqueController(MaterialController* parent, Technique* technique) : mParentController(parent), mTechnique(technique) { registerEvents(); }
Editor::Editor(EditorInput* input) : mEditorInput(input) { registerEvents(); }
RootEventPlugin::RootEventPlugin() { registerEvents(); }
// Function Implementation // TopMostWindowComponent::TopMostWindowComponent(const std::weak_ptr<IApp>& app) : Component(app) { registerEvents(); }
Editor::Editor() : mEditorInput(NULL), mName("Editor") { registerEvents(); }
TextureUnitController::TextureUnitController(TextureUnitState* tus) : mParentController(NULL), mTextureUnit(tus) { registerEvents(); }
TextureUnitController::TextureUnitController(PassController* parent, TextureUnitState* tus) : mParentController(parent), mTextureUnit(tus) { registerEvents(); }
TextureUnitController::TextureUnitController() : mParentController(NULL), mTextureUnit(NULL) { registerEvents(); }
PassController::PassController(TechniqueController* parent, Pass* pass) : mParentController(parent), mPass(pass) { registerEvents(); }
MaterialController::MaterialController() : mMaterialPtr(NULL) { registerEvents(); }
Workspace::Workspace() { registerEvents(); }
MaterialController::MaterialController(MaterialPtr materialPtr) : mMaterialPtr(materialPtr) { registerEvents(); }
SelectionService::SelectionService() { registerEvents(); }
PassController::PassController(Pass* pass) : mParentController(NULL), mPass(pass) { registerEvents(); }