Skip to content

Commit

Permalink
Full isolate texel core!!
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielBRDeveloper committed Jul 18, 2024
1 parent 6c9badd commit e7be4a8
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 35 deletions.
3 changes: 1 addition & 2 deletions src/br/nullexcept/mux/app/Activity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package br.nullexcept.mux.app;

import br.nullexcept.mux.core.texel.TexelAPI;
import br.nullexcept.mux.res.AttributeList;
import br.nullexcept.mux.view.View;
import br.nullexcept.mux.view.Window;
Expand Down Expand Up @@ -84,7 +83,7 @@ public <T extends Activity> void startActivity(Launch<T> launch) {
Activity nw = launch.make();
nw._args = launch;
nw.stack = new ActivityStack(nw);
Application.boot(TexelAPI.createWindow(), nw);
Application.boot(Application.getProject().getCoreBootstrap().makeWindow(), nw);
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/br/nullexcept/mux/app/Application.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package br.nullexcept.mux.app;

import br.nullexcept.mux.core.texel.TexelAPI;
import br.nullexcept.mux.view.Window;

import java.io.File;
Expand All @@ -14,10 +13,12 @@ public class Application {
private static final ArrayList<ActivityStack> activities = new ArrayList<>();
private static Project current;

public static void initialize(Project project){
initialize(project, new TexelAPI());
public static Project getProject() {
return current;
}
public static void initialize(Project project, CoreBoostrap boostrap){

public static void initialize(Project project){
CoreBoostrap boostrap = project.getCoreBootstrap();;
Application.current = project;
Looper loop = new Looper();
Looper.mainLooper = loop;
Expand Down
3 changes: 1 addition & 2 deletions src/br/nullexcept/mux/app/Context.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package br.nullexcept.mux.app;

import br.nullexcept.mux.core.texel.TexelAPI;
import br.nullexcept.mux.lang.Parcel;
import br.nullexcept.mux.res.AssetsManager;
import br.nullexcept.mux.res.LayoutInflater;
Expand All @@ -18,7 +17,7 @@ public class Context {

public Context(){
mResource = new Resources(this);
applets.putAll(TexelAPI.obtainApplets());
applets.putAll(Application.getProject().getCoreBootstrap().getSystemApplets());
}

public File getFilesDir() {
Expand Down
3 changes: 3 additions & 0 deletions src/br/nullexcept/mux/app/CoreBoostrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import br.nullexcept.mux.view.Window;

import java.util.Map;

public interface CoreBoostrap {
void boot();
void finish();
Window makeWindow();
Map<? extends String,? extends Applet> getSystemApplets();
}
24 changes: 1 addition & 23 deletions src/br/nullexcept/mux/app/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,5 @@ public interface Project {
String getPackage();
Launch<Activity> getLaunch();

static <T extends Activity> Project build(Launch<T> init, String package_) {
return new SimpleProject(package_, init);
}
}

class SimpleProject <T extends Activity> implements Project {
private final String package_;
private final Launch<T> initial;

SimpleProject(String package_, Launch<T> initial) {
this.package_ = package_;
this.initial = initial;
}

@Override
public String getPackage() {
return package_;
}

@Override
public Launch<Activity> getLaunch() {
return (Launch<Activity>) initial;
}
CoreBoostrap getCoreBootstrap();
}
7 changes: 6 additions & 1 deletion src/br/nullexcept/mux/core/texel/TexelAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.glfw.GLFW.glfwSwapInterval;

public class TexelAPI implements CoreBoostrap {
class TexelAPI implements CoreBoostrap {
static final HashMap<String, Applet> applets = new HashMap<>();
private static final HashMap<PointerIcon.Model, Long> pointers = new HashMap<>();

Expand Down Expand Up @@ -96,4 +96,9 @@ public void finish() {
public Window makeWindow() {
return createWindow();
}

@Override
public Map<? extends String, ? extends Applet> getSystemApplets() {
return TexelAPI.obtainApplets();
}
}
2 changes: 1 addition & 1 deletion src/br/nullexcept/mux/core/texel/TexelFontFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import java.io.InputStream;

public class TexelFontFactory extends TypefaceFactory {
class TexelFontFactory extends TypefaceFactory {

public TexelFontFactory() {
Typeface.DEFAULT = decodeTypeface(TexelFontFactory.class.getResourceAsStream("/res/fonts/Roboto/Roboto-Regular.ttf"));
Expand Down
2 changes: 1 addition & 1 deletion src/br/nullexcept/mux/core/texel/TexelFontMetrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import br.nullexcept.mux.graphics.Paint;
import br.nullexcept.mux.graphics.fonts.FontMetrics;

public class TexelFontMetrics extends FontMetrics {
class TexelFontMetrics extends FontMetrics {
private final Paint paint;

protected TexelFontMetrics(Paint paint){
Expand Down
31 changes: 31 additions & 0 deletions src/br/nullexcept/mux/core/texel/TexelProject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package br.nullexcept.mux.core.texel;

import br.nullexcept.mux.app.Activity;
import br.nullexcept.mux.app.CoreBoostrap;
import br.nullexcept.mux.app.Launch;
import br.nullexcept.mux.app.Project;

public class TexelProject implements Project {
private final String package_;
private final Launch<Activity> initial;

public <T extends Activity> TexelProject(String package_, Launch<T> initial) {
this.package_ = package_;
this.initial = (Launch<Activity>) initial;
}

@Override
public String getPackage() {
return package_;
}

@Override
public Launch<Activity> getLaunch() {
return initial;
}

@Override
public CoreBoostrap getCoreBootstrap() {
return new TexelAPI();
}
}
3 changes: 2 additions & 1 deletion src/br/nullexcept/mux/test/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import br.nullexcept.mux.app.Application;
import br.nullexcept.mux.app.Launch;
import br.nullexcept.mux.app.Project;
import br.nullexcept.mux.core.texel.TexelProject;
import br.nullexcept.mux.lang.Promise;
import br.nullexcept.mux.utils.Log;
import br.nullexcept.mux.view.View;

public class Example extends Activity {
private static int layer = 0;
public static void main(String[] args) {
Application.initialize(Project.build(new Launch<>(Example.class), "br.nullexcept.test-master-ui"));
Application.initialize(new TexelProject("br.nullexcept.test-master-ui",new Launch<>(Example.class)));
}
private View animate;
int x = 0;
Expand Down

0 comments on commit e7be4a8

Please sign in to comment.