int main()
{
  struct Drawing d;
  struct Circle bottom;
  struct Circle middle;
  struct Circle top;
  
  initDrawing(&d, DRAWINGTYPE_BW, 200, 150, BW_BLACK);

  // draw a snowMan with height 90 pixels
  //   Bottom circle has radius 20, center at 100, 80
  //   Middle circle has radius 15, center at 100, 45
  //   Top circle has radius 10, center at 100, 20

  initCircle(&bottom, makePoint(100.0,80.0), 20.0);
  initCircle(&middle, makePoint(100.0,45.0), 15.0);
  initCircle(&top, makePoint(100.0,20.0), 10.0);
  
  fillCircle(&d,bottom,BW_WHITE);
  fillCircle(&d,middle,BW_WHITE);
  fillCircle(&d,top, BW_WHITE);

  writeFile(&d, FILENAME);

  return 0;

}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    } 

	initCircle();

	
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("Code.plist");
	

	_chicken = Chicken::createFromLayer(this);
	_chicken->setAnchorPoint(Point(0.5,0));
	int posnum = MAXROW * MAXCOLLUM /2 ;
	_chicken->setCoor(Point(posnum / MAXROW,posnum % MAXCOLLUM));
	


	_moveCountLabel = Label::createWithBMFont("fonts/Arial.fnt","Moves: 0");
	_moveCountLabel->setPosition(250,400);
	this->addChild(_moveCountLabel);
	

	auto lister = EventListenerTouchOneByOne::create();
	lister->setSwallowTouches(true);
	lister->onTouchBegan = CC_CALLBACK_2(HelloWorld::onTouchBegan,this);
	_eventDispatcher->addEventListenerWithSceneGraphPriority(lister, this);

    return true;
}
Exemple #3
0
void initCircleArray(Circle circle[], GLfloat yVal) {
    int i;
    GLfloat step = (GLfloat) SCREEN_WIDTH / (GLfloat) BARS;
    GLfloat xVal = step / 2.0;
    for (i = 0; i < BARS; i++) {
        circle[i] = initCircle(xVal + step * i, yVal);
    }
}
Exemple #4
0
void init(void)
{
  mapState.border = createPanelBorder(X_BORD, Y_BORD, WIDTH_BORD);
  mapState.button_rect = initRect();
  mapState.button_triangle = initTriangle();
  mapState.button_line = initLine();
  mapState.button_circle = initCircle();
  
  mapState.points_storage = createLinkedList();
  mapState.edges_storage = createLinkedList();
}
Exemple #5
0
void GrassField::init(){

	
	std::cout << "init grass field" << std::endl;
	
	
	switch (type){
		case GRASS_CIRCLE:
			initCircle();
		break;
		
		case GRASS_SQUARE:
			initSquare();
		break;
		
		default:
		break;

	}

}
Exemple #6
0
void initCircleArray(Circle circle[], int length) {
    int i;

    // set position
    circle[0].x = RADIUS + 5;
    circle[1].x = SCREEN_WIDTH - RADIUS - 5;
    
    circle[0].y = SCREEN_HEIGHT - RADIUS - 5;
    circle[1].y = RADIUS + 5;

    // init circles    
    for (i = 0; i < length; i++) {
        circle[i] = initCircle(circle[i]);
    }

    // set color of the upper right circle to green
    circle[1].colour[0] = 0;
    circle[1].colour[1] = 255;
    circle[1].colour[2] = 0;
    chosenCircleIndex = 1;
    currentCircle = &circle[1];
}
Exemple #7
0
Node * newNode(GLfloat xVal) {
    Node * n = (Node *) malloc(sizeof (Node));
    n->circle = initCircle(xVal, STIMULUS_Y);
    n->next = NULL;
    return n;
}
Exemple #8
0
DrawItemCircle::DrawItemCircle( RectF rect,float pos_x,float pos_y,float radius )
	:DrawItemShape(rect,std::list<IDataLine*>())
{
	initCircle(rect,pos_x,pos_y,radius);
}