void draw(void) { int newCount; char buf[20]; int i, len; /* Draw the frame */ cull_proc(); draw_proc(); /* Update the frames per second count if we have gone past at least a quarter of a second since the last update. */ newCount = glutGet(GLUT_ELAPSED_TIME); frameCount++; if ((newCount - lastCount) > 1000) { fpsRate = (int) ((10000.0f / (newCount - lastCount)) * frameCount); lastCount = newCount; frameCount = 0; } if (show_timer) { sprintf(buf,"%3d.%d fps", fpsRate / 10, fpsRate % 10); glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); glDisable(GL_FOG); glDisable(GL_BLEND); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0, Wxsize, 0, Wysize, -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glColor3f(1.0f, 1.0f, 0.0f); glRasterPos2i(10, 10); len = strlen(buf); for (i = 0; i < len; i++) glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, buf[i]); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib(); } glutSwapBuffers(); }
/* * Allegro GUI procedure for editing the map. */ int map_edit_proc(int msg, DIALOG *d, int c) { switch(msg) { // Simply calls the graph's draw_proc case MSG_DRAW: for (c=0; c<game.tiles; c++) { matrix[c].info |= 0x40; matrix[c].fog = 0xff; } draw_proc(d); return D_O_K; // Checks if the mouse has been moved and update the map accordently case MSG_IDLE: { int x, y; if ((d->flags & D_GOTMOUSE)==0) return D_O_K; x = (mouse_x - d->x)/24; y = (mouse_y - d->y)/24; if (y==0 && game.pane_y>0) { game.pane_y--; d->flags |= D_DIRTY; } if (y==19 && game.pane_y<game.row_y-20) { game.pane_y++; d->flags |= D_DIRTY; } if (x==0 && game.pane_x>0) { game.pane_x--; d->flags |= D_DIRTY; } if (x==19 && game.pane_x<game.row_x-20) { game.pane_x++; d->flags |= D_DIRTY; } return D_O_K; } case MSG_WANTFOCUS: return D_WANTFOCUS; // Changes the tile by the listboxes selections case MSG_CLICK: { int x, y, i; x = (mouse_x - d->x)/24 + game.pane_x; y = (mouse_y - d->y)/24 + game.pane_y; i = y*game.row_x+x; matrix[i].info = mapedit_dialog[7].d1; switch (mapedit_dialog[6].d1) { case 0: matrix[i].info |= MATRIX_WATER; break; case 1: matrix[i].info |= MATRIX_VOID; break; case 2: matrix[i].info |= MATRIX_ARMY; break; case 3: matrix[i].info |= MATRIX_CITY; break; } d->flags |= D_DIRTY; game.random=0xffff; return D_O_K; } } return D_O_K; }
void item_button::draw_complete_with_children(draw_info in) { draw_children(in); draw_proc(in, true, true, true, false, false, true); }
void item_button::draw_grid_border_ghost(draw_info in) { draw_proc(in, false, true, false, true, true); }
void item_button::draw_dragged_ghost_inside(draw_info in) { draw_proc(in, true, false, false, true); }