123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- class FX {
- //img in and out
- Shader shader;
- String[] params; // IS THIS NECESSARY? I DOUBT IT
- FX(Shader shader_) {
- shader = shader_;
- }
- }
-
- FXManager fxManager = new FXManager();
-
- class FXManager {
- ArrayList<FX> fxList = new ArrayList<FX>();
-
- void addFx(Shader shader) {
- this.fxList.add(new FX(shader));
- println("Added " + shader + " to fxList at spot. List length: " + this.fxList.size());
- }
-
- void addFx(Shader shader, int pos) {
- fxList.add(new FX(shader));
- swapFx(this.fxList.size(), pos);
- println("Added " + shader + " to fxList at spot. List length: " + this.fxList.size());
- }
-
-
- void swapFx(int pos1, int pos2) {
- if (pos1 >= 0 && pos2 < this.fxList.size()) Collections.swap(fxList, pos1, pos2);
- }
-
- void removeFx(int pos) {
- if (pos >= 0 && this.fxList.size() > pos) this.fxList.remove(pos);
- }
-
- void run(boolean animate, boolean apply) {
- for (int i = 0; i < fxManager.fxList.size(); i++) {
- if (animate) {
- for (int j = 0; j < this.fxList.get(i).shader.params.size(); j++) {
- if (this.fxList.get(i).shader.params.get(j).animating) {
- this.fxList.get(i).shader.params.get(j).animate();
- }
- }
- }
- if (apply) this.fxList.get(i).shader.apply();
- if (i > maxFx) break;
- }
- }
- }
|