remove extra threading code
parent
1ae5e3e633
commit
3fa156c8bf
|
@ -16,7 +16,6 @@ import com.github.hydos.ginger.engine.render.MasterRenderer;
|
|||
import com.github.hydos.ginger.engine.render.tools.MousePicker;
|
||||
import com.github.hydos.ginger.engine.screen.Screen;
|
||||
import com.github.hydos.ginger.engine.utils.Loader;
|
||||
import com.github.hydos.multithreading.GingerThreading;
|
||||
|
||||
public class Ginger
|
||||
{
|
||||
|
@ -25,7 +24,6 @@ public class Ginger
|
|||
public MousePicker picker;
|
||||
public FontType globalFont;
|
||||
public Fbo contrastFbo;
|
||||
public GingerThreading threading;
|
||||
|
||||
private Timer timer;
|
||||
TickListener gameTickListener = new TickListener()
|
||||
|
@ -104,7 +102,6 @@ public class Ginger
|
|||
{
|
||||
INSTANCE = this;
|
||||
registry = new GingerRegister();
|
||||
threading = new GingerThreading();
|
||||
registry.registerGame(game);
|
||||
timer = new Timer(game.data.tickSpeed);
|
||||
timer.addTickListener(gameTickListener);
|
||||
|
@ -117,15 +114,11 @@ public class Ginger
|
|||
|
||||
public void startGameLoop()
|
||||
{
|
||||
if (!threading.isAlive()) // Prevents this from accidentally being run twice
|
||||
while (!Window.closed())
|
||||
{
|
||||
threading.start();
|
||||
while (!Window.closed())
|
||||
{
|
||||
update(Litecraft.getInstance().data); // Run this regardless, (so as fast as possible)
|
||||
if (timer.tick()) Litecraft.getInstance().tps += 1; // Run this only [ticklimit] times per second (This invokes gameTickListener.onTick!)
|
||||
if (Window.shouldRender()) registry.game.render(); // Run this only [framelimit] times per second
|
||||
}
|
||||
update(Litecraft.getInstance().data); // Run this regardless, (so as fast as possible)
|
||||
if (timer.tick()) Litecraft.getInstance().tps += 1; // Run this only [ticklimit] times per second (This invokes gameTickListener.onTick!)
|
||||
if (Window.shouldRender()) registry.game.render(); // Run this only [framelimit] times per second
|
||||
}
|
||||
registry.game.exit();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.github.hydos.ginger.engine.font.GUIText;
|
|||
import com.github.hydos.ginger.engine.postprocessing.Fbo;
|
||||
import com.github.hydos.ginger.engine.render.MasterRenderer;
|
||||
import com.github.hydos.ginger.engine.screen.Screen;
|
||||
import com.github.hydos.multithreading.GingerThreading;
|
||||
|
||||
/** Used if a game wants to access engine variables safely */
|
||||
public class GingerRegister
|
||||
|
@ -19,7 +18,6 @@ public class GingerRegister
|
|||
public static GingerRegister getInstance()
|
||||
{ return INSTANCE; }
|
||||
|
||||
public GingerThreading threadRegister;
|
||||
public List<GUIText> texts;
|
||||
public List<TextureButton> guiButtons;
|
||||
public List<Fbo> fbos;
|
||||
|
@ -30,12 +28,11 @@ public class GingerRegister
|
|||
public GingerRegister()
|
||||
{
|
||||
INSTANCE = this;
|
||||
threadRegister = new GingerThreading();
|
||||
}
|
||||
|
||||
public void registerButton(TextureButton button)
|
||||
{
|
||||
if (guiButtons == null) guiButtons = new ArrayList<TextureButton>();
|
||||
if (guiButtons == null) guiButtons = new ArrayList<>();
|
||||
guiButtons.add(button);
|
||||
}
|
||||
|
||||
|
@ -44,7 +41,7 @@ public class GingerRegister
|
|||
|
||||
public void registerText(GUIText guiText)
|
||||
{
|
||||
if (texts == null) texts = new ArrayList<GUIText>();
|
||||
if (texts == null) texts = new ArrayList<>();
|
||||
texts.add(guiText);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue