void start() { Sinal sinal; Display2Timer timer; Display2Timer_init(&timer, CATODO_COMUM, pin_b0, ANODO_COMUM, pin_c2); initDisplay(&timer.unidade); initDisplay(&timer.dezena); Sinal_init(&sinal); naInterrupcao(EXT1, sinal.sinalizar, &sinal); sinal.semaforo.verde(&sinal.semaforo); sinal.semaforoPedestre.vermelho(&sinal.semaforoPedestre); while(1) { if (!entrada_pin_e3) Reset(); sinal.semaforo.verde(&sinal.semaforo); tempo_ms(1000); if (sinal.sinalizado) { rodarSemaforo(&sinal); rodarSemaforoPedestre(&sinal, &timer); sinal.sinalizado = false; } } }
void setup() { configPins(); initDisplay(); detectInputMode(); menuInit(); i2cInit(); }
void window(struct Info *i) { image = NULL; errno = 0; info = i; correct = 0; wrong = 0; student = randomStudent(info); hasAnswer = false; finish = false; isNegative = false; lines = ((info->maxNameLength+10)>50 ? info->maxNameLength+10 : 50) /27 +1; image = malloc((info->height)*(info->width)*((info->bpp)/8)*sizeof(GLubyte)); text = malloc(((info->maxNameLength+10)>50 ? info->maxNameLength+10 : 50)*sizeof(char)); if (image == NULL || text == NULL) { fprintf(stderr, "Error allocating memory for Image\n"); errno = -1; return; } sprintf(text, "Name: "); atexit(cleanupGraphics); if (loadImage() == 0) { initDisplay(); glutDisplayFunc(drawImage); glutKeyboardFunc(keyPressed); glutMainLoop(); } }
int mm_app_start_preview(int cam_id) { int rc = MM_CAMERA_OK; mm_camera_app_obj_t *pme = mm_app_get_cam_obj(cam_id); int op_mode = 0; CDBG("pme = %p, pme->cam =%p, pme->cam->camera_handle = %d", pme,pme->cam,pme->cam->camera_handle); if (pme->cam_state == CAMERA_STATE_PREVIEW) { return rc; } if (!my_cam_app.run_sanity) { if (MM_CAMERA_OK != initDisplay()) { CDBG_ERROR("%s : Could not initalize display",__func__); goto end; } } if (MM_CAMERA_OK != (rc = mm_app_prepare_preview(cam_id))) { CDBG_ERROR("%s:Stream On Preview failed rc=%d\n", __func__, rc); goto end; } if (MM_CAMERA_OK != (rc = mm_app_streamon_preview(cam_id))) { CDBG_ERROR("%s:Stream On Preview failed rc=%d\n", __func__, rc); goto end; } end: CDBG("%s: END, rc=%d\n", __func__, rc); return rc; }
int main( int argc, char **argv ) { glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE ); glutInitWindowSize( IMAGE_WIDTH,IMAGE_HEIGHT ); glutInitWindowPosition(100,120); window = glutCreateWindow("Assignment 2"); /* Register the appropriate callback functions with GLUT */ glutDisplayFunc( display ); glutKeyboardFunc( readKeyboard ); glutMouseFunc( mouseButtHandler ); glutMotionFunc( mouseMoveHandler ); glutPassiveMotionFunc( mouseMoveHandler ); glutIdleFunc( idle_func ); initDisplay( ); glutMainLoop( ); return( 0 ); }
int main(int argc, char * argv[]) { /* initalise and run the mandelbrot kernel */ clMandelbrot.initialize(); if(!clMandelbrot.parseCommandLine(argc, argv)) return SDK_FAILURE; if(clMandelbrot.setup()!=SDK_SUCCESS) return SDK_FAILURE; if(clMandelbrot.run()!=SDK_SUCCESS) return SDK_FAILURE; if(clMandelbrot.verifyResults()!=SDK_SUCCESS) return SDK_FAILURE; /* show window if it is not running in quiet mode */ if(clMandelbrot.showWindow()) { width = clMandelbrot.getWidth(); height = clMandelbrot.getHeight(); int * output = clMandelbrot.getPixels(); pixels = (unsigned char *)malloc(height*width*4*sizeof(unsigned char)); for(int i=0; i< width*height; ++i) { pixels[4*i] = (unsigned char)output[i]*(i/width)/height; pixels[4*i + 1] = (unsigned char)output[i]*(i%width)/width ; pixels[4*i + 2] = (unsigned char)output[i]*i/(width*height); pixels[4*i + 3] = 255; } initDisplay(argc, argv); mainLoopGL(); } cleanup(); return SDK_SUCCESS; }
void animate (int argc, char **argv) { glutInit (&argc, argv); glutInitDisplayMode (GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH); glutInitWindowSize (dset.old_w, dset.old_h); glutCreateWindow (WINDOW_TITLE); dset.old_x = glutGet ((GLenum) GLUT_INIT_WINDOW_X) + 6; dset.old_y = glutGet ((GLenum) GLUT_INIT_WINDOW_Y) + 36; /* Even if there are no events, redraw our gl scene. */ glutIdleFunc (idle); glutDisplayFunc (display); glutKeyboardFunc (key); glutReshapeFunc (reshape); if (dset.fullscreen) glutFullScreen (); initDisplay (); threadRunning = 1; pthread_create (&ph, NULL, backgroundCompute, NULL); glutMainLoop (); }
int main( int argc, char **argv ){ // signal( SIGHUP, cleanup ); glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE ); glutInitWindowSize( IMAGE_WIDTH,IMAGE_HEIGHT ); /* glutInitWindowPosition(0,0); */ window = glutCreateWindow( argv[0] ); /* Register the appropriate callback functions with GLUT */ glutDisplayFunc( display ); glutKeyboardFunc( readKeyboard ); glutMouseFunc( mouseButtHandler ); glutMotionFunc( mouseMoveHandler ); glutPassiveMotionFunc( mouseMoveHandler ); glutIdleFunc( NULL ); initDisplay( ); /* This function doesn't return - put all clean up code in * the cleanup function */ glutMainLoop( ); /* ANSI C requires main to return an int. */ return( 0 ); }
// called by touching the screen (see main.c) void Cube::restart() { lifeCounter = 100; playSample(StartSND); initDisplay(); if (IDcounter++ == 0) AudioChannel(0).resume(); // loop }
GLFWwindow *setupWindow(void) { // Try init GLFW if (!glfwInit()) { fprintf(stderr, "GLFW could not init.\n"); exit(1); } // Create window GLFWwindow *window = glfwCreateWindow(displayRes, displayRes, "QuadTree Example", NULL, NULL); // Check that window opened if (!window) { // Terminate if not fprintf(stderr, "GLFW could not create window.\n"); glfwTerminate(); exit(1); } glfwMakeContextCurrent(window); initDisplay(displayRes, displayRes); glfwSwapInterval(1); setCallbacks(window); return window; }
void Engine::handleCommand(int32_t cmd) { LOGD("At handleCommand()"); switch (cmd) { case APP_CMD_SAVE_STATE: saveState(); break; case APP_CMD_INIT_WINDOW: // The window is being shown, get it ready. if (app->window != NULL) { initDisplay(); drawFrame(); } break; case APP_CMD_TERM_WINDOW: // The window is being hidden or closed, clean it up. terminateDisplay(); break; case APP_CMD_GAINED_FOCUS: LOGD("At APP_CMD_GAINED_FOCUS"); paused = false; break; case APP_CMD_LOST_FOCUS: LOGD("At APP_CMD_LOST_FOCUS"); // Also stop animating. paused = true; drawFrame(); break; } return; }
GLFWwindow* windowSetup() { /* */ // GLFW Init Boilerplate // /* */ if(!glfwInit()) { // Exit if GLFW does not init std::cerr << "GLFW could not init" << std::endl; exit(1); } GLFWwindow* window; // Create window glfwWindowHint(GLFW_SAMPLES,8); // MSAA 8x // Get user screen resolution const GLFWvidmode* mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); // Make window smaller than screen int wXRes = mode->width * 0.8; int wYRes = mode->height * 0.8; window = glfwCreateWindow(wXRes, wYRes, "Exo N-Body", NULL, NULL); if (!window) { // Terminate and exit if window cannot open std::cerr << "GLFW could not create window" << std::endl; glfwTerminate(); exit(1); } glfwMakeContextCurrent(window); initDisplay(wXRes, wYRes); setCallbacks(window); return window; /* */ // GLFW Boilerplate End // /* */ }
static int updateGL(struct engine* engine) { GK_BOOL init = engine->context == EGL_NO_CONTEXT; EGLint w, h; if (init) { initDisplay(engine); createSurface(engine); engine->context = eglCreateContext(engine->display, engine->config, NULL, NULL); }else { createSurface(engine); } if (!bindContext(engine, GK_TRUE)) return -1; GLEE_EXT_framebuffer_object = (strstr((const char*)glGetString(GL_EXTENSIONS), "OES_framebuffer_object")?GK_TRUE:GK_FALSE); eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w); eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h); if (init) { gkScreenSize.width = w; gkScreenSize.height = h; } else { onWindowSizeChanged(GK_SIZE(w, h)); } engine->initialized = GK_TRUE; engine->animating = GK_TRUE; return 0; }
bool FightLayer::init(){ if(Layer::init()){ _bgOffset = Size(98,92); auto background =Sprite::create("textures/IMG_Background/bg_fight.png"); background->setPosition(VisibleRect::center()); addChild(background); ReadString* rs = ReadString::getReadString("json/combat.json"); for(int i=1;i<3;i++){ auto monsterCard = rs->read(i, "Monster"); _monsterVec.pushBack(CardNode::createWithCombat(monsterCard)); auto myCard = rs->read(i, "My"); _myVec.pushBack(CardNode::createWithCombat(myCard)); auto combat = rs->readCombat(); _combatVec.pushBack(combat); auto end = rs->readEnd(); _endVec.pushBack(end); } initCard(); initDisplay(); combatAction(0); return true; } return false; }
Map::Map(DBItem item, BackgroundLayer *bgLayer, MapLayer *mapLayer, FoWLayer *fowLayer, DrawingLayer *drawingLayer, bool isMj) : DBItem(), ui(new Ui::Map) { ui->setupUi(this); QHash<QString, QVariant> itemHashMap = item.getHashMap(); columnsValues_ = item.getHashMap(); int id = itemHashMap.value("id").toInt(); QString windowtitle = itemHashMap.value("windowtitle").toString(); int sceneHeight = itemHashMap.value("sceneheight").toInt(); int sceneWidth = itemHashMap.value("scenewidth").toInt(); bool isImage = itemHashMap.value("isimage").toBool(); id_ = id; setWindowTitle(windowtitle); initRole(isMj); m_Layers = new Layers(bgLayer, mapLayer, fowLayer, drawingLayer); initScene(sceneWidth, sceneHeight); initLayers(false); initDisplay(); initTooltip(); m_IsImage = isImage; if(isImage){ initAsImage(); } }
DisplayInternalInfo::DisplayInternalInfo(HT1632Class& ht1632) : ht1632(ht1632), dictionary(Dictionary::bind()), motionSensor(MotionSensor::bind()), lightSensor(LightSensor::bind()), inboxRegistry(InboxRegistry::bind()) { initDisplay(*this); }
int main( int argc, char *argv[] ) { initDisplay(); // get number of SMs on this GPU int devID; /*cudaDeviceProp props; cudaGetDevice(&devID); cudaGetDeviceProperties(&props, devID); check(); printf("using device %s \n", props.name); printf("number of MPs %d \n", props.multiProcessorCount); printf("max threads per block %d \n", props.maxThreadsPerBlock); printf("max concurrent kernels %d \n", props.concurrentKernels); printf("number of bodies %d \n", numBodies); */ if(argc == 2) { if(strcmp(argv[1], "--cpu") == 0) { gpu = false; } else if(strcmp(argv[1], "--gpu") == 0) { gpu = true; } else { printf("wrong argument %s \nallowed: NULL, --cpu, --gpu \n", argv[1]); exit(EXIT_FAILURE); } } if(randData){ loadDataRand(numBodies); }else{ loadData("data/data.tab", numBodies); } init(numBodies); printf("stop with CTRL+C\n"); do { runCuda(); showGalaxy(h_particleData, numBodies, false); //count++; } while (count < 64); printf("finished...\n"); if(gpu) { cudaFree(d_particleData); } closeWindow(); printf("close...\n"); return EXIT_SUCCESS; }
GradientTable::GradientTable(QWidget *parent /*= 0*/, quint8 index, quint8 previndex, quint32 add) : CBasePage(tr("GradientTable"), index, previndex, add, parent ) , m_nWhich(add) { ui.setupUi(this); m_strTitle = tr("GradientTable"); initDisplay(); setStyleSheet( BTNGLOBALSTYLE); }
FlowFixPage::FlowFixPage(QWidget *parent /*= 0*/, quint8 index, quint8 previndex, quint32 add) : CBasePage(tr("FlowFixPage"), index, previndex, add, parent ) , flag(false) { ui.setupUi(this); m_strTitle = tr("FlowFix"); initDisplay(); setStyleSheet( BTNGLOBALSTYLE); }
tm1637::tm1637(uint8_t ClockPin, uint8_t DataPin) { _clk = ClockPin; _dio = DataPin; pinMode(_dio, OUTPUT); digitalWrite(_dio, LOW); //pin will be low when acting as output pinMode(_dio, INPUT_PULLUP); //pin will be high when acting as input pinMode(_clk, OUTPUT); initDisplay(); }
extern "C" int main(int argc, char *argv[]) { initDisplay(); draw(); emulatorEmitScreenshot(); sceGuTerm(); return 0; }
/// /////////////////////////////////////////////////////////////////////////// /// Fonction d'initialisation /// /////////////////////////////////////////////////////////////////////////// void initGLIMAGIMP_IHM(unsigned int w_im,unsigned int h_im,unsigned char *tabRVB, unsigned int w_ecran,unsigned int h_ecran) { ////// parametres GL ///////////////////////////////////// cptidletime = 0; flag_test = 0; flag_fichier = 0; width_ecran = w_ecran; height_ecran = h_ecran; width_image = w_im; height_image = h_im; if ((width_image>width_ecran) || (height_image>height_ecran)) { printf("ERREUR : la taille de l'image est plus grande que la taille ecran"); exit(1); } image_src = tabRVB; glPixelStorei(GL_UNPACK_ALIGNMENT,1); initDisplay(); int argc = 0; char** argv = (char**) malloc(sizeof(char*)); argv[0] = (char*) calloc(20,sizeof(char)); sprintf(argv[0],"imagimp"); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowPosition(0, 0); glutInitWindowSize(width_ecran, height_ecran); if (glutCreateWindow("IMAGIMP") == GL_FALSE) { printf("Impossible de créer la fenetre GL\n"); exit(1); } //if (fullscreen) glutFullScreen(); /* association de la fonction de dimensionnement */ glutReshapeFunc(reshapeFunc); /* association de la fonction d'affichage */ glutDisplayFunc(drawScene_GLIMAGIMP); /* association de la fonction d'événement souris */ glutMouseFunc(clickMouse_GLIMAGIMP); /* association de la fonction de DRAG */ //glutMotionFunc(motionFunc); /* association de la fonction d'événement du clavier */ glutKeyboardFunc(kbdFunc_GLIMAGIMP); /* association de la fonction de traitement des touches*/ /* spéciales du clavier */ glutSpecialFunc(kbdSpFunc_GLIMAGIMP); /* fonction d'attente */ glutIdleFunc(idleFunc); /* Ready to go! */ glutMainLoop(); }
int main(void) { unsigned int i; int sum = 0; int current = 0; int hgt_percent = 0; int degrees = 0; STATE = IDLE; initClock(); initADC(); initYaw(); initMotorPin(); initDisplay(); intButton(); initConsole(); initPWMchan(); initCircBuf (&g_inBuffer, BUF_SIZE); // Enable interrupts to the processor. IntMasterEnable(); while (1) { //double dt = SysCtlClockGet() / SYSTICK_RATE_HZ; degrees = yawToDeg(); // Background task: calculate the (approximate) mean of the values in the // circular buffer and display it. sum = 0; for (i = 0; i < BUF_SIZE; i++) { current = readCircBuf (&g_inBuffer); sum = sum + current; } int newHght = ADC_TO_MILLIS(sum/BUF_SIZE); if(initialRead != 0) { hgt_percent = calcHeight(initialRead, newHght); } if (STATE == FLYING || STATE == LANDING){ PIDControl(hgt_percent, SysCtlClockGet() / SYSTICK_RATE_HZ); PWMPulseWidthSet (PWM_BASE, PWM_OUT_1, period * main_duty / 100); PWMPulseWidthSet (PWM_BASE, PWM_OUT_4, period * tail_duty / 100); } displayInfo((int)initialRead, hgt_percent, degrees); } }
virtual int run(bool fDaemonised /* = false */) { Display *pDisplay = XOpenDisplay(NULL); if (!pDisplay) return VERR_NOT_FOUND; int rc = initDisplay(pDisplay); if (RT_SUCCESS(rc)) rc = runDisplay(pDisplay); XCloseDisplay(pDisplay); return rc; }
/*************************************************************************** show the 5x7 matrix for ms (milli seconds ) ***************************************************************************/ void showMatrix(uint16_t ms) { uint16_t n; initDisplay(); for(n=0;n<ms;n++) { _showMatrix(); _delay_ms(1); } displayOff(); }
bool TfrmMove::init( const LCDbCryoJob *p_job ) { createNewJob = false; job = *p_job; initDisplay( "Move job " + job.getName() ); PartFactory rhs( false, false ); rhs.loadBoxes( job ); root = rhs.createSiteList(); if( root == NULL ) { String error = "Cannot create RHS for "; error += job.getName().c_str(); Application -> MessageBox( error.c_str(), NULL, MB_OK ); return false; } PartFactory lhs( true, false ); lhs.loadBoxes( job ); part = lhs.createSiteList(); if( part == NULL ) { String error = "Cannot create LHS for "; error += job.getName().c_str(); Application -> MessageBox( error.c_str(), NULL, MB_OK ); return false; } int pid = LCDbAuditTrail::getCurrent().getProcessID(); bool ownJob = (job.getProcessCID() == pid); if( !job.claim( jobQuery, ownJob ) ) { String error = "Cannot claim job "; error += job.getName().c_str(); Application -> MessageBox( error.c_str(), NULL, MB_OK ); return false; } rightKids.clear(); makeBoxList( root, rightKids, isUnmappedBox ); leftKids.clear(); makeBoxList( part, leftKids, isUnmappedBox ); mapChildrenByJob(); TTreeNode* parent = AvlTree->Items->Add( NULL, "Allocated-Storage" ); parent->Data = (void*)root; LoadTree( AvlTree, parent, root ); parent = SampleTree->Items->Add( NULL, "Items-to-Move" ); parent->Data = (void*)part; LoadTree( SampleTree, parent, part ); return true; }
void MainWindow::Game() { initDisplay(); QWidget *widget= new QWidget; setCentralWidget(widget); widget->setLayout(MainLayout); initCards(); //cree héros, deck, première main initHeros(); Display();//afichage }
void run() { initDisplay(); touch->initialize(); drawMenu(); for(;;){ processEvents(); } }
EditSheet::EditSheet(Sheet* s, Core* C, QWidget *parent) : QDialog(parent), ui(new Ui::EditSheet) { ui->setupUi(this); this->sheet = s; this->C = C; initDisplay(); refreshDisplay(); connect(ui->pushButton,SIGNAL(clicked()),SLOT(addColumn())); ui->checkBoxAdapt->setChecked(s->getAdaptColumns()); }
DebugMcuProtoPage::DebugMcuProtoPage(QWidget *parent /*= 0*/, quint8 index, quint8 previndex, quint32 add) : CBasePage(tr("DebugMcuProtoPage"), index, previndex, add, parent ) , m_bCollectFlag(false) , m_bStartFlag(false) , m_nBulgeFlag(0) , m_dPeriod(0) { ui.setupUi(this); m_strTitle = tr("DebugPressPage"); initDisplay(); //图表初始化; initPlotDisp(); }