53 lines
2.1 KiB
C++
53 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include "ofMain.h"
|
|
#include "AtlasLayerCombo.h"
|
|
#include "MsdfAtlasLayerCombo.h"
|
|
#include "MsdfLayer.h"
|
|
#include "GPUFontAtlasLayerCombo.h"
|
|
#include "GPUFontLayer.h"
|
|
#include "Utils.h"
|
|
|
|
namespace ofxVariableLab {
|
|
|
|
class LayerComposition {
|
|
public:
|
|
void setup();
|
|
void update();
|
|
void draw(int width = 0, int height = 0) const;
|
|
LayerID addLayer(const Layer::Props & props,
|
|
LayerID layerID = "");
|
|
LayerID addLayer(const ComboIdentifier & identifier,
|
|
const string & text,
|
|
const std::vector <FontVariation> & variations,
|
|
LayerID layerID = "");
|
|
LayerID addLayer(const ComboIdentifier & identifier,
|
|
const Layer::Props & props,
|
|
const std::vector <FontVariation> & variations,
|
|
LayerID layerID = "");
|
|
void findOrCreateNewMomForLayer(shared_ptr <Layer> layer,
|
|
ComboIdentifier idealMom);
|
|
void removeLayer(const LayerID & id); // TODO: make bool, to catch nonexisting
|
|
const unordered_map <LayerID, shared_ptr <Layer> > & getLayers();
|
|
shared_ptr <Layer> getLayer(const LayerID & layerID);
|
|
const unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > & getAtlasLayerCombos() const;
|
|
void setVFlip(bool vFlip);
|
|
|
|
void setLayerOrder(const vector <LayerID> & layerOrder);
|
|
private:
|
|
VFlipState vFlipState = V_FLIP_UNKNOWN;
|
|
unordered_map <LayerID, shared_ptr <Layer> > layers;
|
|
unordered_map <LayerID, shared_ptr <AtlasLayerCombo> > layerIDcombos;
|
|
unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > atlasLayerCombos;
|
|
vector <LayerID> layerOrder;
|
|
|
|
/**
|
|
* @brief lastGpuTextureOffset GL_TEXTURE0 + offset
|
|
* we want to different textures for different fonts
|
|
* this value is incremented/decremented when adding/removing GPUFont layers
|
|
*/
|
|
int nextGpuTextureOffset = 0;
|
|
//unordered_map <LayerIdentifier, shared_ptr <ofxVariableLab::Layer> > layers;
|
|
};
|
|
|
|
}
|