diff --git a/ss/LightBounce.cc b/ss/LightBounce.cc index 4733f0c..f63013a 100644 --- a/ss/LightBounce.cc +++ b/ss/LightBounce.cc @@ -15,6 +15,25 @@ using namespace std; #define STRIDE_MULTIPLIER 1.0; #define ZOOM 10.0 +LightBounceBox::LightBounceBox(LogoBox * lb, + float x, float y, float z, + float xr, float yr, float zr) +{ + this->logoBox = lb; + this->x = x; + this->y = y; + this->z = z; + this->xr = xr; + this->yr = yr; + this->zr = zr; + this->dist = 0.0; +} + +LightBounceBox::~LightBounceBox() +{ + delete this->logoBox; +} + /* construct screensaver mode and do some basic OpenGL setup */ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain) { @@ -38,14 +57,9 @@ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain) float x = -half_size + box_stride / 2.0; for (int j = 0; j < SIZE; j++) { - LightBounce_Box * box = new LightBounce_Box; - box->logoBox = new LogoBox(); - box->x = x; - box->y = y; - box->z = -half_size; - box->xr = 0; - box->yr = 0; - box->zr = rot ? 90.0 : 0; + LightBounceBox * box = new LightBounceBox( + new LogoBox(), x, y, -half_size, 0, 0, rot ? 90.0 : 0 + ); m_boxes.push_back(box); x += box_stride; rot = !rot; diff --git a/ss/LightBounce.h b/ss/LightBounce.h index 75a863d..edd4aa5 100644 --- a/ss/LightBounce.h +++ b/ss/LightBounce.h @@ -12,8 +12,13 @@ #include using namespace std; -typedef struct +class LightBounceBox { +public: + LightBounceBox(LogoBox * lb, + float x, float y, float z, + float xr, float yr, float zr); + ~LightBounceBox(); LogoBox * logoBox; float x; float y; @@ -22,7 +27,7 @@ typedef struct float yr; float zr; float dist; -} LightBounce_Box; +}; class LightBounce : public SSMode { @@ -30,7 +35,7 @@ public: LightBounce(SSMain * _SSMain); void update(); protected: - vector m_boxes; + vector m_boxes; }; #endif