本文整理汇总了C++中setpos函数的典型用法代码示例。如果您正苦于以下问题:C++ setpos函数的具体用法?C++ setpos怎么用?C++ setpos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setpos函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 */
}
示例7: Model_3ds
object::object()
{
mesh =new Model_3ds();
setpos(0,0,0);
setrot(0,0,0);
}
示例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 ???
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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};
}
示例15: getch
/** used to implement ws() */
void istream::skipWhite() {
int c;
FatPos_t pos;
do {
c = getch(&pos);
} while (isspace(c));
setpos(&pos);
}