6 changed files with 95 additions and 41 deletions
@ -0,0 +1,54 @@ |
|||
#include "LayerPanelWidget.h" |
|||
|
|||
namespace ofx{ |
|||
namespace piMapper{ |
|||
|
|||
LayerPanelWidget::LayerPanelWidget(){ |
|||
_sm = 0; |
|||
} |
|||
|
|||
void LayerPanelWidget::draw(){ |
|||
if(_sm == 0){ |
|||
return; |
|||
} |
|||
|
|||
int numSurfaces = _sm->size(); |
|||
|
|||
for(int i = 0; i < numSurfaces; ++i){ |
|||
BaseSurface * surface = _sm->getSurface(i); |
|||
BaseSurface * surfaceSelected = _sm->getSelectedSurface(); |
|||
|
|||
ofPushStyle(); |
|||
ofSetColor(255, 255, 255); |
|||
|
|||
if(surface == surfaceSelected){ |
|||
ofFill(); |
|||
}else{ |
|||
ofNoFill(); |
|||
} |
|||
|
|||
int layerIconWidth = 45; |
|||
int layerIconHeight = 20; |
|||
int offsetRight = 20; |
|||
int offsetTop = 40; |
|||
int verticalSpacing = 10; |
|||
int layerIconX = ofGetWidth() - offsetRight - layerIconWidth; |
|||
int layerIconY = offsetTop + ((layerIconHeight + verticalSpacing) * (numSurfaces - i - 1)); |
|||
|
|||
string label = "Layers"; |
|||
ofDrawBitmapString(label, ofGetWidth() - 66, 30); |
|||
|
|||
ofRectangle layerIcon = ofRectangle( |
|||
layerIconX, |
|||
layerIconY, |
|||
layerIconWidth, |
|||
layerIconHeight); |
|||
|
|||
ofDrawRectangle(layerIcon); |
|||
|
|||
ofPopStyle(); |
|||
} |
|||
} |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
@ -0,0 +1,31 @@ |
|||
#pragma once |
|||
|
|||
#include "GuiBaseWidget.h" |
|||
#include "SurfaceManager.h" |
|||
|
|||
namespace ofx { |
|||
namespace piMapper { |
|||
|
|||
class LayerPanelWidget : public GuiBaseWidget { |
|||
public: |
|||
LayerPanelWidget(); |
|||
|
|||
void setup(){} |
|||
void update(){} |
|||
void draw(); |
|||
|
|||
void onMousePressed(ofMouseEventArgs & args){} |
|||
void onMouseReleased(ofMouseEventArgs & args){} |
|||
void onMouseDragged(ofMouseEventArgs & args){} |
|||
|
|||
bool inside(float x, float y){ return false; } |
|||
|
|||
void setSurfaceManager(SurfaceManager * sm){ _sm = sm; } |
|||
|
|||
private: |
|||
SurfaceManager * _sm; |
|||
|
|||
}; |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
Loading…
Reference in new issue