void Field::draw(std::ostream& os) { Disc* dsc; for(unsigned int i = height; i > 0; i--) { for(unsigned int j = 0; j < width; j++) { dsc = getDisc(j,i-1); if(dsc == NULL) { os << " ["; Field::spacer(os, tlMax, " "); os << "]"; } else { os << " [" << *dsc->getColor()->getToken(); Field::spacer(os, (unsigned int)(tlMax-dsc->getColor()->getToken()->length()), " "); os << "]"; } } os << std::endl; } // draw column numbers and separation line for(unsigned int i = 0; i < width; i++) { os << "---"; Field::spacer(os, tlMax, "-"); } os << std::endl; for(unsigned int i = 0; i < width; i++) { os << " [" << i+1; Field::spacer(os, tlMax-1, " "); os << "]"; } os << std::endl << std::endl; }
static float identify_partition(int fd, partition_data *partition, void **cookie) { DEBUG_INIT_ETC(NULL, ("fd: %d, id: %ld, offset: %Ld, " "size: %Ld, block_size: %ld, flags: 0x%lx", fd, partition->id, partition->offset, partition->size, partition->block_size, partition->flags)); device_geometry geometry; float result = -1; if ((partition->flags & B_PARTITION_IS_DEVICE) != 0 && partition->block_size == 2048 && ioctl(fd, B_GET_GEOMETRY, &geometry) == 0 && geometry.device_type == B_CD) { Disc *disc = new(std::nothrow) Disc(fd); if (disc != NULL && disc->InitCheck() == B_OK) { // If we have only a single session then we can let the file system // drivers play directly with the device. Session *session = disc->GetSession(1); if (session != NULL) { result = 0.9f; delete session; } else result = 0.1f; *cookie = static_cast<void*>(disc); } else delete disc; } PRINT(("returning %g\n", result)); return result; }
bool isDiscInside(Disc d,Hole h) { if(isLessThan(abs(d.getX() - h.getX()),h.getRadius()) && isLessThan(abs(d.getY() - h.getY()),h.getRadius())) return true; else return false; }
void loop_pulse_function(void *data, int message){ Disc *d = static_cast<Disc *>(data); if (message != -100) d->set_texture(15 + message); if (message == -4){ d->set_orb_maintain(100); } d->pulse(); }
void drawRadar(){ //Set up orthographic projection for radar mat4 projection1 = perspective(45.0f, window.window_aspect, 0.01f, 10.0f); glm::mat4 Projection2 = glm::ortho( -10.0f, 10.0f, -10.0f, 00.0f,1.0f, 10.0f); glm::mat4 View = glm::lookAt( glm::vec3(0,0,5), // Camera is at (0,0,5), in World Space glm::vec3(0,0,0), // and looks at the origin glm::vec3(0,1,0) // Head is up (set to 0,-1,0 to look upside-down) ); mat4 another = View; mat4 healthBarMatrix = View; another = translate(another, vec3(8.5,-8.5,0)); another = rotate(another, 90.0f, vec3(0,1,0)); another = rotate(another, 90.0f, vec3(0,0,1)); healthBarMatrix = translate(healthBarMatrix, vec3(-9.5,-0.5,0)); //healthBarMatrix = rotate(healthBarMatrix, 90.0f, vec3(0,1,0)); healthBarMatrix = rotate(healthBarMatrix, -90.0f, vec3(0,0,1)); healthBarMatrix = scale(healthBarMatrix, vec3(0.05f, userTeam.soldiers[0].health/10.f, 0.05f)); if(userTeam.soldiers[0].health < 50){ healthBar.color = vec3(1.f, userTeam.soldiers[0].health/50.f, 0.f); } else{ healthBar.color = vec3(1.f - (userTeam.soldiers[0].health-50.f)/50.f, 1.f, 0.f); } healthBar.Draw(Projection2, healthBarMatrix, tod, 0); mat4 radar = another; //Radar display int radarBlipTime = current_timeDisplay * 1000; float radarBlip = 0.0015 * (radarBlipTime%1000); radar = scale(radar, vec3(radarBlip, radarBlip, radarBlip)); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); disc.color = vec3(0,1,0); disc.Draw(Projection2, radar, tod, 0); another = scale(another, vec3(1.5, 1.5, 1.5)); disc.Draw(Projection2, another, tod, 0); glPolygonMode(GL_FRONT_AND_BACK, window.wireframe ? GL_LINE : GL_FILL); disc.color = vec3(0,0.25,0); disc.Draw(Projection2, another, tod, 0); another = translate(View, vec3(8.5 - ((3/104.6)*transX),-8.6 + ((3/104.6)*transZ),0)); usr.Draw(Projection2, another, tod, 0); stringstream ammo (stringstream::in | stringstream::out); ammo << userTeam.soldiers[0].ammo; activeTextDisplay(("Ammo: " + ammo.str()).c_str(), -0.95f, -0.85f, 16); }
bool checkNearness(Disc d, Wall w,int wallno) { bool cond = (wallno==0 || wallno==2); if(abs((cond?d.getY():d.getX()) - (cond?w.getY():w.getX())) <= d.getRadius() && (cond?d.getVy():d.getVx())*(cond?w.getY():w.getX())>= 0) { //cout<<d.getDiscNo()<<" colliding with wall"<<wallno<<endl; return true; } return false; }
Disc * MusicBrainz::readDisc(const std::string &deviceName) { #ifdef DISCID_FOUND DiscId *discid = discid_new(); if (!discid) { throw DiscError("Couldn't create a new DiscId instance."); } if (!discid_read(discid, deviceName.empty() ? NULL : deviceName.c_str())) { string msg(discid_get_error_msg(discid)); discid_free(discid); throw DiscError(msg); } Disc *disc = new Disc; disc->setId(discid_get_id(discid)); disc->setSectors(discid_get_sectors(discid)); disc->setFirstTrackNum(discid_get_first_track_num(discid)); disc->setLastTrackNum(discid_get_last_track_num(discid)); for (int i = disc->getFirstTrackNum(); i <= disc->getLastTrackNum(); i++) { disc->addTrack(Disc::Track(discid_get_track_offset(discid, i), discid_get_track_length(discid, i))); } discid_free(discid); return disc; #else throw DiscError("libdiscid is not available."); #endif }
bool checkNextCollision(Disc d1,Disc d2) { double relVx = d1.getVx() - d2.getVx(); double relVy = d1.getVy() - d2.getVy(); double relx = d1.getX() - d2.getX(); double rely = d1.getY() - d2.getY(); if(relVx*relx + relVy*rely < 0) return true; return false; }
bool TowerHanoi::move(int from, int to) { if (!this->towers[from]->empty()) { Disc* objFrom = this->towers[from]->front(); if (!this->towers[to]->empty()) { Disc* objTo = this->towers[to]->front(); if (objFrom->getCount() < objTo->getCount()) { this->towers[to]->push(this->towers[from]->pop()); if ((to > 0) && (this->towers[to]->size() == this->discs)) { this->win = true; } return true; } } else { this->towers[to]->push(this->towers[from]->pop()); return true; } } return false; }
//Deletes all of the created objects here. void CloseFunc(){ window.window_handle = -1; cylinder.TakeDown();torus.TakeDown();square.TakeDown();square2.TakeDown(); disc.TakeDown();sphere.TakeDown();sphere2.TakeDown();tiger.TakeDown();goldeen.TakeDown(); stadium.TakeDown();coin.TakeDown();ss.TakeDown();healthBar.TakeDown(); shark.TakeDown();bird.TakeDown();sb.TakeDown();arena.TakeDown();skyboxUW.TakeDown();fbo.TakeDown();rain2.TakeDown(); tri2.TakeDown();skybox.TakeDown();skybox2.TakeDown();skybox3.TakeDown();egg.TakeDown();snow2.TakeDown(); star.TakeDown();magneton.TakeDown();haunter.TakeDown();frog.TakeDown(); sph1.TakeDown(); enm.TakeDown(); usr.TakeDown();sq4.TakeDown();soldier.TakeDown();userTeam.TakeDown();cpuTeam.TakeDown(); }
void DisplayDisc() { Window * window = Window::FindCurrentWindow(windows); if (window->handle == BAD_GL_VALUE) return; glViewport(0, 0, window->size.x, window->size.y); vec4 crimson(0.6f , 0.0f , 0.0f , 1.0f); vec3 ambient = vec3(0.0f , 0.0f , 0.0f); vec3 specular = vec3(0.0f , 0.0f , 0.3f); vec3 diffuse = vec3(0.0f , 0.0f , 0.9f); glClearColor(crimson.r , crimson.g , crimson.b , crimson.a); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glEnable(GL_DEPTH_TEST); mat4 model_matrix = rotate(mat4() , radians(window->LocalTime() * 30.0f) , vec3(0.0f , 1.0f , 0.0f)); model_matrix = scale(model_matrix , vec3(3.0f , 3.0f , 3.0f)); mat4 view_matrix = lookAt(vec3(0.0f , 0.0f , 8.0f) , vec3(0.0f , 0.0f , 0.0f) , vec3(0.0f , 1.0f , 0.0f)); mat4 projection_matrix = perspective(radians(window->fovy) , window->aspect , window->near_distance , window->far_distance); phong_shader.Use(model_matrix , view_matrix , projection_matrix); phong_shader.SetMaterial(diffuse , specular , 128.0f , ambient); phong_shader.SetLightPosition(vec3(0.0f , 0.0f , 1000.0f)); phong_shader.SelectSubroutine(PhongShader::PHONG_WITH_TEXTURE); phong_shader.EnableTexture(textures[2] , 0); disc3.Draw(false); phong_shader.UnUse(); if (window->draw_normals) { constant_shader.Use(model_matrix , view_matrix , projection_matrix); constant_shader.SetMaterial(diffuse , specular , 32.0f , vec3(1.0f , 1.0f , 1.0f)); disc3.Draw(true); constant_shader.UnUse(); } glutSwapBuffers(); disc3.UpdateValues(TestUpdateDisc , window->LocalTime(), nullptr); }
void afterCollision(Disc d1,Disc d2,double v[][2]) { //double **v = (double**) malloc(4*sizeof(double)); //cout<<"array declared"<<endl; //sleep(2); double vector_par[2],vector_per[2],u_par[2],v_per[2],v_par[2],l; double v1[2][2],y,x; double v1x = d1.getVx(),v2x = d2.getVx(),v1y = d1.getVy(),v2y = d2.getVy(),m1 = d1.getMass(),m2 = d2.getMass(); double slope; y=(d1.getY()-d2.getY()); x=(d1.getX()-d2.getX()); l=sqrt(y*y+x*x); vector_par[0]=x/l; vector_par[1]=y/l; vector_per[0]=y/l; vector_per[1]=-x/l; //cout<<"vector par"<<vector_par[0]<<"+"<<vector_par[1]<<"\n"; //cout<<"vector_per"<<vector_per[0]<<"+"<<vector_per[1]<<"\n"; //cout<<"v1"<<v1x<<"+"<<v1y<<"\n"; //cout<<"v2"<<v2x<<"+"<<v2y<<"\n"; u_par[0]=v1x*vector_par[0]+v1y*vector_par[1]; u_par[1]=v2x*vector_par[0]+v2y*vector_par[1]; //cout<<u_par[0]<<"+"<<u_par[1]<<"\n"; v_per[0]=v1x*vector_per[0]+v1y*vector_per[1]; v_per[1]=v2x*vector_per[0]+v2y*vector_per[1]; //cout<<v_per[0]<<"+"<<v_per[1]<<"\n"; v_par[0]=(m1*u_par[0] + m2*u_par[1] + m2*ed*(u_par[1]-u_par[0]))/(m1+m2); v_par[1]=(m1*u_par[0] + m2*u_par[1] - m1*ed*(u_par[1]-u_par[0]))/(m1+m2); //cout<<v_par[0]<<"+"<<v_par[1]<<"+"; //cout<<"slope"<<slope<<"\n"; //sleep(2); v[0][0]=v_par[0]*vector_par[0]+v_per[0]*vector_per[0]; v[0][1]=v_par[0]*vector_par[1]+v_per[0]*vector_per[1]; v[1][0]=v_par[1]*vector_par[0]+v_per[1]*vector_per[0]; v[1][1]=v_par[1]*vector_par[1]+v_per[1]*vector_per[1]; //cout<<"disk"<<v[0][0]<<"+"<<v[0][1]<<"\n"; //cout<<"striker"<<v[1][0]<<"+"<<v[1][1]<<"\n"; }
static status_t scan_partition(int fd, partition_data *partition, void *cookie) { DEBUG_INIT_ETC(NULL, ("fd: %d, id: %ld, offset: %Ld, size: %Ld, " "block_size: %ld, cookie: %p", fd, partition->id, partition->offset, partition->size, partition->block_size, cookie)); Disc *disc = static_cast<Disc*>(cookie); partition->status = B_PARTITION_VALID; partition->flags |= B_PARTITION_PARTITIONING_SYSTEM | B_PARTITION_READ_ONLY; partition->content_size = partition->size; Session *session = NULL; status_t error = B_OK; for (int i = 0; (session = disc->GetSession(i)); i++) { partition_data *child = create_child_partition(partition->id, i, partition->offset + session->Offset(), session->Size(), -1); if (!child) { PRINT(("Unable to create child at index %d.\n", i)); // something went wrong error = B_ERROR; break; } child->block_size = session->BlockSize(); child->flags |= session->Flags(); child->type = strdup(session->Type()); delete session; if (!child->type) { error = B_NO_MEMORY; break; } child->parameters = NULL; } PRINT(("error: 0x%lx, `%s'\n", error, strerror(error))); RETURN(error); }
int read(void* to, int count) { u8 tmp[2048]; verify(count != 0); int rem = count; while (rem >= 2048) { disc->ReadSectors( (pos/2048) + offs, 1, tmp, 2048); int toread = min(2048, rem) - pos%2048; memcpy(to, &tmp[pos%2048], toread), (char*&)to += rem; pos += toread; rem -= toread; } return count; }
void playHole(int holeName, Hole currentHole, Player jimmy, int *score ) { //array of things to pass from graphics to disc class double* stuff; int scoreHole = 0 ; Disc disc; int past = 0; int diff; std::string currentPic; while( !disc.checkHole(currentHole.getX(), currentHole.getY()) && !past) { currentPic = disc.pickScreen(holeName); //cout << currentPic << endl; //play the current hole stuff = play(currentPic, jimmy.getSong(), currentHole.getY() - disc.getY(), currentHole.getX() - disc.getX(), *score, scoreHole); //throw the frisbee disc.letFly(stuff[0],stuff[1],stuff[2],jimmy.getPower(),jimmy.getAccuracy(), currentHole); //track score (*score)++; scoreHole++; //see if disc has passed hole if(disc.getX() > currentHole.getX()) { past = 1; //cout << "You passed the hole. Auto score set to 8." << endl; diff = 8 - scoreHole; scoreHole = 8; (*score) += diff; } } // determine which end screen to show if( past ) play(currentPic,jimmy.getSong(), -6, -6, *score, scoreHole); else play(currentPic,jimmy.getSong(), 0,0, *score, scoreHole); if( holeName == 5) play("../../pictures/Pat_being_a_goon.png",jimmy.getSong(), -7,-7, *score, 0); }
Scene* ConfigReader::parse(){ string line, label, rest, svalue; while ( getline(is_f,line)){ parseObject(line,label,rest); if (label == "sphere" ) { Sphere* s = new Sphere(); if (parseSphere(rest,*s)){ _s.objects.push_back(s); } if (s->isLight()) _s.olights.push_back(s); } else if (label == "scene" ) { if (parseScene(rest,_s)){ } } else if (label == "camera" ) { if (parseCamera(rest,_s.camera)){ } }else if (label == "material" ) { Material tmp; Material *m = NULL; if (parseMaterial(rest,tmp)){ switch (tmp.type) { case DIFF: m = new DiffuseMaterial(tmp); break; case SPEC: m = new MirrorMaterial(tmp); break; case SPECP: m = new PhongMetalMaterial(tmp); break; case DSPEC: m = new DiffSpecularMaterial(tmp); break; case REFR: m = new DielectricMaterial(tmp); break; } _s.materials.push_back(m); } } else if (label == "plane" ) { Plane* p = new Plane(); if (parsePlane(rest,*p)){ _s.objects.push_back(p); } if (p->isLight()) _s.olights.push_back(p); } else if (label == "frame" ) { Frame* f = new Frame(); if (parseFrame(rest,*f)){ _s.objects.push_back(f); } if (f->isLight()) _s.olights.push_back(f); } else if (label == "disc" ) { Disc* c = new Disc(); if (parseDisc(rest,*c)){ _s.objects.push_back(c); } if (c->isLight()) _s.olights.push_back(c); } if (label == "triangle" ) { Triangle* t = new Triangle(); if (parseTriangle(rest,*t)){ _s.objects.push_back(t); } if (t->isLight()) _s.olights.push_back(t); } else if (label == "box" ) { Box* b = new Box(); if (parseBox(rest,*b)){ b->fill(); _s.objects.push_back(b); } if (b->isLight()) _s.olights.push_back(b); } } return &_s; }
bool checkNearness(Disc d1,Disc d2) { double vrel_radial,arel_radial; double vector_par[2],x,y,l; double xgap = abs(d1.getX() - d2.getX()); double ygap = abs(d1.getY() - d2.getY()); y=(d1.getY()-d2.getY()); x=(d1.getX()-d2.getX()); l=sqrt(y*y+x*x); vector_par[0]=x/l; vector_par[1]=y/l; vrel_radial=(d1.getVx()-d2.getVx())*vector_par[0]+(d1.getVy()-d2.getVy())*vector_par[1]; arel_radial=(d1.getAx()-d2.getAx())*vector_par[0]+(d1.getAy()-d2.getAy())*vector_par[1]; error=vrel_radial*delt+0.5*arel_radial*delt*delt; double r = d1.getRadius() + d2.getRadius()+error; if(xgap*xgap + ygap*ygap<=r*r ) //sleep(1); if(xgap*xgap + ygap*ygap <= r*r && (checkNextCollision(d1,d2))) { cout<<"colission bw "<<d1.getDiscNo()<<" "<<d2.getDiscNo()<<endl; //sleep(1); error=0; return true; } error=0; return false; }
void DrawScene(Window * window) { phong_shader.GLReturnedError("DrawScene() - entering"); #ifdef MOVE mat4 m = rotate(mat4() , radians(window->LocalTime() * 30.0f) , vec3(0.0f , 1.0f , 0.2f)); m = translate(m, vec3(0.0f, 11.5f * cos(window->LocalTime() * 0.5f) + 2.0f, 11.5f * sin(window->LocalTime() * 0.5f) + 2.0f)); #else mat4 m; #endif // MOVE mat4 view_matrix = lookAt(vec3(m * vec4(eye, 1.0f)), cop, up); mat4 model_matrix; mat4 projection_matrix = perspective(radians(window->fovy), window->aspect, window->near_distance, window->far_distance); vec3 z_axis = vec3(0.0f, 0.0f, 1.0f); vec3 y_axis = vec3(0.0f, 1.0f, 0.0f); vec3 ambient = vec3(0.1f, 0.1f, 0.1f); vec3 specular = vec3(1.0f, 1.0f, 1.0f); float c_offset = radians(45.0f); glViewport(0, 0, window->size.x, window->size.y); const int count_of_shapes = 4; for (unsigned int i = 0; i < instances.size(); i++) { model_matrix = translate(mat4(), instances[i].position); model_matrix = rotate(model_matrix, radians(window->LocalTime() * instances[i].rate) + instances[i].offset, y_axis); if (i % count_of_shapes == 3) model_matrix = scale(model_matrix, vec3(0.25f, 0.25f, 0.25f)); phong_shader.Use(model_matrix, view_matrix, projection_matrix); phong_shader.SetMaterial(instances[i].diffuse, specular, 32.0f, ambient); phong_shader.SetLightPosition(vec3(0.0f, 0.0f, 1000.0f)); switch (i % count_of_shapes) { case 0: disc1.Draw(false); break; case 1: disc3.Draw(false); break; case 2: plane2.Draw(false); break; case 3: cube.Draw(false); break; } phong_shader.UnUse(); #ifdef SHOW_NORMALS if (i == 0) { constant_shader.Use(model_matrix, view_matrix, projection_matrix); constant_shader.SetMaterial(vec3(0.0f, 0.0f, 0.8f), specular, 128.0f, vec3(1.0f, 0.0f, 0.0f)); disc1.Draw(true); constant_shader.UnUse(); } #endif } model_matrix = mat4(); mat4 mz = model_matrix; model_matrix = scale(model_matrix, vec3(0.5f, 0.5f, 16.0f)); phong_shader.Use(model_matrix, view_matrix, projection_matrix); phong_shader.SetMaterial(vec3(0.0f, 0.0f, 0.8f), specular, 128.0f, ambient); phong_shader.SetLightPosition(vec3(0.0f, 1000.0f, 0.0f)); cylinder1.Draw(false); phong_shader.UnUse(); #ifdef SHOW_NORMALS constant_shader.Use(model_matrix, view_matrix, projection_matrix); constant_shader.SetMaterial(vec3(0.0f, 0.0f, 0.8f), specular, 128.0f, vec3(1.0f, 1.0f, 1.0f)); cylinder.Draw(true); constant_shader.UnUse(); #endif model_matrix = rotate(mz, radians(90.0f), y_axis); model_matrix = scale(model_matrix, vec3(0.5f, 0.5f, 16.0f)); phong_shader.Use(model_matrix, view_matrix, projection_matrix); phong_shader.SetMaterial(vec3(1.0f, 0.0f, 0.0f), specular, 128.0f, ambient); phong_shader.SetLightPosition(vec3(0.0f, 1000.0f, 0.0f)); cylinder1.Draw(false); phong_shader.UnUse(); model_matrix = rotate(mz, radians(-90.0f), vec3(1.0f, 0.0f, 0.0f)); model_matrix = scale(model_matrix, vec3(0.5f, 0.5f, 16.0f)); phong_shader.Use(model_matrix, view_matrix, projection_matrix); phong_shader.SetMaterial(vec3(0.0f, 1.0f, 0.0f), specular, 128.0f, ambient); phong_shader.SetLightPosition(vec3(0.0f, 1000.0f, 0.0f)); cylinder1.Draw(false); phong_shader.UnUse(); cylinder1.UpdateValues(TestUpdate, window->LocalTime(), nullptr); }
int main(int argc, char * argv[]) { glewInit(); glutInit(&argc, argv); glutInitWindowSize(1024, 512); glutInitWindowPosition(0, 0); glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); //Initialize object's colors / values torus.color = vec3(1.0f, 0.1f, 0.0f); square.color1 = vec3(1.0, 1.0, 1.0); square2.color1 = vec3(0.95f, 0.1f, 0.7f); square2.color2 = vec3(1.0f, 1.0f, 0.0f); disc.color = vec3(0.1f, 0.5f, 1.0f); sphere.color = vec3(0.15f, 0.45f, 0.0f); sphere2.color = vec3(0.45f, 0.05f, 0.25f); cylinder.color = vec3(0.0f, 0.5f, 0.0f); arena.texID = 18; egg.texID = 20; star.texID = 22; magneton.texID = 25; haunter.texID = 26; frog.texID = 27; goldeen.texID = 76; rain2.color = vec3(0.4f, 0.4f, 1.0f); snow2.color = vec3(1.0f, 1.0f, 1.0f); fontfilename = "Pokemon.ttf"; //Initialize the precipitation numParts = 300; partX = new float[numParts]; partY = new float[numParts]; partOffset = new float[numParts]; for(int i=0; i<numParts; i++){ partX[i] = (float)(rand() % 1200); partX[i] = (partX[i] - 600)/100; partY[i] = (float)(rand() % 1200); partY[i] = (partY[i] - 600)/100; partOffset[i] = (float)(rand() % 360 + 1); } sphere.lava = true;sphere2.lava = false; //Initialize sphere statuses window.window_handle = glutCreateWindow("Solar System"); glutReshapeFunc(ReshapeFunc); glutCloseFunc(CloseFunc); glutMotionFunc(mouseMovement); glutPassiveMotionFunc(mouseMovement); //check for mouse movement glutKeyboardFunc(KeyboardFunc); glutSpecialFunc(SpecialFunc); glutTimerFunc(window.interval, TimerFunc, 0); glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION); //Initialize everything if (glewInit() != GLEW_OK) { cerr << "GLEW failed to initialize." << endl; return 0; } init_resources(); glutDisplayFunc(DisplayFunc); if (!fbo.Initialize(glm::ivec2(512, 512), 1, true)){ cerr << "Frame buffer failed to initialize." << endl; return 0; } sph1.color = vec3(1.0f, 0.85f, 0.0f); if (!sph1.Initialize(8,1.0f, "phong3.vert", "phong3.frag")){return 0;} enm.color = vec3(0.75f, 0.0f, 0.75f); if (!enm.Initialize(2,0.05f, "phong.vert", "phong.frag")){return 0;} usr.color = vec3(0.0f, 0.0f, 0.5f); if (!usr.Initialize(2,0.05f, "phong.vert", "phong.frag")){return 0;} //if (!sb.Initialize()){return 0;} //if (!coin.Initialize()){return 0;} //if (!stadium.Initialize(0)){return 0;} if (!skybox.Initialize(0, 5000, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;} if (!skybox2.Initialize(1, 5025, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;} if (!skybox3.Initialize(2, 5050, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;} if (!skyboxUW.Initialize(3, 5075, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;} arena.order = 1; if (!sphere.Initialize(15, 1, "sphereShader2.vert", "sphereShader2.frag")){return 0;} if (!sphere2.Initialize(15, 1, "sphereShader2.vert", "sphereShader2.frag")){return 0;} if (!rain2.Initialize(2, 0.02f, "phong.vert", "phong.frag")){return 0;} if (!snow2.Initialize(3, 0.02f, "phong.vert", "phong.frag")){return 0;} //if (!egg.Initialize(15, 1, "./textures/alienEgg.jpg", "basic_texture_shader.vert", "basic_texture_shader.frag")){return 0;} if (!square.Initialize(1, 3.0f, "phong.vert", "phong.frag")) {return 0;} if (!sq4.Initialize(1, 5.0f, "basic_texture_shader.vert", "basic_texture_shader.frag")) {return 0;} if (!disc.Initialize(8, 1.0f, "phong3.vert", "phong3.frag")) {return 0;} if (!healthBar.Initialize(2, 1.0f, 1.f, 1.f, "phong3.vert", "phong3.frag")) {return 0;} if (!soldier.Initialize()) {return 0;} if (!ss.Initialize()) {return 0;} userTeam.userTeam = true; if (!userTeam.Initialize()) {return 0;} if (!cpuTeam.Initialize()) {return 0;} glutMainLoop(); }
int main(int argc, char **argv) { if (argc < 1) { cout << "Usage: cdlookup [device]" << endl; return 1; } string device; if (argc > 1) device = argv[1]; Disc *disc; try { disc = readDisc(device); } catch (DiscError &e) { cout << "Error: " << e.what() << endl; return 1; } string discId = disc->getId(); delete disc; cout << "Disc Id: " << discId << endl << endl; Query q; ReleaseResultList results; try { ReleaseFilter f = ReleaseFilter().discId(discId); results = q.getReleases(&f); } catch (WebServiceError &e) { cout << "Error: " << e.what() << endl; return 1; } for (ReleaseResultList::iterator i = results.begin(); i != results.end(); i++) { ReleaseResult *result = *i; Release *release; try { release = q.getReleaseById(result->getRelease()->getId(), &ReleaseIncludes().tracks().artist()); } catch (WebServiceError &e) { cout << "Error: " << e.what() << endl; continue; } cout << "Id : " << release->getId() << endl; cout << "Title : " << release->getTitle() << endl; cout << "Tracks : "; int trackno = 1; for (TrackList::iterator j = release->getTracks().begin(); j != release->getTracks().end(); j++) { Track *track = *j; Artist *artist = track->getArtist(); if (!artist) artist = release->getArtist(); cout << trackno++ << ". " << artist->getName() << " / " << track->getTitle() << endl; cout << " "; } cout << endl; delete result; } return 0; }