// CSE 143 // Homework 5 // http://www.cs.washington.edu/education/courses/143/00su/homework/ // 31 Jul 2000, Ken Yasuhara // class FireworksScript // // encapsulates reading entries from fireworks script file // fireworks script file, format of each entry: // {launch time} {type} {x} {y} {vx} {vy} {color} // [additional parameters] // where type is a char, all other fields are ints // // (x, y) is starting coordinates // (vx, vy) are x and y components of initial velocity // colors are enumed in gp142display.h, starting at 0 with Black: // Black, White, Red, Green, Blue, Yellow, Magenta, Cyan, // Purple, NavyBlue, DustyPlum, IceBlue, Turquoise, Orange, // Brown, Pink, Chalk, Gold, Peach, ForestGreen, SeaGreen, // Olive, MedGray, LightGray // currently supported types and additional parameters: // // 'r' BasicRayFirework // {radius} {mass} {duration} // where radius is a double, mass and duration are ints // // document other supported types here #ifndef _FIREWORKSSCRIPT_H_ #define _FIREWORKSSCRIPT_H_ #include "movingobject.h" // Do not modify the following two lines: #include using namespace std; class FireworksScript { public: FireworksScript(const char scriptFilename[]); // // methods // // returns true when there are no more fireworks to be read from // the script file bool isEmpty() { return (!scriptStream); } // reads launch time and firework parameters for next firework in // in given script file; sets pointer to new firework instance // (dynamically allocated) and sets launchTime; sets pointer to // NULL if no more firework data in script file void getNextFirework(MovingObject *&ptrRef, int &launchTimeRef); protected: // // member variables // // opened using filename given in constructor ifstream scriptStream; }; #endif // _FIREWORKSSCRIPT_H_