当前位置: 首页>>代码示例>>C++>>正文


C++ set_size函数代码示例

本文整理汇总了C++中set_size函数的典型用法代码示例。如果您正苦于以下问题:C++ set_size函数的具体用法?C++ set_size怎么用?C++ set_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ss_reconfig

static void ss_reconfig(ss_t *s, size_t new_alloc_size, const size_t new_mt_sz)
{
	size_t size = sd_get_size(s), unicode_size = get_unicode_size(s);
	char *s_str = get_str(s);
	/* Compute offset on target location: */
	struct SSTR_Small sm;
	struct SSTR_Full sf;
	const size_t s2_off = new_mt_sz == SS_METAINFO_SMALL?
				sm.str -(char *)&sm : sf.str - (char *)&sf;
	/* Convert string: */
	memmove((char *)s + s2_off, s_str, size);
	s->is_full = sd_alloc_size_to_is_big(new_alloc_size, &ssf);
	set_size(s, size);
	set_alloc_size(s, new_alloc_size);
	set_unicode_size(s, unicode_size);
}
开发者ID:nobody1986,项目名称:libsrt,代码行数:16,代码来源:sstring.c

示例2: clique_unweighted_max_weight

/*
 * clique_unweighted_max_weight()
 *
 * Returns the size of the maximum (sized) clique in g (or 0 if search
 * was aborted).
 *
 *   g    - the graph
 *   opts - time printing options
 *
 * Note: As we don't have an algorithm faster than actually finding
 *       a maximum clique, we use clique_unweighted_find_single().
 *       This incurs only very small overhead.
 */
int clique_unweighted_max_weight(graph_t *g, clique_options *opts) {
	set_t s;
	int size;

	ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
	ASSERT(g!=NULL);

	s=clique_unweighted_find_single(g,0,0,FALSE,opts);
	if (s==NULL) {
		/* Search was aborted. */
		return 0;
	}
	size=set_size(s);
	set_free(s);
	return size;
}
开发者ID:Wushaowei001,项目名称:vcp,代码行数:29,代码来源:cliquer.c

示例3: AbstractButton

RadioButton::RadioButton (const RefPtr<AbstractIcon>& icon)
    : AbstractButton(icon)
{
  set_round_type(RoundAll);
  set_checkable(true);

  int w = this->icon()->size().width();
  int h = this->icon()->size().height();

  w += pixel_size(kPadding.hsum());
  h += pixel_size(kPadding.vsum());

  set_size(w, h);

  InitializeRadioButtonOnce();
}
开发者ID:Skytale,项目名称:BlendInt,代码行数:16,代码来源:radio-button.cpp

示例4: Entity

/**
 * \brief Creates a carried item (i.e. an item carried by the hero).
 * \param hero the hero who is lifting the item to be created
 * \param original_entity the entity that will be replaced by this carried item
 * (its coordinates, size and origin will be copied)
 * \param animation_set_id name of the animation set for the sprite to create
 * \param destruction_sound_id Name of the sound to play when this item is destroyed
 * (or an empty string).
 * \param damage_on_enemies damage received by an enemy if the item is thrown on him
 * (possibly 0)
 * \param explosion_date date of the explosion if the item should explode,
 * or 0 if the item does not explode
 */
CarriedItem::CarriedItem(
    Hero& hero,
    const Entity& original_entity,
    const std::string& animation_set_id,
    const std::string& destruction_sound_id,
    int damage_on_enemies,
    uint32_t explosion_date
):
  Entity("", 0, hero.get_layer(), Point(0, 0), Size(0, 0)),
  hero(hero),
  is_lifting(true),
  is_throwing(false),
  is_breaking(false),
  break_one_layer_above(false),
  destruction_sound_id(destruction_sound_id),
  damage_on_enemies(damage_on_enemies),
  shadow_sprite(nullptr),
  throwing_direction(0),
  next_down_date(0),
  item_height(0),
  y_increment(0),
  explosion_date(explosion_date) {

  // align correctly the item with the hero
  int direction = hero.get_animation_direction();
  if (direction % 2 == 0) {
    set_xy(original_entity.get_x(), hero.get_y());
  }
  else {
    set_xy(hero.get_x(), original_entity.get_y());
  }
  set_origin(original_entity.get_origin());
  set_size(original_entity.get_size());
  set_drawn_in_y_order(true);

  // create the lift movement and the sprite
  std::shared_ptr<PixelMovement> movement = std::make_shared<PixelMovement>(
      lifting_trajectories[direction], 100, false, true
  );
  create_sprite(animation_set_id);
  get_sprite().set_current_animation("stopped");
  set_movement(movement);

  // create the shadow (not visible yet)
  shadow_sprite = std::make_shared<Sprite>("entities/shadow");
  shadow_sprite->set_current_animation("big");
}
开发者ID:Codex-NG,项目名称:solarus,代码行数:60,代码来源:CarriedItem.cpp

示例5: graph_rem_vertex

/* graph_rem_veterx */
int graph_rem_vertex(Graph *graph, void **data) {
	ListElmt *element, *temp, *prev;
	AdjList *adjlist;
	int found;

	/* Traverse each adjacency list and the vertices it contains. */
	prev = NULL;
	found = 0;

	for (element = list_head(&graph->adjlists); element != NULL;
		 element = list_next(element)) {
		/* Do not allow removal of the vertex if it is in an adjacenty list. */
		if (set_is_member(&((AdjList *)list_data(element))->adjacent, *data))
			return -1;

		/* Keep a pointer to the vertex to be removed. */
		if (graph->match(*data, ((AdjList *)list_data(element))->vertex)) {
			temp = element;
			found = 1;
		}

		/* Keep a pointer to the vertex before the vertex to be removed. */
		if (!found)
			prev = element;
	}

	/* Return if the vertex was not found. */
	if (!found)
		return -1;

	/* Do not allow removal of the vertex if its adjacency list is not empty. */
	if (set_size(&((AdjList *)list_data(temp))->adjacent) > 0)
		return -1;

	/* Remove the vertex. */
	if (list_rem_next(&graph->adjlists, prev, (void **)&adjlist) != 0)
		return -1;

	/* Free the storage allocated by the abstract datatype. */
	*data = adjlist->vertex;
	free(adjlist);

	/* Adjust the vertex count to account for the removed vertex. */
	graph->vcount--;
	return 0;
}
开发者ID:rekkid,项目名称:MyDataStructureAlgorithm,代码行数:47,代码来源:graph.c

示例6: set_size

Asteroid::Asteroid(float x, float y, float ang, float xv, float yv, float rv, int s)
{
    xPos = x;
    yPos = y;
    Collider.x = xPos;
    Collider.y = yPos;
    Angle = ang;
    xVel = xv;
    yVel = yv;
    rotVel = rv;
    split_num = 3;
    mass_max = 90;
    powerup_chance = 10;
    set_size(s);

    TYPE = T_ASTEROID;
}
开发者ID:dhakimian,项目名称:SeniorProject,代码行数:17,代码来源:Asteroid.cpp

示例7: capacity

TiXmlString& TiXmlString::assign(const char* str, size_type len)
{
	size_type cap = capacity();
	if (len > cap || cap > 3*(len + 8))
	{
		TiXmlString tmp;
		tmp.init(len);
		std::memcpy(tmp.start(), str, len);
		swap(tmp);
	}
	else
	{
		std::memmove(start(), str, len);
		set_size(len);
	}
	return *this;
}
开发者ID:HBPVIS,项目名称:Vista,代码行数:17,代码来源:tinystr.cpp

示例8: setup

void setup(){
    set_brief("How to make a basic sword");
    set_long(@MAY

Inherit the appropriate file - SWORD, M_VALUABLE.
Normal setup for adj, size and value (id not needed).
Set weapon_class - approx max hps of damage from a hit.

inherit SWORD;
inherit M_VALUABLE;

void setup() {
    set_adj("dull");
    set_weapon_class(15);
    set_size(MEDIUM);
    set_value(1000);
}
开发者ID:Lundex,项目名称:lima,代码行数:17,代码来源:sword01.c

示例9: setup

void setup(void) {
   set_id("crown");
   set_adj("metal");
   set_short("A metal crown");
   set_long("This crown functions as a useful helmet." +
      " It is a simple crown of metal but you know that it's ancient " +
      "and has rested upon the heads of champions throughout the " +
      "ages.");
   set_gettable(1);
   set_slot("head");
   set_wear_message("$N $vdon $o.");
   set_remove_message("$N $vtake off $o");
   set_ac(2);
   set_value(3000);
   set_size(3);
   set_weight(1);
}
开发者ID:bbailey,项目名称:gurbalib,代码行数:17,代码来源:crown.c

示例10: set_render_type

bool vsx_widget_note::init_from_command(vsx_command_s* c)
{
  set_render_type(render_3d);
  vsx_vector3<> np;
  np = vsx_vector3_helper::from_string<float>(c->parts[2]);
  set_pos(np);
  np = vsx_vector3_helper::from_string<float>(c->parts[3]);
  set_size(np);
  set_font_size(vsx_string_helper::s2f(c->parts[5]));
  set_border(font_size*0.15f);
  size_min.x = font_size*3.0f;
  size_min.y = font_size*4.0f;

  //new_note->target_size = new_note->size;
  load_text( vsx_string_helper::base64_decode(c->parts[4]));
  return true;
}
开发者ID:vovoid,项目名称:vsxu,代码行数:17,代码来源:vsx_widget_note.cpp

示例11: set_to_xml

void set_to_xml(int *l, char* res) /* prints the content of a set */
{
  int i, j, start = 1;

  for(i = 0; i < set_size(4); i++) {
    for(j = 0; j < mod; j++){
      if(l[i] & (1 << j)) {
        if(!start) strcat(res, ",");
        char tmp[8];
        sprintf(tmp, "z[%i]=0", mod * i + j);
        strcat(res,tmp);

        start = 0;
      }
    }
  }
}
开发者ID:yzh89,项目名称:MITL2Timed,代码行数:17,代码来源:set.c

示例12: Detector

/**
 * \brief Creates an enemy.
 * \param game The game.
 * \param name Id of the enemy.
 * \param layer The layer on the map.
 * \param x X position on the map.
 * \param y Y position on the map.
 * \param breed Breed of the enemy.
 * \param treasure Treasure dropped when the enemy is killed.
 */
Enemy::Enemy(
    Game& game,
    const std::string& name,
    Layer layer,
    int x,
    int y,
    const std::string& breed,
    const Treasure& treasure):

  Detector(COLLISION_RECTANGLE | COLLISION_SPRITE,
      name, layer, x, y, 0, 0),

  breed(breed),
  damage_on_hero(1),
  magic_damage_on_hero(0),
  life(1),
  hurt_style(HURT_NORMAL),
  pushed_back_when_hurt(true),
  push_hero_on_sword(false),
  can_hurt_hero_running(false),
  minimum_shield_needed(0),
  rank(RANK_NORMAL),
  savegame_variable(),
  traversable(true),
  obstacle_behavior(OBSTACLE_BEHAVIOR_NORMAL),
  drawn_in_y_order(true),
  initialized(false),
  being_hurt(false),
  stop_hurt_date(0),
  invulnerable(false),
  vulnerable_again_date(0),
  can_attack(true),
  can_attack_again_date(0),
  immobilized(false),
  start_shaking_date(0),
  end_shaking_date(0),
  dying_animation_started(false),
  treasure(treasure),
  exploding(false),
  nb_explosions(0),
  next_explosion_date(0) {

  set_size(16, 16);
  set_origin(8, 13);
}
开发者ID:joshuarobinson,项目名称:solarus,代码行数:55,代码来源:Enemy.cpp

示例13: MapEntity

/**
 * @brief Creates a carried item (i.e. an item carried by the hero).
 * @param hero the hero who is lifting the item to be created
 * @param original_entity the entity that will be replaced by this carried item
 * (its coordinates, size and origin will be copied)
 * @param animation_set_id name of the animation set for the sprite to create
 * @param destruction_sound_id name of the sound to play when this item is destroyed
 * (or an empty string)
 * @param damage_on_enemies damage received by an enemy if the item is thrown on him
 * (possibly 0)
 * @param explosion_date date of the explosion if the item should explode,
 * or 0 if the item does not explode
 */
CarriedItem::CarriedItem(Hero& hero, MapEntity& original_entity,
    const std::string& animation_set_id,
    const std::string& destruction_sound_id,
    int damage_on_enemies, uint32_t explosion_date):

  MapEntity(),
  hero(hero),
  is_lifting(true),
  is_throwing(false),
  is_breaking(false),
  break_on_intermediate_layer(false) {

  // put the item on the hero's layer
  set_layer(hero.get_layer());

  // align correctly the item with the hero
  int direction = hero.get_animation_direction();
  if (direction % 2 == 0) {
    set_xy(original_entity.get_x(), hero.get_y());
  }
  else {
    set_xy(hero.get_x(), original_entity.get_y());
  }
  set_origin(original_entity.get_origin());
  set_size(original_entity.get_size());

  // create the lift movement and the sprite
  PixelMovement *movement = new PixelMovement(lifting_trajectories[direction], 100, false, true);
  create_sprite(animation_set_id);
  get_sprite().set_current_animation("stopped");
  set_movement(movement);

  // create the breaking sound
  this->destruction_sound_id = destruction_sound_id;

  // create the shadow (not visible yet)
  this->shadow_sprite = new Sprite("entities/shadow");
  this->shadow_sprite->set_current_animation("big");

  // damage on enemies
  this->damage_on_enemies = damage_on_enemies;

  // explosion
  this->explosion_date = explosion_date;
}
开发者ID:xor-mind,项目名称:solarus,代码行数:58,代码来源:CarriedItem.cpp

示例14: Initialize

/*ARGSUSED*/
    static void
Initialize(Widget rq, Widget ebw, ArgList args, Cardinal *n)
{
    XmEnhancedButtonWidget  request = (XmEnhancedButtonWidget)rq;
    XmEnhancedButtonWidget  eb = (XmEnhancedButtonWidget)ebw;
    XtWidgetProc	    resize;

    XtProcessLock();
    resize = xmLabelClassRec.core_class.resize;
    XtProcessUnlock();

    /* Create a bitmap for stippling (Drawable resources are cheap).  */
    if (STIPPLE_BITMAP == None)
    {
	Display *dpy = XtDisplay((Widget) request);
	Window	rootW = DefaultRootWindow(dpy);

	STIPPLE_BITMAP = XCreateBitmapFromData(dpy, rootW, stipple_bits,
		stipple_width, stipple_height);
    }
    eb->enhancedbutton.doing_setvalues = False;

    /* First see what type of extended label this is.
     */
    if (eb->enhancedbutton.pixmap_data)
    {
	XmString str;
	set_pixmap(eb);

	/* FIXME: this is not the perfect way to deal with menues, which do not
	 * have any string set right now.  */
	str = XmStringCreateLocalized("");
	XtVaSetValues((Widget) eb, XmNlabelString, str, NULL);
	XmStringFree(str);
    }
    eb->label.pixmap = eb->enhancedbutton.normal_pixmap;

    if (request->core.width == 0)
	eb->core.width = 0;
    if (request->core.height == 0)
	eb->core.height = 0;
    set_size(eb);

    (* resize)((Widget)eb);
}
开发者ID:oddstr,项目名称:macvim_extended,代码行数:46,代码来源:gui_xmebw.c

示例15: ZERO_REALTYPE

Unison::Unison(int update_period_samples_, REALTYPE max_delay_sec_) {
    update_period_samples = update_period_samples_;
    max_delay    = (int)(max_delay_sec_ * (REALTYPE)SAMPLE_RATE + 1);
    if(max_delay < 10)
        max_delay = 10;
    delay_buffer = new REALTYPE[max_delay];
    delay_k      = 0;
    base_freq    = 1.0;
    unison_bandwidth_cents = 10.0;

    ZERO_REALTYPE(delay_buffer, max_delay);

    uv = NULL;
    update_period_sample_k = 0;
    first_time = 0;

    set_size(1);
}
开发者ID:beatwise,项目名称:ZynWise,代码行数:18,代码来源:Unison.cpp


注:本文中的set_size函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。