-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
81 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
editor/src/macbury/forge/editor/controllers/PostProcessingController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package macbury.forge.editor.controllers; | ||
|
||
import com.badlogic.gdx.Gdx; | ||
import com.badlogic.gdx.files.FileHandle; | ||
import macbury.forge.editor.controllers.listeners.OnMapChangeListener; | ||
import macbury.forge.editor.reloader.DirectoryWatchJob; | ||
import macbury.forge.editor.reloader.DirectoryWatcher; | ||
import macbury.forge.editor.screens.LevelEditorScreen; | ||
import macbury.forge.graphics.postprocessing.PostProcessingManager; | ||
import macbury.forge.level.Level; | ||
|
||
/** | ||
* Created by macbury on 31.08.15. | ||
*/ | ||
public class PostProcessingController implements OnMapChangeListener, DirectoryWatchJob.DirectoryWatchJobListener { | ||
private Level currentLevel; | ||
|
||
public PostProcessingController(DirectoryWatcher directoryWatcher) { | ||
directoryWatcher.addListener(PostProcessingManager.STORAGE_DIR, this); | ||
} | ||
|
||
@Override | ||
public void onCloseMap(ProjectController controller, LevelEditorScreen screen) { | ||
currentLevel = null; | ||
} | ||
|
||
@Override | ||
public void onNewMap(ProjectController controller, LevelEditorScreen screen) { | ||
this.currentLevel = screen.level; | ||
} | ||
|
||
@Override | ||
public void onProjectStructureChange(ProjectController controller) { | ||
|
||
} | ||
|
||
@Override | ||
public void onMapSaved(ProjectController projectController, LevelEditorScreen levelEditorScreen) { | ||
|
||
} | ||
|
||
@Override | ||
public void onFileInDirectoryChange(FileHandle handle) { | ||
if (handle.extension().endsWith("glsl") || handle.extension().endsWith("json")) { | ||
Gdx.app.postRunnable(new Runnable() { | ||
@Override | ||
public void run() { | ||
reloadPostProcessing(); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
private void reloadPostProcessing() { | ||
if (currentLevel != null) { | ||
try { | ||
currentLevel.postProcessing.reload(); | ||
System.gc(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
editor/src/macbury/forge/editor/controllers/WatchFileController.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters