void MainWindow::OnLoadOperatorPlugin() { QString filename = QFileDialog::getOpenFileName( this, "Choose an operator plugin file", QDir::currentPath(), "Operator Plugins (*.dll)"); if(!filename.isNull()) { HMODULE lib = LoadLibraryA(filename.toAscii()); if(!lib) { printf("ERROR: unable to load '%s'\n", filename.toAscii()); } typedef OP::Operator* (*createOperator_t)(); typedef OP::OperatorPanel* (*createPanel_t)(); createOperator_t opFunc = (createOperator_t)GetProcAddress(lib, "CreateOperator"); createPanel_t panelFunc = (createPanel_t)GetProcAddress(lib, "CreateOperatorPanel"); if(!opFunc) printf("ERROR - unable to load createoperator() function\n"); else { OP::Operator* op = opFunc(); OP::OperatorPanel* panel = NULL; if(panelFunc) panel = panelFunc(); OP::g_operators.Register(panel, op, lib); } } }
CCPoint ccpCompOp(const CCPoint& p, float (*opFunc)(float)) { return ccp(opFunc(p.x), opFunc(p.y)); }