diff --git a/check b/check new file mode 100755 index 0000000..f173ba2 --- /dev/null +++ b/check @@ -0,0 +1,8 @@ +#!/bin/bash +echo + +echo -e "\e[0;33m> git status\e[0m" +echo +git status + +echo \ No newline at end of file diff --git a/pull b/pull new file mode 100755 index 0000000..49af273 --- /dev/null +++ b/pull @@ -0,0 +1,8 @@ +#!/bin/bash +echo + +echo -e "\e[0;33m> git pull origin master\e[0m" +echo +git pull origin master + +echo \ No newline at end of file diff --git a/send b/send new file mode 100755 index 0000000..1201c17 --- /dev/null +++ b/send @@ -0,0 +1,40 @@ +#!/bin/bash + +. check + +if [ -z "`git status --porcelain`" ] + then + echo -e "\e[0;31m Nothing to commit.\e[0m" + echo + exit +fi + + +echo -e "\e[0;32m Going to ADD all, COMMIT and PUSH.\e[0m" +echo -e "\e[0;32m Enter commit message (leave blank to abort).\e[0m" +echo +echo -n -e "\e[1;36m [msg]: \e[0m" +read msg +echo + +if [ -z "$msg" ] + then + echo -e "\e[0;31m Aborted.\e[0m" + echo + exit +fi + +echo -e "\e[0;33m> git add --all\e[0m" +echo +git add --all +echo + +echo -e "\e[0;33m> git commit -m \"$msg\"\e[0m" +echo +git commit -m "$msg" +echo + +echo -e "\e[0;33m> git push origin master\e[0m" +echo +git push origin master +echo diff --git a/src/mightypork/rogue/display/LayeredScreen.java b/src/mightypork/rogue/display/LayeredScreen.java new file mode 100644 index 0000000..8a3cfa4 --- /dev/null +++ b/src/mightypork/rogue/display/LayeredScreen.java @@ -0,0 +1,65 @@ +package mightypork.rogue.display; + + +import java.util.ArrayList; +import java.util.List; + +import mightypork.rogue.AppAccess; +import mightypork.rogue.display.rendering.ScreenLayer; + + +public abstract class LayeredScreen extends Screen { + + private List layers = new ArrayList(); + + + public LayeredScreen(AppAccess app) { + super(app); + } + + + @Override + protected abstract void initScreen(); + + + @Override + protected abstract void deinitScreen(); + + + @Override + protected abstract void onScreenEnter(); + + + @Override + protected abstract void onScreenLeave(); + + + @Override + protected void renderScreen() + { + // in reverse order (topmost added last) + for (int i = layers.size() - 1; i >= 0; i--) { + layers.get(i).render(); + } + } + + + @Override + protected void updateScreen(double delta) + { + // no impl + } + + + protected void addLayer(ScreenLayer layer) + { + this.layers.add(layer); + } + + + protected void removeLayer(ScreenLayer layer) + { + this.layers.remove(layer); + } + +} diff --git a/src/mightypork/rogue/display/Screen.java b/src/mightypork/rogue/display/Screen.java index f97771c..70a8e29 100644 --- a/src/mightypork/rogue/display/Screen.java +++ b/src/mightypork/rogue/display/Screen.java @@ -2,6 +2,7 @@ package mightypork.rogue.display; import static org.lwjgl.opengl.GL11.*; + import mightypork.rogue.AppAccess; import mightypork.rogue.bus.DelegatingBusClient; import mightypork.rogue.bus.events.ScreenChangeEvent; @@ -233,6 +234,9 @@ public abstract class Screen extends DelegatingBusClient implements KeyBinder, B renderBegin(); renderScreen(); + + // TODO render layers ? + renderEnd(); } diff --git a/src/mightypork/rogue/display/rendering/ScreenLayer.java b/src/mightypork/rogue/display/rendering/ScreenLayer.java index aebf1d3..e02e974 100644 --- a/src/mightypork/rogue/display/rendering/ScreenLayer.java +++ b/src/mightypork/rogue/display/rendering/ScreenLayer.java @@ -1,18 +1,29 @@ package mightypork.rogue.display.rendering; -import mightypork.rogue.AppAccess; -import mightypork.rogue.bus.DelegatingBusClient; +import mightypork.rogue.bus.UpdateReceiver; +import mightypork.rogue.display.Screen; -public abstract class ScreenLayer extends DelegatingBusClient implements Renderable { +public abstract class ScreenLayer extends UpdateReceiver implements Renderable { - public ScreenLayer(AppAccess app) { - super(app, true); + private Screen screen; + + public ScreenLayer(Screen screen) { + super(screen); + this.screen = screen; } @Override public abstract void render(); + + @Override + public abstract void update(double delta); + + protected Screen screen() { + return screen; + } + }