int main(int argc, char **argv) { struct termios oldline; t_area ar; if (argc > 1) { non_canonical_mode(&oldline); init_term(&ar, argv, argc); display_arguments(&ar); while ((ar.len = read(0, ar.buff, sizeof(ar.buff)))) { x_read(ar.len); init_lines(&ar, &oldline); check_ctrl(&ar); check_keys(&ar, ar.len); check_select(&ar); if (my_exit(&oldline, &ar) == 1 || void_exit(&ar, &oldline) == 1) return (EXIT_SUCCESS); } restore_mode(&oldline, &ar); free_struct(&ar); } else my_put_error(ERR_ARGV); return (EXIT_SUCCESS); }
int main(void) { logOpen(); initXWindows(); init_opengl(); Game game; init(&game); srand(time(NULL)); clock_gettime(CLOCK_REALTIME, &timePause); clock_gettime(CLOCK_REALTIME, &timeStart); int done=0; while (!done) { while (XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_resize(&e); check_mouse(&e); done = check_keys(&e); } clock_gettime(CLOCK_REALTIME, &timeCurrent); timeSpan = timeDiff(&timeStart, &timeCurrent); timeCopy(&timeStart, &timeCurrent); physicsCountdown += timeSpan; while (physicsCountdown >= physicsRate) { physics(&game); physicsCountdown -= physicsRate; } render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); cleanup_fonts(); logClose(); return 0; }
void display(void) { // clear the screen glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GLfloat modelView[16], camMatrix[16], cam_Matrix_skybox[16], total[16]; printError("pre display"); check_keys(); t += 1; glUseProgram(program); // Build matrix lookAt(&cam_pos, &obj_pos, up.x, up.y, up.z, camMatrix); CopyMatrix(camMatrix, cam_Matrix_skybox); cam_Matrix_skybox[3] = 0; cam_Matrix_skybox[7] = 0; cam_Matrix_skybox[11] = 0; cam_Matrix_skybox[15] = 1; // disable z-buffer for skybox glDisable(GL_DEPTH_TEST); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Draw skybox // Set the skybox variable glUniform1i(glGetUniformLocation(program, "skybox"), 1); T(0,-0.5,0,modelView); Mult(cam_Matrix_skybox, modelView, total); glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total); glBindTexture(GL_TEXTURE_2D, skytex); DrawModel(skybox, program, "inPosition", "inNormal", "inTexCoord"); glUniform1i(glGetUniformLocation(program, "skybox"), 0); glEnable(GL_DEPTH_TEST); // Bind terrain IdentityMatrix(modelView); Mult(camMatrix, modelView, total); glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total); // Bind Our Texture tex1 glBindTexture(GL_TEXTURE_2D, tex1); DrawModel(tm, program, "inPosition", "inNormal", "inTexCoord"); // Draw sphere sphere_pos = update_sphere(t, total); sphere_pos.y = calculate_height(sphere_pos.x, sphere_pos.z, ttex.width, vertexArray); T(sphere_pos.x, sphere_pos.y, sphere_pos.z, trans); Mult(camMatrix, trans, total); //Ry(0.01*t, roty); glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total); glBindTexture(GL_TEXTURE_2D, spheretex); DrawModel(sphere, program, "inPosition", "inNormal", "inTexCoord"); printError("display 2"); glutSwapBuffers(); }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=MAX_PARTICLES; //declare a box shape game.box.width = 70; game.box.height = 10; game.box.center.x = -50 + 5*65; game.box.center.y = 500 - 5*60; //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_mouse(&e, &game); done = check_keys(&e, &game); } movement(&game); render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); return 0; }
void cScreenGirlDetails::process() { if (!ids_set) set_ids(); // we need to make sure the ID variables are set if (check_keys()) return; // handle arrow keys init(); // set up the window if needed check_events(); // check to see if there's a button event needing handling }
static int os2_getchar(aa_context * c, int wait) { KBDKEYINFO kbdkey; MOUEVENTINFO mouEvent; USHORT mouwait = MOU_NOWAIT; if(wait) { while(1) { KbdCharIn(&kbdkey, IO_NOWAIT, 0); if(kbdkey.fbStatus!=0) return check_keys(kbdkey); if(hMou!=-1) { MouReadEventQue(&mouEvent, &mouwait, hMou); /* mouse event! */ if(!((mouEvent.fs==0)&&(mouEvent.col==0)&&(mouEvent.row==0))) { if(mouEvent.fs&0x60) but |= AA_BUTTON2; else but &= ~AA_BUTTON2; if((mouEvent.fs&0x18)||(mouEvent.fs&0x60 && mouEvent.fs&0x06)) but |= AA_BUTTON3; else but &= ~AA_BUTTON3; if(mouEvent.fs&0x06) but |= AA_BUTTON1; else but &= ~AA_BUTTON1; if(mouEvent.fs&0x01) but = 0; return AA_NONE; } } DosSleep(0); } } else { KbdCharIn(&kbdkey, IO_NOWAIT, 0); if(kbdkey.fbStatus==0) return AA_NONE; else return check_keys(kbdkey); } return (AA_NONE); }
/* wrappers for the blowfish function. * Updates the subkeys and divides the data block in two 32b halves. * Return encrypted or decrypted text. * * Strategy: * - calculates the output length, depending on the input. * - updates the subkeys according to the user key. * - for every 64-bit blocks of data, apply the blowfish algorithm. * - when there are less than 64 bits remaining, complete with 0's. */ int encrypt(const char* user_key, byte_t* content, byte_t** cipher, int* safe) { int i, j; int data_block_counter; byte_t* data = (byte_t*) content; goldeen_32b_block remaining_bytes; byte_t* input_pointer; byte_t* output_pointer; int input_length = strlen((char*) content); int output_length = calculate_output_length(input_length); *cipher = (byte_t*) malloc(output_length*sizeof(byte_t)); byte_t* stream = *cipher; update_subkeys(user_key, strlen(user_key)); *safe = check_keys(); for (data_block_counter = 0; data_block_counter < output_length; data_block_counter += 8) { if (data_block_counter < input_length - 7) { input_pointer = data; output_pointer = stream; for (i = 0; i < 8; ++i) { *output_pointer++ = *input_pointer++; } blowfish((goldeen_32b_block*) stream, (goldeen_32b_block*) (stream + 4), ENCRYPT); } else { remaining_bytes = input_length - data_block_counter; input_pointer = data; output_pointer = stream; for (i = 0; i < (int) remaining_bytes; ++i) { *output_pointer++ = *input_pointer++; } for (j = i; j < 8; j++) { *output_pointer++ = 0; } blowfish((goldeen_32b_block*) stream, (goldeen_32b_block*) (stream + 4), ENCRYPT); } data += 8; stream += 8; } return output_length; }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=0; clock_gettime(CLOCK_REALTIME, &timePause); clock_gettime(CLOCK_REALTIME, &timeStart); //declare a box shape for(int i = 0; i<5; i++) { game.box[i].width = 100; game.box[i].height = 15; game.box[i].center.x = 120 + (60*i); game.box[i].center.y = 500 - (100*i); } game.circle.radius = .5; game.circle.center.x = 60 + 9*65; game.circle.center.y = 450- 8*60; //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_mouse(&e, &game); done = check_keys(&e, &game); } clock_gettime(CLOCK_REALTIME, &timeCurrent); timeSpan = timeDiff(&timeStart, &timeCurrent); timeCopy(&timeStart, &timeCurrent); physicsCountdown += timeSpan; while(physicsCountdown >= physicsRate) { physics(&game); physicsCountdown -= physicsRate; } movement(&game); render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); return 0; }
int main(void) { logOpen(); initXWindows(); init_opengl(); init(); init_sounds(); clock_gettime(CLOCK_REALTIME, &timePause); clock_gettime(CLOCK_REALTIME, &timeStart); while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_resize(&e); check_mouse(&e); check_keys(&e); } // //Below is a process to apply physics at a consistent rate. //1. Get the time right now. clock_gettime(CLOCK_REALTIME, &timeCurrent); //2. How long since we were here last? timeSpan = timeDiff(&timeStart, &timeCurrent); //3. Save the current time as our new starting time. timeCopy(&timeStart, &timeCurrent); //4. Add time-span to our countdown amount. physicsCountdown += timeSpan; //5. Has countdown gone beyond our physics rate? // if yes, // In a loop... // Apply physics // Reducing countdown by physics-rate. // Break when countdown < physics-rate. // if no, // Apply no physics this frame. while(physicsCountdown >= physicsRate) { //6. Apply physics physics(); //7. Reduce the countdown by our physics-rate physicsCountdown -= physicsRate; } //Always render every frame. render(); glXSwapBuffers(dpy, win); } cleanupXWindows(); cleanup_fonts(); #ifdef USE_SOUND fmod_cleanup(); #endif //USE_SOUND logClose(); return 0; }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=0; game.bubble = 0; //declare a box shape game.box[0].width = 100; game.box[0].height = 15; game.box[0].center.x = 150; game.box[0].center.y = 500; game.box[1].width = 100; game.box[1].height = 15; game.box[1].center.x = 250; game.box[1].center.y = 425; game.box[2].width = 100; game.box[2].height = 15; game.box[2].center.x = 350; game.box[2].center.y = 350; game.box[3].width = 100; game.box[3].height = 15; game.box[3].center.x = 450; game.box[3].center.y = 275; game.box[4].width = 100; game.box[4].height = 15; game.box[4].center.x = 550; game.box[4].center.y = 200; game.circle.center.x = 700; game.circle.center.y = 50; game.circle.radius = 125; //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_mouse(&e, &game); done = check_keys(&e, &game); } movement(&game); render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); return 0; }
void CALLBACK TimerProc(UINT uID,UINT uMsg,DWORD dwUser,DWORD dw1,DWORD dw2) { LONGLONG pc; MSG msg; QueryPerformanceCounter((_LARGE_INTEGER *)&pc); //TIMING.acttime=pc; check_keys(); if (GLOBAL.neurobit_available) NdProtocolEngine(); if (GLOBAL.emotiv_available) process_emotiv(); if ((!TIMING.pause_timer) && (!GLOBAL.loading)) { // one second passed ? -> update PPS-info if (pc-TIMING.timestamp >= TIMING.pcfreq) { TIMING.timestamp+=TIMING.pcfreq; TIMING.actpps=(int) TIMING.ppscounter; TIMING.ppscounter=0; } // Reading from Archive & next packet demanded? -> read from File and Process Packets while ((pc-TIMING.readtimestamp >= TTY.packettime) || (GLOBAL.fly)) { TIMING.readtimestamp+=TTY.packettime; TIMING.acttime=TIMING.readtimestamp; if(CAPTFILE.do_read&&(CAPTFILE.offset<=TIMING.packetcounter)&&(CAPTFILE.offset+CAPTFILE.length>TIMING.packetcounter)) { long tmp; tmp=TIMING.packetcounter; read_captfile(TTY.amount_to_read); ParseLocalInput(TTY.amount_to_read); if ((TIMING.packetcounter-tmp-1)>0) TIMING.readtimestamp+=TTY.packettime*(TIMING.packetcounter-tmp-1); //return; } // process packets in case of no File-Read and no Com-Read else if ((TTY.read_pause) && (!GLOBAL.neurobit_available) && (!GLOBAL.emotiv_available)) process_packets(); if (GLOBAL.fly) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } } }
static int load_config(struct vpn_config *config, char *path, enum what action) { GKeyFile *keyfile; gsize length; char **groups; char *str; bool found = false; int i; DBG("config %p", config); keyfile = __connman_storage_load_provider_config(config->ident); if (!keyfile) return -EIO; /* Verify keys validity of the global section */ check_keys(keyfile, "global", config_possible_keys); str = __vpn_config_get_string(keyfile, "global", CONFIG_KEY_NAME, NULL); if (str) { g_free(config->name); config->name = str; } str = __vpn_config_get_string(keyfile, "global", CONFIG_KEY_DESC, NULL); if (str) { g_free(config->description); config->description = str; } groups = g_key_file_get_groups(keyfile, &length); for (i = 0; groups[i]; i++) { if (g_str_has_prefix(groups[i], "provider_")) { int ret = load_provider(keyfile, groups[i], config, action); if (ret == 0 || ret == -EALREADY) found = true; } } if (!found) connman_warn("Config file %s/%s.config does not contain any " "configuration that can be provisioned!", path, config->ident); g_strfreev(groups); g_key_file_free(keyfile); return 0; }
/** * Handle mouse events for target widget. * @param x Mouse X position * @param y Mouse Y position */ void widget_event_target(widgetdata *widget, int x, int y) { /* Combat modes */ if (y > widget->y1 + 3 && y < widget->y1 + 38 && x > widget->x1 + 3 && x < widget->x1 + 30) check_keys(SDLK_c); /* Talk button */ if (y > widget->y1 + 7 && y < widget->y1 + 25 && x > widget->x1 + 223 && x < widget->x1 + 259) { if (cpl.target_code) send_command("/t_tell hello"); } }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=0; //declare a box shape game.box[0].width = 100; game.box[0].height = 10; game.box[0].center.x = 270 + 5*65; game.box[0].center.y = 500 - 5*60; game.box[1].width = 100; game.box[1].height = 10; game.box[1].center.x = 270 + 5*65 - 75; game.box[1].center.y = 500 - 5*60 + 45; game.box[2].width = 100; game.box[2].height = 10; game.box[2].center.x = 270 + 5*65 - 150; game.box[2].center.y = 500 - 5*60 + 90; game.box[3].width = 100; game.box[3].height = 10; game.box[3].center.x = 270 + 5*65 - 225; game.box[3].center.y = 500 - 5*60 + 135; game.box[4].width = 100; game.box[4].height = 10; game.box[4].center.x = 270 + 5*65 - 300; game.box[4].center.y = 500 - 5*60 + 180; game.circle.center.x = 760; game.circle.center.y = -25; game.circle.radius = 100; //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_mouse(&e, &game); done = check_keys(&e, &game); } movement(&game); render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); cleanup_fonts(); return 0; }
void cScreenGetInput::process() { g_CurrentScreen = SCREEN_BROTHEL; if (!ids_set) set_ids(); if (check_keys()) return; init(); check_events(); }
static void fwmkeys_test(void *db, int num, unsigned int seed) { TCADB *adb = db; struct keygen keygen; char prefix[KEYGEN_PREFIX_SIZE + 1]; TCLIST *list; keygen_init(&keygen, seed); list = tcadbfwmkeys2(adb, keygen_prefix(&keygen, prefix), -1); check_keys(list, num, seed); tclistdel(list); }
void cScreenBrothelManagement::process() { g_CurrentScreen = SCREEN_BROTHEL; if (!id_set) set_ids(); if (check_keys()) return; init(); check_events(); }
int main(int argc, char **argv) { int errline = 0, i; CMD_FILE cf; // check if cmd file was given if (argc < 2) { printf("USAGE: su_exec cmdfile\n"); return 0; } if ((errline = open_and_parse_cmd_file(argv[1], &cf)) != 0) { if (errline == ERR_NOFILE) { printf("could not find command file %s \n", argv[1]); return ERR_NOFILE; } if (errline == ERR_NOKEY) { printf("authentication keys do not match! will not process file \n"); return ERR_NOKEY; } printf("error on line %i of command file: %s\n", errline, g_err_line); free(g_err_line); free_cmds(&cf); return 0; } if (!check_keys(&cf)) { printf("keys do not match!\n"); free_cmds(&cf); return 0; } // set the uid to root, so that shell commands think they are really run from the root account setuid(geteuid()); for (i = 0; i < cf.num_cmds; i++) { printf("exec command %s <br>\n", cf.cmds[i].real_cmd); system(cf.cmds[i].real_cmd); } free_cmds(&cf); return 0; }
int redis_monitor::check_keys(const std::map<acl::string, acl::string>& info, std::vector<int>& keys) { int count = 0; for (std::map<acl::string, acl::string>::const_iterator cit = info.begin(); cit != info.end(); ++cit) { int n = check_keys(cit->first, cit->second); if (n > 0) count += n; } keys.push_back(count); return count; }
bool key_listener::process_event(const SDL_Event& event, bool claimed) { switch(event.type) { case SDL_KEYDOWN: case SDL_KEYUP: if(claimed) { reset(); break; } if(check_keys(event.key.keysym, event.type)) { claimed = true; } break; default: break; } return claimed; }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); init_sounds(); clock_gettime(CLOCK_REALTIME, &timePause); clock_gettime(CLOCK_REALTIME, &timeStart); //declare game object Game game; fmod_playsound(1); //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_resize(&e); check_mouse(&e, &game); done = check_keys(&e, &game); } clock_gettime(CLOCK_REALTIME, &timeCurrent); timeSpan = timeDiff(&timeStart, &timeCurrent); timeCopy(&timeStart, &timeCurrent); movementCountdown += timeSpan; while(movementCountdown >= movementRate) { movement(&game); movementCountdown -= movementRate; } render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); cleanup_fonts(); #ifdef USE_SOUND fmod_cleanup(); #endif //USE_SOUND return 0; }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=0; //set bubbler to false game.bubbler = false; // circle coordinates game.circle.radius = RADIUS; game.circle.center.x = 460.0; game.circle.center.y = 1.0; //declare boxes for(int x = 0; x < 5; ++x) { game.box[x].width = BOX_WIDTH; game.box[x].height = BOX_HEIGHT; game.box[x].center.x = 100 + 50*x; game.box[x].center.y = 600 - 5*60 - 50*x; } //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_mouse(&e, &game); done = check_keys(&e, &game); } movement(&game); render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); return 0; }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=0; // used to check if jumped, already in the air game.space = false; // deny jumping til collision on floor //declare a box shape game.box.width = BOX_WIDTH; game.box.height = BOX_HEIGHT; game.box.center.x = 20;//120 + 5*65; game.box.center.y = 10;//500 - 5*60; game.box.velocity.y = 0; game.box.velocity.x = 0; //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_mouse(&e, &game); check_resize(&e); done = check_keys(&e, &game); } movement(&game); render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); return 0; }
/*========================================= * check_index -- Validate one index node of btree * Created: 2003/09/05, Perry Rapp *=======================================*/ static BOOLEAN check_index (BTREE btr, INDEX index, TABLE fkeytab, RKEY * lo, RKEY * hi) { INT n = nkeys(index); INT i; if (!check_keys((BLOCK)index, lo, hi)) return FALSE; for (i = 0; i <= n; i++) { INDEX newix=0; char scratch[200]; FKEY fkey = fkeys(index, i); RKEY *lox, *hix; get_index_file(scratch, btr, fkey); if (in_table(fkeytab, scratch)) { printf(_("Cycle in indexes, file %s found again!\n"), scratch); return FALSE; } else { insert_table_int(fkeytab, scratch, 1); } newix = readindex(btr, fkey, TRUE); if (!newix) { printf(_("Error loading index at key")); printf("%ld\n", i); printblock((BLOCK)index); } /* figure upper & lower bounds of what keys should be in the child */ lox = (i==0 ? lo : &rkeys(index, i)); hix = (i==n ? hi : &rkeys(index, i+1)); if (ixtype(newix) == BTINDEXTYPE) { if (!check_index(btr, newix, fkeytab, lox, hix)) return FALSE; } else { if (!check_block((BLOCK)newix, lox, hix)) return FALSE; } } /* TODO: use fkeytab */ return TRUE; }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=0; //declare a box shape for (int i = 0; i < 5; i++) { game.box[i].width = 70 + i*5; game.box[i].height = 10; game.box[i].center.x = 120 + (i*80); game.box[i].center.y = 500 - (i*70); } game.circle.center.x = 700; game.circle.center.y = 0; game.circle.radius = 200; //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); //check_mouse(&e, &game); done = check_keys(&e, &game); } makeParticle(&game,35,550); movement(&game); render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); return 0; }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); Game game; DefineRagdoll(&game); init_opengl(&game); create_sounds(); play(); //declare game object init_keys(); clock_gettime(CLOCK_REALTIME, &timePause); clock_gettime(CLOCK_REALTIME, &timeStart); //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_mouse(&e, &game); check_resize(&game, &e); done = check_keys(&e); } clock_gettime(CLOCK_REALTIME, &timeCurrent); timeSpan = timeDiff(&timeStart, &timeCurrent); timeCopy(&timeStart, &timeCurrent); physicsCountdown += timeSpan; while(physicsCountdown >= physicsRate) { movement(&game); physicsCountdown -= physicsRate; } render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); cleanup_fonts(); return 0; }
int main(void) { logOpen(); initXWindows(); init_opengl(); init(); //buttonsInit();------------------------------------------------------------------ init_sounds(); clock_gettime(CLOCK_REALTIME, &timePause); clock_gettime(CLOCK_REALTIME, &timeStart); while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_resize(&e); check_mouse(&e); GOcheck_mouse(&e); check_keys(&e); } clock_gettime(CLOCK_REALTIME, &timeCurrent); timeSpan = timeDiff(&timeStart, &timeCurrent); timeCopy(&timeStart, &timeCurrent); physicsCountdown += timeSpan; while(physicsCountdown >= physicsRate) { physics(); physicsCountdown -= physicsRate; } render(); glXSwapBuffers(dpy, win); } cleanupXWindows(); cleanup_fonts(); #ifdef USE_SOUND fmod_cleanup(); #endif //USE_SOUND logClose(); return 0; }
bool wcore_config_attrs_parse( const int32_t waffle_attrib_list[], struct wcore_config_attrs *attrs) { memset(attrs, 0, sizeof(*attrs)); if (!check_keys(waffle_attrib_list)) return false; if (!parse_context_api(attrs, waffle_attrib_list)) return false; if (!set_context_version_default(attrs)) return false; if (!parse_context_version(attrs, waffle_attrib_list)) return false; if (!set_context_profile_default(attrs)) return false; if (!parse_context_profile(attrs, waffle_attrib_list)) return false; if (!parse_context_forward_compatible(attrs, waffle_attrib_list)) return false; if (!set_misc_defaults(attrs)) return false; if (!parse_misc(attrs, waffle_attrib_list)) return false; if (!check_final(attrs)) return false; return true; }
int main(void) { int done=0; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=0; game.bubbler = false; for (int i = 0; i < 5; i++) { game.box[i].width = 100; game.box[i].height = 15; game.box[i].center.x = 130 + (i*85); game.box[i].center.y = 475 - (i*75); } game.circle.radius = 140.0; game.circle.center.x = 400 + (5*65); game.circle.center.y = 300 - (5*60); //this big loop is called "the controller" //start animation "event loop" while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_mouse(&e, &game); done = check_keys(&e, &game); } movement(&game);//checks if anything moves render(&game);//renders images to the screen glXSwapBuffers(dpy, win);//swaps buffers } cleanupXWindows(); return 0; }
int main(void) { initXWindows(); srand(time(NULL)); clock_gettime(CLOCK_REALTIME, &timePause); clock_gettime(CLOCK_REALTIME, &timeStart); init_opengl(); init_ship(); //Do this to allow fonts glEnable(GL_TEXTURE_2D); initialize_fonts(); init_textures(); while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); check_resize(&e); check_mouse(&e); check_keys(&e); } clock_gettime(CLOCK_REALTIME, &timeCurrent); timeSpan = timeDiff(&timeStart, &timeCurrent); timeCopy(&timeStart, &timeCurrent); physicsCountdown += timeSpan; while (physicsCountdown >= physicsRate) { physics(); physicsCountdown -= physicsRate; render(); } //physics(); //render(); glXSwapBuffers(dpy, win); } cleanupXWindows(); cleanup_fonts(); return 0; }