本文整理汇总了C++中MI_DISPLAY函数的典型用法代码示例。如果您正苦于以下问题:C++ MI_DISPLAY函数的具体用法?C++ MI_DISPLAY怎么用?C++ MI_DISPLAY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MI_DISPLAY函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: check_death
/* Checks for death of any ghosts/pacman and updates. It also makes a new
level if all ghosts are dead or all dots are eaten. */
static void
check_death(ModeInfo * mi, pacmangamestruct *pp)
{
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
unsigned int ghost;
int alldead;
alldead = 1;
for (ghost = 0; ghost < pp->nghosts; ghost++) {
if (pp->ghosts[ghost].dead == True)
continue;
if ((pp->ghosts[ghost].nextrow == NOWHERE &&
pp->ghosts[ghost].nextcol == NOWHERE)) {
alldead = 0;
continue;
}
if (((pp->ghosts[ghost].nextrow == pp->pacman.nextrow) &&
(pp->ghosts[ghost].nextcol == pp->pacman.nextcol)) ||
((pp->ghosts[ghost].nextrow == pp->pacman.row) &&
(pp->ghosts[ghost].nextcol == pp->pacman.col) &&
(pp->ghosts[ghost].row == pp->pacman.nextrow) &&
(pp->ghosts[ghost].col == pp->pacman.nextcol))) {
pp->ghosts[ghost].dead = 1;
XSetForeground(display,
pp->stippledGC,
MI_BLACK_PIXEL(mi));
XFillRectangle(display, window,
pp->stippledGC,
pp->ghosts[ghost].cf,
pp->ghosts[ghost].rf,
pp->spritexs,
pp->spriteys);
} else
alldead = 0;
}
if (alldead == 1 || pp->dotsleft == 0)
repopulate(mi);
}
开发者ID:Bluerise,项目名称:bitrig-xenocara,代码行数:45,代码来源:pacman.c
示例2: draw_cube21
ENTRYPOINT void draw_cube21(ModeInfo * mi)
{
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
cube21_conf *cp;
if (!cube21) return;
cp = &cube21[MI_SCREEN(mi)];
MI_IS_DRAWN(mi) = True;
if (!cp->glx_context) return;
mi->polygon_count = 0;
glXMakeCurrent(display, window, *cp->glx_context);
if (!draw_main(mi, cp)) {
MI_ABORT(mi);
return;
}
if (MI_IS_FPS(mi)) do_fps (mi);
glFlush();
glXSwapBuffers(display, window);
}
开发者ID:Zygo,项目名称:xscreensaver,代码行数:19,代码来源:cube21.c
示例3: draw_grav
ENTRYPOINT void
draw_grav(ModeInfo * mi)
{
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
GC gc = MI_GC(mi);
register unsigned char ball;
gravstruct *gp;
if (gravs == NULL)
return;
gp = &gravs[MI_SCREEN(mi)];
if (gp->planets == NULL)
return;
MI_IS_DRAWN(mi) = True;
/* Mask centrepoint */
XSetForeground(display, gc, MI_BLACK_PIXEL(mi));
XDrawArc(display, window, gc,
gp->width / 2 - gp->sr / 2, gp->height / 2 - gp->sr / 2, gp->sr, gp->sr,
0, 23040);
/* Resize centrepoint */
switch (NRAND(4)) {
case 0:
if (gp->sr < (int) STARRADIUS)
gp->sr++;
break;
case 1:
if (gp->sr > 2)
gp->sr--;
}
/* Draw centrepoint */
XSetForeground(display, gc, gp->starcolor);
XDrawArc(display, window, gc,
gp->width / 2 - gp->sr / 2, gp->height / 2 - gp->sr / 2, gp->sr, gp->sr,
0, 23040);
for (ball = 0; ball < (unsigned char) gp->nplanets; ball++)
draw_planet(mi, &gp->planets[ball]);
}
开发者ID:david-sackmary,项目名称:distro-mods,代码行数:42,代码来源:grav.c
示例4: refresh_toneclock
void
refresh_toneclock(ModeInfo * mi)
{
toneclockstruct *tclock;
if (toneclocks == NULL)
return;
tclock = &toneclocks[MI_SCREEN(mi)];
if (tclock->hour == NULL)
return;
if (!tclock->painted)
return;
MI_CLEARWINDOW(mi);
#ifdef NO_DBUF
{
Display *display = MI_DISPLAY(mi);
int i;
XSetFunction(display, tclock->gc, GXxor);
for (i = 0; i < tclock->num_hour; i++) {
toneclockhour *hour0;
int x0 , y0;
x0 = (int) (tclock->radius * sin( -tclock->angle - PI_RAD * i *
360.0 / tclock->num_hour ) +
tclock->x0 + tclock->a_x * sin( tclock->anglex ) );
y0 = (int) (tclock->radius * cos( -tclock->angle - PI_RAD * i *
360.0 / tclock->num_hour ) +
tclock->y0 + tclock->a_y * sin( tclock->angley ) );
hour0 = &tclock->hour[i];
if (MI_IS_INSTALL(mi) && MI_NPIXELS(mi) > 2) {
XSetForeground(display, tclock->gc, tclock->colors[hour0->colour].pixel);
} else {
XSetForeground(display, tclock->gc, hour0->colour);
}
toneclock_drawhour(mi, hour0 , x0 , y0 );
}
XSetFunction(display, tclock->gc, GXcopy);
}
#endif
}
开发者ID:Gelma,项目名称:xlockmore-for-13.04,代码行数:42,代码来源:toneclock.c
示例5: setup_xpm_texture
/* Set up and enable texturing on our object */
static void
setup_xpm_texture (ModeInfo *mi, char **xpm_data)
{
XImage *image = xpm_to_ximage (MI_DISPLAY (mi), MI_VISUAL (mi),
MI_COLORMAP (mi), xpm_data);
char buf[1024];
clear_gl_error();
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
/* iOS invalid enum:
glPixelStorei(GL_UNPACK_ROW_LENGTH, image->width);
*/
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
image->width, image->height, 0,
GL_RGBA,
/* GL_UNSIGNED_BYTE, */
GL_UNSIGNED_INT_8_8_8_8_REV,
image->data);
sprintf (buf, "builtin texture (%dx%d)", image->width, image->height);
check_gl_error(buf);
}
开发者ID:Ro6afF,项目名称:XScreenSaver,代码行数:21,代码来源:dymaxionmap.c
示例6: first_strike
static void
first_strike(Lightning bolt, ModeInfo * mi)
{
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
GC gc = MI_GC(mi);
int i;
XSetForeground(display, gc, MI_WHITE_PIXEL(mi));
XDrawLine(display, window, gc,
bolt.end1.x, bolt.end1.y, bolt.middle[0].x, bolt.middle[0].y);
draw_line(mi, bolt.middle, BOLT_VERTICIES, gc, 0);
XDrawLine(display, window, gc,
bolt.middle[BOLT_VERTICIES - 1].x, bolt.middle[BOLT_VERTICIES - 1].y,
bolt.end2.x, bolt.end2.y);
for (i = 0; i < bolt.fork_number; i++)
draw_line(mi, bolt.branch[i].ForkVerticies, bolt.branch[i].num_used,
gc, 0);
}
开发者ID:RazZziel,项目名称:pongclock,代码行数:20,代码来源:lightning.c
示例7: screenflip_handle_event
ENTRYPOINT Bool
screenflip_handle_event (ModeInfo *mi, XEvent *event)
{
Screenflip *c = &screenflip[MI_SCREEN(mi)];
if (gltrackball_event_handler (event, c->trackball,
MI_WIDTH (mi), MI_HEIGHT (mi),
&c->button_down_p))
return True;
else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
{
if (!c->waiting_for_image_p)
{
getSnapshot (mi);
return True;
}
}
return False;
}
开发者ID:Zygo,项目名称:xscreensaver,代码行数:20,代码来源:flipscreen3d.c
示例8: free_stream
ENTRYPOINT void
free_stream (ModeInfo * mi)
{
stream_configuration *es = &ess[MI_SCREEN(mi)];
int i;
if (!es->glx_context) return;
glXMakeCurrent (MI_DISPLAY(mi), MI_WINDOW(mi), *es->glx_context);
if (es->trackball) gltrackball_free (es->trackball);
if (es->rot) free_rotator (es->rot);
for (i = 0; i < es->num_streams; i++) {
free (es->streams[i].flares);
glDeleteTextures (1, &es->streams[i].flare_tex);
}
if (es->streams) free (es->streams);
}
开发者ID:Zygo,项目名称:xscreensaver,代码行数:20,代码来源:energystream.c
示例9: refresh_image
void
refresh_image(ModeInfo * mi)
{
#ifdef HAVE_XPM
imagestruct *ip;
if (ims == NULL)
return;
ip = &ims[MI_SCREEN(mi)];
if (ip->icons == NULL)
return;
if (ip->graphics_format >= IS_XPM) {
/* This is needed when another program changes the colormap. */
free_image(MI_DISPLAY(mi), ip);
init_image(mi);
return;
}
#endif
drawImages(mi);
}
开发者ID:Gelma,项目名称:xlockmore-for-13.04,代码行数:20,代码来源:image.c
示例10: draw_gasket
ENTRYPOINT void
draw_gasket(ModeInfo * mi)
{
gasketstruct *gp = &gasket[MI_SCREEN(mi)];
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
if (!gp->glx_context) return;
glDrawBuffer(GL_BACK);
if (max_depth > 10)
max_depth = 10;
glXMakeCurrent(display, window, *(gp->glx_context));
draw(mi);
if (mi->fps_p) do_fps (mi);
glFinish();
glXSwapBuffers(display, window);
}
开发者ID:RazZziel,项目名称:pongclock,代码行数:20,代码来源:sierpinski3d.c
示例11: initLogo
static Bool
initLogo(ModeInfo * mi)
{
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
imagestruct *ip = &ims[MI_SCREEN(mi)];
if (ip->logo == None) {
getImage(mi, &ip->logo, IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_BITS,
#ifdef HAVE_XPM
DEFAULT_XPM, IMAGE_NAME,
#endif
&ip->graphics_format, &ip->cmap, &ip->black);
if (ip->logo == None) {
free_image(display, ip);
return False;
}
ip->pixw = ip->logo->width;
ip->pixh = ip->logo->height;
}
#ifndef STANDALONE
if (ip->cmap != None) {
setColormap(display, window, ip->cmap, MI_IS_INWINDOW(mi));
if (ip->bgGC == None) {
XGCValues xgcv;
xgcv.background = ip->black;
if ((ip->bgGC = XCreateGC(display, window, GCBackground,
&xgcv)) == None) {
free_image(display, ip);
return False;
}
}
} else
#endif /* STANDALONE */
{
ip->black = MI_BLACK_PIXEL(mi);
ip->bgGC = MI_GC(mi);
}
return True;
}
开发者ID:Gelma,项目名称:xlockmore-for-13.04,代码行数:41,代码来源:image.c
示例12: init_lissie
ENTRYPOINT void
init_lissie (ModeInfo * mi)
{
lissstruct *lp;
unsigned char ball;
MI_INIT (mi, lisses, 0);
lp = &lisses[MI_SCREEN(mi)];
lp->width = MI_WIDTH(mi);
#ifdef HAVE_JWXYZ
jwxyz_XSetAntiAliasing (MI_DISPLAY(mi), MI_GC(mi), False);
#endif
lp->height = MI_HEIGHT(mi);
lp->nlissies = MI_COUNT(mi);
if (lp->nlissies < -MINLISSIES) {
if (lp->lissie) {
(void) free((void *) lp->lissie);
lp->lissie = (lissiestruct *) NULL;
}
lp->nlissies = NRAND(-lp->nlissies - MINLISSIES + 1) + MINLISSIES;
} else if (lp->nlissies < MINLISSIES)
lp->nlissies = MINLISSIES;
lp->loopcount = 0;
if (lp->lissie == NULL)
if ((lp->lissie = (lissiestruct *) calloc(lp->nlissies,
sizeof (lissiestruct))) == NULL)
return;
MI_CLEARWINDOW(mi);
lp->painted = False;
for (ball = 0; ball < (unsigned char) lp->nlissies; ball++)
initlissie(mi, &lp->lissie[ball]);
}
开发者ID:sev-,项目名称:xscreensaver,代码行数:41,代码来源:lissie.c
示例13: draw_fire
/*
*-----------------------------------------------------------------------------
* Called by the mainline code periodically to update the display.
*-----------------------------------------------------------------------------
*/
void draw_fire(ModeInfo * mi)
{
firestruct *fs = &fire[MI_SCREEN(mi)];
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
MI_IS_DRAWN(mi) = True;
if (!fs->glx_context)
return;
#ifdef WIN32
wglMakeCurrent(hdc, fs->glx_context);
#else
glXMakeCurrent(display, window, *(fs->glx_context));
#endif
DrawFire(mi);
reshape_fire(mi,MI_WIDTH(mi),MI_HEIGHT(mi));
glFinish();
glXSwapBuffers(display, window);
}
开发者ID:Gelma,项目名称:xlockmore-for-13.04,代码行数:26,代码来源:fire.c
示例14: draw_rubikblocks
ENTRYPOINT void
draw_rubikblocks(ModeInfo * mi)
{
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
rubikblocks_conf *cp;
if (!rubikblocks) return;
cp = &rubikblocks[MI_SCREEN(mi)];
MI_IS_DRAWN(mi) = True;
if (!cp->glx_context) return;
mi->polygon_count = 0;
glXMakeCurrent(display, window, *(cp->glx_context));
if (!draw_main(mi, cp))
{
release_rubikblocks(mi);
return;
}
if (MI_IS_FPS(mi)) do_fps (mi);
glFlush();
glXSwapBuffers(display, window);
}
开发者ID:davehorner,项目名称:XScreenSaverWin,代码行数:21,代码来源:rubikblocks.c
示例15: cube_handle_event
ENTRYPOINT Bool
cube_handle_event (ModeInfo *mi, XEvent *event)
{
cube_configuration *cc = &ccs[MI_SCREEN(mi)];
/* Neutralize any vertical motion */
GLfloat rot = current_device_rotation();
Bool rotp = ((rot > 45 && rot < 135) ||
(rot < -45 && rot > -135));
if (event->xany.type == ButtonPress ||
event->xany.type == ButtonRelease)
{
if (rotp)
event->xbutton.x = MI_WIDTH(mi) / 2;
else
event->xbutton.y = MI_HEIGHT(mi) / 2;
}
else if (event->xany.type == MotionNotify)
{
if (rotp)
event->xmotion.x = MI_WIDTH(mi) / 2;
else
event->xmotion.y = MI_HEIGHT(mi) / 2;
}
if (gltrackball_event_handler (event, cc->trackball,
MI_WIDTH (mi), MI_HEIGHT (mi),
&cc->button_down_p))
return True;
else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
{
reset_colors (mi);
tweak_cubes (mi);
gltrackball_reset (cc->trackball, 0, 0);
return True;
}
return False;
}
开发者ID:Zygo,项目名称:xscreensaver,代码行数:40,代码来源:cityflow.c
示例16: carousel_handle_event
ENTRYPOINT Bool
carousel_handle_event (ModeInfo *mi, XEvent *event)
{
carousel_state *ss = &sss[MI_SCREEN(mi)];
if (event->xany.type == ButtonPress &&
event->xbutton.button == Button1)
{
if (! ss->button_down_p)
ss->button_down_time = time((time_t *) 0);
}
else if (event->xany.type == ButtonRelease &&
event->xbutton.button == Button1)
{
if (ss->button_down_p)
{
/* Add the time the mouse was held to the expire times of all
frames, so that mouse-dragging doesn't count against
image expiration.
*/
int secs = time((time_t *) 0) - ss->button_down_time;
int i;
for (i = 0; i < ss->nframes; i++)
ss->frames[i]->expires += secs;
}
}
if (gltrackball_event_handler (event, ss->trackball,
MI_WIDTH (mi), MI_HEIGHT (mi),
&ss->button_down_p))
return True;
else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
{
int i = random() % ss->nframes;
ss->frames[i]->expires = 0;
return True;
}
return False;
}
开发者ID:sev-,项目名称:xscreensaver,代码行数:40,代码来源:carousel.c
示例17: draw_noof
ENTRYPOINT void
draw_noof (ModeInfo *mi)
{
int i;
noof_configuration *bp = &bps[MI_SCREEN(mi)];
if (!bp->glx_context)
return;
glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));
/**
if((random() & 0xff) == 0x34){
glClear(GL_COLOR_BUFFER_BIT);
}
if((tko & 0x1f) == 0x1f){
glEnable(GL_BLEND);
glColor4f(0.0, 0.0, 0.0, 0.09);
glRectf(0.0, 0.0, wd, ht);
glDisable(GL_BLEND);
#ifdef __sgi
sginap(0);
#endif
}
*/
gravity(bp, -2.0);
for (i = 0; i < N_SHAPES; i++) {
motionUpdate(bp, i);
colorUpdate(bp, i);
drawleaf(bp, i);
}
if (mi->fps_p) do_fps (mi);
glFinish();
/* For some reason this hack screws up on Cocoa if we try to double-buffer it.
It looks fine single-buffered, so let's just do that. */
/* glXSwapBuffers(MI_DISPLAY(mi), MI_WINDOW(mi)); */
}
开发者ID:RazZziel,项目名称:pongclock,代码行数:40,代码来源:noof.c
示例18: flipflop_handle_event
ENTRYPOINT Bool
flipflop_handle_event (ModeInfo *mi, XEvent *event)
{
Flipflopcreen *c = &qs[MI_SCREEN(mi)];
if (gltrackball_event_handler (event, c->trackball,
MI_WIDTH (mi), MI_HEIGHT (mi),
&c->button_down_p))
return True;
else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
{
if (!textured || c->got_texture)
{
textured = 1;
c->got_texture = False;
get_texture (mi);
return True;
}
}
return False;
}
开发者ID:mmarseglia,项目名称:xscreensaver,代码行数:22,代码来源:flipflop.c
示例19: draw_lisa
ENTRYPOINT void
draw_lisa (ModeInfo * mi)
{
lisacons *lc;
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
if (lc->lissajous == NULL)
return;
#ifdef HAVE_JWXYZ /* Don't second-guess Quartz's double-buffering */
XClearWindow (MI_DISPLAY(mi), MI_WINDOW(mi));
#endif
MI_IS_DRAWN(mi) = True;
lc->painted = True;
if (++lc->loopcount > lc->maxcycles) {
change_lisa(mi);
}
refreshlisa(mi);
}
开发者ID:Ro6afF,项目名称:XScreenSaver,代码行数:22,代码来源:lisa.c
示例20: slideshow_handle_event
ENTRYPOINT Bool
slideshow_handle_event (ModeInfo *mi, XEvent *event)
{
slideshow_state *ss = &sss[MI_SCREEN(mi)];
if (event->xany.type == Expose ||
event->xany.type == GraphicsExpose ||
event->xany.type == VisibilityNotify)
{
ss->redisplay_needed_p = True;
if (debug_p)
fprintf (stderr, "%s: exposure\n", blurb());
return False;
}
else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
{
ss->change_now_p = True;
return True;
}
return False;
}
开发者ID:MaddTheSane,项目名称:xscreensaver,代码行数:22,代码来源:glslideshow.c
注:本文中的MI_DISPLAY函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论