Skip to content

Commit

Permalink
updated font by popular demand, added in-game tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
The-AhmadAA committed Oct 15, 2023
1 parent 70da0f5 commit b5e2cc3
Show file tree
Hide file tree
Showing 11 changed files with 654 additions and 161 deletions.
191 changes: 191 additions & 0 deletions source/core/assets/images/ui/buttons/determination_mono_18.fnt

Large diffs are not rendered by default.

191 changes: 191 additions & 0 deletions source/core/assets/images/ui/buttons/determination_mono_18_bold.fnt

Large diffs are not rendered by default.

206 changes: 110 additions & 96 deletions source/core/assets/images/ui/buttons/glass.atlas

Large diffs are not rendered by default.

102 changes: 62 additions & 40 deletions source/core/assets/images/ui/buttons/glass.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
com.badlogic.gdx.graphics.g2d.BitmapFont: {
determination_mono_18: {
file: determination_mono_18.fnt
scaledSize: -1
markupEnabled: false
flip: false
}
determination_mono_18_bold: {
file: determination_mono_18_bold.fnt
scaledSize: -1
markupEnabled: false
flip: false
}
determination_mono_32: {
file: determination_mono_32.fnt
scaledSize: -1
Expand Down Expand Up @@ -74,6 +86,12 @@ com.badlogic.gdx.graphics.Color: {
b: 1
a: 1
}
dark_blue: {
r: 0
g: 0.1882353
b: 0.5921569
a: 1
}
Grey: {
r: 0.73333335
g: 0.73333335
Expand Down Expand Up @@ -301,7 +319,7 @@ com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
checkboxOnOver: UI_Glass_Slot_Selected_01a
checkboxOver: UI_Glass_Slot_Unavailable_01a
checkboxOnDisabled: UI_Glass_Slot_Unavailable_01a
font: glitch_24
font: determination_mono_32
}
}
com.badlogic.gdx.scenes.scene2d.ui.ImageButton$ImageButtonStyle: {
Expand All @@ -314,79 +332,83 @@ com.badlogic.gdx.scenes.scene2d.ui.ImageButton$ImageButtonStyle: {
imageDown: weapon_tower_down
imageOver: weapon_tower_over
imageDisabled: weapon_tower_disabled
imageChecked: weapon_tower_down
imageCheckedDown: weapon_tower_down
imageCheckedOver: weapon_tower_over
}
tnt_tower: {
imageUp: tnt-tower-default
imageDown: tnt_tower_down
imageOver: tnt_tower_over
imageDisabled: tnt_tower_disabled
imageChecked: tnt_tower_down
imageCheckedDown: tnt_tower_down
imageCheckedOver: tnt_tower_over
}
droid_tower: {
imageUp: droid-tower-default
imageDown: droid_tower_down
imageOver: droid_tower_over
imageDisabled: droid_tower_disabled
imageChecked: droid_tower_down
imageCheckedDown: droid_tower_down
imageCheckedOver: droid_tower_over
}
stun_tower: {
imageUp: stun-tower-default
imageDown: stun_tower_down
imageOver: stun_tower_over
imageDisabled: stun_tower_disabled
imageChecked: stun_tower_down
imageCheckedDown: stun_tower_down
imageCheckedOver: stun_tower_over
}
fire_tower: {
imageUp: fire-tower-default
imageDown: fire_tower_down
imageOver: fire_tower_over
imageDisabled: fire_tower_disabled
imageChecked: fire_tower_down
imageCheckedDown: fire_tower_down
imageCheckedOver: fire_tower_over
}
wall: {
imageUp: wall-tower-default
imageDown: wall_tower_down
imageOver: wall_tower_over
imageDisabled: wall_tower_disabled
imageChecked: wall_tower_down
imageCheckedDown: wall_tower_down
imageCheckedOver: wall_tower_over
}
income_tower: {
imageUp: mine-tower-default
imageDown: mine_tower_down
imageOver: mine_tower_over
imageDisabled: mine_tower_disabled
}
}
com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton$ImageTextButtonStyle: {
default: {
imageUp: Weapon-Tower-Default
font: glitch_24
fontColor: White
downFontColor: Blue
overFontColor: White
focusedFontColor: White
disabledFontColor: Grey
up: UI_Glass_Button_Large_Press_01a4
down: UI_Glass_Button_Large_Press_01a1
over: UI_Glass_Button_Large_Press_01a3
focused: UI_Glass_Button_Large_Press_01a2
disabled: UI_Glass_Banner_01a
checked: UI_Glass_Button_Large_Press_01a2
checkedOver: UI_Glass_Button_Large_Press_01a3
checkedDown: UI_Glass_Button_Large_Press_01a1
checkedFocused: UI_Glass_Button_Large_Press_01a2
pressedOffsetY: -2
imageChecked: mine_tower_down
imageCheckedDown: mine_tower_down
imageCheckedOver: mine_tower_over
}
}
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
default: {
font: glitch_24
font: determination_mono_32
fontColor: White
}
title: {
parent: default
font: glitch_title
font: determination_mono_48_title
fontColor: White
}
small: {
font: determination_mono_18_bold
fontColor: White
}
}
com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle: {
default: {
font: glitch_24
font: determination_mono_32
fontColorSelected: White
fontColorUnselected: Grey
selection: UI_Glass_Banner_01a
Expand Down Expand Up @@ -415,14 +437,14 @@ com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: {
}
com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: {
default: {
font: glitch_24
font: determination_mono_32
fontColor: Grey
overFontColor: White
disabledFontColor: Grey
background: UI_Glass_Button_Large_Press_01a4
background: UI_Glass_Button_Large_Lock_01a1
scrollStyle: default
listStyle: default
backgroundOver: UI_Glass_Button_Large_Lock_01a2
backgroundOver: UI_Glass_Button_Large_Lock_01a3
backgroundOpen: UI_Glass_Button_Large_Lock_01a4
backgroundDisabled: UI_Glass_Banner_01a
}
Expand All @@ -434,43 +456,43 @@ com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
}
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: {
font: glitch_24
parent: default
font: determination_mono_32
fontColor: Grey
downFontColor: White
overFontColor: White
focusedFontColor: White
disabledFontColor: Grey
checkedFontColor: White
checkedDownFontColor: White
checkedOverFontColor: White
checkedFocusedFontColor: White
up: UI_Glass_Button_Large_Press_01a4
down: UI_Glass_Button_Large_Press_01a1
over: UI_Glass_Button_Large_Press_01a3
focused: UI_Glass_Button_Large_Press_01a3
disabled: UI_Glass_Banner_01a
checked: UI_Glass_Button_Large_Press_01a1
checkedOver: UI_Glass_Button_Large_Press_01a3
checkedDown: UI_Glass_Button_Large_Press_01a1
checkedFocused: UI_Glass_Button_Large_Press_01a3
pressedOffsetY: -2
}
small: {
parent: default
font: determination_mono_18
fontColor: White
}
}
com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle: {
default: {
font: glitch_24
font: determination_mono_32
fontColor: White
messageFont: determination_mono_32
}
}
com.badlogic.gdx.scenes.scene2d.ui.TextTooltip$TextTooltipStyle: {
default: {
label: default
label: small
wrapWidth: 200
}
}
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
default: {
background: UI_Glass_Frame_Standard_01a
titleFont: glitch_title
titleFont: determination_mono_48_title
titleFontColor: White
}
}
Expand Down
Binary file modified source/core/assets/images/ui/buttons/glass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CurrencyDisplay extends UIComponent {
private TextButton scrapsTb;
private TextButton crystalsTb;
private Sound clickSound;
private static final String defaultFont = "glitch_24";
private static final String defaultFont = "determination_mono_18";

/**
* Adds actors to stage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.csse3200.game.components.gamearea;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextTooltip;
import com.badlogic.gdx.scenes.scene2d.ui.TooltipManager;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align;
Expand All @@ -17,7 +16,7 @@

public class EngineerCountDisplay extends UIComponent {
private TextButton engineerTb;
private static final String defaultFont = "glitch_24";
private static final String defaultFont = "determination_mono_18";

@Override
public void create() {
Expand All @@ -44,9 +43,12 @@ private void addActors() {
engineerTb = new TextButton(text, style);
engineerTb.setDisabled(true);
engineerTb.getLabel().setAlignment(Align.right);

engineerTb.setTouchable(Touchable.enabled);
engineerTb.pad(0, 0, 0, 50);
engineerTb.setTransform(true);
// engineerTb.setTransform(true);
TextTooltip tooltip = new TextTooltip(
"Humans left. If this reaches 0, the game ends", getSkin());
engineerTb.addListener(tooltip);

table.add(engineerTb).width(engineerTb.getWidth() * 0.5f).height(engineerTb.getHeight() * 0.5f);
stage.addActor(table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.EventListener;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Array;
import com.csse3200.game.GdxGame;
import com.csse3200.game.entities.factories.PauseMenuFactory;
Expand Down Expand Up @@ -122,25 +124,39 @@ public void changed(ChangeEvent changeEvent, Actor actor) {

// Triggers an event when the button is pressed.
tower1.addListener(
new ChangeListener() {
new ClickListener() {
@Override
public void changed(ChangeEvent changeEvent, Actor actor) {
logger.debug("Tower 1 build button clicked");
ServiceLocator.getCurrencyService().setTowerType(towers.get(0));
public void clicked(InputEvent event, float x, float y) {

TowerType selected = ServiceLocator.getCurrencyService().getTower();
if (selected == towers.get(0) ) {
ServiceLocator.getCurrencyService().setTowerType(null);
} else {
ServiceLocator.getCurrencyService().setTowerType(towers.get(0));
}
click.play(0.4f);
}
});
TextTooltip tower1Tooltip = new TextTooltip(towers.get(0).getDescription(), getSkin());
tower1.addListener(tower1Tooltip);

// Triggers an event when the button is pressed.
tower2.addListener(
new ChangeListener() {
new ClickListener() {
@Override
public void changed(ChangeEvent changeEvent, Actor actor) {
logger.debug("Tower 2 build button clicked");
ServiceLocator.getCurrencyService().setTowerType(towers.get(1));
public void clicked(InputEvent event, float x, float y) {

TowerType selected = ServiceLocator.getCurrencyService().getTower();
if (selected == towers.get(1) ) {
ServiceLocator.getCurrencyService().setTowerType(null);
} else {
ServiceLocator.getCurrencyService().setTowerType(towers.get(1));
}
click.play(0.4f);
}
});
TextTooltip tower2Tooltip = new TextTooltip(towers.get(1).getDescription(), getSkin());
tower2.addListener(tower2Tooltip);

tower3.addListener(
new ChangeListener() {
Expand All @@ -151,6 +167,8 @@ public void changed(ChangeEvent changeEvent, Actor actor) {
click.play(0.4f);
}
});
TextTooltip tower3Tooltip = new TextTooltip(towers.get(3).getDescription(), getSkin());
tower3.addListener(tower3Tooltip);

tower4.addListener(
new ChangeListener() {
Expand All @@ -161,6 +179,8 @@ public void changed(ChangeEvent changeEvent, Actor actor) {
click.play(0.4f);
}
});
TextTooltip tower4Tooltip = new TextTooltip(towers.get(3).getDescription(), getSkin());
tower4.addListener(tower4Tooltip);

tower5.addListener(
new ChangeListener() {
Expand All @@ -171,6 +191,8 @@ public void changed(ChangeEvent changeEvent, Actor actor) {
click.play(0.4f);
}
});
TextTooltip tower5Tooltip = new TextTooltip(towers.get(4).getDescription(), getSkin());
tower5.addListener(tower5Tooltip);

// Add all buttons to their respective tables and position them
towerTable.add(tower1).padRight(10f);
Expand All @@ -183,6 +205,10 @@ public void changed(ChangeEvent changeEvent, Actor actor) {
// Add tables to the stage
stage.addActor(buttonTable);
stage.addActor(towerTable);

TooltipManager tm = TooltipManager.getInstance();
tm.initialTime = 3;
tm.hideAll();
}

@Override
Expand Down
Loading

0 comments on commit b5e2cc3

Please sign in to comment.