remove extra threading code

pull/12/head
SuperCoder7979 2020-03-01 12:06:08 -05:00
parent 1ae5e3e633
commit 3fa156c8bf
2 changed files with 6 additions and 16 deletions

View File

@ -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,16 +114,12 @@ public class Ginger
public void startGameLoop()
{
if (!threading.isAlive()) // Prevents this from accidentally being run twice
{
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
}
}
registry.game.exit();
}

View File

@ -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);
}