//------------------------------------------------------------------- // Play one frame of the DEMO GAME. void demo(void) { int dx, dy, fire; newwave(); enemystep(); s_update(); player[nowplayer].control(dx, dy, fire); weaponstep(nowplayer, dx * SHIPSPEED, dy * SHIPSPEED, fire); crash(nowplayer); if (gstate.frame < layerlength(1)) { gstate.frame++; movelayer(0, gstate.frame & 1); movelayer(1, 1); } else { movelayer(0, 0); movelayer(1, 0); } //Draw game to demo texture render.setTarget(&demoTexture); process_objects(); drawscreen(); postprocess_objects(); render.setTarget(NULL); }
void doall(void) { char buf[80]; int i; for (i = 0; i < 10; i++) layers[i] = NULL; for (;;) { printf("> "); fflush(stdout); scanf("%s", buf); if (!strcmp(buf,"quit")) { freelayers(); return; } else if (!strcmp(buf, "help")) { printf("quit help createupfrontlayer [cul] createbehindlayer [cbl] deletelayer [dl]\n"); printf("behindlayerupfrontlayer [ul] movelayerinfrontof [mlio]\n"); printf("movelayer [ml] movesizelayer [msl] sizelayer [sl] scrollayer [scl]\n"); printf("motion [mot] DumpCliprects [dc] \n"); printf("Frame [F] DemoA DemoB DemoC DemoD\n"); printf("Generate a few layers: [gl1,gl2,gl3,gl4]\n"); } else if (!strcmp(buf, "createupfrontlayer") || !strcmp(buf, "cul")) { createupfrontlayer(); } else if (!strcmp(buf, "createbehindlayer") || !strcmp(buf, "cbl")) { createbehindlayer(); } else if (!strcmp(buf, "deletelayer") || !strcmp(buf, "dl")) { deletelayer(); } else if (!strcmp(buf, "behindlayer") || !strcmp(buf, "bl")) { behindlayer(); } else if (!strcmp(buf, "upfrontlayer") || !strcmp(buf, "ul")) { upfrontlayer(); } else if (!strcmp(buf, "movelayerinfrontof") || !strcmp(buf, "mlio")) { movelayerinfrontof(); } else if (!strcmp(buf, "movelayer") || !strcmp(buf, "ml")) { movelayer(); } else if (!strcmp(buf, "movesizelayer") || !strcmp(buf, "msl")) { movesizelayer(); } else if (!strcmp(buf, "sizelayer") || !strcmp(buf, "sl")) { sizelayer(); } else if (!strcmp(buf, "scrolllayer") || !strcmp(buf, "scl")) { scrolllayer(); } else if (!strcmp(buf, "motion") || !strcmp(buf, "mot")) { motion(); } else if (!strcmp(buf, "Frame") || !strcmp(buf, "F")) { Frame(); } else if (!strcmp(buf, "DemoA")) { DemoA(); } else if (!strcmp(buf, "DemoB")) { DemoB(); } else if (!strcmp(buf, "DemoC")) { DemoC(); } else if (!strcmp(buf, "DemoD")) { DemoD(); } else if (!strcmp(buf, "gl1")) { GenerateLayers1(); } else if (!strcmp(buf, "gl2")) { GenerateLayers2(); } else if (!strcmp(buf, "gl3")) { GenerateLayers3(); } else if (!strcmp(buf, "gl4")) { GenerateLayers4(); } else if (!strcmp(buf, "dc")) { DumpCliprects(); } else printf("Unknown command. Try 'help'.\n"); } }