• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_pos函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: if

void
Root::active_update(float dt_sec)
{
  if (mystate == STATE_APPEARING) {
    if (base_sprite->animation_done()) {
      hatch_timer.start(HATCH_TIME);
      mystate = STATE_HATCHING;
    }
  }
  if (mystate == STATE_HATCHING) {
    if (!hatch_timer.started()) mystate = STATE_GROWING;
  }
  else if (mystate == STATE_GROWING) {
    offset_y -= dt_sec * SPEED_GROW;
    if (offset_y < static_cast<float>(-m_sprite->get_height())) {
      offset_y = static_cast<float>(-m_sprite->get_height());
      mystate = STATE_SHRINKING;
    }
    set_pos(m_start_position + Vector(0, offset_y));
  }
  else if (mystate == STATE_SHRINKING) {
    offset_y += dt_sec * SPEED_SHRINK;
    if (offset_y > 0) {
      offset_y = 0;
      mystate = STATE_VANISHING;
      base_sprite->set_action("vanishing", 2);
      base_sprite->set_animation_loops(2); // TODO: doesn't seem to work for loops=1
    }
    set_pos(m_start_position + Vector(0, offset_y));
  }
  else if (mystate == STATE_VANISHING) {
    if (base_sprite->animation_done()) remove_me();
  }
  BadGuy::active_update(dt_sec);
}
开发者ID:HybridDog,项目名称:supertux,代码行数:35,代码来源:root.cpp


示例2: set_size

void vsx_widget_profiler_plot::init()
{
  support_interpolation = true;

  allow_resize_x = true;
  allow_resize_y = true;
  set_size(vsx_vector3<>(20.0f,0.3f));
  set_pos(vsx_vector3<>(0,0));
  this->interpolate_size();

  size_min.x = 0.2;
  size_min.y = 0.2;

  allow_move_x = false;
  set_pos(vsx_vector3<>(0,0));

  plot_type = v_t;
  plot_tuple_depth = one_dimension;

  profiler = vsx_profiler_manager::get_instance()->get_profiler();

  title = "plot";

  // Menu
  menu = add(new vsx_widget_popup_menu, ".comp_menu");
  menu->commands.adds(VSX_COMMAND_MENU, "close", "menu_close", "");
  menu->commands.adds(VSX_COMMAND_MENU, "Plot Type;v_t", "plot_type", "v_t");
  menu->size.x = size.x * 0.4;
  menu->init();

  init_run = true;
}
开发者ID:CJFocke,项目名称:vsxu,代码行数:32,代码来源:vsx_widget_profiler_plot.cpp


示例3: set_pos

void OLEDClass::print_c(uint8_t x, uint8_t y, char c, CharMode mode)
{
	set_pos(x, y);
	switch (mode)
	{
	case C6x8:
		for (uint8_t i = 0; i < 6; i++)
		{
			write(F6x8[c - 32][i], Data_Mode);
		}
		break;
	case C8x16:
		for (uint8_t i = 0; i < 8; i++)
		{
			write(F8x16[c - 32][i], Data_Mode);
		}
		set_pos(x, y + 1);
		for (uint8_t i = 8; i < 16; i++)
		{
			write(F8x16[c - 32][i], Data_Mode);
		}
		break;
	case C16x16:
		for (uint8_t i = 0; i < 16; i++)
		{
			write(F16x16[c - 32][i], Data_Mode);
		}
		set_pos(x, y + 1);
		for (uint8_t i = 16; i < 32; i++)
		{
			write(F16x16[c - 32][i], Data_Mode);
		}
		break;
	}
}
开发者ID:tromeli,项目名称:STM32F1_Module_lib,代码行数:35,代码来源:OLED.cpp


示例4: printf_fvec3

bool Player::unmount() {
    if (!mount) {
        return true;
    }
    printf_fvec3(get_world_pos());
    printf("\n");
    mount->remove_entity(this);
    // try setting pos to about 2 blocks above current position
    set_pos(fvec3(pos.x, pos.y + 2.0f, pos.z));
    if (get_world()->will_collide_with_anything(this)) {
        // return false if we can't unmount...because not room for player
        set_pos(fvec3(pos.x, pos.y - 2.0f, pos.z));
        mount->add_entity(this);
        return false;
    }
    velocity = mount->velocity;
    mount = 0;
    can_collide = true;
    printf_fvec3(get_world_pos());
    get_world()->add_entity(this);
    
    toggle_mount(false);

    return true;
}
开发者ID:ericandoh,项目名称:Bawk,代码行数:25,代码来源:player.cpp


示例5: decode_flightpath

PyObject* decode_flightpath(const std::string& buf,int version)
{
	Chunk chunk;
	chunk.deserialize(buf,version);
	PyObject* d=PyDict_New();
	/*
	startstamp=path['startstamp']
	endstamp=path['endstamp']
	startpos=path['startpos']
	endpos=path['endpos']
	distance=path['distance']
	path=path['path']
	 *
	 */

	PyObject* thelist=PyList_New(0);
	for(;;)
	{
		PyObject* item=chunk.playback();
		if (item==NULL)
			break;
		PyList_Append(thelist,item);
	}
	set_long(d,"startstamp",chunk.startstamp);
	set_long(d,"endstamp",chunk.real_endstamp);
	set_pos(d,"startpos",chunk.start17);
	set_pos(d,"endpos",chunk.real_endpos);
	set_float(d,"distance",chunk.distance_millinm/1000.0);

	PyDict_SetItemString(d,"path",thelist);
	Py_DECREF(thelist);
	return d;
}
开发者ID:avl,项目名称:SwFlightPlanner,代码行数:33,代码来源:flightpath.cpp


示例6: main

/**
 * 主函数,显示一些东西
 * @return
 */
int main(void)
{
    uint8_t ch;
    //0. 初始化LCD
    init_lcd();
    //1. 最简单的字符输出测试 (写数据)
    set_pos(0x00);
    write_str("hello world");
    _delay_ms(100);
    //2. 读取数据测试 (读数据)
    _delay_ms(100);
    set_pos(0x06);     //设置读取的位置,第1行6列,'w'的位置
    _delay_ms(1000);
    ch = get_data();
    set_pos(0x0D);     //设置光标位置
    set_data(ch);
    _delay_ms(1000);
    //3. 自定义字符测试 (写内存+读内存)
    init_chardb();     //初始化自定义的字符集
    set_pos(0x40);     //设置在第2行还是显示
    int i;
    for ( i =0; i<0b111+1; i++) {
        set_data(i);
        //_delay_ms(50);
    }
    //4. 读取光标位置 (读地址/位置) I处即光标所在地址
    _delay_ms(1000);
    char str[5];
    set_pos(0x4a);
    ch=get_pos();
    sprintf(str,"I=%02XH",ch);
    write_str(str);
    return 0;
}
开发者ID:zodiac1111,项目名称:lcd_4bit_allport,代码行数:38,代码来源:main.c


示例7: tfio_read

// Reads data from the IO, according to the Rack specifications for `#read`.
static VALUE tfio_read(int argc, VALUE *argv, VALUE self) {
  int fd = get_tmpfile(self);
  size_t pos = get_pos(self);
  size_t end = get_end(self);
  VALUE buffer = Qnil;
  char ret_nil = 0;
  ssize_t len = 0;
  // get the buffer object if given
  if (argc == 2) {
    Check_Type(argv[1], T_STRING);
    buffer = argv[1];
  }
  // get the length object, if given
  if (argc > 0 && argv[0] != Qnil) {
    Check_Type(argv[0], T_FIXNUM);
    len = FIX2LONG(argv[0]);
    if (len < 0)
      rb_raise(rb_eRangeError, "length should be bigger then 0.");
    ret_nil = 1;
  }
  // return if we're at the EOF.
  if (pos == end)
    goto no_data;
  // calculate length if it wasn't specified.
  if (len == 0) {
    // make sure we're not reading more then we have
    len = end - pos;
    // set position for future reads
    set_pos(self, end);
    if (len == 0)
      goto no_data;
  } else {
    // set position for future reads
    set_pos(self, pos + len);
  }
  // limit read to what we have
  if (len + pos > end)
    len = end - pos;
  // create the buffer if we don't have one.
  if (buffer == Qnil) {
    buffer = rb_str_buf_new(len);
    // make sure the buffer is binary encoded.
    rb_enc_associate(buffer, BinaryEncoding);
  } else {
    // make sure the buffer is binary encoded.
    rb_enc_associate(buffer, BinaryEncoding);
    if (rb_str_capacity(buffer) < len)
      rb_str_resize(buffer, len);
  }
  // read the data.
  if (pread(fd, RSTRING_PTR(buffer), len, pos) <= 0)
    goto no_data;
  rb_str_set_len(buffer, len);
  return buffer;
no_data:
  if (ret_nil)
    return Qnil;
  else
    return rb_str_buf_new(0);
}
开发者ID:boazsegev,项目名称:iodine,代码行数:61,代码来源:rb-rack-io.c


示例8: get_parent_item

void Node2D::set_global_pos(const Point2& p_pos) {

	Matrix32 inv;
	CanvasItem *pi = get_parent_item();
	if (pi) {
		inv = pi->get_global_transform().affine_inverse();
		set_pos(inv.xform(p_pos));
	} else {
		set_pos(p_pos);
	}
}
开发者ID:Ragar0ck,项目名称:godot,代码行数:11,代码来源:node_2d.cpp


示例9: set_chunk

static void
set_chunk(struct chunk *cnk, struct text *txt,
	  size_t start, size_t size
) {
	/*	Fill the chunk *cnk with info about the piece of text
		in txt starting at start extending over size tokens.
	*/
	cnk->ch_text = txt;
	set_pos(&cnk->ch_first, 0, txt, start);
	set_pos(&cnk->ch_last, 1, txt, start + size - 1);
}
开发者ID:lambdafu,项目名称:similarity-tester,代码行数:11,代码来源:add_run.c


示例10: display_chinese

/******************************************************
 * 函数:display_chinese
 * 作用:显示单个汉字
 * 备注:
 ******************************************************/
void display_chinese(unsigned char row, unsigned char page,unsigned char *c) //row:列 page:页 dd:字符
{
	unsigned char i;

	set_pos(row*16, page*2);  //写数据 第一行起始地址设定,由于每个字符大小是6*12,占用两行
	for(i=0; i<16;i++)
          LCD_DC(c[i],1);//c代表在zifu数组中的位置

  	set_pos(row*16, page*2+1);//写数据 第二行起始地址设定
	for(i=16; i<32;i++)
          LCD_DC(c[i],1);
}
开发者ID:killcoding,项目名称:Electronic-contest,代码行数:17,代码来源:lcd_5110.c


示例11: set_pos

void LCD1602::disp_time_HMS(uint8_t hour,uint8_t min,uint8_t sec)
{
	char s[8];

	set_pos(2,0);
	disp_string("Time:  ");

	sprintf(s,"%02d:%02d:%02d",hour,min,sec);
	disp_string(s);

	set_pos(2,15);
	disp_char('*'); //第二行结束符显示
}
开发者ID:Hletian,项目名称:ebox_stm32,代码行数:13,代码来源:LCD1602.cpp


示例12: set_lir

void FpuStackAllocator::allocate_block(BlockBegin* block) {
  bool processed_merge = false;
  LIR_OpList* insts = block->lir()->instructions_list();
  set_lir(block->lir());
  set_pos(0);


  // Note: insts->length() may change during loop
  while (pos() < insts->length()) {
    LIR_Op* op = insts->at(pos());
    _debug_information_computed = false;

#ifndef PRODUCT
    if (TraceFPUStack) {
      op->print();
    }
    check_invalid_lir_op(op);
#endif

    LIR_OpBranch* branch = op->as_OpBranch();
    LIR_Op1* op1 = op->as_Op1();
    LIR_Op2* op2 = op->as_Op2();
    LIR_OpCall* opCall = op->as_OpCall();

    if (branch != NULL && branch->block() != NULL) {
      if (!processed_merge) {
        // propagate stack at first branch to a successor
        processed_merge = true;
        bool required_merge = merge_fpu_stack_with_successors(block);

        assert(!required_merge || branch->cond() == lir_cond_always, "splitting of critical edges should prevent FPU stack mismatches at cond branches");
      }

    } else if (op1 != NULL) {
      handle_op1(op1);
    } else if (op2 != NULL) {
      handle_op2(op2);
    } else if (opCall != NULL) {
      handle_opCall(opCall);
    }

    compute_debug_information(op);

    set_pos(1 + pos());
  }

  // Propagate stack when block does not end with branch
  if (!processed_merge) {
    merge_fpu_stack_with_successors(block);
  }
}
开发者ID:lmsf,项目名称:jdk9-dev,代码行数:51,代码来源:c1_LinearScan_x86.cpp


示例13: Thing

void Logic::create_things(Position p){//生产掉落物品
	if(rand()%7 == 0){
		auto temp = new Thing(*thing_type[0]);
		temp->set_pos(p);
		things.push_back(temp);
		return;//直接return,如果防止同时出现两个物品
	}
	if(rand()%8 == 0){
		auto temp = new Thing(*thing_type[1]);
		temp->set_pos(p);
		things.push_back(temp);
		return; 
	}
}
开发者ID:smartczh,项目名称:PlanFightGame,代码行数:14,代码来源:logic.cpp


示例14: tfio_gets

/**
Gets returns a line. this is okay for small lines,
but shouldn't really be used.

Limited to ~ 1Mb of a line length.
*/
static VALUE tfio_gets(VALUE self) {
  int fd = get_tmpfile(self);
  size_t pos = get_pos(self);
  size_t end = get_end(self);
  if (pos == end)
    return Qnil;
  size_t pos_e = pos;
  char c;
  int ret;
  VALUE buffer;

  do {
    ret = pread(fd, &c, 1, pos_e);
  } while (ret > 0 && c != '\n' && (++pos_e < end));
  set_pos(self, pos_e + 1);
  if (pos > pos_e) {
    buffer = rb_str_buf_new(pos_e - pos);
    // make sure the buffer is binary encoded.
    rb_enc_associate(buffer, BinaryEncoding);
    if (pread(fd, RSTRING_PTR(buffer), pos_e - pos, pos) < 0)
      return Qnil;
    rb_str_set_len(buffer, pos_e - pos);
    return buffer;
  }
  return Qnil;
}
开发者ID:boazsegev,项目名称:iodine,代码行数:32,代码来源:rb-rack-io.c


示例15: get_window

void Popup::popup_centered_ratio(float p_screen_ratio) {
	
	
	Control *window = get_window();
	ERR_FAIL_COND(!window);
	
	emit_signal("about_to_show");

	Rect2 rect;
	Point2 window_size = window==this ? get_parent_area_size()  :window->get_size();
	rect.size = (window_size * p_screen_ratio).floor();
	rect.pos = ((window_size-rect.size)/2.0).floor();
	set_pos( rect.pos );
	set_size( rect.size );
	
	show_modal(exclusive);
	_fix_size();

	Control *focusable = find_next_valid_focus();
	if (focusable)
		focusable->grab_focus();

	_post_popup();
	notification(NOTIFICATION_POST_POPUP);

}
开发者ID:0871087123,项目名称:godot,代码行数:26,代码来源:popup.cpp


示例16: set_fd

void Buffer_pool_node::reset(){
	set_fd(INIT);
	set_pos(INIT);
	set_timestamp(INIT);

	mark_clean();
}
开发者ID:koushikghosh13sep,项目名称:DBMS,代码行数:7,代码来源:structures.cpp


示例17: change_private_mode

static void change_private_mode(int mode, int set)
{
	switch (mode)
	{
	case 1: /* DECCKM */
		console->cursor_key_mode = set;
		break;

	case 3:
		if (set) /* 132 column mode */
			console_set_size(132, 24);
		else /* 80 column mode */
			console_set_size(80, 24);
		/* Clear window content and reset scrolling regions */
		erase_screen(2);
		set_pos(0, 0);
		break;
		
	case 6:
		console->origin_mode = set;
		break;

	case 7:
		console->wraparound_mode = set;
		break;

	default:
		log_error("change_private_mode(): private mode %d not supported.\n", mode);
	}
}
开发者ID:geek-li,项目名称:flinux,代码行数:30,代码来源:console.c


示例18: console_set_size

static void console_set_size(int width, int height)
{
	console->top = min(console->top, console->buffer_height - height);
	COORD size;
	size.X = width;
	size.Y = console->buffer_height;
	SMALL_RECT rect;
	rect.Left = 0;
	rect.Right = width - 1;
	rect.Top = console->top;
	rect.Bottom = console->top + height - 1;

	if (width > console->width)
	{
		/* Enlarge buffer then window */
		SetConsoleScreenBufferSize(console->out, size);
		SetConsoleWindowInfo(console->out, TRUE, &rect);
	}
	else
	{
		/* Reduce window then buffer */
		SetConsoleWindowInfo(console->out, TRUE, &rect);
		SetConsoleScreenBufferSize(console->out, size);
	}
	set_pos(console->x, console->y);
	console->width = width;
	console->height = height;
}
开发者ID:geek-li,项目名称:flinux,代码行数:28,代码来源:console.c


示例19: set_pos

void cTtyStatus::OsdStatusMessage(const char *Message)
{
    set_pos(23,0);
    if (Message)
    {
        set_color(BLACK_YELLOW);
        print("     %-80s", Message);
    }
    else
    {
        set_color(WHITE_BLACK);
        print("%-80s", "");
    }
    refresh();
    set_pos(2, 0);
}
开发者ID:FFTEAM,项目名称:evolux-spark-sh4,代码行数:16,代码来源:ttystatus.c


示例20: if

void WindowDialog::_input_event(const InputEvent& p_event) {

	if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==BUTTON_LEFT) {

		if (p_event.mouse_button.pressed && p_event.mouse_button.y < 0)
			dragging=true;
		else if (dragging && !p_event.mouse_button.pressed)
			dragging=false;
	}


	if (p_event.type == InputEvent::MOUSE_MOTION && dragging) {

		Point2 rel( p_event.mouse_motion.relative_x, p_event.mouse_motion.relative_y );
		Point2 pos = get_pos();
		Size2 size = get_size();

		pos+=rel;

		if (pos.y<0)
			pos.y=0;

		set_pos(pos);
	}
}
开发者ID:AutonomicStudios,项目名称:godot,代码行数:25,代码来源:dialogs.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_position函数代码示例发布时间:2022-05-30
下一篇:
C++ set_port函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap