static void draw(ALLEGRO_JOYSTICK *curr_joy) { int x = 100; int y = 100; ALLEGRO_JOYSTICK_STATE joystate; int i; al_clear_to_color(al_map_rgb(0, 0, 0)); if (curr_joy) { al_get_joystick_state(curr_joy, &joystate); for (i = 0; i < al_get_joystick_num_sticks(curr_joy); i++) { al_draw_filled_circle( x+joystate.stick[i].axis[0]*20 + i * 80, y+joystate.stick[i].axis[1]*20, 20, al_map_rgb(255, 255, 255) ); } for (i = 0; i < al_get_joystick_num_buttons(curr_joy); i++) { if (joystate.button[i]) { al_draw_filled_circle( i*20+10, 400, 9, al_map_rgb(255, 255, 255) ); } } } al_flip_display(); }
void drawTracks() { int n; float y = ((float)SCREEN_H - (CAR_WIDTH * 1.3) * TRACKS_NUM)/2; for (n = TRACKS_BEGIN-5; n <= TRACKS_FINISH; n += 400) { al_draw_filled_circle( n + world_x, y - 60, 10, al_map_rgb(255,255,0)); } al_draw_filled_rectangle(0, y, SCREEN_W, y + 1.3*CAR_WIDTH*TRACKS_NUM, al_map_rgb(20,20,20)); for(n = 0; n <= TRACKS_NUM; n++) { al_draw_line( (float)TRACKS_BEGIN + world_x, y, (float)TRACKS_FINISH + world_x, y, al_map_rgb(200,200,200 ), 1); y += (float)(CAR_WIDTH * 1.3); } for (n = TRACKS_BEGIN-5; n <= TRACKS_FINISH; n += 400) { al_draw_filled_circle( n + world_x, y + 40, 10, al_map_rgb(255,255,0)); } }
void particle_circ::render(double tx, double ty){ if(tracer){ al_draw_line( tx-x_vel/2, ty-y_vel/2, tx, ty, color, 2*rad ); al_draw_filled_circle( tx-x_vel/2, ty-y_vel/2, rad, color); al_draw_filled_circle( tx, ty, rad, color); }else{ al_draw_filled_circle( tx, ty, rad, color); } }
void particle_circ::render(){ if(tracer){ al_draw_line( x-x_vel/2, y-y_vel/2, x, y, color, 2*rad ); al_draw_filled_circle( x-x_vel/2, y-y_vel/2, rad, color); al_draw_filled_circle( x, y, rad, color); }else{ al_draw_filled_circle( x, y, rad, color); } }
void SpeakingAgent::draw() { // store state placement2d::start_transform(); // background al_draw_filled_rectangle(0, 0, size.x, size.y, color::hex("319cff")); // mouth ALLEGRO_BITMAP *mouth_shape = _get_phoneme_image(Speaker::get_current_phoneme()); if (mouth_shape) al_draw_bitmap(mouth_shape, 0, 10, NULL); // eyes float eye_y = size.y/4; float eye_r = 2.3; float eye_1x = size.x/4; float eye_2x = size.x/4 * 3; if (blink_counter < 0.1) { al_draw_line(eye_1x-eye_r*2, eye_y, eye_1x+eye_r*2, eye_y, color::black, eye_r); al_draw_line(eye_2x-eye_r*2, eye_y, eye_2x+eye_r*2, eye_y, color::black, eye_r); if (blink_counter < 0.0) blink_counter = random_double(2.0, 6.0); } else { al_draw_filled_circle(eye_1x, eye_y, eye_r, color::black); al_draw_filled_circle(eye_2x, eye_y, eye_r, color::black); } blink_counter -= 1.0/60; // words float bx = size.x+size.x/4; float by = -size.y/3; float bw = size.x*2.5; float bh = size.y*0.8; float border_radius = 7; al_draw_filled_rounded_rectangle(bx, by, bx+bw, by+bh, border_radius, border_radius, color::white); float tx = bx+border_radius*4; float ty = by+bh-1; float ts = 20; al_draw_filled_triangle(tx, ty, tx+ts, ty, tx, ty+ts, color::white); std::string word = Speaker::get_current_word(); ALLEGRO_FONT *font = fonts["lacuna.ttf 26"]; if (is_paused()) word = "[PAUSED]"; if (font) al_draw_text(font, color::black, bx+bw/2, by+bh/2-al_get_font_line_height(font)/2, ALLEGRO_ALIGN_CENTRE, word.c_str()); // show stream # //al_draw_text(font, color::white, 0, 0, NULL, tostring(voice->get_current_stream()).c_str()); // restore state placement2d::restore_transform(); //draw_crosshair(x, y, color::white); }
void draw() { if(onGround == true) { al_draw_filled_circle(x,y,16,al_map_rgb(0,0,255)); } else { al_draw_filled_circle(x,y,16,al_map_rgb(0,255,0)); } }
void coor_matrix(int mapa[A][B], Coord coordenada[], ALLEGRO_FONT *fonte) { int i = 0; int j = 0; int m_x = 0; int m_y = 0; for (i=0; i<A; i++) { for(j=0; j<B; j++) { switch (mapa[i][j]) { case 0: al_draw_filled_rectangle(m_x, m_y, m_x + l_celula, m_y + a_celula, al_map_rgb(0, 0, 255)); break; case 1: al_draw_filled_rectangle(m_x, m_y, m_x + l_celula, m_y + a_celula, al_map_rgb(0, 0, 255)); break; case 2: al_draw_filled_rectangle(m_x, m_y, m_x + l_celula, m_y + a_celula, al_map_rgb(0, 0, 255)); break; case 3: al_draw_filled_rectangle(m_x, m_y, m_x + l_celula, m_y + a_celula, al_map_rgb(0, 0, 255)); break; case 4: al_draw_filled_rectangle(m_x, m_y, m_x + l_celula, m_y + a_celula, al_map_rgb(0, 0, 255)); break; case 5: al_draw_filled_rectangle(m_x, m_y, m_x + l_celula, m_y + a_celula, al_map_rgb(0, 255, 0)); break; case 6: al_draw_filled_rectangle(m_x, m_y, m_x + l_celula, m_y + a_celula, al_map_rgb(255, 255, 0)); break; case 9: al_draw_filled_circle(m_x + (l_celula/2), m_y + (a_celula/2), l_celula/2, al_map_rgb(0, 200, 0)); break; case 10: al_draw_filled_circle(m_x + (l_celula/2), m_y + (a_celula/2), l_celula/2, al_map_rgb(255, 0, 255)); break; } al_draw_line(0 + l_celula * j, 0, 0 + l_celula * j, ALTURA_TELA, al_map_rgb(255, 0, 90 ), 0); //Linhas verticais al_draw_line( 0, 0 + a_celula * i, LARGURA_TELA, a_celula * i, al_map_rgb(0, 255, 0), 0); //Linhas horizontais // al_draw_textf(fonte, al_map_rgb(0, 0, 0), l_celula * j, a_celula * i, ALLEGRO_ALIGN_LEFT, "%c%c%i", coordenada[j].letra[0], coordenada[j].letra[1], coordenada[i].numero + 1); m_x += l_celula; } m_x = 0; m_y += a_celula; } }
int draw_symbols(Game *g, Board *b) { float cus = b->clue_unit_size; // create symbols b->symbol_bmp[SYM_FORBIDDEN] = al_create_bitmap(cus, cus); b->symbol_bmp[SYM_SWAPPABLE] = al_create_bitmap(3*cus + 2*b->clue_unit_space, cus); b->symbol_bmp[SYM_ONE_SIDE] = al_create_bitmap(cus, cus); b->symbol_bmp[SYM_ONLY_ONE] = al_create_bitmap(cus, 3*cus + 2*b->clue_unit_space); if( (!b->symbol_bmp[SYM_FORBIDDEN]) || (!b->symbol_bmp[SYM_SWAPPABLE]) || (!b->symbol_bmp[SYM_ONE_SIDE]) || (!b->symbol_bmp[SYM_ONLY_ONE])){ fprintf(stderr, "Error creating bitmap.\n"); return -1; } al_set_target_bitmap(b->symbol_bmp[SYM_FORBIDDEN]); al_clear_to_color(NULL_COLOR); al_draw_line(0, 0, cus, cus,SYMBOL_COLOR,cus*0.05); al_draw_line(0, cus, cus,0, SYMBOL_COLOR,cus*0.05); al_set_target_bitmap(b->symbol_bmp[SYM_SWAPPABLE]); al_clear_to_color(NULL_COLOR); al_draw_line(cus*0.7,cus*0.9, cus*(3-0.7),cus*0.9, SYMBOL_COLOR, 2); draw_horizontal_arrow((3*cus + 2*b->clue_unit_space)/2, cus*0.9, cus/2, cus*0.9, SYMBOL_COLOR, cus*0.05); draw_horizontal_arrow((3*cus + 2*b->clue_unit_space)/2, cus*0.9, (3*cus + 2*b->clue_unit_space)-cus/2, cus*0.9, SYMBOL_COLOR, cus*0.05); al_set_target_bitmap(b->symbol_bmp[SYM_ONE_SIDE]); al_clear_to_color(NULL_COLOR); al_draw_filled_circle(cus/2, cus*0.8, 0.05*cus, SYMBOL_COLOR); al_draw_filled_circle(cus/2 - 0.2*cus, cus*0.8, 0.05*cus, SYMBOL_COLOR); al_draw_filled_circle(cus/2 + 0.2*cus, cus*0.8, 0.05*cus, SYMBOL_COLOR); // al_draw_textf(tile_font3, WHITE_COLOR, cus/2,cus/2-al_get_font_line_height(tile_font3)/2, ALLEGRO_ALIGN_CENTER, "%s", "..."); draw_horizontal_arrow(cus*0.2, cus*0.5, cus*0.8, cus*0.5, SYMBOL_COLOR, cus*0.05); al_set_target_bitmap(b->symbol_bmp[SYM_ONLY_ONE]); al_clear_to_color(NULL_COLOR); al_draw_line(cus*0.975, 2.5*cus + 2*b->clue_unit_space, cus*0.975, 1.5*cus + b->clue_unit_space, SYMBOL_COLOR, cus*0.05); draw_horizontal_arrow(cus, 2.5*cus + 2*b->clue_unit_space, cus*0.7, 2.5*cus + 2*b->clue_unit_space, SYMBOL_COLOR, cus*0.05); draw_horizontal_arrow(cus, 1.5*cus + b->clue_unit_space, cus*0.7, 1.5*cus + b->clue_unit_space, SYMBOL_COLOR, cus*0.05); al_draw_line(cus*0.025, 2.5*cus + 2*b->clue_unit_space, cus*0.025, 1.5*cus + b->clue_unit_space, SYMBOL_COLOR, cus*0.05); draw_horizontal_arrow(0, 2.5*cus + 2*b->clue_unit_space, cus*0.3, 2.5*cus + 2*b->clue_unit_space, SYMBOL_COLOR, cus*0.05); draw_horizontal_arrow(0, 1.5*cus + b->clue_unit_space, cus*0.3, 1.5*cus + b->clue_unit_space, SYMBOL_COLOR, cus*0.05); al_draw_filled_circle(cus/2, 2*cus + 1.5*b->clue_unit_space, cus*0.15, SYMBOL_COLOR); al_draw_line(cus/2, (2-0.08)*cus + 1.5*b->clue_unit_space, cus/2, (2+0.08)*cus + 1.5*b->clue_unit_space, WHITE_COLOR, cus*0.05); return 0; }
void Bullet::Render(){ if(GetAlive()){ switch(GetGun()){ case PISTOL: al_draw_filled_circle(x, y, 2, al_map_rgb(255, 255, 255)); break; case SHOTGUN: al_draw_filled_circle(x, y, 2, al_map_rgb(255, 255, 255)); break; case RIFLE: al_draw_filled_circle(x, y, 2, al_map_rgb(255, 255, 255)); break; } } }
void bn_desenhaBola(const BN_BOLA *b) { if(b->efeito == 'c') { al_draw_circle(b->x, b->y, b->raio, b->cor, 2); } else if(b->efeito == 't') { al_draw_filled_circle(b->x, b->y, b->raio, al_map_rgba(255, 255, 255, 128)); } else { al_draw_filled_circle(b->x, b->y, b->raio, b->cor); } }
void draw_billiard_balls(billiard_ball *balls) { int i; const double sx = 0; const double sy = 0; const double dw = 2 * BALL_RADIUS; const double dh = 2 * BALL_RADIUS; double sw, sh, dx, dy; /* DEBUG */ #ifdef DEBUG if(balls == NULL) { perror("billiard_ball null pointer"); return; } for(i = 0 ; i < BALL_COUNT ; i ++) al_draw_filled_circle(balls[i].cx, balls[i].cy, BALL_RADIUS, balls[i].color); #endif for(i = 0 ; i < BALL_COUNT ; i ++) { if(!balls[i].is_on_table) continue; sw = balls[i].bitmap_sw; sh = balls[i].bitmap_sh; dx = balls[i].cx - BALL_RADIUS; dy = balls[i].cy - BALL_RADIUS; al_draw_scaled_bitmap(balls[i].bitmap, sx, sy, sw, sh, dx, dy, dw, dh, 0); } }
void draw() { if(exists == true) { al_draw_filled_circle(x,y,16,al_map_rgb(255,0,0)); } }
void drawmonster(int n) { al_init_primitives_addon(); al_draw_filled_circle(Monstro[n].xlocation, Monstro[n].ylocation, 18, al_map_rgb(0, 0, 255)); printf("\nmonstro %d foi criado\n", n); al_rest(0); }
void drawBullet(Bullet bullet[], int size){ for (int i = 0; i < size; i++){ if(bullet[i].live){ al_draw_filled_circle(bullet[i].x, bullet[i].y, 2, al_map_rgb(255,255,255)); } } }
void draw_tower(int r, int l, Torre torre[], int t) { al_draw_filled_circle(r*l_celula + (l_celula/2), l*a_celula + (a_celula/2), l_celula/2, al_map_rgb(150, 50, 0)); torre[t].xlocation = r*l_celula + (l_celula/2); torre[t].ylocation = l*a_celula + (a_celula/2); torre[t].live = true; }
void TParticle::Draw(double a_dCamX,double a_dCamY) { double DrawX=int(m_pEngine->m_nScreenMidX+(m_dX-a_dCamX)); double DrawY=int(m_pEngine->m_nScreenMidY+(m_dY-a_dCamY)); // only draw what we see // float r=1.0; // float g=0.2; // float b=0.8; // float a=m_nLife/50; if ((DrawX>=0)&&(DrawX<m_pEngine->m_nScreenWidth)&&(DrawY>=0)&&(DrawY<m_pEngine->m_nScreenHeight)) { int r,g,b; switch (m_Effect) { case EFF_NORMAL: r = (m_nLife*6)+15; g = 100; if (r<g) g=r; b=0; break; case EFF_PROBE: r = g = b = (m_nLife*6)+15; break; } al_draw_filled_circle(DrawX, DrawY, 1, al_map_rgba(r,g,b,m_nLife*5)); } }
void Player::draw() const { const b2Vec2 screen = g.getScreenCorner(); model->skeleton->x = (body->GetPosition().x) * g.pixelpm - screen.x; model->skeleton->y = (body->GetPosition().y + .9) * g.pixelpm - screen.y; skeletonDraw(model); //hp bar al_draw_rectangle(al_get_display_width(g.m.display) / 2 - 102, al_get_display_height(g.m.display) - 62, al_get_display_width(g.m.display) / 2 + 102, al_get_display_height(g.m.display) - 38, al_map_rgb(80, 0, 0), 4); al_draw_filled_rectangle(al_get_display_width(g.m.display) / 2 - 100, al_get_display_height(g.m.display) - 60, al_get_display_width(g.m.display) / 2 - 100 + ((life >= 0) ? life * 2 : 0), al_get_display_height(g.m.display) - 40, al_map_rgb(255, 0, 0)); if(Game::debug) { if(landed) al_draw_filled_circle(al_get_display_width(g.m.display) / 2 + 120, al_get_display_height(g.m.display) - 50, 10, al_map_rgb(0, 255, 0)); } }
void BallEntity::draw(Rect viewWindow) { al_draw_filled_circle( m_Position.x - viewWindow.left(), m_Position.y - viewWindow.top(), m_Radius, al_map_rgb(250, 0, 0)); }
void Environment::visualizePlaceCellFiring(std::vector<Point> neuronMap, std::vector<float>rates){ for(unsigned int i=0 ;i <neuronMap.size(); i++){ float max = *std::max_element(std::begin(rates), std::end(rates)); int intensity = rates[i]*255/max; al_draw_filled_circle(neuronMap[i].x, neuronMap[i].y, 10., al_map_rgb(0, 0, intensity)); } }
void Bot::render() { ostringstream ss; if(health > 0) { ss << "h:" << health << " a:" << ammo; al_draw_filled_circle(position.x, position.y, 20, color); al_draw_filled_circle(nearestNode->position.x, nearestNode->position.y, 5, al_map_rgb(160, 160, 0)); al_draw_text(font, al_map_rgb(0, 0, 0), position.x, position.y - 30, ALLEGRO_ALIGN_CENTRE, ss.str().c_str()); Pathfinding::getInstance().drawPath(currentPath); } else { ss << "DEAD"; al_draw_filled_circle(position.x, position.y, 20, al_map_rgb(150,150,150)); al_draw_text(font, al_map_rgb(0, 0, 0), position.x, position.y - 30, ALLEGRO_ALIGN_CENTRE, ss.str().c_str()); } }
void Board::paintThySelf(int GRIDSIZE) { al_clear_to_color(al_map_rgb(0, 0, 0)); for (int x = 0; x < xSize; ++x) { for (int y = 0; y < ySize; ++y) { if ((x != xSize - 1 && x != 0 && y != ySize - 1)) { grid[x][y]->roads[Directions::EAST]->paintThySelf(GRIDSIZE); grid[x][y]->roads[Directions::SOUTH_EAST]->paintThySelf(GRIDSIZE); grid[x][y]->roads[Directions::SOUTH_WEST]->paintThySelf(GRIDSIZE); } grid[x][y]->paintThySelf(GRIDSIZE); } } al_draw_filled_circle(mouse.x, mouse.y, 4, al_map_rgb(255, 255, 255)); if (clicked.x != -1) al_draw_filled_circle(clicked.x*30 + (grid[clicked.x][clicked.y]->shifted ? 15:0), clicked.y*30, 6, al_map_rgb(255, 69, 0)); }
void drawTiro(Tiro tiro[], int t) { for(int t = 0 ; t < 10; t++) { if(tiro[t].live) al_draw_filled_circle(tiro[t].xlocation, tiro[t].ylocation, 15, al_map_rgb(255, 255, 255)); } }
void drawComet(Comet comets[], int size){ for (int i = 0; i < size; i++){ if (comets[i].live){ al_draw_filled_circle(comets[i].x,comets[i].y,20,al_map_rgb(255,0,0)); } } }
void Turtle::Forward(float distance) { distance *= scale; float radAngle = angle * M_PI_4 / 45; float nx = x + sin(radAngle) * distance; float ny = y - cos(radAngle) * distance; if(!up) { float w = width * scale; if(w > 2.5f) { al_draw_filled_circle(x, y, w / 2, color); al_draw_filled_circle(nx, ny, w / 2, color); } al_draw_line(x, y, nx, ny, color, w); } x = nx; y = ny; }
// Draw the bullet void DrawBullet(Bullet bullet[], int size) { // if the bullet is alive, draw it. for (int i = 0; i < size; i++) { if(bullet[i].live) // draw the bullet at it's current position. al_draw_filled_circle(bullet[i].x, bullet[i].y, 2, al_map_rgb(255,255, 255)); } }
void draw_tiro(Torre torre[], int t) //Desenha o tiro durante a trajetória { for(int i = 0; i < t+1; i++) { if(torre[i].tiro.live) al_draw_filled_circle(torre[i].tiro.xlocation, torre[i].tiro.ylocation, 5, al_map_rgb(255, 255, 255)); } }
/**< Função Desenha um circulo preenchido na Janela */ void Des_Circulo_preenchido(int desenha_circulo, ALLEGRO_FONT *fonte, int x1, int y1, int x2, int y2) { if (desenha_circulo == 1) { float r = sqrt(pow(x1 - x2,2) + pow(y1 - y2,2)); al_draw_text(fonte, al_map_rgb(255, 255, 255), 320, 70, ALLEGRO_ALIGN_CENTRE, "Precione em 2 pontos:"); al_draw_filled_circle( x1, y1, r, al_map_rgb(255, 255,255)); } }
void Prog::draw_bitmap(const std::string & str, const std::string &how, bool memory, bool destination) { int i = destination ? 1 : 0; int rv = r[i].get_cur_value(); int gv = g[i].get_cur_value(); int bv = b[i].get_cur_value(); int av = a[i].get_cur_value(); ALLEGRO_COLOR color = makecol(rv, gv, bv, av); ALLEGRO_BITMAP *bmp; if (contains(str, "Mysha")) bmp = (memory ? mysha_bmp : mysha); else bmp = (memory ? allegro_bmp : allegro); if (how == "original") { if (str == "Color") al_draw_filled_rectangle(0, 0, 320, 200, color); else if (contains(str, "tint")) al_draw_tinted_bitmap(bmp, color, 0, 0, 0); else al_draw_bitmap(bmp, 0, 0, 0); } else if (how == "scaled") { int w = al_get_bitmap_width(bmp); int h = al_get_bitmap_height(bmp); float s = 200.0 / h * 0.9; if (str == "Color") { al_draw_filled_rectangle(10, 10, 300, 180, color); } else if (contains(str, "tint")) { al_draw_tinted_scaled_bitmap(bmp, color, 0, 0, w, h, 160 - w * s / 2, 100 - h * s / 2, w * s, h * s, 0); } else { al_draw_scaled_bitmap(bmp, 0, 0, w, h, 160 - w * s / 2, 100 - h * s / 2, w * s, h * s, 0); } } else if (how == "rotated") { if (str == "Color") { al_draw_filled_circle(160, 100, 100, color); } else if (contains(str, "tint")) { al_draw_tinted_rotated_bitmap(bmp, color, 160, 100, 160, 100, ALLEGRO_PI / 8, 0); } else { al_draw_rotated_bitmap(bmp, 160, 100, 160, 100, ALLEGRO_PI / 8, 0); } } }
void m_draw_circle(int x, int y, int radius, MCOLOR color, int flags) { if (flags & M_FILLED) { al_draw_filled_circle(x, y, radius, color); } else { al_draw_circle(x, y, radius, color, 1); } }
void CMap::draw_map(int x,int y){ al_clear_to_color(al_map_rgb(255,255,255)); for(int i=0;i<n_object;i++){ if(objects[i].type==RECTANGLE) al_draw_filled_rectangle(objects[i].x-x,objects[i].y-y,objects[i].x-x+objects[i].length, objects[i].y-y+objects[i].width,al_map_rgb(objects[i].r,objects[i].g,objects[i].b)); else if (objects[i].type==CIRCLE && drawCircles==true) al_draw_filled_circle(objects[i].x-x,objects[i].y-y,objects[i].radius,al_map_rgb(objects[i].r,objects[i].g,objects[i].b)); } }