int main(int argc, char *argv[]) { displayInit(argc, argv); audioInit(); fftwInit(); textureInit(); atexit(audioDeinit); atexit(fftwDeinit); atexit(textureDeinit); glutMainLoop(); return 0; /* Not reached. */ }
int main () { srand(time(NULL)); FsOpenWindow(0,0,600, 800,1); glClearColor(0, 0, 0, 1); glShadeModel(GL_SMOOTH); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); textureInit(); WeaponUpgrade::LoadTexture("pic/red.png", "pic/green.png", "pic/blue.png"); Plane *plane; plane = new WeaponUpgrade(); bool running = true; while(running) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); FsPollDevice(); int key=FsInkey(); int lb, mb, rb, mx, my; int mouse = FsGetMouseEvent(lb, mb, rb, mx, my); if(FSKEY_ESC==key) { running=false; } plane->Draw(); plane->Move(1.0); if (((Prize *)plane)->Dead()) { delete plane; plane = new WeaponUpgrade(); } FsSwapBuffers(); FsSleep(25); } return 0; }
unsigned int chckAtlasPush(chckAtlas *atlas, const unsigned int width, const unsigned int height) { assert(atlas); void *tmp; if (!(tmp = realloc(atlas->textures, (atlas->textureCount + 1) * sizeof(struct texture)))) return 0; atlas->textures = tmp; atlas->textureCount += 1; textureInit(&atlas->textures[atlas->textureCount - 1], width, height); if (width > atlas->longestEdge) atlas->longestEdge = width; if (height > atlas->longestEdge) atlas->longestEdge = height; atlas->totalArea += width * height; return atlas->textureCount; }
WhiteBall::WhiteBall(const Point & pos) :Ball(pos, Vec(-0.1, -0.1, 0.0), BallGUI(wAmbient, wSpecular), false) { textureInit(); }