Layered screen added

v5stable
Ondřej Hruška 11 years ago
parent ab73e0affd
commit b7f0057eaa
  1. 8
      check
  2. 8
      pull
  3. 40
      send
  4. 65
      src/mightypork/rogue/display/LayeredScreen.java
  5. 4
      src/mightypork/rogue/display/Screen.java
  6. 21
      src/mightypork/rogue/display/rendering/ScreenLayer.java

@ -0,0 +1,8 @@
#!/bin/bash
echo
echo -e "\e[0;33m> git status\e[0m"
echo
git status
echo

@ -0,0 +1,8 @@
#!/bin/bash
echo
echo -e "\e[0;33m> git pull origin master\e[0m"
echo
git pull origin master
echo

40
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

@ -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<ScreenLayer> layers = new ArrayList<ScreenLayer>();
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);
}
}

@ -2,6 +2,7 @@ package mightypork.rogue.display;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
import mightypork.rogue.AppAccess; import mightypork.rogue.AppAccess;
import mightypork.rogue.bus.DelegatingBusClient; import mightypork.rogue.bus.DelegatingBusClient;
import mightypork.rogue.bus.events.ScreenChangeEvent; import mightypork.rogue.bus.events.ScreenChangeEvent;
@ -233,6 +234,9 @@ public abstract class Screen extends DelegatingBusClient implements KeyBinder, B
renderBegin(); renderBegin();
renderScreen(); renderScreen();
// TODO render layers ?
renderEnd(); renderEnd();
} }

@ -1,18 +1,29 @@
package mightypork.rogue.display.rendering; package mightypork.rogue.display.rendering;
import mightypork.rogue.AppAccess; import mightypork.rogue.bus.UpdateReceiver;
import mightypork.rogue.bus.DelegatingBusClient; 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) { private Screen screen;
super(app, true);
public ScreenLayer(Screen screen) {
super(screen);
this.screen = screen;
} }
@Override @Override
public abstract void render(); public abstract void render();
@Override
public abstract void update(double delta);
protected Screen screen() {
return screen;
}
} }

Loading…
Cancel
Save