本文整理汇总了C++中redraw_screen函数的典型用法代码示例。如果您正苦于以下问题:C++ redraw_screen函数的具体用法?C++ redraw_screen怎么用?C++ redraw_screen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redraw_screen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:seirl,项目名称:i3lock,代码行数:33,代码来源:i3lock.c
示例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;
}
}
}
}
开发者ID:m1ch4ls,项目名称:gfxprim,代码行数:58,代码来源:fonttest.c
示例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);
}
}
开发者ID:jollheef,项目名称:i3lock-clock,代码行数:50,代码来源:i3lock.c
示例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;
}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:34,代码来源:fonttest.c
示例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();
}
}
}
开发者ID:autumn-wind,项目名称:ics2015,代码行数:69,代码来源:game.c
示例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;
}
开发者ID:jbebe,项目名称:all-my-projects,代码行数:28,代码来源:med.c
示例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);
}
}
开发者ID:m1ch4ls,项目名称:gfxprim,代码行数:28,代码来源:randomshapetest.c
示例8: handleUpdateWhileScrolling
static void handleUpdateWhileScrolling(volatile bool& doneScrolling, int refresh) {
while(!doneScrolling) {
sf::sleep(sf::milliseconds(10));
redraw_screen(refresh);
}
mainPtr.setActive(false);
}
开发者ID:LibreGames,项目名称:cboe,代码行数:7,代码来源:boe.main.cpp
示例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();
}
开发者ID:eplanet,项目名称:i3lock,代码行数:12,代码来源:unlock_indicator.c
示例10: Handle_Update
void Handle_Update() {
redraw_screen(REFRESH_NONE);
if(map_visible) draw_map(false);
else mini_map.setVisible(false);
}
开发者ID:LibreGames,项目名称:cboe,代码行数:7,代码来源:boe.main.cpp
示例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;
}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:28,代码来源:SDL_glue.c
示例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);
}
开发者ID:PBrookfield,项目名称:cboe-msvc,代码行数:28,代码来源:boe.dlgutil.cpp
示例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;
}
}
}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:26,代码来源:SDL_glue.c
示例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 );
}
开发者ID:Xstarfct,项目名称:Cgames,代码行数:37,代码来源:WINDOW.C
示例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);
}
}
开发者ID:ramnes,项目名称:i3lock,代码行数:46,代码来源:i3lock.c
示例16: handle_action
bool handle_action(sf::Event event) {
short i;
location the_point;
bool to_return = false;
the_point = {event.mouseButton.x, event.mouseButton.y};
if(file_in_mem.empty())
return false;
for(i = 0; i < 6; i++)
if((the_point.in(pc_area_buttons[i][0])) &&
(univ.party[i].main_status != eMainStatus::ABSENT)) {
do_button_action(0,i);
current_active_pc = i;
redraw_screen();
}
for(i = 0; i < 5; i++)
if((the_point.in(edit_rect[i])) &&
(univ.party[current_active_pc].main_status != eMainStatus::ABSENT)) {
do_button_action(0,i + 10);
switch(i) {
case 0:
display_pc(current_active_pc,10,nullptr);
break;
case 1:
display_pc(current_active_pc,11,nullptr);
break;
case 2:
pick_race_abil(&univ.party[current_active_pc],0);
break;
case 3:
spend_xp(current_active_pc,2,nullptr);
break;
case 4:
edit_xp(&univ.party[current_active_pc]);
break;
}
}
for(i = 0; i < 24; i++)
if((the_point.in(item_string_rects[i][1])) && // drop item
univ.party[current_active_pc].items[i].variety != eItemType::NO_ITEM) {
flash_rect(item_string_rects[i][1]);
univ.party[current_active_pc].take_item(i);
}
for(i = 0; i < 24; i++)
if((the_point.in(item_string_rects[i][2])) && // identify item
univ.party[current_active_pc].items[i].variety != eItemType::NO_ITEM) {
flash_rect(item_string_rects[i][2]);
univ.party[current_active_pc].items[i].ident = true;
}
return to_return;
}
开发者ID:LibreGames,项目名称:cboe,代码行数:57,代码来源:pc.action.cpp
示例17: clear_pam_wrong
/*
* Resets pam_state to STATE_PAM_IDLE 2 seconds after an unsuccessful
* authentication event.
*
*/
static void clear_pam_wrong(EV_P_ ev_timer *w, int revents) {
DEBUG("clearing pam wrong\n");
pam_state = STATE_PAM_IDLE;
unlock_state = STATE_STARTED;
redraw_screen();
/* Now free this timeout. */
STOP_TIMER(clear_pam_wrong_timeout);
}
开发者ID:Kamori,项目名称:i3lock,代码行数:14,代码来源:i3lock.c
示例18: drawscreen
static void drawscreen (void) {
/* This is the screen redrawing routine that event_loop assumes exists. *
* It erases whatever is on screen, then calls redraw_screen to redraw *
* it. */
clearscreen();
redraw_screen ();
}
开发者ID:BackupTheBerlios,项目名称:pvpr,代码行数:9,代码来源:draw.c
示例19: main_loop
/* 游戏主循环。
* 在初始化工作结束后,main函数就跳转到主循环执行。
* 在主循环执行期间随时会插入异步的中断。时钟中断最终调用timer_event,
* 键盘中断最终调用keyboard_event。中断处理完成后将返回主循环原位置继续执行。
*
* tick是时钟中断中维护的信号,数值含义是“系统到当前时刻已经发生过的时钟中断数”
* HZ是时钟控制器硬件每秒产生的中断数,在include/device/timer.h中定义
* now是主循环已经正确处理的时钟中断数,即游戏已经处理到的物理时间点
*
* 由于qemu-kvm在访问内存映射IO区域时每次都会产生陷入,在30FPS时,
* 对显存区域每秒会产生30*320*200/4次陷入,从而消耗过多时间导致跳帧的产生(实际FPS<30)。
* 在CFLAGS中增加-DSLOW可以在此情况下提升FPS。如果FPS仍太小,可以尝试
* -DTOOSLOW,此时将会采用隔行扫描的方式更新屏幕(可能会降低显示效果)。
* 这些机制的实现在device/video.c中。
* */
void
main_loop(void) {
int now = 0, target;
int num_draw = 0;
bool redraw;
while (TRUE) {
wait_for_interrupt();
/*disable_interrupt();*/
if (now == tick) {
/*enable_interrupt();*/
continue;
}
assert(now < tick);
target = tick; /* now总是小于tick,因此我们需要“追赶”当前的时间 */
/*enable_interrupt();*/
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只被置一次。 */
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();
}
}
}
开发者ID:autumn-wind,项目名称:os-lab0,代码行数:71,代码来源:game.c
示例20: clear_indicator
/*
* Hides the unlock indicator completely when there is no content in the
* password buffer.
*
*/
static void clear_indicator(EV_P_ ev_timer *w, int revents) {
if (input_position == 0) {
unlock_state = STATE_STARTED;
} else unlock_state = STATE_KEY_PRESSED;
redraw_screen();
ev_timer_stop(main_loop, clear_indicator_timeout);
free(clear_indicator_timeout);
clear_indicator_timeout = NULL;
}
开发者ID:jeffc,项目名称:i3lock-color,代码行数:15,代码来源:unlock_indicator.c
注:本文中的redraw_screen函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论