Merge branch 'liteCraft' of https://github.com/halotroop/Ginger3D into liteCraft
commit
05d0c52958
|
@ -32,8 +32,8 @@ public class Litecraft extends Game
|
|||
private LitecraftSave save;
|
||||
private Ginger ginger3D;
|
||||
private static Litecraft INSTANCE;
|
||||
private Player player;
|
||||
private Camera camera;
|
||||
public Player player;
|
||||
public Camera camera;
|
||||
//temp stuff to test out fbo fixes
|
||||
int oldWindowWidth = Window.width;
|
||||
int oldWindowHeight = Window.height;
|
||||
|
@ -158,22 +158,13 @@ public class Litecraft extends Game
|
|||
public static Litecraft getInstance()
|
||||
{ return INSTANCE; }
|
||||
|
||||
public void setGingerPlayer(Player player)
|
||||
{
|
||||
this.data.entities.remove(this.player); // remove the old player
|
||||
this.data.player = player; // set all the player variables
|
||||
this.player = player;
|
||||
this.camera.player = player;
|
||||
this.data.entities.add(this.player); // add the new player
|
||||
}
|
||||
|
||||
public void onPlayButtonClick()
|
||||
{
|
||||
if (world == null)
|
||||
{
|
||||
this.save = new LitecraftSave("test", false);
|
||||
this.world = this.save.getWorldOrCreate(Dimensions.OVERWORLD);
|
||||
this.setGingerPlayer(this.world.player);
|
||||
ginger3D.setGingerPlayer(this.world.player);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import com.github.halotroop.litecraft.logic.Timer.TickListener;
|
|||
import com.github.halotroop.litecraft.world.World;
|
||||
import com.github.hydos.ginger.engine.api.game.*;
|
||||
import com.github.hydos.ginger.engine.elements.buttons.TextureButton;
|
||||
import com.github.hydos.ginger.engine.elements.objects.Player;
|
||||
import com.github.hydos.ginger.engine.font.*;
|
||||
import com.github.hydos.ginger.engine.io.Window;
|
||||
import com.github.hydos.ginger.engine.particle.ParticleMaster;
|
||||
|
@ -49,6 +50,15 @@ public class Ginger
|
|||
public void openScreen(Screen screen)
|
||||
{ gingerRegister.currentScreen = screen; }
|
||||
|
||||
public void setGingerPlayer(Player player)
|
||||
{
|
||||
gingerRegister.game.data.entities.remove(Litecraft.getInstance().player); // remove the old player
|
||||
gingerRegister.game.data.player = player; // set all the player variables
|
||||
Litecraft.getInstance().player = player;
|
||||
Litecraft.getInstance().camera.player = player;
|
||||
gingerRegister.game.data.entities.add(player); // add the new player
|
||||
}
|
||||
|
||||
public void postRender()
|
||||
{ Window.swapBuffers(); }
|
||||
|
||||
|
|
Loading…
Reference in New Issue