int main(int argc, char** argv) { // Inicializamos OpenGL glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); // Inicializamos la Ventana glutInitWindowSize(SCREEN_SIZE); glutInitWindowPosition(SCREEN_POSITION); glutCreateWindow("Sesion 3.1"); // Inicializaciones específicas initFunc(); // Configuración CallBacks glutReshapeFunc(funReshape); glutDisplayFunc(funDisplay); glutKeyboardUpFunc(funKeyboardUp); glutSpecialFunc(funSpecial); glutMouseFunc(funMouse); glutMotionFunc(funMotion); glutPassiveMotionFunc(funMotionPassive); glutIdleFunc(funIdle); glutMouseWheelFunc(funMouseWheel); // Bucle principal glutMainLoop(); // Destrucción de objetos return(0); }
RadialDistribution::RadialDistribution(uint dimentions, uint numOfPoints, num distBetwZeroAndEdge, num(*initFunc)(num)) { m_dim = dimentions; m_dist = distBetwZeroAndEdge; m_data = std::vector<num>(numOfPoints); for (uint i = 0; i < GetNumOfPoints(); i++) { m_data[i] = initFunc(getCoord(i)); } }
int main(int argc, char* argv[]) { StateSet entries; StateCreatorFunction initFunc(InitState::createState); entries.insert(StateEntry(INIT, "init", initFunc)); StateCreatorFunction stopFunc(StopState::createState); entries.insert(StateEntry(STOP, "stop", stopFunc)); StateEntry entryArray[] = { StateEntry(INIT, "init", initFunc), StateEntry(STOP, "stop", stopFunc) }; StateSet entires2(entryArray, entryArray + (sizeof(entryArray) / sizeof(entryArray[0]))); StateSet::iterator it = entries.find(INIT); boost::shared_ptr<State> s1 = it->creatorFunction_(); StateSet::nth_index<1>::type::iterator it2 = entries.get<1>().find("stop"); boost::shared_ptr<State> s2 = it2->creatorFunction_(); std::cout << "State name: " << s1->name() << std::endl; std::cout << "State name: " << s2->name() << std::endl; BOOST_FOREACH(const StateEntry& entry, entires2) { std::cout << entry.umStateName_ << std::endl; }
void drawGraph(Ad *ad){ int argc = 1; char** argv = new char*[1](); char* ch =(char*) "ara"; argv[0] = ch; md = ad; glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); //glutInitWindowSize(700,700); //glutInitWindowPosition(600,0); //glutCreateWindow("A*"); //glutDisplayFunc(drawFuncAstar); //initAstar(); //janela glutInitWindowSize(700,700); glutInitWindowPosition(0,0); glutCreateWindow("Ad*"); // local initialization initFunc(); glutKeyboardFunc(keyPressed); // configure callbacks glutDisplayFunc(drawFunc); glutIdleFunc(idleFunc); //glutMouseFunc(mouseFunc); glutMainLoop(); }
int main(int argc, char *argv[]) { glutInit(&argc, argv); initFunc(); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowPosition(100, 100); glutInitWindowSize(windowX, windowY); glutCreateWindow("Draw a circle"); glutDisplayFunc(myDisplay); glutMouseFunc(Mouse); glutMainLoop(); return 0; }
/*ロード画面の準備・終了*/ void setLoad(int funcs,void (*init_func)(),void (*finish_func)(),LOAD_FUNCS* load_funcs, int next_mode){ LoadIndex = 0; /*変数セット*/ initFunc = init_func; finishFunc = finish_func; Funcs = funcs; //関数数 LoadFuncs = load_funcs; NextMode = next_mode; //最初の関数読み込み if(initFunc != NULL) initFunc(); //プリペア startLoad(); /*場面切り替え*/ GameScene = GAME_SCENE_LOADING; /*一回だけ描画*/ drawLoad(); SDL_GL_SwapBuffers(); }
static void load_initLib(sSharedLib *l) { /* already initialized? */ if(l->initialized) return; /* first go through the dependencies */ for(sDep *dl = l->deps; dl != NULL; dl = dl->next) load_initLib(dl->lib); /* if its not the executable, call the init-function */ if(l->isDSO) { uintptr_t initAddr = (uintptr_t)load_getDyn(l->dyn,DT_INIT); if(initAddr) { DBGDL("Calling _init of %s...\n",l->name); void (*initFunc)(void) = (void (*)(void))(initAddr + l->loadAddr); initFunc(); } } l->initialized = true; }
scfSharedLibrary::scfSharedLibrary (csStringID libraryName, const char *core) { LibraryRegistry->Push (this); RefCount = 0; LibraryName = libraryName; const char* lib = get_library_name(LibraryName); if (PrivateSCF->IsVerbose(SCF_VERBOSE_PLUGIN_LOAD)) csPrintfErr("SCF_NOTIFY: loading plugin %s to satisfy request for %s\n", lib, core); LibraryHandle = csLoadLibrary (lib); if (LibraryHandle != 0) { csString sym; sym << core << "_scfInitialize"; initFunc = (scfInitFunc)csGetLibrarySymbol(LibraryHandle, sym); if (!initFunc) { csPrintfErr("SCF_ERROR: %s doesn't export %s\n", CS::Quote::Single (lib), CS::Quote::Single (sym.GetData())); csPrintLibraryError (sym); } sym.Clear (); sym << core << "_scfFinalize"; finisFunc = (scfFinisFunc)csGetLibrarySymbol(LibraryHandle, sym); if (!finisFunc) { csPrintfErr("SCF_ERROR: %s doesn't export %s\n", CS::Quote::Single (lib), CS::Quote::Single (sym.GetData())); csPrintLibraryError (sym); } if (initFunc && finisFunc) initFunc (PrivateSCF); } else csPrintLibraryError (lib); }
bool QCtkXipSGWidget::loadIVExtensions(const QStringList& extensionList) { for(int i = 0; i < extensionList.size(); ++i) { QString extensionFilename = extensionList.at(i); if(QLibrary::isLibrary(extensionFilename)) { QLibrary lib(extensionFilename); lib.load(); if(!lib.isLoaded()) { QMessageBox msgBox; msgBox.setText(QString("Failed to load iv extension ") + extensionFilename); msgBox.setStandardButtons(QMessageBox::Ok ); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); return false; } else { typedef int (*dllInitFunc)(void); dllInitFunc initFunc = (dllInitFunc) lib.resolve("xipivcoregl_init"); if(initFunc) initFunc(); } } } return true; }
/* * InitPrintDrivers is called from dix:AddScreen. It in turn calls the * driver initialization routine for any and all drivers which are * implicated in supporting printers on the particular screen number * specified by the "index" parameter. The printerDb variable is used * to determine which printers are to be associated with a particular * screen. */ static Bool InitPrintDrivers( int index, ScreenPtr pScreen, int argc, char **argv) { PrinterDbPtr pDb, pDb2; GenericScreenInit(index, pScreen, argc, argv); for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next) { if(pDb->screenNum == index) { Bool callInit = TRUE; for(pDb2 = printerDb; pDb2 != pDb; pDb2 = pDb2->next) { if(!strcmp(pDb->driverName, pDb2->driverName)) { callInit = FALSE; break; } } if(callInit == TRUE) { pBFunc initFunc; initFunc = GetInitFunc(pDb->driverName); if(initFunc(index, pScreen, argc, argv) == FALSE) { /* XXX - What do I do if the driver's init fails? */ } } } } return TRUE; }
void CfgLazyInitializer::doInitialize() { initFunc(); }