the base implementation of threads

pull/12/head
hYdos 2020-02-27 19:52:45 +10:00
parent b6c411caaf
commit cefe804e13
3 changed files with 32 additions and 1 deletions

View File

@ -8,6 +8,7 @@ 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
@ -16,6 +17,7 @@ public class GingerRegister
public MasterRenderer masterRenderer;
public static GingerRegister getInstance()
{ return INSTANCE; }
public GingerThreading threadRegister;
public List<GUIText> texts;
public List<TextureButton> guiButtons;
public List<Fbo> fbos;
@ -25,7 +27,10 @@ public class GingerRegister
public boolean wireframe = false;
public GingerRegister()
{ INSTANCE = this; }
{
INSTANCE = this;
threadRegister = new GingerThreading();
}
public void registerButton(TextureButton button)
{

View File

@ -0,0 +1,9 @@
package com.github.hydos.multiThreading;
public abstract class GingerThread extends Thread{
public boolean isRunning;
public String threadName;
}

View File

@ -0,0 +1,17 @@
package com.github.hydos.multiThreading;
import java.util.*;
public class GingerThreading {
public List<GingerThread> threads;
public GingerThreading() {
threads = new ArrayList<GingerThread>();
}
public void registerThread(GingerThread thread) {
threads.add(thread);
}
}