TITANIC: Beginnings of PET RealLife Quit button

This commit is contained in:
Paul Gilbert 2016-04-18 22:52:11 -04:00
parent 42206332d0
commit 225af47088
8 changed files with 79 additions and 1 deletions

View File

@ -148,4 +148,12 @@ void CPetControlSub12::mergeStrings() {
}
}
void CPetControlSub12::resize(uint count) {
if (!count || _array.size() == count)
return;
_array.clear();
_array.resize(count);
}
} // End of namespace Titanic

View File

@ -98,6 +98,7 @@ public:
*/
void draw(CScreenManager *screenManager);
void resize(uint count);
};
} // End of namespace Titanic

View File

@ -28,7 +28,7 @@
namespace Titanic {
class CPetGfxElement: public CPetElement {
protected:
public:
CGameObject *_object0;
CGameObject *_object1;
CGameObject *_object2;

View File

@ -52,6 +52,16 @@ CPetSection *CPetGlyph::getPetSection() const {
return _owner ? _owner->getOwner() : nullptr;
}
CPetControl *CPetGlyph::getPetControl() const {
return _owner ? _owner->getPetControl() : nullptr;
}
void CPetGlyph::setName(const CString &name, CPetControl *petControl) {
Rect r(0, 0, 52, 52);
_element.setBounds(r);
_element.reset(name, petControl, MODE_UNSELECTED);
}
/*------------------------------------------------------------------------*/
CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS),
@ -178,4 +188,8 @@ CPetGlyph *CPetGlyphs::getGlyph(int index) {
return nullptr;
}
CPetControl *CPetGlyphs::getPetControl() const {
return _owner ? _owner->getPetControl() : nullptr;
}
} // End of namespace Titanic

View File

@ -68,6 +68,16 @@ public:
*/
void translateBack(const Point &pt) { _element.translate(-pt.x, -pt.y); }
/**
* Get the PET control
*/
CPetControl *getPetControl() const;
/**
* Sets new name and default bounds for glyph
*/
void setName(const CString &name, CPetControl *petControl);
/**
* Setup the glyph
*/
@ -215,6 +225,11 @@ public:
* Get the owning section for the glyphs
*/
CPetSection *getOwner() const { return _owner; }
/**
* Get the PET control
*/
CPetControl *getPetControl() const;
};
} // End of namespace Titanic

View File

@ -21,8 +21,34 @@
*/
#include "titanic/pet_control/pet_quit.h"
#include "titanic/pet_control/pet_real_life.h"
#include "titanic/support/rect.h"
namespace Titanic {
void CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) {
CPetGlyph::setup(petControl, owner);
Rect tempRect(0, 0, 280, 16);
tempRect.moveTo(32, 407);
_sub12.setBounds(tempRect);
_sub12.resize(3);
_sub12.setHasBorder(true);
_sub12.setup();
Rect elementRect(0, 0, 496, 388);
elementRect.moveTo(496, 388);
_element.setBounds(elementRect);
}
bool CPetQuit::reset() {
CPetControl *pet = getPetControl();
if (!pet)
return false;
setName("PetExit", pet);
// TODO
return true;
}
} // End of namespace Titanic

View File

@ -34,6 +34,15 @@ private:
CPetControlSub12 _sub12;
CPetGfxElement _element;
public:
/**
* Setup the glyph
*/
virtual void setup(CPetControl *petControl, CPetGlyphs *owner);
/**
* Reset the glyph
*/
virtual bool reset();
};
} // End of namespace Titanic

View File

@ -154,6 +154,11 @@ public:
virtual void proc36() {}
virtual void proc37() {}
virtual void proc38(int val) {}
/**
* Get the PET control
*/
CPetControl *getPetControl() const { return _petControl; }
};
} // End of namespace Titanic