本文整理汇总了C++中rest函数的典型用法代码示例。如果您正苦于以下问题:C++ rest函数的具体用法?C++ rest怎么用?C++ rest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rest函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: end_game
/*
There was going to be a nice fadeout effect using the allegro fade_out and
fade_in functions, but for some reason these screwed up the palette. Oh well.
*/
void end_game(int fade_speed)
{
// fade_out(fade_speed);
rest(1000 / fade_speed);
clear_keybuf();
clear_bitmap(screen);
// set_palette(palet);
init_palette();
set_palette(palet);
int challenge_winner = 0;
if (arena[0].teams == 0)
challenge_winner = score_table();
else
challenge_winner = score_table_team();
if (arena[0].challenge_level != 0)
{
if (challenge_winner == 0)
{
switch(arena[0].challenge_level)
{
case 1: information_box("", "Norbert won?", "Hmm.", 0); break;
case 2: information_box("", "Looks like you need some more practice.", "", 0); break;
case 3: information_box("", "Sorry, you lose.", "", 0); break;
case 4: information_box("", "Good, but not great.", "", 0); break;
case 5: information_box("", "Oh well, better luck next time.", "", 0); break;
case 6: information_box("", "Almost there. Try again.", "", 0); break;
case 7: information_box("", "Very good, but not quite good enough.", "", 0); break;
}
end_challenge();
}
}
if (arena[0].qstart != QSTART_NONE)
end_qstart();
//shutdown_network();
// fade_in(*palet, fade_speed);
// set_palette(*palet);
do
{
} while (keypressed() == 0);
clear_keybuf();
//net_init();
}
开发者ID:flags,项目名称:CaptPorksRevenge,代码行数:60,代码来源:score.c
示例2: countdownEven
void countdownEven(int n) {
if (n == 0) {
printf("0\n");
} else {
if (n % 2 == 0) {
printf("%d ", n);
}
countdownEven(rest(n));
}
}
开发者ID:jjlumagbas,项目名称:cmsc21,代码行数:10,代码来源:10-recursion.c
示例3: init
List *take(int n, List *xs) {
double head = 0;
if (null(xs) || n <= 0) {
return init();
} else {
head = first(ref(xs));
return cons(head, take(n-1, rest(xs)));
}
}
开发者ID:aichi,项目名称:gists,代码行数:10,代码来源:safelist_extra.c
示例4: op_atan
// (atan x)
// (atan x y)
Cell* op_atan(Scheme *sc) {
Cell* x = first(sc->args);
if (rest(sc->args) == &g_nil) {
return s_return_helper(sc, make_real(sc, atan(double_value(x))));
} else {
Cell* y = second(sc->args);
return s_return_helper(sc,
make_real(sc, atan2(double_value(x), double_value(y))));
}
}
开发者ID:FunnyLanguage,项目名称:funny,代码行数:12,代码来源:math.c
示例5: create_bitmap
void SwapScreen::waitForKey(){
BITMAP* textBuf;
textBuf = create_bitmap(150,50);
clear_to_color(textBuf,makecol(255,0,255));
counter=255;
flag=false;
rest(20);
clear_keybuf();
while (!keypressed()){
textprintf_ex(textBuf,font,5,5, makecol(counter,counter,counter), -1, "<Press Any Key>");
draw_sprite(screen,textBuf,160, SCREEN_H/2);
setCounter();
}
rest(20);
destroy_bitmap(textBuf);
}
开发者ID:gmich,项目名称:Tetris,代码行数:19,代码来源:utilities.cpp
示例6: controllNave
void controllNave(BITMAP * buffer,BITMAP * nave,SAMPLE * sound, int x,int y){
draw_sprite(buffer, nave,x,y);
int color = 0,s;
if(!key[KEY_SPACE] == 0){
it++;
rest(100);
shotGun(x+20,y-20);
s = play_sample(sound, 100, 0, 2000, 0);
}
}
开发者ID:narukaioh,项目名称:Space-Invaders,代码行数:10,代码来源:main.c
示例7: bind_vars
static bool bind_vars(obj* vars, obj lt, obj rt){
obj utype;
switch(lt->type){
default:
break;
case tSymbol:
if(macromode){
if(obj rr = search_assoc(car(macro_env), lt)){
//macromode = false;
if(vars) add_assoc(vars, rr, rt);
//macromode = true;
return true;
}
}
if(vars) add_assoc(vars, lt, rt);
return true;
case tRef:
let(&(uref(lt)), rt);
return true;
case INT:
return equal(lt, rt);
case tOp:
utype = search_assoc(curr_interp->types, ult(lt));
if(utype){
if(vrInt(utype) != rt->type) return false;
return bind_vars(vars, urt(lt), uref(rt));
}
if(rt->type!=tOp) return false;
if(! bind_vars(vars, ult(lt), ult(rt))) return false;
return bind_vars(vars, urt(lt), urt(rt));
case LIST:
if(rt->type!=LIST) return false;
list x=ul(lt), a=ul(rt);
for(; (x && a); x=rest(x),a=rest(a)){
if(!bind_vars(vars, first(x), first(a))) return false;
}
if(x||a) return false;
return true;
}
print(lt);
assert(0);
return nil;
}
开发者ID:mogami29,项目名称:cipher-shell,代码行数:43,代码来源:eval.cpp
示例8: GetDlgItem
bool CLoginDialog::registration(){
CString phone, name, email;
int country=((CComboBox*) GetDlgItem(IDC_COUNTRY))->GetCurSel();
GetDlgItemText(IDC_PHONE,phone);
GetDlgItemText(IDC_NAME,name);
GetDlgItemText(IDC_EMAIL,email);
std::string header = "/oneworld/webreg?country=";
header+=countries[country][2];
header+="&number=";
header+=(CT2CA)phone;
header+="&name=";
header+=(CT2CA)name;
header+="&email=";
header+=(CT2CA)email;
header+="&countrycode=";
header+=countries[country][2];
CInternetSession session;
CHttpConnection *pConnection = session.GetHttpConnection(_T("89.163.142.253"));
char result[500];
CString request(header.c_str());
CHttpFile *pFile = pConnection->OpenRequest(1,request);
if(!pFile->SendRequest())
return false;
//pFile->QueryInfo(HTTP_QUERY_FLAG_REQUEST_HEADERS,result,(LPDWORD)500);
#ifdef _DEBUG
pFile->Read((void*)result,500);
_cprintf("%s",result);
#endif
CString rest(result);
int start=rest.Find(_T("success\":\""));
if(start<0)
return false;
start+=((CString)_T("success\":\"")).GetLength();
int end=rest.Find(_T("\""),start);
if(end<0)
return false;
CString success=rest.Mid(start, end-start);
#ifdef _DEBUG
_cprintf("%s",(CT2CA)success);
_cprintf("%s",result);
#endif
start=rest.Find(_T("msg\":\""));
start+=((CString)_T("msg\":\"")).GetLength();
end=rest.Find(_T("\""),start);
CString msg=rest.Mid(start, end-start);
SetDlgItemText(IDC_LOGTEXT,msg);
Sleep(2000);
return true;
}
开发者ID:afigegoznaet,项目名称:Microtalk-NG,代码行数:55,代码来源:LoginDialog.cpp
示例9: main
int main()
{
int koseler[8];
int kirmizi, yesil, mavi, renk;
// Allegro'yu ilklendir
allegro_init();
// klavyeyi ilklendir
install_keyboard();
// rastgele sayı üretecini ilklendir
srand(time(NULL));
// ekran kipini ayarla
int donen = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
if (donen != 0) {
allegro_message(allegro_error);
return;
}
// ekran çözünürlüğünü göster
textprintf(screen, font, 0, 0, 15,
"Cokgen cizme programı - %dx%d - Cikmak icin ESC tusuna basiniz",
SCREEN_W, SCREEN_H);
// çıkış tusuna basılana kadar devam et
while (!key[KEY_ESC]) {
// rastgele bir nokta seç
koseler[0] = 10 + rand() / (RAND_MAX / (SCREEN_W - 20));
koseler[1] = 10 + rand() / (RAND_MAX / (SCREEN_H - 20));
koseler[2] = koseler[0] + rand() / (RAND_MAX / 30) + 50;
koseler[3] = koseler[1] + rand() / (RAND_MAX / 30) + 50;
koseler[4] = koseler[2] + rand() / (RAND_MAX / 30) - 100;
koseler[5] = koseler[3] + rand() / (RAND_MAX / 30) + 50;
koseler[6] = koseler[4] + rand() / (RAND_MAX / 30);
koseler[7] = koseler[5] + rand() / (RAND_MAX / 30) - 100;
// rastgele bir renk seç
kirmizi = rand() / (RAND_MAX / 255 + 1);
yesil = rand() / (RAND_MAX / 255 + 1);
mavi = rand() / (RAND_MAX / 255 + 1);
renk = makecol(kirmizi, yesil, mavi);
// çokgen çiz
polygon(screen, 4, koseler, renk);
rest(50);
}
// programı sonlandır
allegro_exit();
}
开发者ID:erdemoncel,项目名称:allegro,代码行数:55,代码来源:cokgen.c
示例10: main
int main()
{
allegro_init();
install_keyboard();
set_color_depth(32);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, width, height, 0, 0);
bialy=makecol(200,200,200);
czarny=makecol(0,0,0);//ustawienie kodow kolorow
BITMAP *buffer = create_bitmap(width, height);
clear_to_color(buffer, bialy);
x=width/2;
y=height/2;//ustawienie mrowki w centrum
direction=0;//mrowka zwrocona poczatkowo w gore
while (!keypressed()) {
if(getpixel(buffer,x,y)==bialy)//jesli mrowka znajduje sie na polu bialym
{
//allegro_message("BIALY");
direction = (direction+3)%4;//obrot w lewo
rectfill(buffer,x-0.5*a,y-0.5*a,x+0.5*a,y+0.5*a,czarny);//zamalowanie pola na czarno
}
else{
direction = (direction+5)%4;//obrot w prawo
rectfill(buffer,x-0.5*a,y-0.5*a,x+0.5*a,y+0.5*a,bialy);//zamalowanie pola na bialo
}
x += a*moves[direction][0];
y += a*moves[direction][1];//przesuniecie mrowki w zadanym kierunku
strcpy(napis,"X: ");
strcat(napis,itoa(x,str,10));
strcat(napis," Y: ");
strcat(napis,itoa(y,str,10));
strcat(napis," D: ");
strcat(napis,itoa(direction,str,10));
textout_centre_ex(buffer, font, napis,
SCREEN_W / 2, 0,
makecol(255, 0, 0), makecol(0, 0, 0));
if(x<0.5*a || y<0.5*a || x>width-0.5*a || y>height-0.5*a)break;
//ochrona przed wyjsciem mrowki poza ramy ekranu
blit(buffer, screen, 0, 0, 0, 0, 640, 700);//wklejenie bufora na ekran
rest(10);//odczekanie pomiêdzy kolejnym ruchem
}
readkey();
destroy_bitmap(buffer);
return 0;
}
开发者ID:Robikos,项目名称:Old-Portfolio,代码行数:55,代码来源:main.c
示例11: keyboard_event_handler
static gint
keyboard_event_handler(GtkWidget *mk, GdkEventKey *event, gpointer ignored)
{
int note;
char *key;
guint keyval;
GdkKeymapKey kk;
PianoKeyboard *pk = PIANO_KEYBOARD(mk);
(void) ignored;
/* We're not using event->keyval, because we need keyval with level set to 0.
E.g. if user holds Shift and presses '7', we want to get a '7', not '&'. */
kk.keycode = event->hardware_keycode;
kk.level = 0;
kk.group = 0;
keyval = gdk_keymap_lookup_key(NULL, &kk);
key = gdk_keyval_name(gdk_keyval_to_lower(keyval));
if (key == NULL) {
g_message("gtk_keyval_name() returned NULL; please report this.");
return FALSE;
}
note = key_binding(pk, key);
if (note < 0) {
/* Key was not bound. Maybe it's one of the keys handled in jack-keyboard.c. */
return FALSE;
}
if (note == 128) {
if (event->type == GDK_KEY_RELEASE) {
rest (pk);
}
return TRUE;
}
note += pk->octave * 12;
assert(note >= 0);
assert(note < NNOTES);
if (event->type == GDK_KEY_PRESS) {
press_key(pk, note);
} else if (event->type == GDK_KEY_RELEASE) {
release_key(pk, note);
}
return TRUE;
}
开发者ID:gesius,项目名称:AudioComplete,代码行数:55,代码来源:gtk_pianokeyboard.c
示例12: menu
void
menu()
{
int a=0;
char s[50],version[]="1.0.8";
//play_sample(themes,255,128,1000,1);
while(1) {
textprintf_centre(screen,font,SREDINA,VISINA/3,15,
" TANKS! v%s",version);
if(a==0) {
textprintf_centre(screen,font,SREDINA,VISINA/3+15,
15,"->Start game",version);
textprintf_centre(screen,font,SREDINA,VISINA/3+30,
15," Exit",version);
}
else {
textprintf_centre(screen,font,SREDINA,VISINA/3+15,
15," Start game",version);
textprintf_centre(screen,font,SREDINA,VISINA/3+30,
15,"->Exit",version);
}
if(key[KEY_ESC])
exit(1);
if(key[KEY_ENTER]) {
if(a==0)
break;
else
exit(1);
}
if(key[KEY_UP]||key[KEY_DOWN]) {
a=!a;
rest(100);
}
}
//stop_sample(themes);
rest(200);
clear(screen);
narisi();
}
开发者ID:gto76,项目名称:tanks,代码行数:42,代码来源:menu.c
示例13: list_walk
int list_walk(LIST *list, list_walk_action action, gptr argument)
{
int error=0;
while (list)
{
if ((error = (*action)(list->data,argument)))
return error;
list=rest(list);
}
return 0;
}
开发者ID:825126369,项目名称:2018_Server,代码行数:11,代码来源:list.c
示例14: Abertura
void Abertura (void)
{
BITMAP *buffer;
SAMPLE *som, *grito, *som2, *som3;
buffer = create_bitmap(LARGURA, ALTURA);
carregaSom_Abertura(&som3, "../audio/thunder.wav");
play_sample(som3, 255, 128, 1000, FALSE);
rest (1000);
carregaImg_Abertura(&buffer, "../grafics/img01.tga");
highcolor_fade_in_Abertura(buffer, 3);
carregaSom_Abertura(&som, "../audio/00.wav");
play_sample(som, 255, 128, 1000, FALSE);
carregaSom_Abertura(&som2, "../audio/a_thunder.wav");
play_sample(som2, 255, 128, 1000, FALSE);
rest (2500);
carregaImg_Abertura(&buffer, "../grafics/img02.tga");
play_sample(som, 255, 128, 1000, FALSE);
carregaSom_Abertura(&som, "../audio/01.wav");
play_sample(som, 1000, 128, 1000, FALSE);
carregaSom_Abertura(&grito, "../audio/scream05.wav");
play_sample(grito, 255, 128, 1000, FALSE);
blit(buffer,screen,0,0,0,0,LARGURA,ALTURA);
highcolor_fade_out_Abertura (5);
rest(1000);
destroy_sample(som);
destroy_sample(som2);
destroy_sample(som3);
destroy_sample(grito);
destroy_bitmap(buffer);
}
开发者ID:rafaelol,项目名称:bejewled,代码行数:41,代码来源:abertura.c
示例15: while
void LMain::main_loop()
{
while (true) {
undraw();
// Depending on the vsync option, I do either frameskipping or
// a set number of logic cycle calculations.
if (gloB->screen_vsync) {
const unsigned loops = Help::get_timer_ticks_per_draw() + 1;
rest(1);
while (++tck % loops != 0) calc();
// To not have the program hang when the user changes the vsync
// option, set tck here. The following "else" will start working
// immediately in the next main_loop() call then.
if (!gloB->screen_vsync) tck = Help::timer_ticks;
}
// If vsync is deactivated, do normal frameskipping: Calculate until
// the logic is up to date, then draw. If the computer is slow, several
// logic updates will be calcd before the draw.
else {
while (tck == Help::timer_ticks) {
rest(1);
// The mouse poll is something I've inserted here against
// the Yassin bug. The Yassin bug is when clicks from the user
// won't get registered by L++. I hope this helps.
hardware.poll_mouse();
}
while (tck < Help::timer_ticks) {
++tck;
calc();
}
}
if (exit) break;
draw();
}
// This gets uncommented only whenever I want to test for exit crashes.
// clear_to_color(screen, makecol(0, 0, 128));
// rest(400);
}
开发者ID:twelvedogs,项目名称:Lix,代码行数:41,代码来源:lmain.cpp
示例16: menu
/* Imprime el menu principal de la aplicacion */
void menu(){
clear_to_color(screen, 0x000000);
textout_ex(screen, font, "ALGORITMOS PARA DIBUJAR PRIMITIVAS" , 200, 50, 0xFFFFFF, 0x000000);
textout_ex(screen, font, "1.Linea DDA" , 150, 100, 0xFFFFFF, 0x000000);
textout_ex(screen, font, "2.Linea Bresenham" , 150, 130, 0xFFFFFF, 0x000000);
textout_ex(screen, font, "3.Circulo Polar" , 150, 160, 0xFFFFFF, 0x000000);
textout_ex(screen, font, "4.Circulo Bresenham" , 150, 190, 0xFFFFFF, 0x000000);
textout_ex(screen, font, "PRESIONE LA TECLA ESC PARA SALIR" , 200, 300, 0xFFFFFF, 0x000000);
textout_ex(screen, font, "<< Computacion grafica Unimag 2014-I >>" , 15, 430, 0xFFFFFF, 0x000000);
rest(200);
}
开发者ID:gengue,项目名称:algoritmos-primitivas-computacion-grafica,代码行数:13,代码来源:main.cpp
示例17: explosion2
void explosion2(BITMAP *bmp, int x,int y,int finalcolor)
{
int color,size;
for (n=0; n<20; n++)
{
color = makecol(rand()%255,rand()%255,rand()%255);
size = 20+rand()%20;
circlefill(bmp, x, y, 350, color);
rest(2);
}
circlefill(bmp, x, y, 350, finalcolor);
}
开发者ID:sanchit234,项目名称:GamePack,代码行数:12,代码来源:savecity.c
示例18: gameover
void gameover()
{
BITMAP *fin = load_bitmap("media/gameover.bmp", NULL);
if(fin == NULL)
ERREUR("Echec chargement fin");
blit(fin, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
textprintf_centre_ex(screen, font, SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0), makecol(255, 0, 0), " Score : %d ", score);
while(keypressed())
readkey();
rest(2000);
readkey();
}
开发者ID:Davier,项目名称:WildForest,代码行数:12,代码来源:main.c
示例19: play_memory_fli
//play intro movie etc
void CGame::PlayIntro() {
//play FLC from memory
play_memory_fli(data[ZANIMATION].dat,screen, 0, NULL);
// display flashing prompt
text_mode(-1); //text with transparent background
//crude by effective blinking text :)
while (!keypressed()) {
textout_centre(screen,font,"INSERT COIN(S)..",320,400,makecol(0,0,0));
rest(600);
textout_centre(screen,font,"INSERT COIN(S)..",320,400,makecol(206,206,90));
rest(300);
}
clear_keybuf();
}
开发者ID:Josh-Stewart,项目名称:Scarbble,代码行数:22,代码来源:game.cpp
示例20: spkrioctl
int
spkrioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
#ifdef SPKRDEBUG
printf("spkrioctl: entering with dev = %"PRIx64", cmd = %lx\n", dev, cmd);
#endif /* SPKRDEBUG */
if (minor(dev) != 0)
return(ENXIO);
else if (cmd == SPKRTONE)
{
tone_t *tp = (tone_t *)data;
if (tp->frequency == 0)
rest(tp->duration);
else
tone(tp->frequency, tp->duration);
}
else if (cmd == SPKRTUNE)
{
tone_t *tp = (tone_t *)(*(void **)data);
tone_t ttp;
int error;
for (; ; tp++) {
error = copyin(tp, &ttp, sizeof(tone_t));
if (error)
return(error);
if (ttp.duration == 0)
break;
if (ttp.frequency == 0)
rest(ttp.duration);
else
tone(ttp.frequency, ttp.duration);
}
}
else
return(EINVAL);
return(0);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:40,代码来源:spkr.c
注:本文中的rest函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论