Create working GUI scaffolding

This commit is contained in:
2021-03-10 20:18:03 +01:00
parent 454c8278f3
commit 153e3d30fb
16 changed files with 239 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ package com.bartlomiejpluta.base.api.game.context;
import com.bartlomiejpluta.base.api.game.camera.Camera;
import com.bartlomiejpluta.base.api.game.entity.Entity;
import com.bartlomiejpluta.base.api.game.gui.GUI;
import com.bartlomiejpluta.base.api.game.image.Image;
import com.bartlomiejpluta.base.api.game.screen.Screen;
@@ -15,4 +16,6 @@ public interface Context {
Entity createEntity(String entitySetUid);
Image getImage(String imageUid);
GUI newGUI();
}

View File

@@ -0,0 +1,23 @@
package com.bartlomiejpluta.base.api.game.gui;
public interface Color {
float getRed();
float getGreen();
float getBlue();
float getAlpha();
void setRed(float value);
void setGreen(float value);
void setBlue(float value);
void setAlpha(float value);
void setColor(float red, float green, float blue);
void setColor(float red, float green, float blue, float alpha);
}

View File

@@ -1,7 +1,16 @@
package com.bartlomiejpluta.base.api.game.gui;
import com.bartlomiejpluta.base.api.internal.logic.Updatable;
import com.bartlomiejpluta.base.api.internal.gc.Disposable;
import com.bartlomiejpluta.base.api.internal.render.Renderable;
public interface GUI extends Updatable, Renderable {
public interface GUI extends Renderable, Disposable {
Widget getRoot();
void setRoot(Widget root);
void drawRectangle(float x, float y, float w, float h);
void fillColor(Color color);
Color createColor(float red, float green, float blue, float alpha);
}

View File

@@ -0,0 +1,9 @@
package com.bartlomiejpluta.base.api.game.gui;
import com.bartlomiejpluta.base.api.game.screen.Screen;
public interface Widget {
Widget getParent();
void draw(Screen screen, GUI gui);
}

View File

@@ -23,4 +23,6 @@ public interface Screen {
void update();
void clear(float r, float g, float b, float alpha);
void restoreState();
}