当前位置: 首页>>代码示例>>C++>>正文


C++ GrMapWindow函数代码示例

本文整理汇总了C++中GrMapWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ GrMapWindow函数的具体用法?C++ GrMapWindow怎么用?C++ GrMapWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GrMapWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:35,代码来源:message.c

示例2: new_invaders_window

void new_invaders_window()
{

	invaders_gc = pz_get_gc(1);

	GrSetGCUseBackground(invaders_gc, GR_TRUE);
	GrSetGCBackground(invaders_gc, GR_RGB(255,255,255));
	GrSetGCForeground(invaders_gc, GR_RGB(0,0,0));
	
	invaders_score_pix = GrNewPixmap(screen_info.cols, 13, 0);

	invaders_wid = pz_new_window(0,
				HEADER_TOPLINE + 1,
				screen_info.cols,
				screen_info.rows - HEADER_TOPLINE - 1,
				invaders_do_draw,
				invaders_handle_event);

	GrSelectEvents(invaders_wid, GR_EVENT_MASK_TIMER |
			GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_KEY_UP |
			GR_EVENT_MASK_KEY_DOWN);
	
	score = 0;
	level = 0;
	aliens_rows = (screen_info.rows - 40) / 20;	
	
	game_status = GAME_STATUS_PLAY;
	invaders_create_board(level);

	invaders_timer_id = GrCreateTimer(invaders_wid, 50);

	GrMapWindow(invaders_wid);
	
	draw_first();
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:35,代码来源:invaders.c

示例3: 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
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:34,代码来源:video.c

示例4: 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();
}
开发者ID:iPodLinux-Community,项目名称:podzillaz,代码行数:32,代码来源:ipobble.c

示例5: 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();
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:27,代码来源:blackjack.c

示例6: 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();
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:30,代码来源:tunnel.c

示例7: main

int
main(int argc, char **argv)
{
	int COLS, ROWS;

	if (GrOpen() < 0) {
		fprintf(stderr, "Cannot open graphics\n");
		exit(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();
			exit(0);
		}
	}
}
开发者ID:BadrElh,项目名称:microwindows,代码行数:34,代码来源:dashdemo.c

示例8: main

int main (void)
{
    if (GrOpen() < 0)
    {
        GrError("GrOpen failed");
        return 1;
    }

    gc = GrNewGC();
    GrSetGCUseBackground (gc, GR_FALSE);
    GrSetGCForeground (gc, RED);

    wid = GrNewWindowEx (GR_WM_PROPS_APPFRAME |
                         GR_WM_PROPS_CAPTION  |
                         GR_WM_PROPS_CLOSEBOX,
                         "Hello Window",
                         GR_ROOT_WINDOW_ID, 
                         50, 50, 200, 100, WHITE);

    GrSelectEvents (wid, GR_EVENT_MASK_EXPOSURE | 
                         GR_EVENT_MASK_CLOSE_REQ);

    GrMapWindow (wid);
    GrMainLoop (event_handler);
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:25,代码来源:demo-hello.c

示例9: 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();
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:31,代码来源:lights.c

示例10: 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);
}
开发者ID:iPodLinux-Community,项目名称:Floydzilla,代码行数:26,代码来源:browser.c

示例11: 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();	
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:35,代码来源:cube.c

示例12: 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;
}
开发者ID:iPodLinux,项目名称:iPodLinux-SVN,代码行数:32,代码来源:itunesmenu.c

示例13: do_update

static void
do_update(GR_EVENT_UPDATE *ep)
{
	mwin *	mwp;
	mwin *	tmwp;
	GR_WINDOW_INFO winfo;

	if (IsDecoration(ep->wid)) return;

	if ((mwp = FindWindow(ep->wid)) == NULL) {
		/* We have a new window */
		if (ep->utype != GR_UPDATE_MAP) return;
		if ((mwp = NewWindow(ep->wid)) == NULL) {
			GrError("malloc failed\n");
			return;
		}
		GrGetWindowInfo(ep->wid, &winfo);
		mwp->x = ep->x - winfo.bordersize;
		mwp->y = ep->y - winfo.bordersize;
		mwp->width = ep->width + 2 * winfo.bordersize;
		GrMoveWindow(mwp->wid, mwp->x + winfo.bordersize,
					mwp->y + DEC_HEIGHT +
						2 * winfo.bordersize);
		mwp->fid = GrNewWindow(GR_ROOT_WINDOW_ID, mwp->x + 1,
				mwp->y + 1, mwp->width - 2,
				DEC_HEIGHT - 2, 1, BLUE, BLACK);
		GrSelectEvents(mwp->fid, GR_EVENT_MASK_BUTTON_DOWN |
			GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION);
		GrMapWindow(mwp->fid);
	} else {
		switch (ep->utype) {
			case GR_UPDATE_UNMAP:
				GrUnmapWindow(mwp->fid);
				GrDestroyWindow(mwp->fid);
				if (mwins == mwp) {
					mwins = mwp->next;
				} else for(tmwp = mwins; tmwp; tmwp = tmwp->next) {
					if (tmwp->next == mwp) {
						tmwp->next = mwp->next;
					}
				}
				free(mwp);
				break;
			case GR_UPDATE_MOVE:
				GrGetWindowInfo(ep->wid, &winfo);
				if ((ep->x == (mwp->x + winfo.bordersize)) &&
					(ep->y == (mwp->y + winfo.bordersize
							+ DEC_HEIGHT))) {
					return;
				}
				mwp->x = ep->x - winfo.bordersize;
				mwp->y = ep->y - winfo.bordersize - DEC_HEIGHT;
				GrMoveWindow(mwp->fid, mwp->x + 1, mwp->y + 1);
			default:
				break;
		}
	}
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:58,代码来源:npanel.c

示例14: mvpw_show

void
mvpw_show(mvp_widget_t *widget)
{
	mvp_widget_t *top;

	if (widget) {
		if ((widget->type == MVPW_DIALOG) &&
		    widget->data.dialog.modal) {
			top = mvpw_get_focus();
			GrMapWindow(widget->wid);
			raise_widget(widget, top);
			if (!mvpw_visible((mvp_widget_t*)screensaver_widget))
				GrRaiseWindow(widget->wid);
			mvpw_focus(widget);
		} else {
			GrMapWindow(widget->wid);
			if(widget->show) (*widget->show)(widget, 1);
		}
	}
}
开发者ID:cgbarnwell,项目名称:mvpmc,代码行数:20,代码来源:widget.c

示例15: incall_handler

static int incall_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux)
{
	printf("EVENT: Incoming call type = %u\n", aux->u.call.type);

	GrMapWindow(dialer_window);
	GrSetFocus(dialer_window);
	GrText(dialer_window, gc, 10, 10, "Incoming call", 0, 0);


	return 0;
}
开发者ID:vovan888,项目名称:linux-on-sx1,代码行数:11,代码来源:incoming.c


注:本文中的GrMapWindow函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。