/*
 *  Updates our gps coordinate structure with the newest buffer
 *  data.
 */
void update_coordinates(char *buffer, uint32_t index)
{
  char *latitude = get_latitude();
  char *longitude = get_longitude();
  char *altitude = get_altitude();

  index = index%BUFFERSIZE;

  // skip the time
  index = _skip_data(buffer, index);

  index = set_location(buffer, index, latitude, 10);
  index = set_location(buffer, index, longitude, 11);

  // skip the fix
  index = _skip_data(buffer, index);
  //sendIndex(index);

  //index = (index+2)%BUFFERSIZE;
  // get satalites tracked
  index = set_satellites_tracked(buffer, index);
  //sendIndex(index);

  //sendIndex(index);
  // skip Horizontal dilution of position
  index = _skip_data(buffer, index);

  // altitude
  index = set_location(buffer, index, altitude, 15);

}
gboolean
cc_timezone_map_set_timezone (CcTimezoneMap *map,
                              const gchar   *timezone)
{
  GPtrArray *locations;
  guint i;
  char *real_tz;
  gboolean ret;

  real_tz = tz_info_get_clean_name (map->priv->tzdb, timezone);

  locations = tz_get_locations (map->priv->tzdb);
  ret = FALSE;

  for (i = 0; i < locations->len; i++)
    {
      TzLocation *loc = locations->pdata[i];

      if (!g_strcmp0 (loc->zone, real_tz ? real_tz : timezone))
        {
          set_location (map, loc);
          ret = TRUE;
          break;
        }
    }

  if (ret)
    gtk_widget_queue_draw (GTK_WIDGET (map));

  g_free (real_tz);

  return ret;
}
void GameScene_02::addBall()
{
    auto ball = Ball::create();
    this->addChild(ball);
    ball->set_location(visibleSize/2);
    balls->pushBack(ball);
}
Exemple #4
0
void test_physics(){
  printf("testing physics\n");
  world_handle hello_world = new_world();
  //tests movement, set/get velocity, set/get location(position)
  po_vector center;
  center.x = 1.0;
  center.y = 1.0;
  po_circle circle2 = create_circ(center, 1.0);
  po_geometry geo_circle2 = create_geom_circ(circle2, 1.0);
  po_handle circle02 = add_object (hello_world, &geo_circle2, 20.0, 1.0, 0.0);

  po_vector location = get_position(circle02);

  center.x = 0.0;
  center.y = 0.0;
  po_circle circle1 = create_circ(center, 5.0);
  po_geometry geo_circle1 = create_geom_circ(circle1, 1.0);
  po_handle circle01 = add_object (hello_world, &geo_circle1, 50.0, 0.0, 0.0);


  set_velocity(circle02,-1.0,0.0);
  po_vector velocity = get_velocity(circle02);
  update(hello_world,3);

  po_vector pos02 = get_position(circle02);
  po_vector pos01 = get_position(circle01);

  assert(pos02.x == 17.0);
  assert(pos02.y == 1.0);
  assert(pos01.x == 50.0);
  assert(pos01.y == 0.0);
  
  set_location(circle01, 0.0, 0.0);
  set_velocity(circle01, -7.76,1.7);

  set_location(circle02, 20.0, 0.0);
  set_velocity(circle02, -9.0,2.0);

  update(hello_world,1);
  po_vector pos002 = get_position(circle02);
  po_vector pos001 = get_position(circle01);
  assert( pos002.x == 11.0);
  assert( pos002.y == 2.0);

  assert(fabs(pos001.x - -7.76) <= EPSILON);
  assert(fabs(pos001.y - 1.7)<= EPSILON);
}
void button::calculate_size()
{
	if (type_ == TYPE_IMAGE){
		SDL_Rect loc_image = location();
		loc_image.h = image_->h;
		loc_image.w = image_->w;
		set_location(loc_image);
		return;
	}
	SDL_Rect const &loc = location();
	bool change_size = loc.h == 0 || loc.w == 0;

	if (!change_size) {
		unsigned w = loc.w - (type_ == TYPE_PRESS ? horizontal_padding : checkbox_horizontal_padding + base_width_);
		if (type_ != TYPE_IMAGE)
		{
			int fs = font_size;
			int style = TTF_STYLE_NORMAL;
			std::string::const_iterator i_beg = label_.begin(), i_end = label_.end(),
				i = font::parse_markup(i_beg, i_end, &fs, NULL, &style);
			if (i != i_end) {
				std::string tmp(i, i_end);
				label_.erase(i - i_beg, i_end - i_beg);
				label_ += font::make_text_ellipsis(tmp, fs, w, style);
			}
		}
	}

	if (type_ != TYPE_IMAGE){
		textRect_ = font::draw_text(NULL, screen_area(), font_size,
		                            font::BUTTON_COLOR, label_, 0, 0);
	}

	if (!change_size)
		return;

#ifdef USE_TINY_GUI
	set_height(textRect_.h+vertical_padding);
#else
	set_height(std::max(textRect_.h+vertical_padding,base_height_));
#endif
	if(type_ == TYPE_PRESS) {
#ifdef USE_TINY_GUI
		set_width(textRect_.w + horizontal_padding);
#else
		if(spacing_ == MINIMUM_SPACE) {
			set_width(textRect_.w + horizontal_padding);
		} else {
			set_width(std::max(textRect_.w+horizontal_padding,base_width_));
		}
#endif
	} else {
		if(label_.empty()) {
			set_width(base_width_);
		} else {
			set_width(checkbox_horizontal_padding + textRect_.w + base_width_);
		}
	}
}
Exemple #6
0
void create()
{
        bboard::create();
        set_attic_dir ("/d/Conf/data/attic") ;
	set_save_dir("/d/Conf/data") ;
        set_save_file("conf_A");
        set_location("/d/Conf/room/room_A") ;
	set ("short.text", "Resolutions and Amendments Board") ;
}
void create()
{
        bboard::create();
	set_attic_dir ("/d/TMI/data/attic") ;
	set_save_dir("/d/TMI/data") ;
	set_save_file("network");
		set_location("/d/TMI/rooms/networkroom");
	set ("short.text","The network board");
}
void palette_manager::adjust_size()
{
	scroll_top();
	const SDL_Rect& rect = gui_.palette_area();
	set_location(rect);
	palette_start_ = rect.y;
	bg_register(rect);
	active_palette().adjust_size(rect);
	set_dirty();
}
void create()
{
    bboard::create();
    set_attic_dir(BASE+"data/attic");
    set_save_dir(BASE+"data");
    set_save_file("MS");
    set_location(FLOOR_1("entrance.c"));
    set("author", "cyanide");
    set("short.text", "a brand new posting board");
}
//_____________________________________________________________________________
// Convienience constructor.
ContactGeometry::ContactGeometry(const Vec3& location, const Vec3& orientation, 
    PhysicalFrame& body) : ModelComponent()
{
    setNull();
    constructProperties();

    _body = &body;
    set_body_name(body.getName());
    set_location(location);
    set_orientation(orientation);
}
void rEngine::testInfoSet(unsigned int id)
{
	auto infoset = new rProtos::InfoSet();
	infoset->set_id(id);
	infoset->set_name("RyanBox");
	infoset->set_location("Bathroom");
	auto ret = mProcessor->createMessage(99);
	ret->set_allocated_infoset(infoset);
	BOOST_LOG_TRIVIAL(debug) << "Sending info set with id " << id ;
	if (convertMessageToVectorData(ret))
		mTestClient->Send(mByteData);
}
static void
cal_model_calendar_set_value_at (ETableModel *etm,
                                 gint col,
                                 gint row,
                                 gconstpointer value)
{
	ECalModelComponent *comp_data;
	ECalObjModType mod = E_CAL_OBJ_MOD_ALL;
	ECalComponent *comp;
	ECalModelCalendar *model = (ECalModelCalendar *) etm;

	g_return_if_fail (E_IS_CAL_MODEL_CALENDAR (model));
	g_return_if_fail (col >= 0 && col < E_CAL_MODEL_CALENDAR_FIELD_LAST);
	g_return_if_fail (row >= 0 && row < e_table_model_row_count (etm));

	if (col < E_CAL_MODEL_FIELD_LAST) {
		table_model_parent_interface->set_value_at (etm, col, row, value);
		return;
	}

	comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row);
	if (!comp_data)
		return;

	comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (comp_data->icalcomp));
	if (!comp) {
		return;
	}

	/* ask about mod type */
	if (e_cal_component_is_instance (comp)) {
		if (!e_cal_dialogs_recur_component (comp_data->client, comp, &mod, NULL, FALSE)) {
			g_object_unref (comp);
			return;
		}
	}

	switch (col) {
	case E_CAL_MODEL_CALENDAR_FIELD_DTEND :
		set_dtend ((ECalModel *) model, comp_data, value);
		break;
	case E_CAL_MODEL_CALENDAR_FIELD_LOCATION :
		set_location (comp_data, value);
		break;
	case E_CAL_MODEL_CALENDAR_FIELD_TRANSPARENCY :
		set_transparency (comp_data, value);
		break;
	}

	e_cal_model_modify_component (E_CAL_MODEL (model), comp_data, mod);

	g_object_unref (comp);
}
void create()
{
     monolith::create();
  set_attic_dir("/d/Dark/data/attic");
  set_save_dir("/d/Dark/data");
  set_save_file("necro_board");
  set_location("/d/Dark/Prime/wiz/necro_room");
  set ("short.text", "Great Basalt Monolith");
  set ("long.text",
"this is a black monolith. You can post on it. For information on how to\n"+
"use it, type \"help monolith\".\n");
  set("id",({ "monolith" }));
Exemple #14
0
void file_info::copy(const file_info * src)
{
	meta_remove_all();
	info_remove_all();
	set_location(src->get_location());
	set_length(src->get_length());
	int n;
	for(n=0;n<src->meta_get_count();n++)
		meta_add(src->meta_enum_name(n),src->meta_enum_value(n));
	for(n=0;n<src->info_get_count();n++)
		info_set(src->info_enum_name(n),src->info_enum_value(n));
}
Exemple #15
0
int main(int argc, char *argv[])
{
	struct zz_tree tree;
	struct zz_node *n1, *n2, *n3, *n4, *n5, *n6;

	zz_tree_init(&tree, sizeof(struct node_with_location));

	n1 = zz_node(&tree, TOK_FOO, zz_null);
	set_location(n1, 1);
	n2 = zz_node(&tree, TOK_BAR, zz_int(-314));
	set_location(n2, 2);
	n3 = zz_node(&tree, TOK_BAZ, zz_uint(314));
	set_location(n3, 3);
	n4 = zz_node(&tree, TOK_FOO, zz_double(0.5));
	set_location(n4, 5);
	n5 = zz_node(&tree, TOK_BAR, zz_string("314"));
	set_location(n5, 8);
	n6 = zz_node(&tree, TOK_BAZ, zz_pointer(&tree));
	set_location(n6, 13);

	assert(get_location(n1) == 1);
	assert(get_location(n2) == 2);
	assert(get_location(n3) == 3);
	assert(get_location(n4) == 5);
	assert(get_location(n5) == 8);
	assert(get_location(n6) == 13);

	exit(EXIT_SUCCESS);
}
Exemple #16
0
	void combo_drag::process(events::pump_info& /*info*/)
	{
		if (drag_ == RETURN)
		{
			SDL_Rect loc = location();
			int x_diff = loc.x - old_location_.x;
			int y_diff = loc.y - old_location_.y;
			const float length = std::sqrt(static_cast<float>(x_diff*x_diff + y_diff*y_diff));

			if (length > RETURN_SPEED)
			{
				loc.x -= static_cast<Sint16>(x_diff*(RETURN_SPEED/length));
				loc.y -= static_cast<Sint16>(y_diff*(RETURN_SPEED/length));
				set_location(loc);
			}
			else
			{
				drag_ = NONE;
				set_location(old_location_);
			}
		}
	}
static void
cal_model_calendar_fill_component_from_values (ECalModel *model,
					       ECalModelComponent *comp_data,
					       GHashTable *values)
{
	g_return_if_fail (E_IS_CAL_MODEL_CALENDAR (model));
	g_return_if_fail (comp_data != NULL);
	g_return_if_fail (values != NULL);

	set_dtend (model, comp_data, e_cal_model_util_get_value (values, E_CAL_MODEL_CALENDAR_FIELD_DTEND));
	set_location (comp_data, e_cal_model_util_get_value (values, E_CAL_MODEL_CALENDAR_FIELD_LOCATION));
	set_transparency (comp_data, e_cal_model_util_get_value (values, E_CAL_MODEL_CALENDAR_FIELD_TRANSPARENCY));
}
void GameScene_02::createBall()
{
    balls = new Vector<Ball*>();
    auto ball = Ball::create();
    this->addChild(ball);
    Size B_size = ball->getContentSize();
    Size S_size = slider->getContentSize();
    ball->setContentSize(B_size);
    ball->setPosition(visibleSize.width / 2, B_size.height / 2 + S_size.height + 20);
    ball->set_location(ball->getPosition());
    balls->pushBack(ball);
    ball->autorelease();
}
void button::calculate_size()
{
	if (type_ == TYPE_IMAGE){
		SDL_Rect loc_image = location();
		loc_image.h = image_->h;
		loc_image.w = image_->w;
		set_location(loc_image);
		return;
	}
	SDL_Rect const &loc = location();
	bool change_size = loc.h == 0 || loc.w == 0;

	if (!change_size) {
		unsigned w = loc.w - (type_ == TYPE_PRESS ? horizontal_padding : checkbox_horizontal_padding + base_width_);
		if (type_ != TYPE_IMAGE){
			label_ = font::make_text_ellipsis(label_, font_size, w, false);
		}
	}

	if (type_ != TYPE_IMAGE){
		textRect_ = font::draw_text(NULL, screen_area(), font_size,
		                            font::BUTTON_COLOUR, label_, 0, 0);
	}

	if (!change_size)
		return;

#ifdef USE_TINY_GUI
	set_height(textRect_.h+vertical_padding);
#else
	set_height(std::max(textRect_.h+vertical_padding,base_height_));
#endif
	if(type_ == TYPE_PRESS) {
#ifdef USE_TINY_GUI
		set_width(textRect_.w + horizontal_padding);
#else
		if(spacing_ == MINIMUM_SPACE) {
			set_width(textRect_.w + horizontal_padding);
		} else {
			set_width(std::max(textRect_.w+horizontal_padding,base_width_));
		}
#endif
	} else {
		if(label_.empty()) {
			set_width(base_width_);
		} else {
			set_width(checkbox_horizontal_padding + textRect_.w + base_width_);
		}
	}
}
Exemple #20
0
int zoom_window_update(void *closure, int sxn, int syn, int button)
{
    struct zoom_window *zw = closure;

    if (zw->mode == 1) {
	i_prompt_buttons(_("1. corner"), _("2. corner"), _("Quit"));
	zw->next_mode = 2;
    }

    G_debug(2, "button = %d x = %d y = %d", button, sxn, syn);

    if (button == 3)
	return 1;

    if (zw->mode == 2 && button == 2) {
	double x1 = D_d_to_u_col(zw->sxo);
	double y1 = D_d_to_u_row(zw->syo);
	double x2 = D_d_to_u_col(sxn);
	double y2 = D_d_to_u_row(syn);

	G_debug(2, "x1 = %f x2 = %f y1 = %f y2 = %f", x1, x2, y1, y2);

	window.north = y1 > y2 ? y1 : y2;
	window.south = y1 < y2 ? y1 : y2;
	window.west = x1 < x2 ? x1 : x2;
	window.east = x1 > x2 ? x1 : x2;

	G_debug(2, "w = %f e = %f n = %f s = %f", window.west, window.east,
		window.north, window.south);

	G_adjust_Cell_head(&window, 0, 0);
	G_put_window(&window);
	G_set_window(&window);

	display_redraw();

	i_prompt_buttons(_("1. corner"), _("1. corner"), _("Quit"));
	zw->next_mode = 1;
    }

    zw->sxo = sxn;
    zw->syo = syn;
    zw->mode = zw->next_mode;

    set_mode(zw->mode == 2 ? MOUSE_BOX : MOUSE_POINT);
    set_location(zw->sxo, zw->syo);

    return 0;
}
void editor_palette<Item>::adjust_size(const SDL_Rect& target)
{
	palette_x_ = target.x;
	palette_y_ = target.y;
	const int space_for_items = target.h;
	const int items_fitting = (space_for_items / item_space_) * item_width_;
	nitems_ = std::min(items_fitting, nmax_items_);
	if (num_visible_items() != nitems_) {
		buttons_.resize(nitems_, gui::tristate_button(gui_.video(), this));
	}
	set_location(target);
	set_dirty(true);
	gui_.video().clear_help_string(help_handle_);
	help_handle_ = gui_.video().set_help_string(get_help_string());
}
Exemple #22
0
static void prt_nesc_function_hdr(data_declaration fn_decl,
				  psd_options options)
/* Effects: prints the C function declaration for fn_decl
*/
{
  /* We print the declaration from the interface rather than that of fn_decl
     itself, as this latter may use not-yet-defined typedefs.
     prt_declarator will use the name from fn_decl in its output. */
  variable_decl ifn_vd = CAST(variable_decl, fn_decl->ast);
  data_decl fn_dd = CAST(data_decl, ifn_vd->parent);
  psd_options opts;
  function_declarator fd;
  asttype ret;

  prt_diff_info(fn_decl);
  set_location(fn_dd->location);
  if (!is_binary_component(fn_decl->container->impl))
    output("static ");

  /* Functions returning a network type should return the base type
     instead */
  if (is_function_declarator(ifn_vd->declarator))
    opts = psd_rewrite_nxbase;
  else
    opts = 0;
  options |= psd_rename_parameters;

  fd = get_fdeclarator(ifn_vd->declarator);
  /* Handle nesdoc-overridden return type */
  if (fd && (ret = fd->return_type))
    {
      prt_attribute_elements(fn_dd->modifiers);
      prt_type_elements(ret->qualifiers, opts);
      prt_declarator(ret->declarator, NULL, ifn_vd->attributes, fn_decl,
		     options | psd_print_ddecl_fdeclarator);
    }
  else
    {
      prt_type_elements(fn_dd->modifiers, opts);
      prt_declarator(ifn_vd->declarator, NULL, ifn_vd->attributes, fn_decl, 
		     options);
    }
}
Exemple #23
0
effect::effect(int xpos, int ypos, const animated<image::locator>::anim_description& img,
		const map_location& loc, ORIENTATION orientation, bool infinite) :
	images_(img),
	orientation_(orientation),
	x_(xpos),
	y_(ypos),
	surf_(NULL),
	buffer_(NULL),
	rect_(empty_rect),
	loc_(loc),
	overlayed_hexes_()
{
	assert(disp != NULL);

	set_location(xpos,ypos);

	images_.start_animation(0,infinite);

}
Exemple #24
0
void do_so(const char *line)
{
  const char *p = line;
  while (*p == ' ')
    p++;
  string filename;
  int success = 1;
  for (const char *q = p;
       success && *q != '\0' && *q != '\n' && *q != ' ';
       q++)
    if (*q == '\\') {
      switch (*++q) {
      case 'e':
      case '\\':
	filename += '\\';
	break;
      case ' ':
	filename += ' ';
	break;
      default:
	success = 0;
	break;
      }
    }
    else
      filename += char(*q);
  if (success && filename.length() > 0) {
    filename += '\0';
    const char *fn = current_filename;
    int ln = current_lineno;
    current_lineno--;
    if (do_file(filename.contents())) {
      current_filename = fn;
      current_lineno = ln;
      set_location();
      return;
    }
    current_lineno++;
  }
  fputs(".so", stdout);
  fputs(line, stdout);
}
Exemple #25
0
halo_impl::effect::effect(display * screen, int xpos, int ypos, const animated<image::locator>::anim_description& img,
		const map_location& loc, ORIENTATION orientation, bool infinite) :
	images_(img),
	orientation_(orientation),
	x_(0),
	y_(0),
	surf_(nullptr),
	buffer_(nullptr),
	rect_(sdl::empty_rect),
	loc_(loc),
	overlayed_hexes_(),
	disp(screen)
{
	assert(disp != nullptr);

	set_location(xpos,ypos);

	images_.start_animation(0,infinite);

}
Exemple #26
0
	void combo_drag::handle_move(const SDL_MouseMotionEvent& event)
	{
		if (drag_ == PRESSED)
		{
			aquire_mouse_lock();
			old_location_ = location();
			drag_ = PRESSED_MOVE;
		}
		const int diff_x = event.x - mouse_x_;
		const int diff_y = event.y - mouse_y_;
		if (drag_ == PRESSED_MOVE
			&& std::sqrt(static_cast<float>(diff_x*diff_x + diff_y*diff_y)) > MIN_DRAG_DISTANCE)
		{
			return;
		}
		drag_ = MOVED;
		SDL_Rect loc = old_location_;
		loc.x += diff_x;
		loc.y += diff_y;


		// Don't allow moving outside clip are

		if (clip_rect())
		{
			const SDL_Rect *clip = clip_rect();
			if (loc.x < clip->x)
				loc.x = clip->x;
			if (loc.x + loc.w > clip->x + clip->w)
				loc.x = clip->x + clip->w - loc.w;
			if (loc.y < clip->y)
				loc.y = clip->y;
			if (loc.y + loc.h > clip->y + clip->h)
				loc.y = clip->y + clip->h - loc.h;
		}

		set_location(loc);
	}
Exemple #27
0
void edit_line_phase2(struct edit_line *el, double x, double y)
{
    int node1, node2;
    double nodex, nodey, nodez, dist;

    el->phase = 2;

    el->Points = Vect_new_line_struct();
    el->Cats = Vect_new_cats_struct();
    el->line_type = Vect_read_line(&Map, el->Points, el->Cats, el->line);

    el->reversed = 0;

    /* Find out the node nearest to the line */
    Vect_get_line_nodes(&Map, el->line, &node1, &node2);

    Vect_get_node_coor(&Map, node2, &nodex, &nodey, &nodez);
    dist = (x - nodex) * (x - nodex) + (y - nodey) * (y - nodey);

    Vect_get_node_coor(&Map, node1, &nodex, &nodey, &nodez);
    if ((x - nodex) * (x - nodex) + (y - nodey) * (y - nodey) < dist) {
	/* The first node is the nearest => reverse the line and remember
	 * doing so. */
	Vect_line_reverse(el->Points);
	el->reversed = 1;
    }

    display_node(node1, SYMB_BACKGROUND, 1);
    display_node(node2, SYMB_BACKGROUND, 1);
    i_prompt_buttons(_("New Point"), _("Undo Last Point"), _("Close line"));

    set_location(D_u_to_d_col(el->Points->x[el->Points->n_points - 1]),
		 D_u_to_d_row(el->Points->y[el->Points->n_points - 1])
	);
    set_mode(MOUSE_LINE);
}
Exemple #28
0
bool effect::render()
{
	if(disp == NULL) {
		return false;
	}

	if(loc_.x != -1 && loc_.y != -1) {
		if(disp->shrouded(loc_)) {
			return false;
		} else {
			// The location of a halo is an x,y value and not a map location.
			// This means when a map is zoomed, the halo's won't move,
			// This glitch is most visible on [item] haloes.
			// This workaround always recalculates the location of the halo
			// (item haloes have a location parameter to hide them under the shroud)
			// and reapplies that location.
			// It might be optimized by storing and comparing the zoom value.
			set_location(
				disp->get_location_x(loc_) + disp->hex_size() / 2,
				disp->get_location_y(loc_) + disp->hex_size() / 2);
		}
	}

	images_.update_last_draw_time();
	surf_.assign(image::get_image(current_image(),image::SCALED_TO_ZOOM));
	if(surf_ == NULL) {
		return false;
	}
	if(orientation_ == HREVERSE || orientation_ == HVREVERSE) {
		surf_.assign(image::reverse_image(surf_));
	}
	if(orientation_ == VREVERSE || orientation_ == HVREVERSE) {
		surf_.assign(flop_surface(surf_));
	}

	const map_location zero_loc(0,0);
	const int screenx = disp->get_location_x(zero_loc);
	const int screeny = disp->get_location_y(zero_loc);

	const int xpos = x_ + screenx - surf_->w/2;
	const int ypos = y_ + screeny - surf_->h/2;

	SDL_Rect rect = create_rect(xpos, ypos, surf_->w, surf_->h);
	rect_ = rect;
	SDL_Rect clip_rect = disp->map_outside_area();

	// If rendered the first time, need to determine the area affected.
	// If a halo changes size, it is not updated.
	if(overlayed_hexes_.empty()) {
		rect_of_hexes hexes = disp->hexes_under_rect(rect);
		rect_of_hexes::iterator i = hexes.begin(), end = hexes.end();
		for (;i != end; ++i) {
			overlayed_hexes_.push_back(*i);
		}
	}

	if(rects_overlap(rect,clip_rect) == false) {
		buffer_.assign(NULL);
		return false;
	}

	surface screen = disp->get_screen_surface();

	const clip_rect_setter clip_setter(screen, &clip_rect);
	if(buffer_ == NULL || buffer_->w != rect.w || buffer_->h != rect.h) {
		SDL_Rect rect = rect_;
		buffer_.assign(get_surface_portion(screen,rect));
	} else {
		SDL_Rect rect = rect_;
		sdl_blit(screen,&rect,buffer_,NULL);
	}

	sdl_blit(surf_,NULL,screen,&rect);

	return true;
}
/*
 * Sets the position of this Rectangle to the Point pnt
 */
void Rectangle::set_location(Point pnt) {
    set_location(pnt.get_x(), pnt.get_y());
}
void widget::set_measurements(unsigned w, unsigned h)
{
	set_location(sdl::create_rect(rect_.x, rect_.y, w, h));
}