2 changed files with 49 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||
#include "SurfaceFactory.h" |
|||
|
|||
namespace ofx { |
|||
namespace piMapper { |
|||
|
|||
SurfaceFactory * SurfaceFactory::_instance = 0; |
|||
|
|||
SurfaceFactory * SurfaceFactory::instance(){ |
|||
if(_instance == 0){ |
|||
_instance = new ofx::piMapper::SurfaceFactory(); |
|||
} |
|||
return _instance; |
|||
} |
|||
|
|||
BaseSurface * SurfaceFactory::createSurface(int type){ |
|||
if(type == SurfaceType::TRIANGLE_SURFACE){ |
|||
// TODO: Create triangle surface
|
|||
}else if(type == SurfaceType::QUAD_SURFACE){ |
|||
// TODO: Create quad surface
|
|||
}else{ |
|||
throw runtime_error("Undefined surface type"); |
|||
} |
|||
} |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
@ -0,0 +1,23 @@ |
|||
#pragma once |
|||
|
|||
#include "ofMain.h" |
|||
#include "BaseSurface.h" |
|||
#include "SurfaceType.h" |
|||
|
|||
namespace ofx { |
|||
namespace piMapper { |
|||
|
|||
// The surface factory singleton
|
|||
class SurfaceFactory { |
|||
public: |
|||
static SurfaceFactory * instance(); |
|||
|
|||
// Create new surface based on type
|
|||
BaseSurface * createSurface(int type); |
|||
|
|||
private: |
|||
static SurfaceFactory * _instance; |
|||
}; |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
Loading…
Reference in new issue