// pager与msg设定 // int x_userdefine() { int id; unsigned int newlevel; set_user_status(ST_USERDEF); if (!(id = getuser(currentuser.userid))) { screen_move_clear(3); screen_printf("错误的使用者 ID..."); pressreturn(); screen_clear(); return 0; } screen_move(1, 0); screen_clrtobot(); screen_move(2, 0); use_define = 1; newlevel = setperms(lookupuser.userdefine, "参数", NUMDEFINES, showperminfo); screen_move(2, 0); if (newlevel == lookupuser.userdefine) screen_printf("参数没有修改...\n"); else { lookupuser.userdefine = newlevel; currentuser.userdefine = newlevel; substitut_record(PASSFILE, &lookupuser, sizeof(struct userec), id); screen_printf("新的参数设定完成...\n\n"); } pressreturn(); screen_clear(); use_define = 0; return 0; }
// pager与msg设定 // int x_userdefine() { int id; unsigned int newlevel; set_user_status(ST_USERDEF); if (!(id = getuser(currentuser.userid))) { screen_move_clear(3); //% prints("错误的使用者 ID..."); prints("\xb4\xed\xce\xf3\xb5\xc4\xca\xb9\xd3\xc3\xd5\xdf ID..."); pressreturn(); screen_clear(); return 0; } screen_move(1, 0); screen_clrtobot(); screen_move(2, 0); use_define = 1; //% newlevel = setperms(lookupuser.userdefine, "参数", NUMDEFINES, newlevel = setperms(lookupuser.userdefine, "\xb2\xce\xca\xfd", NUMDEFINES, showperminfo); screen_move(2, 0); if (newlevel == lookupuser.userdefine) //% prints("参数没有修改...\n"); prints("\xb2\xce\xca\xfd\xc3\xbb\xd3\xd0\xd0\xde\xb8\xc4...\n"); else { lookupuser.userdefine = newlevel; currentuser.userdefine = newlevel; substitut_record(PASSFILE, &lookupuser, sizeof(struct userec), id); //% prints("新的参数设定完成...\n\n"); prints("\xd0\xc2\xb5\xc4\xb2\xce\xca\xfd\xc9\xe8\xb6\xa8\xcd\xea\xb3\xc9...\n\n"); } pressreturn(); screen_clear(); use_define = 0; return 0; }
//#define MY_DEBUG // 执行命令cmdfile,参数为param1 static void exec_cmd(int umode, int pager, char *cmdfile, char *param1) { char buf[160]; char *my_argv[18], *ptr; fb_signal(SIGALRM, SIG_IGN); set_user_status(umode); screen_clear(); screen_move(2, 0); if (!dashf(cmdfile)) { //% prints("文件 [%s] 不存在!\n", cmdfile); prints("\xce\xc4\xbc\xfe [%s] \xb2\xbb\xb4\xe6\xd4\xda\xa3\xa1\n", cmdfile); pressreturn(); return; } sprintf(buf, "%s %s %s %d", cmdfile, param1, currentuser.userid, getpid()); report(buf, currentuser.userid); my_argv[0] = cmdfile; strcpy(buf, param1); if (buf[0] != '\0') ptr = strtok(buf, " \t"); else ptr = NULL; for (int i = 1; i < 18; i++) { if (ptr) { my_argv[i] = ptr; ptr = strtok(NULL, " \t"); } else { my_argv[i] = NULL; } } #ifdef MY_DEBUG for (i = 0; i < 18; i++) { if (my_argv[i] != NULL) prints ("my_argv[%d] = %s\n", i, my_argv[i]); else prints ("my_argv[%d] = (none)\n", i); } pressanykey (); #else child_pid = fork(); if (child_pid == -1) { //% prints("资源紧缺,fork() 失败,请稍后再使用"); prints("\xd7\xca\xd4\xb4\xbd\xf4\xc8\xb1\xa3\xac""fork() \xca\xa7\xb0\xdc\xa3\xac\xc7\xeb\xc9\xd4\xba\xf3\xd4\xd9\xca\xb9\xd3\xc3"); child_pid = 0; pressreturn(); return; } if (child_pid == 0) { execv(cmdfile, my_argv); exit(0); } else { waitpid(child_pid, NULL, 0); } #endif child_pid = 0; screen_clear(); }
static void show_progress(char *line) { dialog_busy(5, 60, line); #if 0 static int nfiles = 0, cfile = 0; static char value[64]; char prompt[64]; if (!strncmp(line, "Running gpart on", 16)) { dialog_busy(5, 60, "Partitioning and labeling disk..."); } else if (!strcmp(line, "pc-sysinstall: Extraction Finished")) { screen_clear(MODULE); dialog_busy(5, 60, "Finishing installation..."); } else if (!strncmp(line, "Cleaning up", 11)) { dialog_busy(5, 60, "Cleaning up disk..."); } else if (!strncmp(line, "NEWFS:", 6)) { strlcpy(value, line+7, sizeof(value)); snprintf(prompt, sizeof(prompt), "Creating filesystem %s", value); dialog_busy(5, 60, prompt); } else if (!strncmp(line, "FETCH:", 6)) { screen_clear(MODULE); dialog_busy(5, 60, "Preparing to fetch..."); strlcpy(value, basename(line+6), sizeof(value)); } else if (!strncmp(line, "SIZE:", 5)) { int size, down; sscanf(line, "SIZE: %u DOWNLOADED: %u", &size, &down); if (down == 0) down = 1; if (size == 0) size = 1; if (down > size) down = size; snprintf(prompt, sizeof(prompt), "Downloading file %s", value); dialog_gauge("File download", prompt, (LINES - 7) / 2, (COLS - 60) / 2, 7, 60, (down * 100) / size); } else if (!strncmp(line, "INSTALLCOUNT:", 13)) { nfiles = atoi(line+14); cfile = 0; /* XXX we should be using a FSM */ } else if (!strncmp(line, "x ", 2)) { cfile++; snprintf(prompt, sizeof(prompt), "%s", line + 3); dialog_gauge("Installation progress", prompt, (LINES - 7) / 2, (COLS - 60) / 2, 7, 60, (cfile * 100) / nfiles); } #endif }
/** * If it fits in the highscore, prepare the new highscore * params: * score -- the new highscore */ void new_highscore_init(uint64_t new_score) { screen_clear(NULL, 0x00); int x; for(x = 0; x < SCORE_SIZE; ++x) { if(new_score > score[x].score) { break; // new highscore, and there is a spot } } if(x == SCORE_SIZE) { highscore_init(); return; // no new highscore } // Insert new highscore for(int y = SCORE_SIZE -1; y > x; --y) { score[y] = score[y -1]; } // prepare initial values of the name char *name = score[x].name; name[0] = 'A'; name[1] = 'A'; name[2] = 'A'; name[3] = '\0'; score[x].score = new_score; new_highscore.score = &score[x]; new_highscore.name_p = name; game_state = STATE_NEW_HIGHSCORE; }
void screen_init(void) { LCD_Init(LCD_BUFFER_ADDR, NULL); LCD_Cursor_Dis(0); LCD_Copy_Cursor ((unsigned int *)Cursor, 0, sizeof(Cursor)/sizeof(uint32_t)); LCD_Cursor_Cfg(CRSR_FRAME_SYNC | CRSR_PIX_32); LCD_Cursor_En(0); // LCD_Move_Cursor(0, 0); LCD_Ctrl(1); screen = (unsigned short *) LCD_BUFFER_ADDR; screen_width = 320; screen_height = 240; font = &font_koi5x8; max_text_width = screen_width / font->width; max_text_height = screen_height / font->height; fg_color = 0x7fff; bg_color = 0; screen_clear(); }
int main(int ac, char **av) { t_list *list; t_list *tmp; struct termios t; struct termios old; list = create_list(); if (tcgetattr(0, &t) == -1) { my_putstr("Error: tcgetattr failed"); return (0); } old = t; if (manage_arg(ac, av, list) == -1) return (0); if (screen_clear() == -1) return (0); if (raw_mode(&t) == -1) return (0); tmp = list->next; tmp->cursor = 1; my_select(list, old); list_free(&list); return (0); }
void main_menu() { /* Play a simulated game in the background */ unsigned char _; initialize(); while (1) { unsigned char key; screen_clear(screen); draw_actors(); draw_string(screen, 28, 0, "-- Pong --"); draw_string(screen, 8, 10, "Press ENTER to begin"); screen_draw(screen); update_ai(&left_paddle); update_ai(&right_paddle); update_ball(); key = app_get_key(&_); switch (key) { case KEY_ENTER: return; case KEY_MODE: exit(0); break; } ksleep(5); } }
/* -------------------------------------------------------------------------- */ static void mpd_state_changed_handler(MpdObj *mi, ChangedStatusType what, void *userdata) { struct lcd_stuff_mpd *mpd = (struct lcd_stuff_mpd *)userdata; char *str; mpd->current_state = mpd_player_get_state(mpd->mpd); report(RPT_DEBUG, "State changed, %d\n", mpd->current_state); mpd->song_displayed = false; switch (mpd->current_state) { case MPD_PLAYER_PAUSE: str = "paused"; break; case MPD_PLAYER_UNKNOWN: str = "unknown"; break; case MPD_PLAYER_STOP: str = "stopped"; break; case MPD_PLAYER_PLAY: return; default: str = ""; break; } screen_clear(&mpd->screen); }
int quit() { tcsetattr(0, TCSANOW, &oldtty); screen_clear(); refresh(); syslog("QUIT"); exit(0); }
int my_select(t_list *list, struct termios old) { int i; char buff[2]; i = 0; while (i < 1) { screen_clear(); buff[0] = 0; buff[1] = 0; buff[2] = 0; show_list(list); if (read(0, buff, 3) == -1) { my_putstr("Error: read failled"); return (0); } else if (get_buff(buff, &i, list, old) == -1) return (0); } if (i == 2) show_selected(list); return (0); }
int winhelp() { screen_clear(); //% prints("==欢迎来玩键盘扫雷游戏== (程序由 nju BBS 站长 zhch 设计)\r\n---------------------------------\\r\n\r\n"); prints("==\xbb\xb6\xd3\xad\xc0\xb4\xcd\xe6\xbc\xfc\xc5\xcc\xc9\xa8\xc0\xd7\xd3\xce\xcf\xb7== (\xb3\xcc\xd0\xf2\xd3\xc9 nju BBS \xd5\xbe\xb3\xa4 zhch \xc9\xe8\xbc\xc6)\r\n---------------------------------\\r\n\r\n"); //% prints("玩法很简单,和[1;34mwindows[m下的鼠标扫雷差不多.\r\n"); prints("\xcd\xe6\xb7\xa8\xba\xdc\xbc\xf2\xb5\xa5\xa3\xac\xba\xcd[1;34mwindows[m\xcf\xc2\xb5\xc4\xca\xf3\xb1\xea\xc9\xa8\xc0\xd7\xb2\xee\xb2\xbb\xb6\xe0.\r\n"); //% prints(" '[1;32mF[m'键的作用相当于鼠标的左键及双击的作用, 程序根据你点击的位置\r\n"); prints(" '[1;32mF[m'\xbc\xfc\xb5\xc4\xd7\xf7\xd3\xc3\xcf\xe0\xb5\xb1\xd3\xda\xca\xf3\xb1\xea\xb5\xc4\xd7\xf3\xbc\xfc\xbc\xb0\xcb\xab\xbb\xf7\xb5\xc4\xd7\xf7\xd3\xc3\xa3\xac \xb3\xcc\xd0\xf2\xb8\xf9\xbe\xdd\xc4\xe3\xb5\xe3\xbb\xf7\xb5\xc4\xce\xbb\xd6\xc3\r\n"); //% prints(" 自动判断要进行哪种操作。\r\n"); prints(" \xd7\xd4\xb6\xaf\xc5\xd0\xb6\xcf\xd2\xaa\xbd\xf8\xd0\xd0\xc4\xc4\xd6\xd6\xb2\xd9\xd7\xf7\xa1\xa3\r\n"); //% prints(" '[1;32mS[m'键则相当于鼠标右键的功能, 可用来标雷.\r\n"); prints(" '[1;32mS[m'\xbc\xfc\xd4\xf2\xcf\xe0\xb5\xb1\xd3\xda\xca\xf3\xb1\xea\xd3\xd2\xbc\xfc\xb5\xc4\xb9\xa6\xc4\xdc, \xbf\xc9\xd3\xc3\xc0\xb4\xb1\xea\xc0\xd7.\r\n"); //% prints(" '[1;32mH[m'键用来显示本帮助信息.\r\n"); prints(" '[1;32mH[m'\xbc\xfc\xd3\xc3\xc0\xb4\xcf\xd4\xca\xbe\xb1\xbe\xb0\xef\xd6\xfa\xd0\xc5\xcf\xa2.\r\n"); //% prints(" '[1;32mQ[m'键退出游戏.\r\n"); prints(" '[1;32mQ[m'\xbc\xfc\xcd\xcb\xb3\xf6\xd3\xce\xcf\xb7.\r\n"); //% prints(" 当屏幕乱掉时,可用'[1;32mD[m'可用来刷新屏幕。\r\n"); prints(" \xb5\xb1\xc6\xc1\xc4\xbb\xc2\xd2\xb5\xf4\xca\xb1\xa3\xac\xbf\xc9\xd3\xc3'[1;32mD[m'\xbf\xc9\xd3\xc3\xc0\xb4\xcb\xa2\xd0\xc2\xc6\xc1\xc4\xbb\xa1\xa3\r\n"); //% prints("建议用[1;32mNetterm[m来玩(当然njuterm也可以,:)),[1;32mtelnet[m效果不是太好\r\n"); prints("\xbd\xa8\xd2\xe9\xd3\xc3[1;32mNetterm[m\xc0\xb4\xcd\xe6(\xb5\xb1\xc8\xbbnjuterm\xd2\xb2\xbf\xc9\xd2\xd4,:)),[1;32mtelnet[m\xd0\xa7\xb9\xfb\xb2\xbb\xca\xc7\xcc\xab\xba\xc3\r\n"); //% prints("第一次点击一定会开一片,很舒服吧。\r\n"); prints("\xb5\xda\xd2\xbb\xb4\xce\xb5\xe3\xbb\xf7\xd2\xbb\xb6\xa8\xbb\xe1\xbf\xaa\xd2\xbb\xc6\xac\xa3\xac\xba\xdc\xca\xe6\xb7\xfe\xb0\xc9\xa1\xa3\r\n"); //% prints("熟练后,速度还是很快的,几乎可以达到鼠标扫雷的速度.\r\n"); prints("\xca\xec\xc1\xb7\xba\xf3\xa3\xac\xcb\xd9\xb6\xc8\xbb\xb9\xca\xc7\xba\xdc\xbf\xec\xb5\xc4\xa3\xac\xbc\xb8\xba\xf5\xbf\xc9\xd2\xd4\xb4\xef\xb5\xbd\xca\xf3\xb1\xea\xc9\xa8\xc0\xd7\xb5\xc4\xcb\xd9\xb6\xc8.\r\n"); pressanykey(); winrefresh(); }
//(Main/ariph count) screen help void interface_help_main() { char *gig; screen_clear(); screen_frame_create(); print_graph("Calculator, plots builder.",250,100); print_graph("--------------------------------------------------------------------",250,116); print_graph("Insert ariphmetical expression you want to calculate,",250,132); print_graph("or plot formula you want to visualise.",250,148); gig=(char*)malloc(127*sizeof(char)); //doing that, because it really differs from max number amount of vars sprintf(gig,"You can save %d constants, build %d plots at the same time.",var_max_amount,plot_amount); print_graph(gig,250,164); print_graph("To save constant, print: \"constant_name\" = \"value\".",250,180); print_graph("\"constant_name\" can take up to 8 latin letters.",250,196); print_graph("Keys:",250,212); print_graph("Enter------ Calculate/Build",250,228); print_graph("Esc--------- Exit",250,244); print_graph("F1----------- Watch help",250,260); print_graph("Tab--------- Switch to plots",250,276); print_graph("Insert------- Push value in memory",250,292); print_graph("Space------- Recall memory",250,308); print_graph("Del---------- Clean memory",250,324); SDL_RenderPresent(ren); SDL_getch(); }
int main(int argc, char* argv[]) { if(SDL_Init(SDL_INIT_EVERYTHING) == -1) { throw_SDLerror(); } if(TTF_Init() == -1) { throw_SDLerror(); } window = SDL_CreateWindow(GAME_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, GAME_WIDTH, GAME_HEIGHT, SDL_WINDOW_RESIZABLE); renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); SDL_RenderSetLogicalSize(renderer, GAME_WIDTH, GAME_HEIGHT); // TODO: black loading screen is boring. screen_clear(); screen_display(); asset_init(); Player_create(); Map_init(); run(); asset_quit(); TTF_Quit(); SDL_Quit(); return 0; }
void score(bool player) { if (player) { left_score++; } else { right_score++; } ball_motion.x = -ball_motion.x; if (ball_motion.y > 1) { ball_motion.y = 1; } else if (ball_motion.y < -1) { ball_motion.y = -1; } ball.x = DISPLAY_WIDTH / 2 - (ball_width / 2); ball.y = DISPLAY_HEIGHT / 2 - (ball_height / 2); if (game_running) { screen_clear(screen); draw_actors(); draw_score(); draw_string(screen, 40, 10, "SCORE"); screen_draw(screen); ksleep(1000); } }
//取得genbuf中保存的用户所在的记录位置到*id中,为零表示不存在 int gettheuserid(int x, char *title, int *id) { screen_move(x, 0); usercomplete(title, genbuf); if (*genbuf == '\0') { screen_clear(); return 0; } if (!(*id = getuser(genbuf))) { screen_move_clear(x + 3); //% prints("错误的使用者代号"); prints("\xb4\xed\xce\xf3\xb5\xc4\xca\xb9\xd3\xc3\xd5\xdf\xb4\xfa\xba\xc5"); pressreturn(); screen_clear(); return 0; } return 1; }
//Exit screen void interface_exit() { screen_clear(); screen_frame_create(); print_graph("Are you sure you want to exit the program?",250,250); print_graph("Press 'Enter' to exit",320,266); SDL_RenderPresent(ren); }
void check_reg_extra() { struct schoolmate_info schmate; struct userec *urec = ¤tuser; char buf[192], bufe[192]; sethomefile(buf, currentuser.userid, ".regextra"); if (!dashf(buf)) { do { memset(&schmate, 0, sizeof(schmate)); strlcpy(schmate.userid, currentuser.userid, sizeof(schmate.userid)); screen_move(1, 0); //% prints("请输入个人信息. 如果输入错误,可以重新输入.\n"); prints("\xc7\xeb\xca\xe4\xc8\xeb\xb8\xf6\xc8\xcb\xd0\xc5\xcf\xa2. \xc8\xe7\xb9\xfb\xca\xe4\xc8\xeb\xb4\xed\xce\xf3,\xbf\xc9\xd2\xd4\xd6\xd8\xd0\xc2\xca\xe4\xc8\xeb.\n"); /*default value is 0*/ do { //% getdata(2, 0, "输入以前的学号: ", schmate.school_num, getdata(2, 0, "\xca\xe4\xc8\xeb\xd2\xd4\xc7\xb0\xb5\xc4\xd1\xa7\xba\xc5: ", schmate.school_num, sizeof(schmate.school_num), DOECHO, YEA); } while (!isNumStr(schmate.school_num)); //如果有输入非数字,重新输入!下同 do { //% getdata(4, 0, "输入邮箱(外部邮箱亦可): ", schmate.email, STRLEN, getdata(4, 0, "\xca\xe4\xc8\xeb\xd3\xca\xcf\xe4(\xcd\xe2\xb2\xbf\xd3\xca\xcf\xe4\xd2\xe0\xbf\xc9): ", schmate.email, sizeof(schmate.email), DOECHO, YEA); } while (!valid_addr(schmate.email)); do { //% getdata(6, 0, "输入身份证号码: ", schmate.identity_card_num, getdata(6, 0, "\xca\xe4\xc8\xeb\xc9\xed\xb7\xdd\xd6\xa4\xba\xc5\xc2\xeb: ", schmate.identity_card_num, sizeof(schmate.identity_card_num), DOECHO, YEA); } while (!isNumStrPlusX(schmate.identity_card_num) || strlen(schmate.identity_card_num) !=IDCARDLEN); do { //% getdata(8, 0, "输入毕业证书编号: ", schmate.diploma_num, getdata(8, 0, "\xca\xe4\xc8\xeb\xb1\xcf\xd2\xb5\xd6\xa4\xca\xe9\xb1\xe0\xba\xc5: ", schmate.diploma_num, sizeof(schmate.diploma_num), DOECHO, YEA); } while (!isNumStr(schmate.diploma_num)); do { //% getdata(10, 0, "输入手机或固定电话号码: ", schmate.mobile_num, getdata(10, 0, "\xca\xe4\xc8\xeb\xca\xd6\xbb\xfa\xbb\xf2\xb9\xcc\xb6\xa8\xb5\xe7\xbb\xb0\xba\xc5\xc2\xeb: ", schmate.mobile_num, sizeof(schmate.mobile_num), DOECHO, YEA); } while (!isNumStr(schmate.mobile_num)); strcpy(buf, ""); //% getdata(11, 0, "以上信息输入正确并进行邮箱绑定认证[Y/n]", buf, 2, DOECHO, YEA); getdata(11, 0, "\xd2\xd4\xc9\xcf\xd0\xc5\xcf\xa2\xca\xe4\xc8\xeb\xd5\xfd\xc8\xb7\xb2\xa2\xbd\xf8\xd0\xd0\xd3\xca\xcf\xe4\xb0\xf3\xb6\xa8\xc8\xcf\xd6\xa4[Y/n]", buf, 2, DOECHO, YEA); } while (buf[0] =='n' || buf[0] == 'N'); sprintf(buf, "%s, %s, %s, %s, %s\n", schmate.school_num, schmate.email, schmate.identity_card_num, schmate.diploma_num, schmate.mobile_num); sethomefile(bufe, currentuser.userid, ".regextra"); file_append(bufe, buf); do_report(".SCHOOLMATE", buf); register_send_email(urec, schmate.email); } screen_clear(); tui_check_reg_mail(); }
void screen_show_x(){ int x, y; float r = 0.1f, g = 0.1f, b = 0.1f; char ch = '0'; char row[5], column[5]; screen_clear(); /* vertical grid lines */ for(y=0, ch='0';y<HEIGHT;y++){ if(y%10){ r += .001; } for(x=0, ch='0';x<WIDTH;x+=2){ screen_set_bg_color(r,g,b); screen_bg_update(x,y); } } /* horizontal grid lines */ for(y=0, ch='0';y<HEIGHT;y+=2){ for(x=0, ch='0';x<WIDTH;x++) screen_set_bg_color(0.1f,0.1f,0.1f); screen_bg_update(x,y); } /* horizontal numbers */ for(y=0, ch='0';y<HEIGHT;y+=10){ for(x=0, ch='0';x<WIDTH;x++){ screen_char_update(x,y,ch); if(ch == '9') { ch = '0'; } else { ch++; } } } /* vertical numbers */ for(x=0, ch='0';x<WIDTH;x+=10){ for(y=0, ch='0';y<HEIGHT;y++){ screen_char_update(x,y,ch); if(ch == '9') { ch = '0'; } else { ch++; } } } screen_draw_arrow(1,1); /* mark blocks by tens */ screen_set_fg_color(1.0, 1.0, 1.0); x = 0; y = 0; while(x < 120){ y = 0; while(y < 50){ sprintf(row, "%d", y); sprintf(column, "%d", x); screen_mv_add_str(x+3, y+5, "X="); screen_mv_add_str(x+5, y+5, column); screen_mv_add_str(x+3, y+4, "Y="); screen_mv_add_str(x+5, y+4, row); y += 10; } x += 10; } }
void main() { SCREEN *screen; get_lcd_lock(); screen = screen_allocate(); screen_clear(screen); draw_string(screen, 0, 0, "Hello world!"); screen_draw(screen); while (1); }
/** * initializes any global vars */ void c_init() { // 60HZ setTimer(19886); screen_init(&scr_full, 0, 0, SCREEN_SIZE_X, SCREEN_SIZE_Y); screen_clear(NULL, 0x00); menu_init(); }
int winmine() { int x,y; win_showrec(); screen_clear(); refresh(); while(1) { screen_clear(); for (x=0;x<=31;x++) for (y=0;y<=17;y++) { a[x][y]= 0; m[x][y]= 0; o[x][y]= 0; } winrefresh(); winloop(); pressanykey(); } }
void display_clear() { dprintf("display_clear\n"); screen_clear(); memzero(screenbuf, bufsize); memzero(colorbuf, bufsize); curr_x = curr_y = 0; }
void game_loop() { int64_t ascii = readKeyCode(); screen_t scr_info; screen_init(&scr_info, 0, 0, SCREEN_SIZE_X, 2); --game.timer; if(ascii) { screen_clear(NULL, 0x00); switch(ascii) { case KEY_CODE_AU: block_mov(game.player, 0, -1); break; case KEY_CODE_AD: block_mov(game.player, 0, 1); break; case KEY_CODE_AL: block_mov(game.player, -1, 0); break; case KEY_CODE_AR: block_mov(game.player, 1, 0); break; case KEY_CODE_S: block_rotate(game.player); break; case KEY_CODE_ENT: if( game.player->dealloc || field_empty(&game.field, game.player) ) { ++game.score; field_block_merge(&game.field, game.player); game_next(&game); } break; } game_draw(&game); } if(game.timer == 0) { // screen_clear(NULL, 0x00); // writef(NULL, "The application crashed...%nWhy did you abandon it? You monster!"); new_highscore_init(game.score); return; } writef(&scr_info, "Time left: %c%u%c seconds!%n" "Your current score: %c%u", 0xCF, game.timer / TICKS_PER_SEC +1, 0x07, 0x2F, game.score); }
void console_clear() { screen_clear(); cursor_x = 0; cursor_y = 0; color = DEFAULT_COLOR; _update_cursor_pos(); }
/** * Refreshes the screen. If overlay_on is a non-zero value, then the debug * overlay will be turned on and will be painted with the refresh. */ void screen_refresh(int overlay_on) { screen_blit_surface(virtscreen, screen, 0, 0); if (overlay_on) { screen_trace_message(); screen_blit_surface(overlay, screen, 0, 0); } screen_clear(overlay, COLOR_BLACK); SDL_UpdateRect(screen, 0, 0, 0, 0); }
static void system_abort(void) { if (session_id()) { log_usies("ABORT", "", ¤tuser); u_exit(); } screen_clear(); screen_flush(); //% prints("谢谢光临, 记得常来喔 !\n"); prints("\xd0\xbb\xd0\xbb\xb9\xe2\xc1\xd9, \xbc\xc7\xb5\xc3\xb3\xa3\xc0\xb4\xe0\xb8 !\n"); exit(0); }
void screen_init() { if (backgroundMode) { return; } screen_inited = 1; initscr(); noecho(); screen_clear(); }
void init(){ key=NULL; posY=22; height=16; space=24; forTime=0; score=0; screen_clear(screen); draw_rect_or(screen, height, 96, 0, 0); draw_rect_or(screen, 64-(height+space), 96, height+space, 0); draw_sprite_xor(screen, 88, posY, player_height, &player_sprite); }
//Drawing asix void graph_draw_asix(int right, int up) //right(up) - number of times, that user presses Right-Left/Up-Down { int i; screen_clear(); SDL_SetRenderDrawColor(ren, 200, 200, 200, 255); //light grey for (i=0;i<17;i++) SDL_RenderDrawLine(ren,50*i,0,50*i,600); //drawing vertical lines for (i=0;i<13;i++) SDL_RenderDrawLine(ren,0,50*i,800,50*i); //drawing horisontal lines SDL_SetRenderDrawColor(ren, 0, 0, 0, 255); SDL_RenderDrawLine(ren,400+50*right,0,400+50*right,600); //draw horizontal main axis SDL_RenderDrawLine(ren,0,300-50*up,800,300-50*up); //draw vertical main axis SDL_RenderPresent(ren); }