本文整理汇总了C++中GrSelectEvents函数的典型用法代码示例。如果您正苦于以下问题:C++ GrSelectEvents函数的具体用法?C++ GrSelectEvents怎么用?C++ GrSelectEvents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GrSelectEvents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GrGetScreenInfo
nxeyes_state *init(void)
{
nxeyes_state *state;
GR_REGION_ID rid1, rid2;
GR_SCREEN_INFO si;
GR_WM_PROPERTIES props;
if(!(state = malloc(sizeof(nxeyes_state)))) return NULL;
state->oldx = state->oldy = state->x = state->y = 0;
state->button_down = state->eyes_closed = state->quit = 0;
state->olx = state->orx = EYEMASK_WIDTH / 2;
state->oly = state->ory = EYEMASK_HEIGHT / 2;
GrGetScreenInfo(&si);
state->mousex = si.xpos;
state->mousey = si.ypos;
state->mouse_moved = 1;
state->gc = GrNewGC();
GrSetGCForeground(state->gc, GR_COLOR_WHITE);
GrSetGCBackground(state->gc, GR_COLOR_BLACK);
state->wid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, (EYEFG_HEIGHT * 2) +
EYE_SPACING, EYEFG_HEIGHT, 0, GR_COLOR_WHITE, 0);
rid1 = GrNewBitmapRegion(eyemask_bits, EYEMASK_WIDTH, EYEMASK_HEIGHT);
rid2 = GrNewBitmapRegion(eyemask_bits, EYEMASK_WIDTH, EYEMASK_HEIGHT);
GrOffsetRegion(rid2, EYEMASK_WIDTH + EYE_SPACING, 0);
GrUnionRegion(rid1, rid1, rid2);
GrSetWindowRegion(state->wid, rid1, GR_WINDOW_BOUNDING_MASK);
GrDestroyRegion(rid1);
GrDestroyRegion(rid2);
props.flags = GR_WM_FLAGS_PROPS;
props.props = GR_WM_PROPS_NODECORATE;
GrSetWMProperties(state->wid, &props);
GrSelectEvents(state->wid, GR_EVENT_MASK_CLOSE_REQ |
GR_EVENT_MASK_MOUSE_POSITION |
GR_EVENT_MASK_BUTTON_UP |
GR_EVENT_MASK_BUTTON_DOWN |
GR_EVENT_MASK_EXPOSURE |
GR_EVENT_MASK_TIMER);
GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_MOUSE_POSITION);
GrMapWindow(state->wid);
srand(123);
#if MW_FEATURE_TIMERS
start_blink_timer(state);
#endif
return state;
}
示例2: new_ipobble_window
void new_ipobble_window()
{
ipobble_gc = pz_get_gc(1);
GrSetGCUseBackground(ipobble_gc, GR_TRUE);
GrSetGCForeground(ipobble_gc, BLACK);
GrSetGCBackground(ipobble_gc, WHITE);
ipobble_wid = pz_new_window(0, HEADER_TOPLINE + 1,
screen_info.cols,
screen_info.rows - HEADER_TOPLINE - 1,
ipobble_do_draw, ipobble_handle_event);
GrSelectEvents(ipobble_wid, GR_EVENT_MASK_TIMER |
GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_KEY_UP |
GR_EVENT_MASK_KEY_DOWN);
if( screen_info.bpp > 2) {
ipodc=1;
}
score = 0;
level = 0;
game_status = GAME_STATUS_PLAY;
ipobble_create_board(level);
ipobble_timer_id = GrCreateTimer(ipobble_wid, DELTA_TIME);
GrMapWindow(ipobble_wid);
draw_first();
}
示例3: wm_init
void wm_init(void)
{
GR_WM_PROPERTIES props;
win window;
static int init = 0;
if(!init) {
init = 1;
/* add root window*/
window.wid = GR_ROOT_WINDOW_ID;
window.pid = GR_ROOT_WINDOW_ID;
window.type = WINDOW_TYPE_ROOT;
window.clientid = 1;
window.sizing = GR_FALSE;
window.active = 0;
window.data = NULL;
wm_add_window(&window);
GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_CHLD_UPDATE);
/* Set new root window background color*/
props.flags = GR_WM_FLAGS_BACKGROUND;
props.background = GrGetSysColor(GR_COLOR_DESKTOP);
GrSetWMProperties(GR_ROOT_WINDOW_ID, &props);
}
}
示例4: GrSelectEventsWrapper
static void
GrSelectEventsWrapper(void *r)
{
nxSelectEventsReq *req = r;
GrSelectEvents(req->windowid, req->eventmask);
}
示例5: new_lights_window
/* initialize the window */
void new_lights_window(void)
{
/* Init randomizer */
srand(time(NULL));
lights_gc = pz_get_gc (1);
GrSetGCUseBackground(lights_gc, GR_FALSE);
GrSetGCForeground(lights_gc, GR_RGB(0,0,0));
lights_height = (lights_screen_info.rows - (HEADER_TOPLINE + 1));
lights_wid = pz_new_window( 0, HEADER_TOPLINE + 1,
screen_info.cols, lights_height,
lights_do_draw, lights_handle_event );
lights_bufwid = GrNewPixmap( lights_screen_info.cols,
lights_height, NULL );
GrSelectEvents( lights_wid, GR_EVENT_MASK_TIMER
| GR_EVENT_MASK_EXPOSURE
| GR_EVENT_MASK_KEY_UP
| GR_EVENT_MASK_KEY_DOWN );
lights_timer = GrCreateTimer( lights_wid, 300 );
GrMapWindow( lights_wid );
/* intialize game state */
lights_new_game();
}
示例6: new_video_window
void new_video_window(char *filename)
{
#ifndef IPOD
pz_error("No video support on the desktop.");
#else /* IPOD */
if (full_hw_version==0)
{
full_hw_version = ipod_get_hw_version();
}
outl(1, VAR_VIDEO_ON);
outl(0, VAR_VIDEO_MODE);
cop_wakeup();
init_variables();
video_status = VIDEO_CONTROL_MODE_STARTING;
video_curPosition = 0;
video_gc = pz_get_gc(1);
GrSetGCUseBackground(video_gc, GR_FALSE);
GrSetGCForeground(video_gc, GR_RGB(0,0,0));
//nes_window("Create win");
video_wid = pz_new_window(0, 0, screen_info.cols, screen_info.rows, video_do_draw, video_do_keystroke);
GrSelectEvents(video_wid,
GR_EVENT_MASK_KEY_DOWN| GR_EVENT_MASK_KEY_UP);
GrMapWindow(video_wid);
GrClearWindow(video_wid, GR_FALSE);
//nes_window("Load");
video_status_message("Loading video...");
//nes_window("Play");
playVideo(filename);
outl(0, VAR_VIDEO_ON);
#endif
}
示例7: new_cube_window
void new_cube_window( void )
{
if (screen_info.cols==220) {
photo = 1;
if (!z_off) z_off = 400;
} else if (screen_info.cols==138) {
if (!z_off) z_off = 800;
} else {
if (!z_off) z_off = 600;
}
cube_gc = pz_get_gc(1);
GrSetGCUseBackground(cube_gc, GR_FALSE);
GrSetGCForeground(cube_gc, BLACK);
cube_wid = pz_new_window(0, HEADER_TOPLINE + 1,
screen_info.cols, screen_info.rows - (HEADER_TOPLINE + 1),
cube_do_draw, cube_handle_event);
GrSelectEvents( cube_wid, GR_EVENT_MASK_TIMER|
GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_UP|GR_EVENT_MASK_KEY_DOWN);
cube_timer = GrCreateTimer( cube_wid, 100 );
GrMapWindow( cube_wid );
x_off = screen_info.cols/2;
y_off = (screen_info.rows - (HEADER_TOPLINE + 1))/2;
temp_pixmap = GrNewPixmap(screen_info.cols,
(screen_info.rows - (HEADER_TOPLINE + 1)),
NULL);
cube_init();
}
示例8: malloc
struct menulist *new_ml()
{
struct menulist *ret =
(struct menulist *) malloc(sizeof(struct menulist));
GrGetScreenInfo(&ret->screen_info);
ret->gc = pz_get_gc(1);
GrSetGCUseBackground(ret->gc, GR_FALSE);
GrSetGCForeground(ret->gc, BLACK);
GrSetGCBackground(ret->gc, BLACK);
ret->wid = pz_new_window(0, HEADER_TOPLINE + 1, ret->screen_info.cols,
ret->screen_info.rows - (HEADER_TOPLINE + 1),
itunes_do_draw, itunes_do_keystroke);
GrSelectEvents(ret->wid, GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN|GR_EVENT_MASK_KEY_UP|GR_EVENT_MASK_TIMER);
GrGetGCTextSize(ret->gc, "M", -1, GR_TFASCII, &ret->gr_width,
&ret->gr_height, &ret->gr_base);
ret->gr_height += 4;
GrMapWindow(ret->wid);
ret->itunes_menu = menu_init(ret->wid, "Music", 0, 0,
screen_info.cols, screen_info.rows -
(HEADER_TOPLINE + 1), NULL, NULL, UTF8);
ret->init = 0;
ret->prevml = NULL;
return ret;
}
示例9: new_mandel_window
// creates a new MandelPod window
void new_mandel_window(void)
{
// get the graphics context
mandel_gc = pz_get_gc(1);
// create the main window
mandel_wid = pz_new_window (0, 21,
screen_info.cols, screen_info.rows - (HEADER_TOPLINE+1),
draw_header, handle_event);
#ifdef MANDELPOD_STATUS
// create the status window
status_wid = pz_new_window (22, 4, 12, 12, draw_idle_status, handle_event);
#endif
// get screen info
GrGetWindowInfo(mandel_wid, &wi);
// select the event types
GrSelectEvents (mandel_wid, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP | GR_EVENT_MASK_TIMER);
// display the window
GrMapWindow (mandel_wid);
#ifdef MANDELPOD_STATUS
GrMapWindow (status_wid);
#endif
// create the timer for the busy status animation
mandel_timer_id = GrCreateTimer (mandel_wid, 250);
// start main app
init_values();
create_status();
draw_header();
calculate_mandel();
}
示例10: create_aux_windows
static void create_aux_windows (_THIS)
{
GR_WM_PROPERTIES props ;
Dprintf ("enter create_aux_windows\n") ;
// Don't create any extra windows if we are being managed
if (SDL_windowid) {
FSwindow = 0 ;
return ;
}
if (FSwindow && FSwindow != GR_ROOT_WINDOW_ID) {
GrDestroyWindow (FSwindow) ;
}
FSwindow = GrNewWindow (GR_ROOT_WINDOW_ID, 0, 0, 1, 1, 0, BLACK, BLACK) ;
props.flags = GR_WM_FLAGS_PROPS ;
props.props = GR_WM_PROPS_NODECORATE ;
GrSetWMProperties (FSwindow, & props) ;
GrSelectEvents (FSwindow, (GR_EVENT_MASK_EXPOSURE |
GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP |
GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT |
GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP |
GR_EVENT_MASK_MOUSE_ENTER | GR_EVENT_MASK_MOUSE_EXIT |
GR_EVENT_MASK_MOUSE_MOTION | GR_EVENT_MASK_UPDATE |
GR_EVENT_MASK_CLOSE_REQ)) ;
Dprintf ("leave create_aux_windows\n") ;
}
示例11: new_browser_window
void new_browser_window(char *initial_path)
{
if (initial_path) {
chdir(initial_path);
}
getcwd(current_dir, sizeof(current_dir));
browser_gc = pz_get_gc(1);
GrSetGCUseBackground(browser_gc, GR_FALSE);
GrSetGCBackground(browser_gc, WHITE);
GrSetGCForeground(browser_gc, BLACK);
browser_wid = pz_new_window(0, HEADER_TOPLINE + 2, screen_info.cols,
screen_info.rows - (HEADER_TOPLINE + 2),
browser_do_draw, browser_do_keystroke);
GrSelectEvents(browser_wid, GR_EVENT_MASK_EXPOSURE |
GR_EVENT_MASK_KEY_UP | GR_EVENT_MASK_KEY_DOWN |
GR_EVENT_MASK_TIMER);
browser_menu = NULL;
browser_menu_overlay = NULL;
browser_mscandir("./");
GrMapWindow(browser_wid);
}
示例12: new_tunnel_window
// Creates a new tunnel "app" window
void new_tunnel_window(void)
{
tunnel_gc = pz_get_gc(1); /* Get the graphics context */
/* Open the window: */
tunnel_wid = pz_new_window (0,
21,
screen_info.cols,
screen_info.rows - (HEADER_TOPLINE+1),
draw_header,
handle_event);
GrGetWindowInfo(tunnel_wid, &wi); /* Get screen info */
/* Select the types of events you need for your window: */
GrSelectEvents (tunnel_wid, GR_EVENT_MASK_TIMER|GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN|GR_EVENT_MASK_KEY_UP);
// set up pixmap
temp_pixmap = GrNewPixmap(screen_info.cols,
(screen_info.rows - (HEADER_TOPLINE + 1)),
NULL);
/* Display the window: */
GrMapWindow (tunnel_wid);
draw_header();
readHighScore();
reset();
}
示例13: new_message_common_window
void new_message_common_window(char *message)
{
GR_SIZE width, height, base;
int i, maxwidth;
if (msg_wid) {
msg_destroy_msg();
}
msg_gc = pz_get_gc(1);
GrSetGCUseBackground(msg_gc, GR_FALSE);
GrSetGCForeground(msg_gc, appearance_get_color( CS_MESSAGEFG ));
msg_build_msg(message);
maxwidth = 0;
for(i=linenum; i; i--) {
GrGetGCTextSize(msg_gc, msglines[i-1], -1, GR_TFASCII, &width,
&height, &base);
if(width > maxwidth)
maxwidth = width;
}
msg_wid = pz_new_window((screen_info.cols - (maxwidth + 10)) >> 1,
(screen_info.rows - (((height + 3) * linenum) + 10)) >> 1,
maxwidth + 10, ((height + 3) * linenum) + 10,
msg_do_draw, msg_do_keystroke);
GrSelectEvents(msg_wid, GR_EVENT_MASK_EXPOSURE| GR_EVENT_MASK_KEY_UP|
GR_EVENT_MASK_KEY_DOWN| GR_EVENT_MASK_TIMER);
GrMapWindow(msg_wid);
/* window will auto-close after 6 seconds */
msg_timer = GrCreateTimer(msg_wid, 6000);
}
示例14: main
int
main(int argc, char **argv)
{
int COLS, ROWS;
if (GrOpen() < 0) {
GrError("Cannot open graphics\n");
return 1;
}
COLS = 350;
ROWS = 300;
g_main = GrNewWindowEx(GR_WM_PROPS_APPWINDOW, "dashdemo",
GR_ROOT_WINDOW_ID, 100, 50, COLS - 120, ROWS - 60, BLUE);
GrSelectEvents(g_main, GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_CLOSE_REQ);
GrMapWindow(g_main);
while (1) {
GR_EVENT event;
GrGetNextEvent(&event);
switch (event.type) {
case GR_EVENT_TYPE_EXPOSURE:
draw_screen();
break;
case GR_EVENT_TYPE_CLOSE_REQ:
GrClose();
return 0;
}
}
}
示例15: new_blackjack_window
//Create the blackjack window
void new_blackjack_window(void)
{
srand((unsigned int)time(NULL) / 2); //Make a seed for our random # generator
blackjack_gc = pz_get_gc(1); /* Get the graphics context */
/* Open the window: */
blackjack_wid = pz_new_window (0,
21,
screen_info.cols,
screen_info.rows - (HEADER_TOPLINE+1),
draw_header,
handle_event);
GrGetWindowInfo(blackjack_wid, &wi); /* Get screen info */
/* Select the types of events you need for your window: */
GrSelectEvents (blackjack_wid, GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN|GR_EVENT_MASK_KEY_UP);
/* Display the window: */
GrMapWindow (blackjack_wid);
readPot();
reset();
}