Browse Source

Add `SurfaceStack` class untested yet

master
Krisjanis Rijnieks 10 years ago
parent
commit
789342b320
  1. 31
      src/Surfaces/SurfaceStack.cpp
  2. 29
      src/Surfaces/SurfaceStack.h

31
src/Surfaces/SurfaceStack.cpp

@ -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

29
src/Surfaces/SurfaceStack.h

@ -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…
Cancel
Save