2 changed files with 60 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||||
|
#include "SurfaceStack.h" |
||||
|
|
||||
|
namespace ofx { |
||||
|
namespace piMapper { |
||||
|
|
||||
|
SurfaceStack::SurfaceStack(){} |
||||
|
|
||||
|
void SurfaceStack::push_back(ofx::piMapper::BaseSurface & s){ |
||||
|
_surfaces.push_back(s); |
||||
|
} |
||||
|
|
||||
|
void SurfaceStack::pop_back(){ |
||||
|
if(_surfaces.size() > 0){ |
||||
|
_surfaces.pop_back(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
int SurfaceStack::size(){ |
||||
|
return _surfaces.size(); |
||||
|
} |
||||
|
|
||||
|
void SurfaceStack::erase(int pos){ |
||||
|
_surfaces.erase(_surfaces.begin() + pos); |
||||
|
} |
||||
|
|
||||
|
void SurfaceStack::swap(ofx::piMapper::BaseSurface * a, ofx::piMapper::BaseSurface * b){ |
||||
|
std::swap(a, b); |
||||
|
} |
||||
|
|
||||
|
} // namespace piMapper
|
||||
|
} // namespace ofx
|
@ -0,0 +1,29 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "ofMain.h" |
||||
|
#include "BaseSurface.h" |
||||
|
|
||||
|
namespace ofx { |
||||
|
namespace piMapper { |
||||
|
|
||||
|
// One can imagine this as a layers panel in an image editor
|
||||
|
class SurfaceStack { |
||||
|
public: |
||||
|
SurfaceStack(); |
||||
|
|
||||
|
void push_back(BaseSurface & s); |
||||
|
void pop_back(); |
||||
|
void erase(int pos); |
||||
|
void swap(BaseSurface * a, BaseSurface * b); |
||||
|
void draw(); |
||||
|
|
||||
|
int size(); |
||||
|
|
||||
|
BaseSurface * at(int pos); |
||||
|
|
||||
|
private: |
||||
|
vector<BaseSurface> _surfaces; |
||||
|
}; |
||||
|
|
||||
|
} // namespace piMapper
|
||||
|
} // namespace ofx
|
Loading…
Reference in new issue