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

C++ setpos函数代码示例

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

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



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

示例1: switch

ss_inst *parse_until(stream_t *stream, char until) {
    char start;
    switch (until) {
        case ')': start = '('; break;
        case ']': start = '['; break;
        case '}': start = '{'; break;
    }
    int count = 1;
    long IP, new_IP;
    new_IP = IP = getpos(stream);
    while (count) {
        char ch = getch(stream);
        if (ch == start) count++;
        else if (ch == until) count--;
    }
    new_IP = getpos(stream);
    int len = new_IP - IP - 1;
    char *buf = calloc(len + 1, sizeof(char));
    setpos(stream, IP);
    getstr(stream, len, buf);
    setpos(stream, new_IP);
    stream_t *sub_stream = init_stream('s', buf);
    ss_inst *expr = init_insts(sub_stream);  /* {expr} */
    close_stream(sub_stream);
    free(buf);
    return expr;
}
开发者ID:Irides-Chromium,项目名称:compiler,代码行数:27,代码来源:parse.c


示例2: get_parsable_length

int get_parsable_length(stream_t *stream) {
    long IP, new_IP;
    new_IP = IP = getpos(stream);
    int diff;
    LOG(DEBUG, "next:: %u", listench(stream));
    while (listench(stream)) {
        diff = bi_parsable(stream);
        if (diff) {
            LOG(DEBUG, "inloop:: %d", diff);
        } else break;
    }
    new_IP = getpos(stream);
    int len = new_IP - IP - 1;
    char *buf = calloc(len + 1, sizeof(char));

    setpos(stream, IP);
    getstr(stream, len, buf);
    setpos(stream, new_IP);
    int pars_len;
    regmatch_t *match = malloc(sizeof(regmatch_t));
    regex_t *pattern = malloc(sizeof(regex_t));
    regcomp(pattern, ".[~#].", 0);

    if (!regexec(pattern, buf, 1, match, 0))
        pars_len = match->rm_so + 2;
    else
        pars_len = len;
    regfree(pattern);
    free(pattern);
    free(match);
    return pars_len;
}
开发者ID:Irides-Chromium,项目名称:compiler,代码行数:32,代码来源:parse.c


示例3: user_serve

void user_serve()
{
	setpos(&user.pos, mix+3, maxy/2);
	setpos(&ball.pos, mix+4, maxy/2);

	redraw();

	user1_serving_now = 1;
}
开发者ID:jukarimov,项目名称:ping,代码行数:9,代码来源:ping.c


示例4: init_game

void init_game()
{
	setpos(&user.pos, mix+3, maxy/2);
	setpos(&ball.pos, mix+4, maxy/2);

	setpos(&user2.pos, max-3, maxy/2);

	user.score = 0;
	user2.score = 0;
}
开发者ID:jukarimov,项目名称:ping,代码行数:10,代码来源:ping.c


示例5: help

help()
{
	char *menu[]={"How To Play","Selecting Option","Credits","About Me","Back"};
	int w=0,k,g=130,h=200;
	setbkcolor(0);
	settextstyle(3,0,3);
	setpos(0,0);
	viewport();
	settextstyle(7,0,5);
	setcolor(14);
	outtextxy(245,100,"HELP");
	settextstyle(1,0,2);
	setcolor(8);
	for(k=0;k<5;k++)
	{
		outtextxy(g,h,menu[k]);
		h+=textheight(menu[k])+10;
	}
	setpos(0,0);
	status("Select Any one using mouse pointer");

	while(1)
	{
		pos(&button,&n,&m);
		w=opt2(n,m);
		settextstyle(1,0,2);
		g=130;
		h=200;
		for(k=0;k<5;k++)
		{
			if(w==k+1)
			{
				setcolor(11);
				outtextxy(g,h,menu[k]);
				h+=textheight(menu[k])+10;

				if(button==1)
					return w;
			}
			else
			{
				setcolor(8);
				outtextxy(g,h,menu[k]);
				h+=textheight(menu[k])+10;
			}
		}
		if(kbhit())
			goto pr;
	}
      //	getch();
	pr:
	return 0;
}
开发者ID:ramkicse,项目名称:Snake-Game-in-C,代码行数:53,代码来源:snake.C


示例6: scroll

PROC
scroll(bool down)
{
    int i;

    if (count <= 0)
	count = dofscroll;
    strput(CURoff);
    if (down) {
	curr = min(bufmax-1, nextline(TRUE, curr, count));
	i = min(bufmax-1, nextline(TRUE, pend, count));
	if (i > pend)
	    scrollforward(i);
    }
    else {
	curr = bseekeol(max(0,nextline(FALSE, curr, count)));
	i = bseekeol(max(0,nextline(FALSE, ptop, count)));
	if (i < ptop)
	    if (canUPSCROLL)
		scrollback(i);
	    else {
		ptop = i;
		setend();
		redisplay(TRUE);
	    }
    }
    strput(CURon);
    setpos(skipws(curr));	/* initialize new position - first nonwhite */
    yp = setY(curr);
    mvcur(yp, xp);		/* go there */
}
开发者ID:8l,项目名称:FUZIX,代码行数:31,代码来源:editcor.c


示例7: Model_3ds

object::object()
{
    mesh =new Model_3ds();
    setpos(0,0,0);
    setrot(0,0,0);

}
开发者ID:Patrick-Heyer,项目名称:Sabina-patrick,代码行数:7,代码来源:model_3ds.cpp


示例8: logf

void FormantFilter::setfreq_and_q(float frequency, float q_)
{
/*     //Convert form real freq[Hz]
    const float freq = (logf(frequency) / logf(2.0)) - 9.96578428f; //log2(1000)=9.95748f.*/
   Qfactor = q_;
    setpos(frequency); // setpos(freq) // zyn code doesn't seem to do anything ???
}
开发者ID:yiqideren,项目名称:yoshimi,代码行数:7,代码来源:FormantFilter.cpp


示例9: while

istream& istream::getline(char *str, streamsize n, char delim) {
  FatPos_t pos;
  int c;
  m_gcount = 0;
  if (n > 0) str[0] = '\0';
  while (1) {
    c = getch(&pos);
    if (c < 0) {
      break;
    }
    if (c == delim) {
      m_gcount++;
      break;
    }
    if ((m_gcount + 1)  >=  n) {
      setpos(&pos);
      setstate(failbit);
      break;
    }
    str[m_gcount++] = c;
    str[m_gcount] = '\0';
  }
  if (m_gcount == 0) setstate(failbit);
  return *this;
}
开发者ID:nauman-naeem,项目名称:SdFat-beta,代码行数:25,代码来源:istream.cpp


示例10: credit

credit()
{
	setpos(0,0);
	viewport();
	status("                        Return : [Any key]");
	settextstyle(1,0,3);
	setcolor(14);
	outtextxy(240,50,"Credits");
	settextstyle(1,0,1);
	setcolor(2);
		outtextxy(100,100,"SPEED LEVEL [ 00 - 09 ] : 1 Point");
		outtextxy(100,125,"SPEED LEVEL [ 10 - 19 ] : 2 Points");
		outtextxy(100,150,"SPEED LEVEL [ 20 - 29 ] : 3 Points");
		outtextxy(100,175,"SPEED LEVEL [ 30 - 39 ] : 4 Points");
		outtextxy(100,200,"SPEED LEVEL [ 40 - 49 ] : 5 Points");
		outtextxy(100,225,"SPEED LEVEL [ 50 - 59 ] : 6 Points");
		outtextxy(100,250,"SPEED LEVEL [ 60 - 69 ] : 7 Points");
		outtextxy(100,275,"SPEED LEVEL [ 70 - 79 ] : 8 Points");
		outtextxy(100,300,"SPEED LEVEL [ 80 - 89 ] : 9 Points");
		outtextxy(100,325,"SPEED LEVEL [ 90 - 99 ] : 10 Points");
		outtextxy(100,350,"SPEED LEVEL [ - 100 - ] : 11 Points");
     setcolor(4);
     rectangle(0,400,getmaxx(),getmaxy()-27);
     setcolor(15);
     outtextxy(200,403,"BONUS POINT [ 100 POINTS ]");
     outtextxy(200,430,"\( Valid for 10 Seconds \)");
     getch();
     return 0;
}
开发者ID:ramkicse,项目名称:Snake-Game-in-C,代码行数:29,代码来源:snake.C


示例11: select

select()
{
	setpos(0,0);
	viewport();
	status("                         Return : [Any key]");
	settextstyle(1,0,3);
	setcolor(14);
	outtextxy(180,50,"Selecting Option");
	settextstyle(1,0,2);
	setcolor(4);
	outtextxy(100,100,"SPEED LEVEL:");
	settextstyle(1,0,1);
	setcolor(2);
	outtextxy(130,130,"To Increase the speed press [->] ");
	outtextxy(130,160,"To Decrease the speed press [<-] ");
	settextstyle(1,0,2);
	setcolor(4);
	outtextxy(100,200,"MAZE LEVEL:");
	settextstyle(1,0,1);
	setcolor(2);
	outtextxy(130,240,"To select the difficulty level \( Maze \)");
	outtextxy(130,280," Use Mouse pointer");
	getch();
	return 0;
}
开发者ID:ramkicse,项目名称:Snake-Game-in-C,代码行数:25,代码来源:snake.C


示例12: width

//------------------------------------------------------------------------------
void istream::getStr(char *str) {
  FatPos_t pos;
  uint16_t i = 0;
  uint16_t m = width() ? width() - 1 : 0XFFFE;
  if (m != 0) {
    getpos(&pos);
    int c = readSkip();

    while (i < m) {
      if (c < 0) {
        break;
      }
      if (isspace(c)) {
        setpos(&pos);
        break;
      }
      str[i++] = c;
      c = getch(&pos);
    }
  }
  str[i] = '\0';
  if (i == 0) {
    setstate(failbit);
  }
  width(0);
}
开发者ID:0x1abin,项目名称:Gamebuino,代码行数:27,代码来源:istream.cpp


示例13: log_2

void FormantFilter::setfreq_and_q(float frequency, float q_)
{
    //Convert form real freq[Hz]
    const float freq = log_2(frequency) - 9.96578428f; //log2(1000)=9.95748f.

    Qfactor = q_;
    setpos(freq);
}
开发者ID:CallisteHanriat,项目名称:lmms,代码行数:8,代码来源:FormantFilter.cpp


示例14: setpos

Reader::LineInfo Reader::getlineinfo (long p) {
    if (p == -1)
        p = pos;
    setpos(0,'^');
    pos = 0;
    char buff[line_size];
    int last_pos, lineno = 1;
    read_line(buff,line_size);
    while (pos < p) {
        lineno++;
        last_pos = pos;
        read_line(buff,line_size);
    }
    int col = p - last_pos;
    setpos(p,'^');
    return {lineno, col};
}
开发者ID:stevedonovan,项目名称:outstreams,代码行数:17,代码来源:instream.cpp


示例15: getch

/** used to implement ws() */
void istream::skipWhite() {
  int c;
  FatPos_t pos;
  do {
    c = getch(&pos);
  } while (isspace(c));
  setpos(&pos);
}
开发者ID:nauman-naeem,项目名称:SdFat-beta,代码行数:9,代码来源:istream.cpp


示例16: topscore

topscore()
{
	int k,sco;
	char nam[20],sc[10];
	FILE *file;
	setpos(0,0);
	viewport();
	file=fopen("snake.dat","r");
	//if(file==-1)
	  //	printf("error");
	k=0;

	status("                         Exit : [Any key]   ");
	settextstyle(3,0,4);
	setcolor(14);
	outtextxy(250,50,"Top Score");
	settextstyle(1,0,1);
	setcolor(2);
	outtextxy(100,200,"NO MAZE");
	outtextxy(100,240,"MAZE  1");
	outtextxy(100,280,"MAZE  2");
	outtextxy(100,320,"MAZE  3");
	outtextxy(100,360,"MAZE  4");
	setcolor(13);
	while(fscanf(file,"%s %d\n",nam,&sco)!=EOF)
	{       itoa(sco,sc,10);
	if(k==0)
	{
	outtextxy(300,200,sc);
	outtextxy(400,200,nam);
	}
	else if(k==1)
	{
	outtextxy(300,240,sc);
	outtextxy(400,240,nam);
	}
	else if(k==2)
	{
	outtextxy(300,280,sc);
	outtextxy(400,280,nam);
	}
	else if(k==3)
	{
	outtextxy(300,320,sc);
	outtextxy(400,320,nam);
	}
	else if(k==4)
	{
	outtextxy(300,360,sc);
	outtextxy(400,360,nam);
	}
	k++;
	}

	fclose(file);
	getch();
	return 0;
}
开发者ID:ramkicse,项目名称:Snake-Game-in-C,代码行数:58,代码来源:snake.C


示例17: posx

/* Random walking even when we've moved
 * To simulate zombie stumbling and ineffective movement
 * Note that this is sub-optimal; stumbling may INCREASE a zombie's speed.
 * Most of the time (out in the open) this effect is insignificant compared to
 * the negative effects, but in a hallway it's perfectly even
 */
void monster::stumble(bool moved)
{
// don't stumble every turn. every 3rd turn, or 8th when walking.
    if((moved && !one_in(8)) || !one_in(3))
    {
        return;
    }

    std::vector <point> valid_stumbles;
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            const int nx = posx() + i;
            const int ny = posy() + j;
            if ((i || j) && can_move_to(nx, ny) &&
                    /* Don't ever stumble into impassable terrain, even if we normally could
                     * smash it, as this is uncoordinated movement (and is forced). */
                    g->m.move_cost(nx, ny) != 0 &&
                    //Stop zombies and other non-breathing monsters wandering INTO water
                    //(Unless they can swim/are aquatic)
                    //But let them wander OUT of water if they are there.
                    !(has_flag(MF_NO_BREATHE) && !has_flag(MF_SWIMS) && !has_flag(MF_AQUATIC)
                      && g->m.has_flag("SWIMMABLE", nx, ny)
                      && !g->m.has_flag("SWIMMABLE", posx(), posy())) &&
                    (g->u.posx != nx || g->u.posy != ny) &&
                    (g->mon_at(nx, ny) == -1)) {
                point tmp(nx, ny);
                valid_stumbles.push_back(tmp);
            }
        }
    }
    if (valid_stumbles.size() == 0) //nowhere to stumble?
    {
        return;
    }

    int choice = rng(0, valid_stumbles.size() - 1);
    int cx = valid_stumbles[choice].x;
    int cy = valid_stumbles[choice].y;

    moves -= calc_movecost(posx(), posy(), cx, cy);
    setpos(cx, cy);

// Here we have to fix our plans[] list,
// acquiring a new path to the previous target.
// target == either end of current plan, or the player.
    int tc;
    if (plans.size() > 0) {
        if (g->m.sees(posx(), posy(), plans.back().x, plans.back().y, -1, tc))
            set_dest(plans.back().x, plans.back().y, tc);
        else if (sees_player( tc ))
            set_dest(g->u.posx, g->u.posy, tc);
        else //durr, i'm suddenly calm. what was i doing?
            plans.clear();
    }
}
开发者ID:Oddzball,项目名称:Cataclysm-DDA,代码行数:61,代码来源:monmove.cpp


示例18: menu_block_palette

void		menu_block_palette(t_fox_window *win, t_tekpain *paint)
{
  t_color	color;

  (void) win;
  (void) paint;
  if (win->mouse.state == GO_DOWN)
    {
      paint->current_color = fox_getpixelxy(paint->menu, win->mouse.pos->x,
					    win->mouse.pos->y - 581);
      color.full = paint->current_color;
      fox_draw_rectangle_fill(paint->menu, setpos(87, 123), setpos(30, 30),
			      color);
      color.full = paint->tmp_color[1];
      fox_draw_rectangle_fill(paint->menu, setpos(127, 139), setpos(30, 30),
			      color);
      paint->status = 1;
      paint->is_drug = 0;
    }
}
开发者ID:MeixDev,项目名称:gfx_tekpaint_2015,代码行数:20,代码来源:menu_block.c


示例19: Q_UNUSED

void PololuOutputDevice::outputValue(double value, int output, int speed)
{
    Q_UNUSED(speed);
    if(!enabled)
        return;

    double pos = value;
    pos = qMax(pos, minValue);
    pos = qMin(pos, maxValue);

    setpos(output, pos);
}
开发者ID:dankrusi,项目名称:ExtPlane-Panel,代码行数:12,代码来源:pololuoutputdevice.cpp


示例20: getpos

//------------------------------------------------------------------------------
int istream::peek() {
  int16_t c;
  FatPos_t pos;
  m_gcount = 0;
  getpos(&pos);
  c = getch();
  if (c < 0) {
    if (!bad()) setstate(eofbit);
  } else {
    setpos(&pos);
  }
  return c;
}
开发者ID:nauman-naeem,项目名称:SdFat-beta,代码行数:14,代码来源:istream.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setprg16函数代码示例发布时间:2022-05-30
下一篇:
C++ setpixel函数代码示例发布时间: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