void OpenSpace::render() { drawBody(*upper, sf::Color::Black); drawBody(*middle, sf::Color::Black); drawBodies(bodies, sf::Color::Black, sf::Color::White, -2); }
void renderAlive(void) { if (aimY > 0.0f) { drawCanon(); drawBody(); } else { drawBody(); drawCanon(); } if (firing) drawFire(); drawSprite(locX+aimX, locY+aimY, SCALE_CROSSHAIR, 0.0f, BLOCK_CROSSHAIR1, 0); drawSprite(locX+lookX, locY+lookY, SCALE_CROSSHAIR, 0.0f, BLOCK_CROSSHAIR2, 0); }
void Car::draw(DrawingState* d) { // Draw four wheel glColor3f(.1f,.1f,.1f); glPushMatrix(); glTranslatef(w-.5f,h,f-h); drawWheel(h,1); glPopMatrix(); glPushMatrix(); glTranslatef(w-.5f,h,f+r-h-1); drawWheel(h,1); glPopMatrix(); glPushMatrix(); glTranslatef(-w+.5f,h,f-h); glRotatef(180,0,1,0); drawWheel(h,1); glPopMatrix(); glPushMatrix(); glTranslatef(-w+.5f,h,f+r-h-1); glRotatef(180,0,1,0); drawWheel(h,1); glPopMatrix(); // Draw the body of the car glColor3fv(&color.r); drawBody(d); }
void animateSceneCenterMovement() { calculateBezier(points); for(int i = 0; i < bezierPoints.size(); ++i) { center.i = bezierPoints[i].x; center.j = bezierPoints[i].y; center.k = bezierPoints[i].z; ObjectModel* n = removePolygons(original); //pronadji matricu transformacije za postojece ociste i glediste float* MatrixViewT; float* MatrixProjectionT; MakeTransform(eye, center, &MatrixViewT, &MatrixProjectionT); float* Matrix; MatrixMultiply(MatrixViewT, 4, 4, MatrixProjectionT, 4, 4, &Matrix); ObjectModel* o = TransformCopy(n, Matrix); o->normalize(); free(MatrixViewT); free(MatrixProjectionT); free(Matrix); drawBody(o); delete n; delete o; sleep(1); } //glutSwapBuffers(); printf("Animacija gotova.\n"); }
void Render::paintGL() { glClear(GL_COLOR_BUFFER_BIT); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); move(); drawGrid(); drawCar(); drawSparks(); drawBody(world->getTrack()->getBody()); drawText(); drawParents(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glOrtho(0, width(), height(), 0, 1.0, -1.0); drawTable(); drawGraph(); glPopMatrix(); //GL_MODELVIEW glMatrixMode(GL_PROJECTION); glPopMatrix(); }
void NodeControl::draw(GlInterface &gl) { if(visible && isolateViewport(gl))// && ngd_parent->nodeIsVisible(node)) { drawBody(gl); restoreViewport(gl); } }
void drawBodies() { int i; for (i = 0; i < world.bodyCount; i++) { drawBody(&world.bodies[i]); } }
void Render::drawCar() { Car *car = world->getCar(); b2Body *axle, *wheel; for (int i = 0; i < 8; i++) { wheel = car->getWheel(i); if (wheel) drawBody(wheel); axle = car->getAxleBody(i); if (axle) drawBody(axle); } int piecesCount = car->getPiecesCount(); for (int i = 0; i < piecesCount; i++) { drawBody(car->getPiece(i)); } drawBody(car->getBody()); }
//performs the function of drawing for the letters. Allows for more transformations //@pre mv has been assigned //@post draws an O to the world //@param mv - the model view // color - the model color //@usage draw_O(some_model_view, some_color) void Letter_O::draw_O(mat4& mv, vec4 color) { // save the current modelview matrix on the stack glUniformMatrix4fv( model_view, 1, GL_TRUE, mv ); drawBody(mv, color); mv = mvMatrixStack.popMatrix(); }
void Letter_A::draw_A(mat4& mv) { // save the current modelview matrix on the stack mvMatrixStack.pushMatrix(mv); glUniformMatrix4fv( model_view, 1, GL_TRUE, mv ); drawBody(mv); mv = mvMatrixStack.popMatrix(); }
void drawRobot() { glPushMatrix(); glTranslatef (0, 0, -BodyH/2); drawBody(); glPopMatrix(); //Head glPushMatrix(); glTranslatef (0, 0, BodyH/2); glRotatef (HeadAngle, 0.0, 0.0, 1.0); drawHead(); glPopMatrix(); //Arms glPushMatrix(); glRotatef (ArmVertAngle, 1.0, 0.0, 0.0); glRotatef (ArmLatAngle, 0.0, 1.0, 0.0); drawArm(); glPopMatrix(); glPushMatrix(); glRotatef (-ArmVertAngle, 1.0, 0.0, 0.0); glRotatef (ArmLatAngle, 0.0, 1.0, 0.0); drawArm(); glPopMatrix(); //Legs glPushMatrix(); glTranslatef (0, 0, -BodyH/2); glRotatef (LegRotAngle, 0.0, 0.0, 1.0); glRotatef (-LegVertAngle, 1.0, 0.0, 0.0); drawLeg(); glPopMatrix(); glPushMatrix(); glTranslatef (0, 0, -BodyH/2); glRotatef (LegRotAngle+90, 0.0, 0.0, 1.0); glRotatef (-LegVertAngle, 1.0, 0.0, 0.0); drawLeg(); glPopMatrix(); glPushMatrix(); glTranslatef (0, 0, -BodyH/2); glRotatef (LegRotAngle+180, 0.0, 0.0, 1.0); glRotatef (-LegVertAngle, 1.0, 0.0, 0.0); drawLeg(); glPopMatrix(); glPushMatrix(); glTranslatef (0, 0, -BodyH/2); glRotatef (LegRotAngle+270, 0.0, 0.0, 1.0); glRotatef (-LegVertAngle, 1.0, 0.0, 0.0); drawLeg(); glPopMatrix(); }
/* void drawHelicopter() This function holds all the creation of the parts of the helicopter */ void Model::drawHelicopter() { glPushMatrix(); setPosition(); drawEngine(); drawTailConnect(); drawTail(); drawBody(); glPopMatrix(); // Last pop containing the helicopter glPopMatrix(); }
void PlayerPainter::drawAll( QPainter & painter, const rcss::rcg::PlayerT & player, const rcss::rcg::BallT & ball ) const { const Param param( player, ball, M_main_data.serverParam(), M_main_data.playerType( player.type_ ) ); drawBody( painter, param ); drawDir( painter, param ); if ( player.hasNeck() && player.hasView() && Options::instance().showViewArea() ) { drawViewArea( painter, param ); } if ( player.isGoalie() && Options::instance().showCatchArea() ) { drawCatchArea( painter, param ); } if ( Options::instance().showTackleArea() ) { drawTackleArea( painter, param ); } if ( Options::instance().showKickAccelArea() && Options::instance().selectedPlayer( player.side(), player.unum_ ) ) { drawKickAccelArea( painter, param ); } if ( player.isPointing() && Options::instance().showPointto() ) { drawPointto( painter, param ); } if ( Options::instance().showPlayerTrace() && Options::instance().selectedPlayer( param.player_.side(), param.player_.unum_ ) ) { drawTrace( painter, param ); } drawText( painter, param ); }
void Trogdor::drawTrogdor() { glPushMatrix(); glTranslated(this->position.getX(), this->position.getY(), this->position.getZ()); glScalef(8, 8, 8); glRotatef(facing, 0, 1, 0); glPushMatrix(); drawBody(); drawTail(); drawNeckHead(); drawLegs(); drawWings(); glPopMatrix(); glPopMatrix(); }
int main() { Surface* surface = new Surface(70, 60, ' '); drawBody(surface); drawCockpit(surface); drawWing(surface, true); drawWing(surface, false); drawSeats(surface); drawTail(surface); std::cout << surface->str() << std::endl; }
void Element::draw(DrawContext dc, double zoom) { dc->set_line_width(1); // GTimer *t = g_timer_new(); drawBody(dc, zoom); // gulong m; // g_timer_elapsed(t, &m); // DEBUG_MSG("Body: " << m) if(zoom > 0.6) drawIcon(dc); // g_timer_elapsed(t, &m); // DEBUG_MSG("Icon: " << m) drawPoints(dc); // g_timer_elapsed(t, &m); // DEBUG_MSG("Points: " << m) // g_timer_destroy(t); }
void drawBee() { mvstack.push(model_view); //rotate bee model_view *= RotateY(-10*TIME); model_view *= Translate(0, 5, 0); model_view *= Translate(5, .5*sin(100+TIME), 0); model_view *= RotateY(90); //draw bee parts drawBody(); drawHead(); drawTail(); drawWings(); drawLegz(); model_view = mvstack.pop(); }
void renderScene() { // ObjectModel* n = new ObjectModel(original); ObjectModel* n = removePolygons(original); //pronadji matricu transformacije za postojece ociste i glediste float* MatrixViewT; float* MatrixProjectionT; MakeTransform(eye, center, &MatrixViewT, &MatrixProjectionT); float* Matrix; MatrixMultiply(MatrixViewT, 4, 4, MatrixProjectionT, 4, 4, &Matrix); ObjectModel* o = TransformCopy(n, Matrix); o->normalize(); free(MatrixViewT); free(MatrixProjectionT); free(Matrix); drawBody(o); delete n; delete o; //delete original; }
void render::drawScene(void) { for(unsigned int i = 0; i < bodies.size(); i++) { drawBody(bodies[i]); } // Render static origin point glColor3f(1.0f, 0.0f, 0.0f); glBegin(GL_LINES); glVertex2f( 4, 0); glVertex2f( 1, 0); glVertex2f(-4, 0); glVertex2f(-1, 0); glVertex2f( 0, 4); glVertex2f( 0, 1); glVertex2f( 0,-4); glVertex2f( 0,-1); glEnd(); glBegin(GL_POINTS); glVertex2f( 0, 0); glEnd(); }
static void startContinuous(void){ // Method for continuing the Continuous mode resetContinuous(); drawGallow(); int i; for (i=0; i<try; i++){ if (i==0){ drawHead(); } else if (i==1){ drawBody(); } else if (i==2){ drawRightArm(); } else if (i==3){ drawLeftArm(); } else if (i==4){ drawRightLeg(); } } static char puc_score[10]; usprintf(puc_score, "Score: %d", score); RIT128x96x4StringDraw(puc_score, 69, 0, 15); displayAlphabet(); drawUnderscore(0, 83); drawHiddenWord(); } static void startClassic(void){ // Method for starting the Classic mode resetClassic(); drawGallow(); static char puc_score[10]; usprintf(puc_score, "Score: %d", score); RIT128x96x4StringDraw(puc_score, 69, 0, 15); displayAlphabet(); drawUnderscore(0, 83); drawHiddenWord(); }
void map::playerMov() { Uint8 *keystates = SDL_GetKeyState(NULL); if(keystates[SDLK_UP]) { drawBody(); } if(keystates[SDLK_DOWN]) { } if(keystates[SDLK_LEFT]) { } if(keystates[SDLK_RIGHT]) { } }
void map::run() { //Loads misc. data of screen loadScreen(); bool running = true; //Run loop while(running) { SDL_PollEvent(&occur); if(occur.type == SDL_QUIT) { running = false; } SDL_FillRect(screen, 0, NULL); //Update screen drawBody(); //Draws the snake } SDL_Quit(); }
void Render::drawSparks() { int sparksCount = world->getSparkCount(); for (int i = 0; i < sparksCount; i++) { drawBody(world->getSpark(i)); } }
void drawHelicopter(void) { glRotatef(180, 0.0f, 1.0f, 0.0f); if (lightingEnabled) { if (headlight) { setHeadlight(); } else { glDisable(GL_LIGHT1); } } glClearColor(0.49f, 0.75f, 0.93f, 1.0f); drawBody(); //Tail glPushMatrix(); glTranslatef(0.0f, 1.5f, -16.0f); glScalef(0.25f, 1.0f, 2.0f); glBegin(GL_POLYGON); gluCylinder(obj, 1.5, 1.5, 6, 100, 100); glEnd(); glPopMatrix(); //Back Body glPushMatrix(); glScalef(1.33f, 1.0f, 1.0f); glTranslatef(0.0f, 0.0f, -6.0f); glutSolidSphere(3, 100, 100); glPopMatrix(); drawCockpit(); glColor3f(0.50f, 0.50f, 0.50f); //Front Left Leg glPushMatrix(); glTranslatef(2.5f, -3.0f, 2.5f); glRotatef(90.0f, 1.0f, 0.0f, 0.0f); glBegin(GL_POLYGON); gluCylinder(obj, 0.25, 0.25, 1, 100, 100); glEnd(); glPopMatrix(); //Back Left Leg glPushMatrix(); glTranslatef(2.5f, -3.0f, -2.5f); glRotatef(90.0f, 1.0f, 0.0f, 0.0f); glBegin(GL_POLYGON); gluCylinder(obj, 0.25, 0.25, 1, 100, 100); glEnd(); glPopMatrix(); //Front Right Leg glPushMatrix(); glTranslatef(-2.5f, -3.0f, 2.5f); glRotatef(90.0f, 1.0f, 0.0f, 0.0f); glBegin(GL_POLYGON); gluCylinder(obj, 0.25, 0.25, 1, 100, 100); glEnd(); glPopMatrix(); //Back Right Leg glPushMatrix(); glTranslatef(-2.5f, -3.0f, -2.5f); glRotatef(90.0f, 1.0f, 0.0f, 0.0f); glBegin(GL_POLYGON); gluCylinder(obj, 0.25, 0.25, 1, 100, 100); glEnd(); glPopMatrix(); glColor3f(0.25f, 0.25f, 0.25f); //Landing Ski Left glPushMatrix(); glTranslatef(2.5f, -4.25f, 0.0f); glScalef(1.0f, 0.5f, 10.0f); glutSolidCube(1.0f); glPopMatrix(); //Landing Ski Right glPushMatrix(); glTranslatef(-2.5f, -4.25f, 0.0f); glScalef(1.0f, 0.5f, 10.0f); glutSolidCube(1.0f); glPopMatrix(); glColor3f(0.33f, 0.42f, 0.18f); //Tail Fin glPushMatrix(); glTranslatef(0.0f, 3.0f, -15.0f); glScalef(0.5f, 6.0f, 3.0f); glutSolidCube(1.0f); glPopMatrix(); /*Rotors drawn in separate methods in case we want to rotate them at some point. It would be easier to modify the code that way. */ // Draw top rotor glColor3f(0.50f, 0.50f, 0.50f); glPushMatrix(); glTranslatef(0.0, 4.0, 0.0); glRotatef(bladeAngle, 0.0, 1.0, 0.0); drawBladeCap(); glTranslatef(0.0, 1.0, 0.0); drawBlade(); glRotatef(120.0, 0.0, 1.0, 0.0); drawBlade(); glRotatef(120.0, 0.0, 1.0, 0.0); drawBlade(); glPopMatrix(); // Draw tail rotor glPushMatrix(); glTranslatef(0.5, 4.5, -15.0); glScalef(0.3, 0.3, 0.3); glRotatef(-90.0, 0.0, 0.0, 1.0); glRotatef(bladeAngle, 0.0, 1.0, 0.0); drawBladeCap(); glTranslatef(0.0, 0.5, 0.0); drawBlade(); glRotatef(120.0, 0.0, 1.0, 0.0); drawBlade(); glRotatef(120.0, 0.0, 1.0, 0.0); drawBlade(); glPopMatrix(); glColor3f(0.24f, 0.32f, 0.16f); //Left Wing glPushMatrix(); glTranslatef(6.5f, 0.5f, -2.0f); glRotatef(-30.0f, 0.0f, 0.0f, 1.0f); glScalef(1.0f, 0.075f, 0.60f); glutSolidCube(8.0f); glPopMatrix(); //Right Wing glPushMatrix(); glTranslatef(-6.5f, 0.5f, -2.0f); glRotatef(30.0f, 0.0f, 0.0f, 1.0f); glScalef(1.0f, 0.075f, 0.60f); glutSolidCube(8.0f); glPopMatrix(); //Tail Wings glPushMatrix(); glTranslatef(0.0f, 1.5f, -11.0f); glScalef(1.0f, 0.10f, 0.5f); glutSolidCube(4.0f); glPopMatrix(); glColor3f(0.50f, 0.50f, 0.50f); //Missile Launcher Left glPushMatrix(); glTranslatef(6.0f, -0.25f, -5.0f); glBegin(GL_POLYGON); gluCylinder(obj, 1, 1, 6, 100, 100); glEnd(); glPopMatrix(); //Missile Launcher Right glPushMatrix(); glTranslatef(-6.0f, -0.25f, -5.0f); glBegin(GL_POLYGON); gluCylinder(obj, 1, 1, 6, 100, 100); glEnd(); glPopMatrix(); glColor3f(0.25f, 0.25f, 0.25f); //Left Side Missile Head glPushMatrix(); glTranslatef(6.0f, -0.25f, 1.0f); glutSolidSphere(1.0, 50, 50); glPopMatrix(); //Right Side Missile Head glPushMatrix(); glTranslatef(-6.0f, -0.25f, 1.0f); glutSolidSphere(1.0, 50, 50); glPopMatrix(); //Machine gun glPushMatrix(); glTranslatef(0.0f, -2.5f, 9.0f); glBegin(GL_POLYGON); gluCylinder(obj, 0.25, 0.25, 2, 100, 100); glEnd(); glPopMatrix(); }
/* draws a penguin centered (roughly) at the origin Also moves him around in a circle It now takes a parameter that indicates whether or no the penguin is a shadow (just for coloring purposes) */ void drawPenguin( int is_shadow ) { /* the colors we apply to the bird */ /* Black does not really show lighting very well, (or at all!) so the bird is now a blusih colour */ GLfloat bluish[3]; GLfloat orange[3]; if( is_shadow ) { /* bluish and orange are both grey for a shadow */ bluish[0] = bluish[1] = bluish[2] = 0.2; orange[0] = orange[1] = orange[2] = 0.2; } else { /* for normal penguin, normal colors */ bluish[0] = 0.08; bluish[1] = 0.2; bluish[2] = 0.35; orange[0] = 1.0; orange[1] = 0.5; orange[2] = 0.0; } /* draw main body and head bluish */ glColor3fv( bluish ); glPushMatrix( ); /* Wobble the body a little bit */ glRotatef( wobble_amount, 0.0, 0.0, 1.0 ); drawHead( ); drawBody( ); /* draw the beak orange */ glColor3fv( orange ); drawBeak( ); glPopMatrix( ); /* draw penguin's left wing bluish */ glColor3fv( bluish ); drawLeftWing( ); /* draw the left foot orange */ glColor3fv( orange ); drawLeftFoot( ); /* to draw the penguins' right appendages, we just invert the world along the X axis, and draw the left ones over again... */ glScalef( -1.0, 1.0, 1.0 ); glColor3fv( bluish ); /* bluish wing */ drawLeftWing( ); /* orange */ glColor3fv( orange ); /* to make the left and right rotate on an opposite way, we invert the right one... */ GLfloat temp = foot_move_amount; foot_move_amount = abs( 90.0 - foot_move_amount ); drawLeftFoot( ); foot_move_amount = temp; /* reset the value for the left foot */ }
void GPIOFIntHandler(void){ // Method for handling multiple functions for a select button press // Clear the GPIO interrupt GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1); // Disable Interrupts GPIOPinIntDisable(GPIO_PORTF_BASE, GPIO_PIN_1); GPIOPinIntDisable(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3); // Check which state we are in if (state==0){ // This state handles the main menu if (pointer==0){ // Begin Classic Mode state = 1; startClassic(); } else if (pointer==1){ // Begin Continuous Mode state = 3; startClassic(); } else if (pointer==2){ // Show the instructions state = 2; RIT128x96x4Clear(); displayInstructions(); done = 1; } else if (pointer==3){ // Show the high scores state = 2; RIT128x96x4Clear(); displayScores(); done = 1; } else if (pointer==4){ state = 0; initMain(); } } else if (state==1){ // This state handles classic mode // Black out the letter that was selected int idx = position + position2; int pos = 0; char *puc_letter = alpha[idx]; if (idx>12){ pos = position2 * 10; RIT128x96x4StringDraw(puc_letter, pos, 87, 2); } else { pos = position * 10; RIT128x96x4StringDraw(puc_letter, pos, 75, 2); } // Add the letter to the list of selected letters int i; int wrong = 1; int used = 0; // Loop through the list until we find an empty spot to place the letter for (i=0; i<26; i++){ if (strcmp(selected[i],"!")==0){ selected[i] = puc_letter; break; } if (strcmp(selected[i],puc_letter)==0){ wrong = 0; used = 1; break; } } // Check to see if the letter was already used if (!used){ // Check the word to see if a letter matches the one selected. If it // does, we need to display the letters instead of an underscore for (i=0; i<strlen(words[wotd]); i++){ char w_let = words[wotd][i]; static char g[3]; usprintf(g, "%d", w_let); char p_let = *puc_letter; if (w_let==p_let){ wrong = 0; // Display the letter selected RIT128x96x4StringDraw(puc_letter, 10+i*10, 53, 15); correct++; } } } // Check to see if it was a wrong selection if (wrong==1){ // Increment the number of wrong attempts try++; // If the selection was wrong, we need to draw a piece of the hangman if (try==1){ drawHead(); } else if (try==2){ drawBody(); } else if (try==3){ drawRightArm(); } else if (try==4){