Layers and Events
This commit is contained in:
31
include/utils/Layers/Layerstack.h
Normal file
31
include/utils/Layers/Layerstack.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "pch.hpp"
|
||||
#include "Layer.h"
|
||||
|
||||
class Layerstack {
|
||||
|
||||
public:
|
||||
Layerstack() {}
|
||||
|
||||
~Layerstack() {
|
||||
while(!lstack.empty()) {
|
||||
pop();
|
||||
}
|
||||
}
|
||||
|
||||
void push(Layer* l) { lstack.push_front(l); }
|
||||
|
||||
void pop() {
|
||||
Layer* l = lstack.front();
|
||||
lstack.pop_front();
|
||||
delete l;
|
||||
}
|
||||
|
||||
void renderAll() {
|
||||
for(Layer* l : lstack)
|
||||
l->onRender();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::list<Layer*> lstack;
|
||||
};
|
||||
Reference in New Issue
Block a user