#ifndef ANIMAL_H #define ANIMAL_H #include #include #include #include #include #include "SoundData.h" using namespace std; // These States have something special logic in code (other than just randomly picked) enum SpecialState { NOTHING, stay, drop, jump, jump_end, flop, hang, fast_right, fast_left, SPECIAL_STATE_LAST }; class State { public: string name; string img_name; int count; int interval; int x; int y; string sound; SpecialState special; bool interruptable; vector imgs; SoundData sound_data; }; class Animal { public: Animal(string skin); ~Animal(); SDL_Surface *readImg(string skin, string state_name, int num); void readSkin(string file); void readSkinStep(string skin, char chr, string &buf, string &key, State &state, char &prev_chr); void readSkinFill(string skin, State state); void createShape(int num, int w, int h); void move(); void animate(bool reset); void shuffle(); void setState(State *s); void setSpecialState(SpecialState s); void resetTimes(Uint64 t); Uint64 step(Uint64 cur, bool press); SDL_Surface *getImage(); SoundData *getSound(); bool hasStateChanged(); void shouldRunAway(char dir); SDL_Surface *getPreviewSurface(); SDL_Rect disp_pos; // has display width and height and window posiion on it vector states; vector special_states; State *cur_state; vector random_states; int animation_i; Uint64 move_time; Uint64 animate_time; Uint64 random_time; Uint64 cur; bool viime_event; bool state_changed; }; #endif