コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: plainoldcj/nubuck
	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);
			}
		}
	}
コード例 #2
0
CCPoint ccpCompOp(const CCPoint& p, float (*opFunc)(float))
{
    return ccp(opFunc(p.x), opFunc(p.y));
}