Add icons for weapons

This commit is contained in:
2022-08-24 23:14:21 +02:00
parent 60acb5749d
commit b157d7bf26
12 changed files with 422 additions and 435 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

View File

@@ -18,11 +18,11 @@ $2261c04f-b02e-4486-b388-8a0fa41622e9(2261c04f-b02e-4486-b388-8a0fa41622e9.ttf
$ab9d40b4-eb28-45d7-bff2-9432a05eb41a(ab9d40b4-eb28-45d7-bff2-9432a05eb41a.xml
Start MenuB[
$56ca6b39-f949-4212-9c23-312db25887e0(56ca6b39-f949-4212-9c23-312db25887e0.xml Game MenuBU
$00bd0625-b3b8-4abf-97b7-91f42bce28ec(00bd0625-b3b8-4abf-97b7-91f42bce28ec.xmlHUDJ[
$61e67e44-a0cd-4210-8d1e-ccddcd62c78d(61e67e44-a0cd-4210-8d1e-ccddcd62c78d.pngSlash (JZ
$00bd0625-b3b8-4abf-97b7-91f42bce28ec(00bd0625-b3b8-4abf-97b7-91f42bce28ec.xmlHUDJZ
$e6f067f1-eba0-4e62-99c3-2fd867e6f142(e6f067f1-eba0-4e62-99c3-2fd867e6f142.pngPoof (J[
$312cc4e6-8c44-43e7-828a-e7e2a77836f3(312cc4e6-8c44-43e7-828a-e7e2a77836f3.pngArrow (J[
$54f657bd-8108-464c-9bbe-63944fc14f6b(54f657bd-8108-464c-9bbe-63944fc14f6b.pngPunch (R]
$54f657bd-8108-464c-9bbe-63944fc14f6b(54f657bd-8108-464c-9bbe-63944fc14f6b.pngPunch (J[
$0ddac391-4086-4e9c-8310-59db649419ff(0ddac391-4086-4e9c-8310-59db649419ff.pngSlash (R]
$1311327d-4b74-4252-94da-23ee4129e357(1311327d-4b74-4252-94da-23ee4129e357.ogg Sword slashR\
$e452e215-f581-40fe-a5cf-f555d3db83b8(e452e215-f581-40fe-a5cf-f555d3db83b8.ogg
Deku deathRW

View File

@@ -1,100 +1,98 @@
package com.bartlomiejpluta.demo.gui;
import lombok.extern.slf4j.Slf4j;
import com.bartlomiejpluta.base.api.gui.*;
import com.bartlomiejpluta.base.lib.gui.*;
import com.bartlomiejpluta.base.api.screen.*;
import com.bartlomiejpluta.base.api.context.Context;
import com.bartlomiejpluta.base.api.gui.*;
import com.bartlomiejpluta.base.api.input.*;
import com.bartlomiejpluta.base.api.screen.*;
import com.bartlomiejpluta.base.lib.gui.*;
import com.bartlomiejpluta.demo.entity.Player;
import com.bartlomiejpluta.demo.event.EnemyDiedEvent;
import com.bartlomiejpluta.demo.event.HitEvent;
import com.bartlomiejpluta.demo.runner.DemoRunner;
import com.bartlomiejpluta.demo.entity.*;
import com.bartlomiejpluta.demo.event.*;
import com.bartlomiejpluta.demo.util.LimitedQueue;
import com.bartlomiejpluta.demo.world.weapon.Weapon;
import lombok.extern.slf4j.Slf4j;
import java.util.stream.Collectors;
@Slf4j
public class HUD extends BorderLayout {
private static final int MAX_LOG_SIZE = 10;
private static final float LOG_VISIBILITY_DURATION = 8000f;
private static final float LOG_VISIBILITY_FADING_OUT = 1000f;
private final DemoRunner runner;
private final Player player;
private final Runtime runtime;
private LimitedQueue<String> logger = new LimitedQueue<>(MAX_LOG_SIZE);
private static final int MAX_LOG_SIZE = 10;
private static final float LOG_VISIBILITY_DURATION = 8000f;
private static final float LOG_VISIBILITY_FADING_OUT = 1000f;
private final DemoRunner runner;
private final Player player;
private final Runtime runtime;
private LimitedQueue<String> logger = new LimitedQueue<>(MAX_LOG_SIZE);
private float logVisibilityDuration = 0f;
private float logVisibilityDuration = 0f;
@Ref("hp")
private Bar hp;
private Weapon currentWeapon;
@Ref("debug")
private Label debugLbl;
@Ref("hp")
private Bar hp;
@Ref("log")
private Label logLbl;
@Ref("debug")
private Label debugLbl;
public HUD(Context context, GUI gui) {
super(context, gui);
this.runner = (DemoRunner) context.getGameRunner();
this.player = runner.getPlayer();
this.runtime = Runtime.getRuntime();
context.addEventListener(HitEvent.TYPE, this::logHitEvent);
context.addEventListener(EnemyDiedEvent.TYPE, this::logEnemyDiedEvent);
}
@Ref("log")
private Label logLbl;
private void logHitEvent(HitEvent event) {
log(String.format("%s hits %s with damage = %d", event.getAttacker().getName(), event.getTarget().getName(), event.getDamage()));
}
@Ref("weapon")
private IconView weapon;
private void log(String message) {
logger.add(message);
log.info(message);
logLbl.setText(logger.stream().collect(Collectors.joining("\n")));
logVisibilityDuration = LOG_VISIBILITY_DURATION;
}
public HUD(Context context, GUI gui) {
super(context, gui);
this.runner = (DemoRunner) context.getGameRunner();
this.player = runner.getPlayer();
this.runtime = Runtime.getRuntime();
context.addEventListener(HitEvent.TYPE, this::logHitEvent);
context.addEventListener(EnemyDiedEvent.TYPE, this::logEnemyDiedEvent);
}
private void logEnemyDiedEvent(EnemyDiedEvent event) {
log(String.format("%s has died with HP = %d", event.getEnemy().getName(), event.getEnemy().getHp()));
}
private void logHitEvent(HitEvent event) {
log(String.format("%s hits %s with damage = %d", event.getAttacker().getName(), event.getTarget().getName(), event.getDamage()));
}
@Override
public void update(float dt) {
super.update(dt);
private void log(String message) {
logger.add(message);
log.info(message);
logLbl.setText(logger.stream().collect(Collectors.joining("\n")));
logVisibilityDuration = LOG_VISIBILITY_DURATION;
}
hp.setValue((float) player.getHp() / (float) player.getMaxHp());
private void logEnemyDiedEvent(EnemyDiedEvent event) {
log(String.format("%s has died with HP = %d", event.getEnemy().getName(), event.getEnemy().getHp()));
}
if(logVisibilityDuration > 0) {
logVisibilityDuration -= dt * 1000;
} else {
logVisibilityDuration = 0;
}
}
@Override
public void update(float dt) {
super.update(dt);
@Override
public void draw(Screen screen, GUI gui) {
var coords = player.getCoordinates();
var pos = player.getPosition();
debugLbl.setText(String.format(
"FPS: %.2f\n" +
"Mem: %.2f / %.2f [MB]\n" +
"Coords: %d : %d\n" +
"Pos: %.2f : %.2f\n" +
"Entities: %d",
runner.instantFPS(),
runtime.totalMemory() / 1024f / 1024f,
runtime.maxMemory() / 1024f / 1024f,
coords.x(), coords.y(),
pos.x(), pos.y(),
player.getLayer().getEntities().size() - 1
));
hp.setValue((float) player.getHp() / (float) player.getMaxHp());
logLbl.setAlpha(Math.min(1f, logVisibilityDuration / LOG_VISIBILITY_FADING_OUT));
if (logVisibilityDuration > 0) {
logVisibilityDuration -= dt * 1000;
} else {
logVisibilityDuration = 0;
}
super.draw(screen, gui);
}
if (player.getWeapon() != null && player.getWeapon() != currentWeapon) {
weapon.setIcon(player.getWeapon().getIcon());
this.currentWeapon = player.getWeapon();
} else if (player.getWeapon() == null) {
this.currentWeapon = null;
}
}
@Override
public void draw(Screen screen, GUI gui) {
var coords = player.getCoordinates();
var pos = player.getPosition();
debugLbl.setText(String.format("FPS: %.2f\n" + "Mem: %.2f / %.2f [MB]\n" + "Coords: %d : %d\n" + "Pos: %.2f : %.2f\n" + "Entities: %d", runner.instantFPS(), runtime.totalMemory() / 1024f / 1024f, runtime.maxMemory() / 1024f / 1024f, coords.x(), coords.y(), pos.x(), pos.y(), player.getLayer().getEntities().size() - 1));
logLbl.setAlpha(Math.min(1f, logVisibilityDuration / LOG_VISIBILITY_FADING_OUT));
super.draw(screen, gui);
}
}

View File

@@ -1,122 +1,115 @@
package com.bartlomiejpluta.demo.runner;
import com.bartlomiejpluta.base.api.context.Context;
import com.bartlomiejpluta.base.api.gui.GUI;
import com.bartlomiejpluta.base.api.runner.GameRunner;
import com.bartlomiejpluta.base.api.screen.Screen;
import com.bartlomiejpluta.base.util.profiler.FPSProfiler;
import com.bartlomiejpluta.demo.entity.Player;
import com.bartlomiejpluta.demo.menu.MenuManager;
import com.bartlomiejpluta.demo.world.weapon.RangedWeapon;
import lombok.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bartlomiejpluta.base.api.context.Context;
import com.bartlomiejpluta.base.api.input.Input;
import com.bartlomiejpluta.base.api.screen.Screen;
import com.bartlomiejpluta.base.api.runner.GameRunner;
import com.bartlomiejpluta.base.api.gui.GUI;
import com.bartlomiejpluta.base.util.profiler.FPSProfiler;
import com.bartlomiejpluta.demo.map.ForrestTempleHandler;
import com.bartlomiejpluta.demo.entity.Player;
import com.bartlomiejpluta.demo.menu.MenuManager;
import com.bartlomiejpluta.demo.world.weapon.*;
public class DemoRunner implements GameRunner {
private static final Logger log = LoggerFactory.getLogger(DemoRunner.class);
private Screen screen;
private Context context;
private MenuManager menu;
private GUI hud;
private static final Logger log = LoggerFactory.getLogger(DemoRunner.class);
private Screen screen;
private Context context;
private MenuManager menu;
private GUI hud;
@Getter
private Player player;
@Getter
private Player player;
private final FPSProfiler fpsProfiler = FPSProfiler.create(20);
private final FPSProfiler fpsProfiler = FPSProfiler.create(20);
@Override
public void init(Context context) {
this.context = context;
this.screen = context.getScreen();
@Override
public void init(Context context) {
this.context = context;
this.screen = context.getScreen();
configureScreen();
configureCamera();
initPlayer();
initHUD();
initMenu();
configureScreen();
configureCamera();
initPlayer();
initHUD();
initMenu();
menu.showStartMenu();
menu.showStartMenu();
screen.show();
}
screen.show();
}
private void configureScreen() {
var resolution = screen.getCurrentResolution();
screen.setSize(1800, 1000);
screen.setPosition((resolution.x() - 1800)/2, (resolution.y() - 1000)/2);
}
private void configureScreen() {
var resolution = screen.getCurrentResolution();
screen.setSize(1800, 1000);
screen.setPosition((resolution.x() - 1800) / 2, (resolution.y() - 1000) / 2);
}
private void configureCamera() {
context.getCamera().setScale(2f);
}
private void configureCamera() {
context.getCamera().setScale(2f);
}
private void initMenu() {
this.menu = new MenuManager(this, context);
}
private void initMenu() {
this.menu = new MenuManager(this, context);
}
private void initHUD() {
hud = context.newGUI();
hud.hide();
var hudComponent = hud.inflateComponent(A.widgets.hud.uid);
hud.setRoot(hudComponent);
}
private void initHUD() {
hud = context.newGUI();
hud.hide();
var hudComponent = hud.inflateComponent(A.widgets.hud.uid);
hud.setRoot(hudComponent);
}
private void initPlayer() {
this.player = new Player(context.createCharacter(A.charsets.luna.uid));
}
private void initPlayer() {
this.player = new Player(context.createCharacter(A.charsets.luna.uid));
}
private void resetPlayer() {
this.player.changeCharacterSet(A.charsets.luna.uid);
this.player.setScale(1f);
this.player.setSpeed(4f);
this.player.setAnimationSpeed(2f);
this.player.setBlocking(true);
this.player.setWeapon(new RangedWeapon("wooden_bow"));
}
private void resetPlayer() {
this.player.changeCharacterSet(A.charsets.luna.uid);
this.player.setScale(1f);
this.player.setSpeed(4f);
this.player.setAnimationSpeed(1f);
this.player.setBlocking(true);
this.player.setWeapon(new RangedWeapon("wooden_bow"));
}
public void newGame() {
menu.closeAll();
menu.enableGameMenu();
resetPlayer();
context.openMap(A.maps.forrest.uid);
context.getMap().getObjectLayer(A.maps.forrest.layers.main).addEntity(this.player);
player.setCoordinates(5, 36);
context.resume();
hud.show();
}
public void newGame() {
menu.closeAll();
menu.enableGameMenu();
resetPlayer();
context.openMap(A.maps.forrest.uid);
context.getMap().getObjectLayer(A.maps.forrest.layers.main).addEntity(this.player);
player.setCoordinates(5, 36);
context.resume();
hud.show();
}
public void returnToStartMenu() {
menu.closeAll();
hud.hide();
context.pause();
context.closeMap();
menu.disableGameMenu();
menu.showStartMenu();
}
public void returnToStartMenu() {
menu.closeAll();
hud.hide();
context.pause();
context.closeMap();
menu.disableGameMenu();
menu.showStartMenu();
}
public void exit() {
context.close();
}
public void exit() {
context.close();
}
public double instantFPS() {
return fpsProfiler.getInstantFPS();
}
public double instantFPS() {
return fpsProfiler.getInstantFPS();
}
@Override
public void update(float dt) {
fpsProfiler.update(dt);
}
@Override
public void update(float dt) {
fpsProfiler.update(dt);
}
@Override
public void dispose() {
// Do something after game loop is end
}
@Override
public void dispose() {
// Do something after game loop is end
}
}

View File

@@ -1,65 +1,62 @@
package com.bartlomiejpluta.demo.world.weapon;
import com.bartlomiejpluta.base.api.context.*;
import com.bartlomiejpluta.base.api.icon.Icon;
import com.bartlomiejpluta.base.lib.animation.*;
import com.bartlomiejpluta.base.util.random.DiceRoller;
import com.bartlomiejpluta.demo.entity.Creature;
import com.bartlomiejpluta.demo.event.HitEvent;
import lombok.*;
import org.joml.Vector2i;
import java.util.Random;
import lombok.*;
import org.joml.Vector2i;
import com.bartlomiejpluta.base.api.context.*;
import com.bartlomiejpluta.base.lib.animation.*;
import com.bartlomiejpluta.base.util.random.DiceRoller;
import com.bartlomiejpluta.demo.entity.Creature;
import com.bartlomiejpluta.demo.event.HitEvent;
public class MeleeWeapon implements Weapon {
private final Random random = new Random();
private final Context context;
private final DiceRoller roller;
private final AnimationRunner animation;
private final String sound;
private final Random random = new Random();
private final Context context;
private final DiceRoller roller;
private final AnimationRunner animation;
private final String sound;
@Getter
private String name;
@Getter
private String name;
@Getter
private int cooldown;
@Getter
private final Icon icon;
public MeleeWeapon(@NonNull String id) {
this(DB.dao.melee_weapon.find(id));
}
@Getter
private int cooldown;
public MeleeWeapon(@NonNull DB.model.MeleeWeaponModel template) {
this.context = ContextHolder.INSTANCE.getContext();
this.name = template.getName();
this.roller = DiceRoller.of(template.getDamage());
this.cooldown = template.getCooldown();
this.animation = new RandomAnimationsRunner(2)
.nRange(0, 2f)
.nScale(0.2f, 0.15f)
.uAnimationSpeed(0.5f, 1f)
.nRotation(0, 10)
.offset(0, -10)
.uDelay(250, 500)
.with(A.animations.get(template.getAnimation()).uid);
this.sound = A.sounds.get(template.getSound()).uid;
}
public MeleeWeapon(@NonNull String id) {
this(DB.dao.melee_weapon.find(id));
}
@Override
public boolean attack(Creature attacker) {
var facingNeighbour = attacker.getCoordinates().add(attacker.getFaceDirection().vector, new Vector2i());
for(var entity : attacker.getLayer().getEntities()) {
if(entity.getCoordinates().equals(facingNeighbour) && entity.isBlocking() && entity instanceof Creature) {
var character = (Creature) entity;
var damage = roller.roll();
character.hit(attacker, damage);
animation.run(context, character.getLayer(), character);
context.playSound(sound);
context.fireEvent(new HitEvent(attacker, character, damage));
return true;
}
}
public MeleeWeapon(@NonNull DB.model.MeleeWeaponModel template) {
this.context = ContextHolder.INSTANCE.getContext();
this.name = template.getName();
this.roller = DiceRoller.of(template.getDamage());
this.cooldown = template.getCooldown();
this.animation = new RandomAnimationsRunner(2).nRange(0, 2f).nScale(0.2f, 0.15f).uAnimationSpeed(0.5f, 1f).nRotation(0, 10).offset(0, -10).uDelay(250, 500).with(A.animations.get(template.getAnimation()).uid);
this.sound = A.sounds.get(template.getSound()).uid;
var icons = template.getIcon().split(",");
this.icon = context.createIcon(A.iconsets.get(icons[0]).uid, Integer.valueOf(icons[1]), Integer.valueOf(icons[2]));
}
return false;
}
@Override
public boolean attack(Creature attacker) {
var facingNeighbour = attacker.getCoordinates().add(attacker.getFaceDirection().vector, new Vector2i());
for (var entity : attacker.getLayer().getEntities()) {
if (entity.getCoordinates().equals(facingNeighbour) && entity.isBlocking() && entity instanceof Creature) {
var character = (Creature) entity;
var damage = roller.roll();
character.hit(attacker, damage);
animation.run(context, character.getLayer(), character);
context.playSound(sound);
context.fireEvent(new HitEvent(attacker, character, damage));
return true;
}
}
return false;
}
}

View File

@@ -1,89 +1,81 @@
package com.bartlomiejpluta.demo.world.weapon;
import java.util.Random;
import lombok.*;
import com.bartlomiejpluta.base.api.animation.Animation;
import com.bartlomiejpluta.base.api.context.*;
import com.bartlomiejpluta.base.api.entity.Entity;
import com.bartlomiejpluta.base.api.animation.Animation;
import com.bartlomiejpluta.base.api.icon.Icon;
import com.bartlomiejpluta.base.api.move.*;
import com.bartlomiejpluta.base.lib.animation.*;
import com.bartlomiejpluta.base.util.random.DiceRoller;
import com.bartlomiejpluta.demo.entity.Creature;
import com.bartlomiejpluta.demo.event.HitEvent;
import lombok.*;
import java.util.Random;
public class RangedWeapon implements Weapon {
private final Random random = new Random();
private final Context context;
private final DiceRoller dmgRoller;
private final DiceRoller rangeRoller;
private final BulletAnimationRunner animation;
private final String sound;
private final AnimationRunner punchAnimation;
private final String punchSound;
private final AnimationRunner missAnimation;
private final String missSound;
private final Random random = new Random();
private final Context context;
private final DiceRoller dmgRoller;
private final DiceRoller rangeRoller;
private final BulletAnimationRunner animation;
private final String sound;
private final AnimationRunner punchAnimation;
private final String punchSound;
private final AnimationRunner missAnimation;
private final String missSound;
@Getter
private String name;
@Getter
private String name;
@Getter
private int cooldown;
@Getter
private final Icon icon;
public RangedWeapon(@NonNull String id) {
this(DB.dao.ranged_weapon.find(id));
}
@Getter
private int cooldown;
public RangedWeapon(@NonNull DB.model.RangedWeaponModel template) {
this.context = ContextHolder.INSTANCE.getContext();
this.name = template.getName();
this.dmgRoller = DiceRoller.of(template.getDamage());
this.rangeRoller = DiceRoller.of(template.getRange());
this.cooldown = template.getCooldown();
this.animation = new BulletAnimationRunner(A.animations.get(template.getAnimation()).uid)
.infinite()
.offset(0, -15)
.onHit(this::onHit)
.onMiss(this::onMiss)
.speed(7f)
.animationSpeed(4f)
.scale(0.6f);
this.sound = A.sounds.get(template.getSound()).uid;
this.punchAnimation = new SimpleAnimationRunner(A.animations.get(template.getPunchAnimation()).uid);
this.punchSound = A.sounds.get(template.getPunchSound()).uid;
this.missAnimation = new SimpleAnimationRunner(A.animations.get(template.getMissAnimation()).uid)
.scale(0.4f);
this.missSound = A.sounds.get(template.getMissSound()).uid;
}
public RangedWeapon(@NonNull String id) {
this(DB.dao.ranged_weapon.find(id));
}
private void onHit(Movable attacker, Entity target) {
if(target.isBlocking() && target instanceof Creature) {
var namedAttacker = (Creature) attacker;
var character = (Creature) target;
var damage = dmgRoller.roll();
character.hit(namedAttacker, damage);
punchAnimation.run(context, character.getLayer(), character);
context.playSound(punchSound);
context.fireEvent(new HitEvent(namedAttacker, character, damage));
}
}
public RangedWeapon(@NonNull DB.model.RangedWeaponModel template) {
this.context = ContextHolder.INSTANCE.getContext();
this.name = template.getName();
this.dmgRoller = DiceRoller.of(template.getDamage());
this.rangeRoller = DiceRoller.of(template.getRange());
this.cooldown = template.getCooldown();
this.animation = new BulletAnimationRunner(A.animations.get(template.getAnimation()).uid).infinite().offset(0, -15).onHit(this::onHit).onMiss(this::onMiss).speed(7f).animationSpeed(4f).scale(0.6f);
this.sound = A.sounds.get(template.getSound()).uid;
this.punchAnimation = new SimpleAnimationRunner(A.animations.get(template.getPunchAnimation()).uid);
this.punchSound = A.sounds.get(template.getPunchSound()).uid;
this.missAnimation = new SimpleAnimationRunner(A.animations.get(template.getMissAnimation()).uid).scale(0.4f);
this.missSound = A.sounds.get(template.getMissSound()).uid;
var icons = template.getIcon().split(",");
this.icon = context.createIcon(A.iconsets.get(icons[0]).uid, Integer.valueOf(icons[1]), Integer.valueOf(icons[2]));
}
private void onMiss(Movable attacker, Animation animation) {
missAnimation.run(context, ((Creature) attacker).getLayer(), animation.getPosition());
context.playSound(missSound);
}
private void onHit(Movable attacker, Entity target) {
if (target.isBlocking() && target instanceof Creature) {
var namedAttacker = (Creature) attacker;
var character = (Creature) target;
var damage = dmgRoller.roll();
character.hit(namedAttacker, damage);
punchAnimation.run(context, character.getLayer(), character);
context.playSound(punchSound);
context.fireEvent(new HitEvent(namedAttacker, character, damage));
}
}
@Override
public boolean attack(Creature attacker) {
var direction = attacker.getFaceDirection();
context.playSound(sound);
animation
.range(rangeRoller.roll())
.direction(direction)
.rotation(direction.xAngle - 180)
.run(context, attacker.getLayer(), attacker);
return true;
}
private void onMiss(Movable attacker, Animation animation) {
missAnimation.run(context, ((Creature) attacker).getLayer(), animation.getPosition());
context.playSound(missSound);
}
@Override
public boolean attack(Creature attacker) {
var direction = attacker.getFaceDirection();
context.playSound(sound);
animation.range(rangeRoller.roll()).direction(direction).rotation(direction.xAngle - 180).run(context, attacker.getLayer(), attacker);
return true;
}
}

View File

@@ -1,9 +1,14 @@
package com.bartlomiejpluta.demo.world.weapon;
import com.bartlomiejpluta.base.api.icon.Icon;
import com.bartlomiejpluta.demo.entity.Creature;
public interface Weapon {
String getName();
int getCooldown();
boolean attack(Creature attacker);
String getName();
Icon getIcon();
int getCooldown();
boolean attack(Creature attacker);
}

View File

@@ -1,55 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<demo:HUD
xmlns:base="com.bartlomiejpluta.base.lib.gui"
xmlns:demo="com.bartlomiejpluta.demo.gui"
widthMode="SizeMode.RELATIVE"
heightMode="SizeMode.RELATIVE"
width="1f"
height="1f">
xmlns:base="com.bartlomiejpluta.base.lib.gui"
xmlns:demo="com.bartlomiejpluta.demo.gui"
widthMode="SizeMode.RELATIVE"
heightMode="SizeMode.RELATIVE"
width="1f"
height="1f">
<base:BorderLayout-TopLeft>
<base:BorderLayout-TopLeft>
<demo:Bar
ref="hp"
strokeColor="0x111111"
fillColor="0xFF0000"
widthMode="SizeMode.ABSOLUTE"
heightMode="SizeMode.ABSOLUTE"
width="250f"
height="20f"/>
</base:BorderLayout-TopLeft>
<demo:Bar
ref="hp"
strokeColor="0x111111"
fillColor="0xFF0000"
widthMode="SizeMode.ABSOLUTE"
heightMode="SizeMode.ABSOLUTE"
width="250f"
height="20f"
margin="5f" />
<base:BorderLayout-TopRight>
<base:IconView ref="weapon" scale="2f"/>
</base:BorderLayout-TopRight>
</base:BorderLayout-TopLeft>
<base:BorderLayout-BottomLeft>
<base:Label
ref="log"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.ABSOLUTE"
width="400f"
height="25f"
alignment="GUI.ALIGN_BOTTOM | GUI.ALIGN_LEFT"
color="0xFFFFFF"
fontSize="15f"/>
</base:BorderLayout-BottomLeft>
<base:BorderLayout-BottomLeft>
<base:Label
ref="log"
font="&quot;2261c04f-b02e-4486-b388-8a0fa41622e9&quot;"
widthMode="SizeMode.ABSOLUTE"
width="400f"
height="25f"
margin="10f"
alignment="GUI.ALIGN_BOTTOM | GUI.ALIGN_LEFT"
color="0xFFFFFF"
fontSize="15f"/>
</base:BorderLayout-BottomLeft>
<base:BorderLayout-BottomRight>
<base:Label
ref="debug"
font="&quot;2261c04f-b02e-4486-b388-8a0fa41622e9&quot;"
widthMode="SizeMode.ABSOLUTE"
width="200f"
height="25f"
margin="10f"
alignment="GUI.ALIGN_BOTTOM | GUI.ALIGN_RIGHT"
color="0xFFFFFF"
fontSize="15f"/>
</base:BorderLayout-BottomRight>
<base:BorderLayout-BottomRight>
<base:Label
ref="debug"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.ABSOLUTE"
width="200f"
height="25f"
alignment="GUI.ALIGN_BOTTOM | GUI.ALIGN_RIGHT"
color="0xFFFFFF"
fontSize="15f"/>
</base:BorderLayout-BottomRight>
</demo:HUD>

View File

@@ -1,63 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<demo:GameMenuWindow
xmlns:base="com.bartlomiejpluta.base.lib.gui"
xmlns:demo="com.bartlomiejpluta.demo.gui"
windowPosition="WindowPosition.CENTER"
margin="10f"
padding="20f">
xmlns:base="com.bartlomiejpluta.base.lib.gui"
xmlns:demo="com.bartlomiejpluta.demo.gui"
windowPosition="WindowPosition.CENTER"
margin="10f"
padding="20f">
<base:VLayout
width="200f"
widthMode="SizeMode.ABSOLUTE">
<base:VLayout
width="200f"
widthMode="SizeMode.ABSOLUTE">
<base:Label
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
alignment="GUI.ALIGN_TOP | GUI.ALIGN_CENTER"
red="1f"
green="1f"
blue="1f"
alpha="0.5f"
fontSize="30f">Game Menu</base:Label>
<base:Label
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
alignment="GUI.ALIGN_TOP | GUI.ALIGN_CENTER"
red="1f"
green="1f"
blue="1f"
alpha="0.5f"
fontSize="30f">Game Menu
</base:Label>
<base:VOptionChoice
widthMode="SizeMode.RELATIVE"
width="1f">
<base:VOptionChoice
widthMode="SizeMode.RELATIVE"
width="1f">
<demo:Button
ref="resume_game"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">Resume game</demo:Button>
<demo:Button
ref="resume_game"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">Resume game
</demo:Button>
<demo:Button
ref="start_menu"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">Back to start menu</demo:Button>
<demo:Button
ref="start_menu"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">Back to start menu
</demo:Button>
<demo:Button
ref="exit"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">Exit</demo:Button>
<demo:Button
ref="exit"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">Exit
</demo:Button>
</base:VOptionChoice>
</base:VOptionChoice>
</base:VLayout>
</base:VLayout>
</demo:GameMenuWindow>

View File

@@ -1,53 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<demo:StartMenuWindow
xmlns:base="com.bartlomiejpluta.base.lib.gui"
xmlns:demo="com.bartlomiejpluta.demo.gui"
windowPosition="WindowPosition.BOTTOM"
margin="10f"
padding="20f">
xmlns:base="com.bartlomiejpluta.base.lib.gui"
xmlns:demo="com.bartlomiejpluta.demo.gui"
windowPosition="WindowPosition.BOTTOM"
margin="10f"
padding="20f">
<base:VLayout
width="200f"
widthMode="SizeMode.ABSOLUTE">
<base:VLayout
width="200f"
widthMode="SizeMode.ABSOLUTE">
<base:Label
font="&quot;2261c04f-b02e-4486-b388-8a0fa41622e9&quot;"
widthMode="SizeMode.RELATIVE"
width="1f"
alignment="GUI.ALIGN_TOP | GUI.ALIGN_CENTER"
red="1f"
green="1f"
blue="1f"
alpha="0.5f"
fontSize="30f">Menu</base:Label>
<base:Label
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
alignment="GUI.ALIGN_TOP | GUI.ALIGN_CENTER"
red="1f"
green="1f"
blue="1f"
alpha="0.5f"
fontSize="30f">Menu
</base:Label>
<base:VOptionChoice
widthMode="SizeMode.RELATIVE"
width="1f">
<base:VOptionChoice
widthMode="SizeMode.RELATIVE"
width="1f">
<demo:Button
ref="new_game"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">New Game</demo:Button>
<demo:Button
ref="new_game"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">New Game
</demo:Button>
<demo:Button
ref="exit"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">Exit</demo:Button>
<demo:Button
ref="exit"
font="A.fonts.roboto_regular.uid"
widthMode="SizeMode.RELATIVE"
width="1f"
red="1f"
green="1f"
blue="1f"
fontSize="17f">Exit
</demo:Button>
</base:VOptionChoice>
</base:VOptionChoice>
</base:VLayout>
</base:VLayout>
</demo:StartMenuWindow>