/* ***Grafik laden und vorbereiten*** */ long initgraf(void) { char alerttxt[64]; int xy[4]; /* Offscreen vorbereiten: */ wind_calc(WC_WORK, SWIGADGETS, deskx, desky, deskw, deskh, &xy[0], &xy[1], &xy[2], &xy[3]); offscr.fd_addr=(void *)Malloc((long)(xy[2]+7)/8*xy[3]*bipp); /* Get memory */ if((long)offscr.fd_addr<=0L) { return((long)offscr.fd_addr); } offscr.fd_w=xy[2]; offscr.fd_h=xy[3]; offscr.fd_wdwidth=(xy[2]+15)>>4; offscr.fd_stand=0; offscr.fd_nplanes=bipp; /* Bodengrafik laden und vorbereiten: */ bdnname[15]='0'+bipp; if( loadpic(bdnname, &bodenfdb) ) return(-1); /* Einheitengrafik laden und vorbereiten: */ einhname[17]='0'+bipp; if( loadpic(einhname, &einhfdb) ) return(-1); return(0); }
int main(int ac, char **av) { glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); if (!(win = glutCreateWindow("Terrain"))) { fprintf(stderr, "Error, couldn't open window\n"); return -1; } ModZMnt = 0.0f; loadpic(); init(); #ifndef FX glDisable(GL_TEXTURE_2D); usetex = 0; #endif glutReshapeFunc(reshape); glutDisplayFunc(drawscene); glutKeyboardFunc(key); glutSpecialFunc(special); glutIdleFunc(drawscene); glutMainLoop(); return 0; }
int main(int ac, char **av) { glutInitWindowPosition(0,0); glutInitWindowSize(WIDTH,HEIGHT); glutInit(&ac,av); glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH|GLUT_DOUBLE); glutCreateWindow("Terrain"); loadpic(); init(); #ifndef FX glDisable(GL_TEXTURE_2D); usetex=0; #endif glutReshapeFunc(reshape); glutDisplayFunc(drawscene); glutKeyboardFunc(key); glutSpecialFunc(special); glutIdleFunc(drawscene); glutMainLoop(); return 0; /* ANSI C requires main to return int. */ }
//改变 radio 重新draw picture void sequence_show_img::redrawpic(int pos){ //set zoom radio zoom_radio = 1.0 * (pos + 100) / 100; //redraw picture loadpic(); }
//显示下张图片 void sequence_show_img::next_show(){ idx = idx + 1; idx %= int(datas.size()); loadpic(); }
//显示上张图片 void sequence_show_img::last_show(){ idx = idx + int(datas.size()) - 1; idx %= int(datas.size()); loadpic(); }