

Definition at line 15 of file View.h.
Public Member Functions | |
| View (const ModelList &models) | |
| Create new view. | |
| virtual | ~View () |
| void | setScreenShift (const V2 &shift) |
| void | noteNewRound (int phases) |
| Prepare new anim. | |
| void | drawModel (Cube *model) |
| Draw model. | |
| virtual void | drawOn (SDL_Surface *screen) |
| V2 | getScreenPos (const Cube *model) const |
| Returns position on screen when model will be drawn. | |
| V2 | getFieldPos (const V2 &cursor) const |
| Returns position of tile under cursor. | |
| void | addDecor (Decor *new_decor) |
| void | removeDecors () |
Static Public Attributes | |
| static const int | SCALE = 15 |
|
|
Create new view.
Definition at line 25 of file View.cpp. 00026 : m_models(models), m_screenShift(0, 0)
00027 {
00028 m_animShift = 0;
00029 m_shiftSize = SCALE;
00030 m_screen = NULL;
00031 }
|
|
|
Definition at line 33 of file View.cpp. 00034 {
00035 removeDecors();
00036 }
|
|
|
Definition at line 40 of file View.h. 00040 { m_decors.push_back(new_decor); }
|
|
|
Draw model. Care about model shift during move. Definition at line 82 of file View.cpp. 00083 {
00084 if (!model->isLost()) {
00085 V2 screenPos = getScreenPos(model);
00086
00087 Anim::eSide side = Anim::SIDE_LEFT;
00088 if (!model->isLeft()) {
00089 side = Anim::SIDE_RIGHT;
00090 }
00091 model->anim()->drawAt(m_screen,
00092 screenPos.getX(), screenPos.getY(), side);
00093 }
00094 }
|
|
|
Implements Drawable. Definition at line 69 of file View.cpp. 00070 {
00071 m_screen = screen;
00072 m_animShift = min(SCALE, m_animShift + m_shiftSize);
00073 m_models.drawOn(this);
00074 drawDecors();
00075 }
|
|
|
Returns position of tile under cursor.
Definition at line 132 of file View.cpp.
|
|
|
Returns position on screen when model will be drawn.
Definition at line 114 of file View.cpp. 00115 {
00116 V2 shift(0, 0);
00117 Dir::eDir dir = model->getLastMoveDir();
00118 if (dir != Dir::DIR_NO) {
00119 shift = Dir::dir2xy(dir);
00120 shift = shift.scale(m_animShift);
00121 }
00122 shift = shift.plus(m_screenShift);
00123
00124 V2 anim_shift = model->const_anim()->getViewShift();
00125 return model->getLocation().plus(anim_shift).scale(SCALE).plus(shift);
00126 }
|
|
|
Prepare new anim.
Definition at line 62 of file View.cpp. 00063 {
00064 m_animShift = 0;
00065 computeShiftSize(phases);
00066 }
|
|
|
Definition at line 39 of file View.cpp. 00040 {
00041 t_decors::iterator end = m_decors.end();
00042 for (t_decors::iterator i = m_decors.begin(); i != end; ++i) {
00043 delete *i;
00044 }
00045 m_decors.clear();
00046 }
|
|
|
Definition at line 32 of file View.h. 00032 { m_screenShift = shift; }
|
|
|
|
1.4.2