Exemplo n.º 1
0
int
main(int argc, char ** argv)
{

   struct Exclamation parent;

   struct Exclamation *children;

   int handle, size;

   parent.height = 200;
   parent.width = 20;
   parent.bottom = -100;
   parent.left = -10;

   // Get the children from the recursion
   children = fractal(&parent, &size);

   handle = start_drawing();

   draw_children(size, children);

   free(children);

   stop_drawing(handle);

   return 0;

}
Exemplo n.º 2
0
void nxtCanvasWidget::mousePressEvent( QMouseEvent *event ){
	if( mouse_active ){
		stop_drawing();
		return;
	}
	
	active_tool = current_tool;
	
	//Set modifiers
	key_control = event->modifiers() & Qt::ControlModifier;
	key_shift = event->modifiers() & Qt::ShiftModifier;
	set_options_fill( key_shift );
	
	
	set_options_inverted( false );	//Just to be safe, turn it off if wrong
	
	//Check which button caused the event
	if( event->button() & Qt::LeftButton ){
	}
	else if( event->button() & Qt::MidButton )
		active_tool = TOOL_MOVE;	//Go into move mode
	else if( event->button() & Qt::RightButton )
		set_options_inverted( true );	//Invert the CopyOptions
	else{
		//We do not handle this event
		event->ignore();
		return;
	}
	
	//Make sure to start correctly if canvas is empty
	if( canvas && canvas->get_width() == 0 && canvas->get_height() == 0 ){
		pos_x = pos_y = 0;
		QPoint offset = pos_to_point( event->pos() );
		pos_x = offset.x();
		pos_y = offset.y();
	}
	
	mouse_start = pos_to_point( event->pos() );
	mouse_current = mouse_start;
	mouse_last = mouse_start;
	mouse_active = true;
	
	
	enable_buffer();
	action( EVENT_MOUSE_DOWN );
}
Exemplo n.º 3
0
int
main(int argc, char ** argv)
{
   // Space for the children
   struct Exclamation children[STEPCHILDREN];
   // The parent
   struct Exclamation parent;

   // The handle
   int handle;

   // The parameters for the children
   float width, height, xGap, ySlot;
 
   parent.height = 160;
   parent.width = 20;
   parent.bottom = -79;
   parent.left = -8;

   // Get the paramters for a fractal step
   child_params(&parent,
         &width, &height,
         &xGap, &ySlot);

   // Recurse one step
   fractal_step(width, height, 
         parent.left, parent.bottom, 
         xGap, ySlot,
         children);

   handle = start_drawing();
  
   draw_children(STEPCHILDREN, children);

   stop_drawing(handle);

   return 0;
}