// draws the bullet to the screen void Bullet::drawBullet() { // get points and draw the bullet set_fill_color(this->color); draw_rectangle_filled(this->pos.x, this->pos.y, size, size / 2); set_fill_color(WHITE); }
void main_draw_shape(struct template_t *tmp_tpl) { char *sval = NULL; if(template_get_setting_string(tmp_tpl, "shape", &sval) == 0) { int filled = 0, x = 0, y = 0, width = fb_width(), height = fb_height(), border = 0, fcolor = 0; int x1 = 0, x2 = 0, y1 = 0, y2 = 0, radius = 0, thickness = 1, zindex = 0; unsigned short *color = NULL; if(strcmp(sval, "rectangle") == 0 || strcmp(sval, "circle") == 0) { template_get_setting_number(tmp_tpl, "x", &x); template_get_setting_number(tmp_tpl, "y", &y); template_get_setting_number(tmp_tpl, "border", &border); template_get_setting_number(tmp_tpl, "filled", &filled); } else if(strcmp(sval, "line") == 0) { template_get_setting_number(tmp_tpl, "x1", &x1); template_get_setting_number(tmp_tpl, "x2", &x2); template_get_setting_number(tmp_tpl, "y1", &y1); template_get_setting_number(tmp_tpl, "y2", &y2); template_get_setting_number(tmp_tpl, "thickness", &thickness); } if(strcmp(sval, "rectangle") == 0) { template_get_setting_number(tmp_tpl, "width", &width); template_get_setting_number(tmp_tpl, "height", &height); } else if(strcmp(sval, "circle") == 0) { template_get_setting_number(tmp_tpl, "radius", &radius); } if(template_get_setting_color(tmp_tpl, "color", &color) != 0) { color = malloc(sizeof(unsigned short)*3); color[0] = 0, color[1] = 0, color[2] = 0; fcolor = 1; } template_get_setting_number(tmp_tpl, "z-index", &zindex); if(nodaemon == 0) { if(strcmp(sval, "rectangle") == 0) { if(filled) { draw_rectangle_filled(x, y, zindex, width, height, draw_color(color[0], color[1], color[2])); } else { draw_rectangle(x, y, zindex, width, height, border, draw_color(color[0], color[1], color[2])); } } else if(strcmp(sval, "circle") == 0) { if(filled) { draw_circle_filled(x, y, zindex, radius, draw_color(color[0], color[1], color[2])); } else { draw_circle(x, y, zindex, radius, border, draw_color(color[0], color[1], color[2])); } } else if(strcmp(sval, "line") == 0) { draw_line(x1, y1, x2, y2, zindex, thickness, draw_color(color[0], color[1], color[2])); } } if(fcolor) { free(color); } } }
// draws the player to the screen void Player::drawPlayer() { set_fill_color(WHITE); int size = this->size; int xSize = this->facingEast ? size : size * -1; int x = this->pos.x; int y = this->pos.y; // draw the bill Point billP1 = Point::Point(x - xSize, y - size / 2); Point billP2 = Point::Point(x + xSize / 2, y - size); draw_rectangle_filled(billP1, billP2); // draw the head draw_square(x, y - size, size / 2); // draw the eyes draw_circle_filled(x - xSize / 4, y - (size * 12 / 11), size / 8); draw_circle_filled(x + xSize / 8, y - (size * 12 / 11), size / 8); // draw the left arm draw_square(x - xSize, y, size / 2); // draw the right arm draw_square(x + xSize, y, size / 2); // draw the left foot Point leftFootP1 = Point::Point(x - xSize, y + size); Point leftFootP2 = Point::Point(x + (xSize * 1/10), y + (size * 12/10)); draw_rectangle_filled(leftFootP1, leftFootP2); // draw the right arm Point rightFootP1 = Point::Point(x + xSize, y + size); Point rightFootP2 = Point::Point(x + (xSize * 1/10), y + (size * 12/10)); draw_rectangle_filled(rightFootP1, rightFootP2); }
void main_draw_black(void) { if(nodaemon == 0) { draw_rectangle_filled(0, 0, -1, fb_width(), fb_height(), draw_color(0, 0, 0)); } }