Skip to content

Commit

Permalink
Overhaul to Godot front-end appearance and behaviours
Browse files Browse the repository at this point in the history
  • Loading branch information
qkmaxware committed Jul 18, 2024
1 parent c9fb91e commit 453c031
Show file tree
Hide file tree
Showing 85 changed files with 2,633 additions and 364 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fail-fast: false
matrix:
godot: [ '4.2.2-stable' ]
os: [ 'ubuntu-latest' ]
os: [ 'windows-latest' ]
platform: [ 'Windows x64' ]
steps:
- name: Checkout Code
Expand All @@ -43,11 +43,13 @@ jobs:
with:
dotnet-version: '8.0.x' # SDK Version to use
- name: Download Godot
run: curl -LO https://github.com/godotengine/godot-builds/releases/download/${{ matrix.godot }}/Godot_v${{ matrix.godot }}_mono_linux_x86_64.zip -o godot.zip
run: curl https://github.com/godotengine/godot-builds/releases/download/${{ matrix.godot }}/Godot_v${{ matrix.godot }}_mono_win64.zip -o godot.zip; curl https://github.com/godotengine/godot-builds/releases/download/${{ matrix.godot }}/Godot_v${{ matrix.godot }}_mono_export_templates.tpz -o godot_export_templates.tpz
- name: Extract Godot
run: mkdir Godot && unzip godot.zip -d Godot && mv Godot/Godot_v${{ matrix.godot }}_mono_linux_x86_64 Godot/Engine && mv Godot/Engine/Godot_v${{ matrix.godot }}_mono_linux.x86_64 Godot/Engine/godot
run: Expand-Archive -Path godot.zip -DestinationPath Godot; Rename-Item Godot/Godot_v${{ matrix.godot }}_mono_win64 -NewName Engine; Rename-Item Godot/Engine/Godot_v${{ matrix.godot }}_mono_win64.exe -NewName "godot.exe"; Rename-Item Godot/Engine/Godot_v${{ matrix.godot }}_mono_win64_console.exe -NewName "godot_console.exe"
- name: Extract Build Templates
run: echo 1
- name: Build Binary
run: mkdir -p ./bin/${{ matrix.platform }} && ./Godot/Engine/godot --path ./Gameboy.Player.Godot/project.godot --export ${{ matrix.platform }} ./bin/${{ matrix.platform }}
run: New-Item -Force -Path "./bin/${{ matrix.platform }}" -ItemType "directory"; ./Godot/Engine/godot_console.exe --build-solutions --export-release ${{ matrix.platform }} ../bin/${{ matrix.platform }}/BlazorBoy.exe ./Gameboy.Player.Godot/project.godot

cli:
needs: [ test ]
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ obj/
nupkg/
[pP]rivate/
TestResults/
.site/
.site/

/*.zip
/[gG]odot/
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/CartInfoDebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Qkmaxware.Emulators.Gameboy.Player;
public partial class CartInfoDebug : Control {

[Export] public TextureRenderer Player;
[Export] public GodotBoy Player;

private RichTextLabel text;

Expand Down
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/CartInfoDebug.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://t7khq15qfjuw"]

[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://reload.png" id="1_0a8i2"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://Prefabs/GodotBoy/UI/reload.png" id="1_0a8i2"]
[ext_resource type="Script" path="res://Debuggers/CartInfoDebug.cs" id="1_m4mxx"]

[node name="Cartridge Info" type="Control"]
Expand Down
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/Disassembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Qkmaxware.Emulators.Gameboy.Player;

public partial class Disassembler : Control {

[Export] public TextureRenderer Player;
[Export] public GodotBoy Player;

[Export] public PackedScene RowPrefab;

Expand Down
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/Disassembler.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ext_resource type="Script" path="res://Debuggers/Disassembler.cs" id="1_bgd2f"]
[ext_resource type="PackedScene" uid="uid://c2fsn6ee6p522" path="res://Debuggers/Disassembler.Row.tscn" id="2_hoclf"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://reload.png" id="3_5ffph"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://Prefabs/GodotBoy/UI/reload.png" id="3_5ffph"]

[node name="Disassembler" type="Control"]
layout_mode = 3
Expand Down
5 changes: 5 additions & 0 deletions Gameboy.Player.Godot/Debuggers/IDebugable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Qkmaxware.Emulators.Gameboy;

public interface IDebugable {
public Gameboy Console {get;}
}
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/Map Debugger.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ext_resource type="Script" path="res://Debuggers/MapDebugger.cs" id="1_gnyfy"]
[ext_resource type="Script" path="res://BitmapTextureRect.cs" id="2_0ayh7"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://reload.png" id="3_fd1ro"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://Prefabs/GodotBoy/UI/reload.png" id="3_fd1ro"]

[node name="Map Debugger" type="Control"]
layout_mode = 3
Expand Down
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/MapDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum MapType {

public partial class MapDebugger : Control {

[Export] public TextureRenderer Player;
[Export] public GodotBoy Player;
[Export] public MapType Map;

private BitmapTextureRect rect;
Expand Down
108 changes: 54 additions & 54 deletions Gameboy.Player.Godot/Debuggers/PaletteDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Qkmaxware.Emulators.Gameboy.Player;

public partial class PaletteDebugger : Control {

[Export] public TextureRenderer Player;
[Export] public GodotBoy Player;

private ColorPickerButton bg0Black;
private ColorPickerButton bg0DarkGrey;
Expand All @@ -30,31 +30,31 @@ public partial class PaletteDebugger : Control {
public override void _Ready() {
// Colours
bg0Black = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Bg/HBoxContainer/BgBlack");
bg0Black.Color = Player?.BgBlack ?? new Color(0,0,0,1);
bg0Black.Color = Player?.Screen?.BgBlack ?? new Color(0,0,0,1);
bg0DarkGrey = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Bg/HBoxContainer/BgDarkGrey");
bg0DarkGrey.Color = Player?.BgDarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
bg0DarkGrey.Color = Player?.Screen?.BgDarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
bg0LightGrey = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Bg/HBoxContainer/BgLightGrey");
bg0LightGrey.Color = Player?.BgLightGrey ?? new Color(0.6f,0.6f,0.6f,1);
bg0LightGrey.Color = Player?.Screen?.BgLightGrey ?? new Color(0.6f,0.6f,0.6f,1);
bg0White = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Bg/HBoxContainer/BgWhite");
bg0White.Color = Player?.BgWhite ?? new Color(1,1,1,1);
bg0White.Color = Player?.Screen?.BgWhite ?? new Color(1,1,1,1);

obj0Black = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Objects/HBoxContainer/Obj0Black");
obj0Black.Color = Player?.Obj0Black ?? new Color(0,0,0,1);
obj0Black.Color = Player?.Screen?.Obj0Black ?? new Color(0,0,0,1);
obj0DarkGrey = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Objects/HBoxContainer/Obj0DarkGrey");
obj0DarkGrey.Color = Player?.Obj0DarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
obj0DarkGrey.Color = Player?.Screen?.Obj0DarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
obj0LightGrey = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Objects/HBoxContainer/Obj0LightGrey");
obj0LightGrey.Color = Player?.Obj0LightGrey ?? new Color(0.6f,0.6f,0.6f,1);
obj0LightGrey.Color = Player?.Screen?.Obj0LightGrey ?? new Color(0.6f,0.6f,0.6f,1);
obj0White = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Objects/HBoxContainer/Obj0White");
obj0White.Color = Player?.Obj0White ?? new Color(1,1,1,1);
obj0White.Color = Player?.Screen?.Obj0White ?? new Color(1,1,1,1);

obj1Black = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Objects/HBoxContainer2/Obj1Black");
obj1Black.Color = Player?.Obj1Black ?? new Color(0,0,0,1);
obj1Black.Color = Player?.Screen?.Obj1Black ?? new Color(0,0,0,1);
obj1DarkGrey = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Objects/HBoxContainer2/Obj1DarkGrey");
obj1DarkGrey.Color = Player?.Obj1DarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
obj1DarkGrey.Color = Player?.Screen?.Obj1DarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
obj1LightGrey = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Objects/HBoxContainer2/Obj1LightGrey");
obj1LightGrey.Color = Player?.Obj1LightGrey ?? new Color(0.6f,0.6f,0.6f,1);
obj1LightGrey.Color = Player?.Screen?.Obj1LightGrey ?? new Color(0.6f,0.6f,0.6f,1);
obj1White = GetNode<ColorPickerButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Objects/HBoxContainer2/Obj1White");
obj1White.Color = Player?.Obj1White ?? new Color(1,1,1,1);
obj1White.Color = Player?.Screen?.Obj1White ?? new Color(1,1,1,1);

var themePicker = GetNode<OptionButton>("ScrollContainer/VSplitContainer/Colours/VBoxContainer/HBoxContainer/Themes/OptionButton");
foreach (var theme in LcdColorTheme.Named) {
Expand All @@ -80,20 +80,20 @@ public override void _Ready() {
}

public void Refresh() {
bg0Black.Color = Player?.BgBlack ?? new Color(0,0,0,1);
bg0DarkGrey.Color = Player?.BgDarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
bg0LightGrey.Color = Player?.BgLightGrey ?? new Color(0.6f,0.6f,0.6f,1);
bg0White.Color = Player?.BgWhite ?? new Color(1,1,1,1);
bg0Black.Color = Player?.Screen?.BgBlack ?? new Color(0,0,0,1);
bg0DarkGrey.Color = Player?.Screen?.BgDarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
bg0LightGrey.Color = Player?.Screen?.BgLightGrey ?? new Color(0.6f,0.6f,0.6f,1);
bg0White.Color = Player?.Screen?.BgWhite ?? new Color(1,1,1,1);

obj0Black.Color = Player?.Obj0Black ?? new Color(0,0,0,1);
obj0DarkGrey.Color = Player?.Obj0DarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
obj0LightGrey.Color = Player?.Obj0LightGrey ?? new Color(0.6f,0.6f,0.6f,1);
obj0White.Color = Player?.Obj0White ?? new Color(1,1,1,1);
obj0Black.Color = Player?.Screen?.Obj0Black ?? new Color(0,0,0,1);
obj0DarkGrey.Color = Player?.Screen?.Obj0DarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
obj0LightGrey.Color = Player?.Screen?.Obj0LightGrey ?? new Color(0.6f,0.6f,0.6f,1);
obj0White.Color = Player?.Screen?.Obj0White ?? new Color(1,1,1,1);

obj1Black.Color = Player?.Obj1Black ?? new Color(0,0,0,1);
obj1DarkGrey.Color = Player?.Obj1DarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
obj1LightGrey.Color = Player?.Obj1LightGrey ?? new Color(0.6f,0.6f,0.6f,1);
obj1White.Color = Player?.Obj1White ?? new Color(1,1,1,1);
obj1Black.Color = Player?.Screen?.Obj1Black ?? new Color(0,0,0,1);
obj1DarkGrey.Color = Player?.Screen?.Obj1DarkGrey ?? new Color(0.3f,0.3f,0.3f,1);
obj1LightGrey.Color = Player?.Screen?.Obj1LightGrey ?? new Color(0.6f,0.6f,0.6f,1);
obj1White.Color = Player?.Screen?.Obj1White ?? new Color(1,1,1,1);

var ppu = Player?.Console?.GPU;
if (ppu is IDebuggablePpu debug) {
Expand All @@ -102,23 +102,23 @@ public void Refresh() {
foreach (var pair in palette.First.Zip(palette.Second)) {
var palettedColour = pair.First;
var rgb = palettedColour switch {
ColourPallet.BackgroundDark => Player.BgBlack,
ColourPallet.Object0Dark => Player.BgBlack,
ColourPallet.Object1Dark => Player.BgBlack,
ColourPallet.BackgroundDark => Player.Screen.BgBlack,
ColourPallet.Object0Dark => Player.Screen.BgBlack,
ColourPallet.Object1Dark => Player.Screen.BgBlack,

ColourPallet.BackgroundMedium => Player.BgDarkGrey,
ColourPallet.Object0Medium => Player.BgDarkGrey,
ColourPallet.Object1Medium => Player.BgDarkGrey,
ColourPallet.BackgroundMedium => Player.Screen.BgDarkGrey,
ColourPallet.Object0Medium => Player.Screen.BgDarkGrey,
ColourPallet.Object1Medium => Player.Screen.BgDarkGrey,

ColourPallet.BackgroundLight => Player.BgLightGrey,
ColourPallet.Object0Light => Player.BgLightGrey,
ColourPallet.Object1Light => Player.BgLightGrey,
ColourPallet.BackgroundLight => Player.Screen.BgLightGrey,
ColourPallet.Object0Light => Player.Screen.BgLightGrey,
ColourPallet.Object1Light => Player.Screen.BgLightGrey,

ColourPallet.BackgroundWhite => Player.BgWhite,
ColourPallet.Object0White => Player.BgWhite,
ColourPallet.Object1White => Player.BgWhite,
ColourPallet.BackgroundWhite => Player.Screen.BgWhite,
ColourPallet.Object0White => Player.Screen.BgWhite,
ColourPallet.Object1White => Player.Screen.BgWhite,

_ => Player.BgBlack,
_ => Player.Screen.BgBlack,
};
bgcolours.Add(palettedColour);
pair.Second.Color = rgb;
Expand All @@ -131,10 +131,10 @@ public void Refresh() {
HashSet<ColourPallet> objcolours = new HashSet<ColourPallet>();
var colourSetIndex = 0;
foreach (var palette in debug.ObjectPalettes.Zip(obj)) {
var black = colourSetIndex == 0 ? Player.Obj0Black : Player.Obj1Black;
var dg = colourSetIndex == 0 ? Player.Obj0DarkGrey : Player.Obj1DarkGrey;
var lg = colourSetIndex == 0 ? Player.Obj0LightGrey : Player.Obj1LightGrey;
var white = colourSetIndex == 0 ? Player.Obj0White : Player.Obj1White;
var black = colourSetIndex == 0 ? Player.Screen.Obj0Black : Player.Screen.Obj1Black;
var dg = colourSetIndex == 0 ? Player.Screen.Obj0DarkGrey : Player.Screen.Obj1DarkGrey;
var lg = colourSetIndex == 0 ? Player.Screen.Obj0LightGrey : Player.Screen.Obj1LightGrey;
var white = colourSetIndex == 0 ? Player.Screen.Obj0White : Player.Screen.Obj1White;

foreach (var pair in palette.First.Zip(palette.Second)) {
var palettedColour = pair.First;
Expand Down Expand Up @@ -192,20 +192,20 @@ public void SelectTheme(int index) {

public void UpdatePlayerColours() {
if (Player is not null) {
Player.BgBlack = bg0Black.Color;
Player.BgDarkGrey = bg0DarkGrey.Color;
Player.BgLightGrey = bg0LightGrey.Color;
Player.BgWhite = bg0White.Color;
Player.Screen.BgBlack = bg0Black.Color;
Player.Screen.BgDarkGrey = bg0DarkGrey.Color;
Player.Screen.BgLightGrey = bg0LightGrey.Color;
Player.Screen.BgWhite = bg0White.Color;

Player.Obj0Black = obj0Black.Color;
Player.Obj0DarkGrey = obj0DarkGrey.Color;
Player.Obj0LightGrey = obj0LightGrey.Color;
Player.Obj0White = obj0White.Color;
Player.Screen.Obj0Black = obj0Black.Color;
Player.Screen.Obj0DarkGrey = obj0DarkGrey.Color;
Player.Screen.Obj0LightGrey = obj0LightGrey.Color;
Player.Screen.Obj0White = obj0White.Color;

Player.Obj1Black = obj1Black.Color;
Player.Obj1DarkGrey = obj1DarkGrey.Color;
Player.Obj1LightGrey = obj1LightGrey.Color;
Player.Obj1White = obj1White.Color;
Player.Screen.Obj1Black = obj1Black.Color;
Player.Screen.Obj1DarkGrey = obj1DarkGrey.Color;
Player.Screen.Obj1LightGrey = obj1LightGrey.Color;
Player.Screen.Obj1White = obj1White.Color;
}
}
}
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/PaletteDebugger.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://b5psa1c0pvkya"]

[ext_resource type="Script" path="res://Debuggers/PaletteDebugger.cs" id="1_sor31"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://reload.png" id="2_wsgsr"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://Prefabs/GodotBoy/UI/reload.png" id="2_wsgsr"]

[node name="Palette Debugger" type="Control"]
layout_mode = 3
Expand Down
4 changes: 2 additions & 2 deletions Gameboy.Player.Godot/Debuggers/Sprite Debugger.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[gd_scene load_steps=5 format=3 uid="uid://yis4daekext1"]

[ext_resource type="Texture2D" uid="uid://cip0keh15srys" path="res://cart.png" id="1_44h0a"]
[ext_resource type="Texture2D" uid="uid://cip0keh15srys" path="res://Prefabs/GodotBoy/UI/cart.png" id="1_44h0a"]
[ext_resource type="Script" path="res://Debuggers/SpriteDebugger.cs" id="1_kpo0v"]
[ext_resource type="Script" path="res://BitmapTextureRect.cs" id="2_hqqgw"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://reload.png" id="4_26upw"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://Prefabs/GodotBoy/UI/reload.png" id="4_26upw"]

[node name="Sprite Debugger" type="Control"]
layout_mode = 3
Expand Down
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/SpriteDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Qkmaxware.Emulators.Gameboy.Player;

public partial class SpriteDebugger : Control {

[Export] public TextureRenderer Player;
[Export] public GodotBoy Player;

private BitmapTextureRect[] spriteTextures;

Expand Down
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/Tile Debugger.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ext_resource type="Script" path="res://Debuggers/TileDebugger.cs" id="1_gbx3v"]
[ext_resource type="PackedScene" uid="uid://0jxwbr6l750m" path="res://Debuggers/Tile Debugger.TileTemplate.tscn" id="2_3xqvo"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://reload.png" id="4_i77dr"]
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://Prefabs/GodotBoy/UI/reload.png" id="4_i77dr"]

[node name="Tile Debugger" type="Control"]
layout_mode = 3
Expand Down
2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Debuggers/TileDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Qkmaxware.Emulators.Gameboy.Player;

public partial class TileDebugger : Control {

[Export] public TextureRenderer Player;
[Export] public GodotBoy Player;

private HFlowContainer container;
[Export]
Expand Down
23 changes: 0 additions & 23 deletions Gameboy.Player.Godot/FpsCounter.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Gameboy.Player.Godot/Gameboy.Player.Godot.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Godot.NET.Sdk/4.2.1">
<Project Sdk="Godot.NET.Sdk/4.2.2">
<ItemGroup>
<ProjectReference Include="..\Gameboy\Gameboy.csproj" />
<ProjectReference Include="..\Qkmaxware.Vm.LR35902\Qkmaxware.Vm.LR35902.csproj" />
Expand Down
Loading

0 comments on commit 453c031

Please sign in to comment.