semi added guis
parent
b51274b5c2
commit
47acf509aa
|
@ -0,0 +1,37 @@
|
||||||
|
package com.github.halotroop.litecraft.screens;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.github.hydos.ginger.engine.api.GingerRegister;
|
||||||
|
import com.github.hydos.ginger.engine.elements.GuiTexture;
|
||||||
|
import com.github.hydos.ginger.engine.screen.Screen;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* YeS
|
||||||
|
*/
|
||||||
|
public class TitleScreen extends Screen
|
||||||
|
{
|
||||||
|
|
||||||
|
List<GuiTexture> elements;
|
||||||
|
|
||||||
|
public TitleScreen()
|
||||||
|
{
|
||||||
|
elements = new ArrayList<GuiTexture>();
|
||||||
|
//TODO: move over main menu ui elements from main class to here
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render()
|
||||||
|
{
|
||||||
|
GingerRegister.getInstance().masterRenderer.renderGuis(elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -58,7 +58,7 @@ public class Litecraft extends Game
|
||||||
|
|
||||||
FontType font = new FontType(Loader.loadFontAtlas("candara.png"), "candara.fnt");
|
FontType font = new FontType(Loader.loadFontAtlas("candara.png"), "candara.fnt");
|
||||||
ginger3D.setGlobalFont(font);
|
ginger3D.setGlobalFont(font);
|
||||||
GUIText titleText = ginger3D.registerText("LiteCraft PRE-ALPHA build 1", 3, new Vector2f(0, 0), 1f, true, "PLAYBUTTON");
|
GUIText titleText = ginger3D.registerText("LiteCraft build 1", 3, new Vector2f(0, 0), 1f, true, "PLAYBUTTON");
|
||||||
titleText.setBorderWidth(0.5f);
|
titleText.setBorderWidth(0.5f);
|
||||||
|
|
||||||
Light sun = new Light(new Vector3f(100, 105, -100), new Vector3f(1.3f, 1.3f, 1.3f), new Vector3f(0.0001f, 0.0001f, 0.0001f));
|
Light sun = new Light(new Vector3f(100, 105, -100), new Vector3f(1.3f, 1.3f, 1.3f), new Vector3f(0.0001f, 0.0001f, 0.0001f));
|
||||||
|
@ -88,7 +88,7 @@ public class Litecraft extends Game
|
||||||
}
|
}
|
||||||
oldWindowWidth = Window.width;
|
oldWindowWidth = Window.width;
|
||||||
oldWindowHeight = Window.height;
|
oldWindowHeight = Window.height;
|
||||||
ginger3D.masterRenderer.renderShadowMap(data.entities, data.lights.get(0));
|
ginger3D.gingerRegister.masterRenderer.renderShadowMap(data.entities, data.lights.get(0));
|
||||||
if (isInWorld)
|
if (isInWorld)
|
||||||
{ ginger3D.renderWithoutTerrain(this, world); }
|
{ ginger3D.renderWithoutTerrain(this, world); }
|
||||||
ginger3D.renderOverlays(this);
|
ginger3D.renderOverlays(this);
|
||||||
|
|
|
@ -17,7 +17,6 @@ import com.github.hydos.ginger.engine.utils.Loader;
|
||||||
|
|
||||||
public class Ginger
|
public class Ginger
|
||||||
{
|
{
|
||||||
public MasterRenderer masterRenderer;
|
|
||||||
public GingerRegister gingerRegister;
|
public GingerRegister gingerRegister;
|
||||||
public MousePicker picker;
|
public MousePicker picker;
|
||||||
public FontType globalFont;
|
public FontType globalFont;
|
||||||
|
@ -35,14 +34,14 @@ public class Ginger
|
||||||
Window.stop();
|
Window.stop();
|
||||||
PostProcessing.cleanUp();
|
PostProcessing.cleanUp();
|
||||||
ParticleMaster.cleanUp();
|
ParticleMaster.cleanUp();
|
||||||
masterRenderer.cleanUp();
|
gingerRegister.masterRenderer.cleanUp();
|
||||||
TextMaster.cleanUp();
|
TextMaster.cleanUp();
|
||||||
Loader.cleanUp();
|
Loader.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openScreen(Screen screen)
|
public void openScreen(Screen screen)
|
||||||
{
|
{
|
||||||
|
gingerRegister.currentScreen = screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postRender()
|
public void postRender()
|
||||||
|
@ -65,27 +64,30 @@ public class Ginger
|
||||||
|
|
||||||
public void render(Game game)
|
public void render(Game game)
|
||||||
{
|
{
|
||||||
GingerUtils.preRenderScene(masterRenderer);
|
GingerUtils.preRenderScene(gingerRegister.masterRenderer);
|
||||||
contrastFbo.bindFBO();
|
contrastFbo.bindFBO();
|
||||||
masterRenderer.renderScene(game.data.entities, game.data.normalMapEntities, game.data.flatTerrains, game.data.lights, game.data.camera, game.data.clippingPlane);
|
gingerRegister.masterRenderer.renderScene(game.data.entities, game.data.normalMapEntities, game.data.flatTerrains, game.data.lights, game.data.camera, game.data.clippingPlane);
|
||||||
ParticleMaster.renderParticles(game.data.camera);
|
ParticleMaster.renderParticles(game.data.camera);
|
||||||
contrastFbo.unbindFBO();
|
contrastFbo.unbindFBO();
|
||||||
contrastFbo.handler.render(contrastFbo.colorTexture);
|
contrastFbo.handler.render(contrastFbo.colorTexture);
|
||||||
if (game.data.handleGuis)
|
if (game.data.handleGuis)
|
||||||
{ renderOverlays(game); }
|
{ renderOverlays(game); }
|
||||||
|
if(gingerRegister.currentScreen != null) {
|
||||||
|
gingerRegister.currentScreen.render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderOverlays(Game game)
|
public void renderOverlays(Game game)
|
||||||
{
|
{
|
||||||
masterRenderer.renderGuis(game.data.guis);
|
gingerRegister.masterRenderer.renderGuis(game.data.guis);
|
||||||
TextMaster.render();
|
TextMaster.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderWithoutTerrain(Game game, World world)
|
public void renderWithoutTerrain(Game game, World world)
|
||||||
{
|
{
|
||||||
GingerUtils.preRenderScene(masterRenderer);
|
GingerUtils.preRenderScene(gingerRegister.masterRenderer);
|
||||||
contrastFbo.bindFBO();
|
contrastFbo.bindFBO();
|
||||||
masterRenderer.renderSceneNoTerrain(game.data.entities, game.data.normalMapEntities, game.data.lights, game.data.camera, game.data.clippingPlane, world);
|
gingerRegister.masterRenderer.renderSceneNoTerrain(game.data.entities, game.data.normalMapEntities, game.data.lights, game.data.camera, game.data.clippingPlane, world);
|
||||||
ParticleMaster.renderParticles(game.data.camera);
|
ParticleMaster.renderParticles(game.data.camera);
|
||||||
contrastFbo.unbindFBO();
|
contrastFbo.unbindFBO();
|
||||||
PostProcessing.doPostProcessing(contrastFbo.colorTexture);
|
PostProcessing.doPostProcessing(contrastFbo.colorTexture);
|
||||||
|
@ -103,7 +105,7 @@ public class Ginger
|
||||||
timer = new Timer(game.data.tickSpeed);
|
timer = new Timer(game.data.tickSpeed);
|
||||||
timer.addTickListener(gameTickListener);
|
timer.addTickListener(gameTickListener);
|
||||||
contrastFbo = new Fbo(new ContrastChanger());
|
contrastFbo = new Fbo(new ContrastChanger());
|
||||||
this.masterRenderer = masterRenderer;
|
gingerRegister.masterRenderer = masterRenderer;
|
||||||
picker = new MousePicker(game.data.camera, masterRenderer.getProjectionMatrix(), null);
|
picker = new MousePicker(game.data.camera, masterRenderer.getProjectionMatrix(), null);
|
||||||
PostProcessing.init();
|
PostProcessing.init();
|
||||||
ParticleMaster.init(masterRenderer.getProjectionMatrix());
|
ParticleMaster.init(masterRenderer.getProjectionMatrix());
|
||||||
|
|
|
@ -6,11 +6,14 @@ import com.github.hydos.ginger.engine.api.game.Game;
|
||||||
import com.github.hydos.ginger.engine.elements.buttons.TextureButton;
|
import com.github.hydos.ginger.engine.elements.buttons.TextureButton;
|
||||||
import com.github.hydos.ginger.engine.font.GUIText;
|
import com.github.hydos.ginger.engine.font.GUIText;
|
||||||
import com.github.hydos.ginger.engine.postprocessing.Fbo;
|
import com.github.hydos.ginger.engine.postprocessing.Fbo;
|
||||||
|
import com.github.hydos.ginger.engine.render.MasterRenderer;
|
||||||
|
import com.github.hydos.ginger.engine.screen.Screen;
|
||||||
|
|
||||||
/** Used if a game wants to access engine variables safely */
|
/** Used if a game wants to access engine variables safely */
|
||||||
public class GingerRegister
|
public class GingerRegister
|
||||||
{
|
{
|
||||||
private static GingerRegister INSTANCE;
|
private static GingerRegister INSTANCE;
|
||||||
|
public MasterRenderer masterRenderer;
|
||||||
public static GingerRegister getInstance()
|
public static GingerRegister getInstance()
|
||||||
{ return INSTANCE; }
|
{ return INSTANCE; }
|
||||||
public List<GUIText> texts;
|
public List<GUIText> texts;
|
||||||
|
@ -18,6 +21,7 @@ public class GingerRegister
|
||||||
public List<Fbo> fbos;
|
public List<Fbo> fbos;
|
||||||
|
|
||||||
public Game game;
|
public Game game;
|
||||||
|
public Screen currentScreen;
|
||||||
|
|
||||||
public GingerRegister()
|
public GingerRegister()
|
||||||
{ INSTANCE = this; }
|
{ INSTANCE = this; }
|
||||||
|
|
Loading…
Reference in New Issue