本文整理汇总了C++中redraw_screen函数的典型用法代码示例。如果您正苦于以下问题:C++ redraw_screen函数的具体用法?C++ redraw_screen怎么用?C++ redraw_screen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redraw_screen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_screen_resize
/*
* Called when the properties on the root window change, e.g. when the screen
* resolution changes. If so we update the window to cover the whole screen
* and also redraw the image, if any.
*
*/
void handle_screen_resize(void) {
xcb_get_geometry_cookie_t geomc;
xcb_get_geometry_reply_t *geom;
geomc = xcb_get_geometry(conn, screen->root);
if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL)
return;
if (last_resolution[0] == geom->width &&
last_resolution[1] == geom->height) {
free(geom);
return;
}
last_resolution[0] = geom->width;
last_resolution[1] = geom->height;
free(geom);
redraw_screen();
uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
xcb_configure_window(conn, win, mask, last_resolution);
xcb_flush(conn);
xinerama_query_screens();
redraw_screen();
}
示例2: event_loop
void event_loop(void)
{
GP_Event ev;
for (;;) {
GP_BackendWaitEvent(win, &ev);
switch (ev.type) {
case GP_EV_KEY:
if (ev.code != GP_EV_KEY_DOWN)
continue;
switch (ev.val.key.key) {
case GP_KEY_SPACE:
if (font)
font_flag = (font_flag + 1) % 5;
else
font_flag = (font_flag + 1) % 4;
redraw_screen();
GP_BackendFlip(win);
break;
case GP_KEY_UP:
tracking++;
redraw_screen();
GP_BackendFlip(win);
break;
case GP_KEY_DOWN:
tracking--;
redraw_screen();
GP_BackendFlip(win);
break;
case GP_KEY_B:
font_h++;
if (font_path) {
GP_FontFaceFree(font);
font = GP_FontFaceLoad(font_path, 0, font_h);
redraw_screen();
GP_BackendFlip(win);
}
break;
case GP_KEY_S:
font_h--;
if (font_path) {
GP_FontFaceFree(font);
font = GP_FontFaceLoad(font_path, 0, font_h);
redraw_screen();
GP_BackendFlip(win);
}
break;
case GP_KEY_ESC:
GP_BackendExit(win);
exit(0);
break;
}
}
}
}
示例3: input_done
static void input_done(void) {
if (clear_pam_wrong_timeout) {
ev_timer_stop(main_loop, clear_pam_wrong_timeout);
free(clear_pam_wrong_timeout);
clear_pam_wrong_timeout = NULL;
}
pam_state = STATE_PAM_VERIFY;
redraw_screen();
if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) {
DEBUG("successfully authenticated\n");
clear_password_memory();
if (shell_auth_done_command) {
system(shell_auth_done_command);
}
exit(0);
}
else
{
if (shell_auth_fail_command) {
system(shell_auth_fail_command);
}
}
if (debug_mode)
fprintf(stderr, "Authentication failure\n");
pam_state = STATE_PAM_WRONG;
clear_input();
redraw_screen();
/* Clear this state after 2 seconds (unless the user enters another
* password during that time). */
ev_now_update(main_loop);
if ((clear_pam_wrong_timeout = calloc(sizeof(struct ev_timer), 1))) {
ev_timer_init(clear_pam_wrong_timeout, clear_pam_wrong, 2.0, 0.);
ev_timer_start(main_loop, clear_pam_wrong_timeout);
}
/* Cancel the clear_indicator_timeout, it would hide the unlock indicator
* too early. */
stop_clear_indicator_timeout();
/* beep on authentication failure, if enabled */
if (beep) {
xcb_bell(conn, 100);
xcb_flush(conn);
}
}
示例4: main
int main(int argc, char *argv[])
{
const char *backend_opts = "X11";
print_instructions();
if (argc > 1) {
font_path = argv[1];
fprintf(stderr, "\nLoading font '%s'\n", argv[1]);
font = gp_font_face_load(argv[1], 0, font_h);
}
win = gp_backend_init(backend_opts, "Font Test");
if (win == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
backend_opts);
return 1;
}
white_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win->pixmap);
gray_pixel = gp_rgb_to_pixmap_pixel(0xbe, 0xbe, 0xbe, win->pixmap);
dark_gray_pixel = gp_rgb_to_pixmap_pixel(0x7f, 0x7f, 0x7f, win->pixmap);
black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win->pixmap);
red_pixel = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, win->pixmap);
blue_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0xff, win->pixmap);
redraw_screen();
gp_backend_flip(win);
event_loop();
return 0;
}
示例5: main_loop
/* 游戏主循环。
* 在初始化工作结束后,main函数就跳转到主循环执行。
* 在主循环执行期间随时会插入异步的中断。时钟中断最终调用timer_event,
* 键盘中断最终调用keyboard_event。中断处理完成后将返回主循环原位置继续执行。
*
* tick是时钟中断中维护的信号,数值含义是“系统到当前时刻已经发生过的时钟中断数”
* HZ是时钟控制器硬件每秒产生的中断数,在include/device/timer.h中定义
* now是主循环已经正确处理的时钟中断数,即游戏已经处理到的物理时间点
* */
void
main_loop(void) {
int now = 0, target;
int num_draw = 0;
bool redraw;
while (true) {
wait_intr();
cli();
if (now == tick) {
sti();
continue;
}
assert(now < tick);
target = tick; /* now总是小于tick,因此我们需要“追赶”当前的时间 */
sti();
redraw = false;
while (update_keypress())
;
/* 依次模拟已经错过的时钟中断。一次主循环如果执行时间长,期间可能到来多次时钟中断,
* 从而主循环中维护的时钟可能与实际时钟相差较多。为了维持游戏的正常运行,必须补上
* 期间错过的每一帧游戏逻辑。 */
while (now < target) {
/* 每隔一定时间产生一个新的字符 */
if (now % (HZ / CHARACTER_PER_SECOND) == 0) {
create_new_letter();
}
/* 每隔一定时间更新屏幕上字符的位置 */
if (now % (HZ / UPDATE_PER_SECOND) == 0) {
update_letter_pos();
}
/* 每隔一定时间需要刷新屏幕。注意到这里实现了“跳帧”的机制:假设
* HZ = 1000, FPS = 100, now = 10, target = 1000
* 即我们要模拟990个时钟中断之间发生的事件,其中包含了9次屏幕更新,
* 但redraw flag只被置一次。 */
/* 以上是余大神的解释,但我觉得怎么应该是: */
/* 即我们要模拟990个时钟中断,其中redraw flag被重置了99次(应该更新99次), */
/* 但实际上屏幕只更新了一次 */
if (now % (HZ / FPS) == 0) {
redraw = true;
}
/* 更新fps统计信息 */
if (now % (HZ / 2) == 0) {
int now_fps = num_draw * 2 + 1;
if (now_fps > FPS) now_fps = FPS;
set_fps(now_fps);
num_draw = 0;
}
now ++;
}
if (redraw) { /* 当需要重新绘图时重绘 */
num_draw ++;
redraw_screen();
}
}
}
示例6: main
int main(int argc, char **args)
{
RAND = ((int)time(NULL))%10;
init_console();
init_buffer();
init_clipboard();
if (argc > 1)
{
FILENAME = (unsigned char *)malloc(256*sizeof(char));
strcpy((char *)FILENAME, args[1]);
file_to_buffer();
}
else
{
MAX_VPOS = 1;
}
while (RUN)
{
redraw_screen();
#ifdef DEBUG_MODE
printf("%d", INPUT_KEY);
#endif
INPUT_KEY = _getch();
process_key();
}
DestroyAndExit("Exiting...");
return 0;
}
示例7: main
int main(void)
{
const char *backend_opts = "X11";
win = GP_BackendInit(backend_opts, "Random Shape Test", stderr);
if (win == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
backend_opts);
return 1;
}
white = GP_ColorToContextPixel(GP_COL_WHITE, win->context);
black = GP_ColorToContextPixel(GP_COL_BLACK, win->context);
for (;;) {
GP_BackendPoll(win);
event_loop();
usleep(20000);
if (pause_flag)
continue;
redraw_screen();
GP_BackendFlip(win);
}
}
示例8: handleUpdateWhileScrolling
static void handleUpdateWhileScrolling(volatile bool& doneScrolling, int refresh) {
while(!doneScrolling) {
sf::sleep(sf::milliseconds(10));
redraw_screen(refresh);
}
mainPtr.setActive(false);
}
示例9: clear_indicator
/*
* Hides the unlock indicator completely when there is no content in the
* password buffer.
*
*/
void clear_indicator(void) {
if (input_position == 0) {
unlock_state = STATE_STARTED;
} else
unlock_state = STATE_KEY_PRESSED;
redraw_screen();
}
示例10: Handle_Update
void Handle_Update() {
redraw_screen(REFRESH_NONE);
if(map_visible) draw_map(false);
else mini_map.setVisible(false);
}
示例11: main
int main(void)
{
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError());
return 1;
}
display = SDL_SetVideoMode(W, H, 0, SDL_SWSURFACE);
if (display == NULL) {
fprintf(stderr, "Could not open display: %s\n", SDL_GetError());
SDL_Quit();
return 1;
}
GP_ContextFromSDLSurface(&context, display);
black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, &context);
darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, &context);
redraw_screen();
SDL_Flip(display);
event_loop();
SDL_Quit();
return 0;
}
示例12: end_talk_mode
void end_talk_mode()
{
DeleteObject(talk_gworld);
talk_gworld = NULL;
if((PSD [SDF_ASK_ABOUT_TEXT_BOX] == 1) && (talk_edit_box != NULL)){
DestroyWindow(talk_edit_box);
talk_edit_box = NULL;
}
overall_mode = store_pre_talk_mode;
create_clip_region();
if (overall_mode == MODE_TALK_TOWN)
overall_mode = MODE_TOWN;
if (overall_mode == MODE_TOWN) {
center = c_town.p_loc;
update_explored(center);
}
stat_screen_mode = 0;
put_item_screen(stat_window,0);
put_pc_screen();
redraw_screen(0);
}
示例13: event_loop
void event_loop(void)
{
SDL_Event event;
while (SDL_WaitEvent(&event) > 0) {
switch (event.type) {
case SDL_VIDEOEXPOSE:
redraw_screen();
SDL_Flip(display);
break;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
return;
default:
break;
}
break;
case SDL_QUIT:
return;
}
}
}
示例14: zoom_window
/*
* Name: zoom_window
* Purpose: To blow-up current window.
* Date: September 1, 1991
* Passed: window: pointer to current window
* Notes: Make all windows, visible and hidden, full size.
*/
int zoom_window( WINDOW *window )
{
register WINDOW *wp;
if (window != NULL) {
entab_linebuff( );
un_copy_line( window->ll, window, TRUE );
for (wp=g_status.window_list; wp != NULL; wp=wp->next) {
if (wp != window && wp->visible)
wp->visible = FALSE;
/*
* can't diff one window, reset the diff
*/
diff.defined = FALSE;
if (wp->top_line != 1)
wp->cline = wp->cline - (wp->top_line+wp->ruler) + 1;
wp->top_line = 1;
wp->bottom_line = g_display.nlines;
wp->end_col = g_display.ncols - 1;
wp->start_col = 0;
wp->vertical = FALSE;
check_virtual_col( wp, wp->rcol, wp->ccol );
make_ruler( wp );
}
redraw_screen( window );
show_ruler( window );
}
return( OK );
}
示例15: input_done
static void input_done(void) {
STOP_TIMER(clear_pam_wrong_timeout);
pam_state = STATE_PAM_VERIFY;
redraw_screen();
if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) {
DEBUG("successfully authenticated\n");
clear_password_memory();
/* Turn the screen on, as it may have been turned off
* on release of the 'enter' key. */
turn_monitors_on();
/* PAM credentials should be refreshed, this will for example update any kerberos tickets.
* Related to credentials pam_end() needs to be called to cleanup any temporary
* credentials like kerberos /tmp/krb5cc_pam_* files which may of been left behind if the
* refresh of the credentials failed. */
pam_setcred(pam_handle, PAM_REFRESH_CRED);
pam_end(pam_handle, PAM_SUCCESS);
exit(0);
}
if (debug_mode)
fprintf(stderr, "Authentication failure\n");
pam_state = STATE_PAM_WRONG;
failed_attempts += 1;
clear_input();
if (unlock_indicator)
redraw_screen();
/* Clear this state after 2 seconds (unless the user enters another
* password during that time). */
ev_now_update(main_loop);
START_TIMER(clear_pam_wrong_timeout, TSTAMP_N_SECS(2), clear_pam_wrong);
/* Cancel the clear_indicator_timeout, it would hide the unlock indicator
* too early. */
STOP_TIMER(clear_indicator_timeout);
/* beep on authentication failure, if enabled */
if (beep) {
xcb_bell(conn, 100);
xcb_flush(conn);
}
}