| 1 | /*************************************************************************** |
| 2 | pipequeue.h - description |
| 3 | ------------------- |
| 4 | begin : Sat Sep 30 2000 |
| 5 | copyright : (C) 2000 by Waldemar Baraldi |
| 6 | email : [email protected] |
| 7 | ***************************************************************************/ |
| 8 | |
| 9 | /*************************************************************************** |
| 10 | * * |
| 11 | * This program is free software; you can redistribute it and/or modify * |
| 12 | * it under the terms of the GNU General Public License as published by * |
| 13 | * the Free Software Foundation; either version 2 of the License, or * |
| 14 | * (at your option) any later version. * |
| 15 | * * |
| 16 | ***************************************************************************/ |
| 17 | |
| 18 | #ifndef PIPE_QUEUE_H |
| 19 | #define PIPE_QUEUE_H |
| 20 | |
| 21 | #include "animatedcanvas.h" |
| 22 | #include "pipe.h" |
| 23 | #include "videomanager.h" |
| 24 | |
| 25 | class PipeQueue : public AnimatedCanvas{ |
| 26 | |
| 27 | public: |
| 28 | |
| 29 | static const int MaxPipes=3; |
| 30 | |
| 31 | PipeQueue(); |
| 32 | ~PipeQueue(); |
| 33 | |
| 34 | int width(); |
| 35 | |
| 36 | int height(); |
| 37 | |
| 38 | /** Retorna el Pipe que se encuentra en la cabeza |
| 39 | de la cola y lo quita agregando luego uno por la cola.*/ |
| 40 | Pipe * getHead(); |
| 41 | |
| 42 | /** Retorna el pipe en la posicion.*/ |
| 43 | Pipe * getPipe(int pos); |
| 44 | |
| 45 | /** Asigna una probabilidad entre 1..100 de agregar restricciones |
| 46 | de direccion.*/ |
| 47 | void setRestrictionCoef(unsigned int coef); |
| 48 | |
| 49 | /** Asigna una probabilidad entre 1..100 de agregar pipes fijos.*/ |
| 50 | void setFixedCoef(unsigned int coef); |
| 51 | |
| 52 | bool isChanged(); |
| 53 | |
| 54 | /** paint heredado.*/ |
| 55 | void paint(VideoManager * vm); |
| 56 | |
| 57 | void tick(){}; |
| 58 | |
| 59 | protected: |
| 60 | |
| 61 | void fillUp(); |
| 62 | |
| 63 | Pipe * queue[MaxPipes]; |
| 64 | int index; |
| 65 | bool change; |
| 66 | unsigned int res_coef; |
| 67 | unsigned int fixed_coef; |
| 68 | bool filled; |
| 69 | |
| 70 | Pipe * generatePipe(); |
| 71 | |
| 72 | }; |
| 73 | |
| 74 | #endif |
| 75 |