diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 226d13a..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -android/*.keystore diff --git a/flake.nix b/flake.nix index fd5d7fb..0f15fd7 100644 --- a/flake.nix +++ b/flake.nix @@ -22,31 +22,17 @@ # NOTE: zig overlay triggers issues with X11/GL libraries # This might be misconfiguration on my end overlays = [ ]; - config = { - allowUnfree = true; - android_sdk.accept_license = true; - }; + config = { }; }; formatter = pkgs.nixfmt; devShells.default = with pkgs; mkShell { - LD_LIBRARY_PATH = - lib.makeLibraryPath [ stdenv.cc.cc ]; # For libstdc++.so.6 - ANDROID_HOME = "${androidenv.androidPkgs_9_0.androidsdk}/libexec/android-sdk"; - - nativeBuildInputs = [ - clang - just - - godot_4 - - android-tools - androidenv.androidPkgs_9_0.androidsdk - androidenv.androidPkgs_9_0.platform-tools - jre_headless - ]; + LD_LIBRARY_PATH = lib.makeLibraryPath [ stdenv.cc.cc ]; # For libstdc++.so.6 + ANDROID_HOME = "foo/bar"; + + nativeBuildInputs = [ clang just android-tools godot_4 ]; buildInputs = [ sqlite ]; }; }; diff --git a/godot/export_presets.cfg b/godot/export_presets.cfg index 57c68b0..0be7e60 100644 --- a/godot/export_presets.cfg +++ b/godot/export_presets.cfg @@ -31,7 +31,7 @@ version/name="" package/unique_name="com.example.$genname" package/name="" package/signed=true -package/app_category=6 +package/app_category=2 package/retain_data_on_uninstall=false package/exclude_from_recents=false package/show_in_android_tv=false diff --git a/godot/main.gd b/godot/main.gd index 159bd4a..fcd7cba 100644 --- a/godot/main.gd +++ b/godot/main.gd @@ -2,6 +2,12 @@ extends Control # Called when the node enters the scene tree for the first time. func _ready(): + $FileDialog.mode = FileDialog.FILE_MODE_OPEN_FILE + $FileDialog.access = FileDialog.ACCESS_FILESYSTEM + $FileDialog.use_native_dialog = true + + $MarginContainer/Unloaded/Button.pressed.connect(_on_button_pressed) + Global.state_changed.connect(_update_state) if Global.current_state == Global.State.UNLOADED: pass @@ -11,6 +17,17 @@ func _ready(): var current_scene = s.instantiate() $MarginContainer.add_child(current_scene) +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func _on_button_pressed(): + $FileDialog.show() + print("button pressed") + +func _on_file_dialog_file_selected(path): + Global.load_db(path) + func _update_state(old: Global.State, new: Global.State): print("updated state") - + pass diff --git a/godot/main.tscn b/godot/main.tscn index 791e64e..fb18b4a 100644 --- a/godot/main.tscn +++ b/godot/main.tscn @@ -27,3 +27,7 @@ metadata/_edit_use_anchors_ = true [node name="Unloaded" parent="MarginContainer" instance=ExtResource("2_diny5")] layout_mode = 2 + +[node name="FileDialog" type="FileDialog" parent="."] + +[connection signal="file_selected" from="FileDialog" to="." method="_on_file_dialog_file_selected"] diff --git a/godot/unloaded.gd b/godot/unloaded.gd deleted file mode 100644 index 1930725..0000000 --- a/godot/unloaded.gd +++ /dev/null @@ -1,12 +0,0 @@ -extends CenterContainer - -func _ready(): - $FileDialog.mode = FileDialog.FILE_MODE_OPEN_FILE - $FileDialog.access = FileDialog.ACCESS_FILESYSTEM - $FileDialog.use_native_dialog = true - -func _on_button_pressed(): - $FileDialog.show() - -func _on_file_dialog_file_selected(path): - Global.load_db(path) diff --git a/godot/unloaded.tscn b/godot/unloaded.tscn index 87f4a0c..62acad0 100644 --- a/godot/unloaded.tscn +++ b/godot/unloaded.tscn @@ -1,16 +1,8 @@ -[gd_scene load_steps=2 format=3 uid="uid://b71wpb1vts86r"] - -[ext_resource type="Script" path="res://unloaded.gd" id="1_ibvef"] +[gd_scene format=3 uid="uid://b71wpb1vts86r"] [node name="CenterContainer" type="CenterContainer"] -script = ExtResource("1_ibvef") [node name="Button" type="Button" parent="."] custom_minimum_size = Vector2(200, 200) layout_mode = 2 text = "Load database" - -[node name="FileDialog" type="FileDialog" parent="."] - -[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] -[connection signal="file_selected" from="FileDialog" to="." method="_on_file_dialog_file_selected"] diff --git a/justfile b/justfile index cb4ae20..d79686d 100644 --- a/justfile +++ b/justfile @@ -4,12 +4,7 @@ alias t := test alias fmt := format edit: - godot4 --editor --quiet godot/project.godot - -android-keystore: - mkdir -p android - keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore android/debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 -deststoretype pkcs12 - keytool -v -genkey -keystore logue.keystore -alias logue -keyalg RSA -validity 10000 + godot4 --editor godot/project.godot pre-build: git submodule update --init --recursive