本文整理汇总了C++中GrClose函数的典型用法代码示例。如果您正苦于以下问题:C++ GrClose函数的具体用法?C++ GrClose怎么用?C++ GrClose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GrClose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExceptionExit
void ExceptionExit(int sig)
{
closeLeds();
printf("ExceptionExit(%d)", sig);
GrClose();
exit(0);
}
示例2: 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;
}
}
}
示例3: pexit
static void
pexit(char *why)
{
printf("Image demo thread exiting - %s\n", why);
GrClose();
cyg_thread_exit();
}
示例4: checkevent
static void
checkevent(void)
{
GR_EVENT event;
GrGetNextEvent(&event);
switch (event.type) {
case GR_EVENT_TYPE_EXPOSURE:
doexposure(&event.exposure);
break;
case GR_EVENT_TYPE_BUTTON_DOWN:
dobuttondown(&event.button);
break;
case GR_EVENT_TYPE_BUTTON_UP:
dobuttonup(&event.button);
break;
case GR_EVENT_TYPE_MOUSE_POSITION:
doposition(&event.mouse);
break;
case GR_EVENT_TYPE_KEY_DOWN:
dokeydown(&event.keystroke);
break;
case GR_EVENT_TYPE_CLOSE_REQ:
GrClose();
exit(0);
}
}
示例5: HandleEvent
void
HandleEvent(GR_EVENT *ep)
{
switch (ep->type) {
case GR_EVENT_TYPE_KEY_DOWN:
do_keystroke(&ep->keystroke);
break;
case GR_EVENT_TYPE_FOCUS_IN:
do_focusin(&ep->general);
break;
case GR_EVENT_TYPE_FOCUS_OUT:
do_focusout(&ep->general);
break;
case GR_EVENT_TYPE_CLOSE_REQ:
GrClose();
exit(0);
case GR_EVENT_TYPE_FDINPUT:
do_fdinput();
break;
}
}
示例6: NX_Available
// Microwin driver bootstrap functions
static int NX_Available ()
{
Dprintf ("enter NX_Available\n") ;
if (GrOpen () < 0) return 0 ;
GrClose () ;
Dprintf ("leave NX_Available\n") ;
return 1 ;
}
示例7: GrDefaultErrorHandler
/*
* The default error handler which is called when the server
* reports an error event and the client hasn't set a handler for error events.
*/
void
GrDefaultErrorHandler(GR_EVENT *ep)
{
if (ep->type == GR_EVENT_TYPE_ERROR) {
EPRINTF("nxclient: Error (%s) ", ep->error.name);
EPRINTF(nxErrorStrings[ep->error.code], ep->error.id);
GrClose();
exit(1);
}
}
示例8: main
int main(int argc, char *argv[])
{
nstate *state = my_malloc(sizeof(nstate));
init_game(state);
main_game_loop(state);
write_hiscore(state);
GrClose();
return 0;
}
示例9: event_handler
void event_handler (GR_EVENT *event)
{
switch (event->type)
{
case GR_EVENT_TYPE_EXPOSURE:
GrText (wid, gc, 50, 50, "Hello World", -1, GR_TFASCII);
break;
case GR_EVENT_TYPE_CLOSE_REQ:
GrClose();
exit (0);
}
}
示例10: start
int start(int argc, char **argv)
{
GR_EVENT event;
nxeyes_state *state;
if(GrOpen() < 0) {
printf("Couldn't connect to Nano-X server\n");
return 1;
}
if(!(state = init())) {
printf("Couldn't allocate state structure\n");
return 1;
}
while(!state->quit) {
GrGetNextEvent(&event);
switch(event.type) {
case GR_EVENT_TYPE_CLOSE_REQ:
state->quit = 1;
break;
case GR_EVENT_TYPE_MOUSE_POSITION:
position_event(&event.mouse, state);
break;
case GR_EVENT_TYPE_BUTTON_UP:
case GR_EVENT_TYPE_BUTTON_DOWN:
button_event(&event.button, state);
break;
case GR_EVENT_TYPE_EXPOSURE:
draw_eyes(state, 1);
break;
#if MW_FEATURE_TIMERS
case GR_EVENT_TYPE_TIMER:
timer_event(&event.timer, state);
break;
#endif
default:
break;
}
if(state->mouse_moved) {
draw_eyes(state, 0);
state->mouse_moved = 0;
}
}
GrClose();
free(state);
return 0;
}
示例11: main
int
main(int ac, char **av)
{
GR_EVENT event;
GR_GC_ID gc;
GR_WINDOW_ID pmap;
GR_WINDOW_ID window;
GR_WINDOW_INFO info;
if (GrOpen() < 0) {
fprintf(stderr, "cannot open graphics\n");
exit(1);
}
window = nxCreateAppWindow(&ac, &av, args);
gc = GrNewGC();
GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_WINDOW));
GrSetGCBackground(gc, GrGetSysColor(GR_COLOR_WINDOWTEXT));
GrSelectEvents(window, GR_EVENT_MASK_EXPOSURE |
GR_EVENT_MASK_UPDATE | GR_EVENT_MASK_CLOSE_REQ);
GrGetWindowInfo(window, &info);
pmap = resize(info.width, info.height, 0);
GrMapWindow(window);
while (1) {
GrGetNextEventTimeout(&event, 500L);
switch (event.type) {
case GR_EVENT_TYPE_EXPOSURE:
case GR_EVENT_TYPE_TIMEOUT:
draw_clock(0, 0, width, height, pmap, gc, window);
break;
case GR_EVENT_TYPE_CLOSE_REQ:
GrClose();
exit(0);
case GR_EVENT_TYPE_UPDATE:
switch (event.update.utype) {
case GR_UPDATE_SIZE:
pmap = resize(event.update.width, event.update.height, pmap);
break;
}
}
}
return 0;
}
示例12: SigHandler
void
SigHandler(int sig)
{
/*
If we are blocked, no roaches are visible and we can just bail
out. If we are not blocked, then let the main procedure clean
up the root window.
*/
if (eventBlock) {
GrClose();
exit(0);
}
else {
done = GR_TRUE;
}
}
示例13: main
int main()
{
GR_SCREEN_INFO si;
GR_FONT_INFO fi;
GR_GC_INFO gi;
GR_FONT fonts;
int x, y;
GrOpen();
GrGetScreenInfo(&si);
printf("rows = %d\n", si.rows);
printf("cols = %d\n", si.cols);
printf("bpp = %d\n", si.bpp);
printf("planes = %d\n", si.planes);
printf("ncolors = %d\n", si.ncolors);
printf("buttons = 0x%x\n", si.buttons);
printf("modifiers = 0x%x\n", si.modifiers);
printf("fonts = %d\n", si.fonts);
getch();
for(fonts = 0; fonts < si.fonts; fonts++) {
/* if(!GrGetFontInfo(fonts, &fi)) { */
GrGetFontInfo(fonts, &fi);
if(1) {
printf("\nfont = %d\n", fi.font);
printf("height = %d\n", fi.height);
printf("maxwidth = %d\n", fi.maxwidth);
printf("baseline = %d\n", fi.baseline);
printf("fixed = %s\n", fi.fixed ? "TRUE" : "FALSE");
printf("widths =\n");
for(y = 0; y != 3; y++) {
for(x = 0; x != 7; x++)
printf("%2d", fi.widths[x * y]);
printf("\n");
getch();
}
}
}
getch();
GrClose();
}
示例14: main
int main(int argc, char *argv[])
{
lstate *state;
if(argc != 2) usage();
state = my_malloc(sizeof(lstate));
state->config_file = strdup(argv[1]);
initialise(state);
do_event_loop(state);
GrClose();
return 0;
}
示例15: do_buttonup
/*
* Here when a button is released.
*/
void
do_buttonup(GR_EVENT_BUTTON *bp)
{
if (bp->wid == w4) {
if (lineok) {
GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
GrLine(w4, gc3, bp->x, bp->y, linexpos, lineypos);
}
lineok = GR_FALSE;
return;
}
if (bp->wid == w2) {
GrClose();
exit(0);
}
}