Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad6c4d9581 | ||
|
|
73411a44f3 | ||
|
|
0cef1ea769 | ||
|
|
732a7329bc | ||
|
|
8e8823fb0c |
24 changed files with 367 additions and 187 deletions
34
assets/fonts/Montserrat-ExtraBold.otf.import
Normal file
34
assets/fonts/Montserrat-ExtraBold.otf.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://db83efud5yxsr"
|
||||
path="res://.godot/imported/Montserrat-ExtraBold.otf-8b4f6e223c2354188bd56d5be1852439.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/Montserrat-ExtraBold.otf"
|
||||
dest_files=["res://.godot/imported/Montserrat-ExtraBold.otf-8b4f6e223c2354188bd56d5be1852439.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
34
assets/fonts/OpenSans-ExtraBold.ttf.import
Normal file
34
assets/fonts/OpenSans-ExtraBold.ttf.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dca4i4g8hysm5"
|
||||
path="res://.godot/imported/OpenSans-ExtraBold.ttf-9d520f0ed8398261e18b9fe72a3be25c.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/OpenSans-ExtraBold.ttf"
|
||||
dest_files=["res://.godot/imported/OpenSans-ExtraBold.ttf-9d520f0ed8398261e18b9fe72a3be25c.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
File diff suppressed because one or more lines are too long
34
assets/fonts/OpenSans-SemiBold.ttf.import
Normal file
34
assets/fonts/OpenSans-SemiBold.ttf.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://wyv0hst7dcve"
|
||||
path="res://.godot/imported/OpenSans-SemiBold.ttf-15d8406842a575c8f65fb9c8990d4b7c.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/OpenSans-SemiBold.ttf"
|
||||
dest_files=["res://.godot/imported/OpenSans-SemiBold.ttf-15d8406842a575c8f65fb9c8990d4b7c.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1764642553,
|
||||
"narHash": "sha256-mvbFFzVBhVK1FjyPHZGMAKpNiqkr7k++xIwy+p/NQvA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f720de59066162ee879adcc8c79e15c51fe6bfb4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
37
flake.nix
Normal file
37
flake.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
description = "Taqin";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ nixpkgs, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
formatter.${system} = pkgs.nixfmt-rfc-style;
|
||||
|
||||
devShell.${system} =
|
||||
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
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -46,4 +46,5 @@ pointing/emulate_touch_from_mouse=true
|
|||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="mobile"
|
||||
environment/defaults/default_environment="res://default_env.tres"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ signal toggled()
|
|||
@export var toggle_mode := false
|
||||
@export var group: ButtonGroup
|
||||
|
||||
var pressed : get = is_pressed, set = set_pressed
|
||||
var pressed_state : get = is_pressed, set = set_pressed
|
||||
|
||||
var _pressed_depth := 4
|
||||
var _toggled := false
|
||||
|
|
@ -29,13 +29,13 @@ func _ready():
|
|||
button.text = text
|
||||
button.offset_bottom = -depth
|
||||
button.toggle_mode = toggle_mode
|
||||
button.group = group
|
||||
#button.group = group
|
||||
button.size.y = size.y - depth
|
||||
|
||||
#
|
||||
# Styles
|
||||
#
|
||||
var background_style := Styles.get_stylebox_flat(background.get_stylebox("panel", "panel"), "button_background", corner_type)
|
||||
var background_style := Styles.get_stylebox_flat(background.get_theme_stylebox("panel", "panel"), "button_background", corner_type)
|
||||
background_style.set_bg_color(Color(0.73, 0.35, 0.13))
|
||||
background.set('theme_override_styles/panel', background_style)
|
||||
match corner_type:
|
||||
|
|
@ -54,7 +54,7 @@ func _ready():
|
|||
|
||||
|
||||
for style_name in ["normal", "hover", "focus", "pressed"]:
|
||||
var original_style = button.get_stylebox(style_name)
|
||||
var original_style = button.get_theme_stylebox(style_name)
|
||||
# print_debug("style for ", style_name, ": ", original_style)
|
||||
var stylebox := Styles.get_stylebox_flat(original_style, style_name, corner_type)
|
||||
button.set("custom_styles/%s" % style_name, stylebox)
|
||||
|
|
|
|||
1
src/DepthButton.gd.uid
Normal file
1
src/DepthButton.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cdn73git076hr
|
||||
|
|
@ -5,7 +5,7 @@ signal texture_selected(texture)
|
|||
|
||||
var _parent_display_name := "<parent directory>"
|
||||
var _sep := "/"
|
||||
var _dir := DirAccess.new()
|
||||
var _dir : DirAccess
|
||||
|
||||
@export var root_dir: String
|
||||
@export var walkable := false
|
||||
|
|
@ -21,7 +21,8 @@ func populate(dir: String) -> void:
|
|||
print_debug("populate ", dir)
|
||||
clear()
|
||||
|
||||
if _dir.change_dir(dir) != OK:
|
||||
_dir = DirAccess.open(dir)
|
||||
if !_dir:
|
||||
print_debug("Cannot open path ", dir)
|
||||
assert(false)
|
||||
return
|
||||
|
|
|
|||
1
src/FileList.gd.uid
Normal file
1
src/FileList.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://by50vos4xnap8
|
||||
1
src/ImagePicker.gd.uid
Normal file
1
src/ImagePicker.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://gn1dmf64p11j
|
||||
32
src/Main.gd
32
src/Main.gd
|
|
@ -13,7 +13,7 @@ func _ready():
|
|||
print("Starting state: ", taquin.current_state_name())
|
||||
|
||||
func _notification(what):
|
||||
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
||||
if what == NOTIFICATION_WM_CLOSE_REQUEST:
|
||||
save_game()
|
||||
get_tree().quit() # default behavior
|
||||
|
||||
|
|
@ -31,12 +31,11 @@ func layout_reflow():
|
|||
else:
|
||||
# landscape
|
||||
container.columns = 2
|
||||
update()
|
||||
#update()
|
||||
|
||||
# https://docs.godotengine.org/en/3.2/tutorials/io/saving_games.html
|
||||
# https://docs.godotengine.org/en/stable/tutorials/io/saving_games.html
|
||||
func save_game():
|
||||
var save_game = File.new()
|
||||
save_game.open("user://savegame.save", File.WRITE)
|
||||
var save_file = FileAccess.open("user://savegame.save", FileAccess.WRITE)
|
||||
var save_nodes = get_tree().get_nodes_in_group("Persist")
|
||||
for node in save_nodes:
|
||||
# Check the node has a save function
|
||||
|
|
@ -51,21 +50,20 @@ func save_game():
|
|||
node_data["path"] = node.get_path()
|
||||
|
||||
# Store the save dictionary as a new line in the save file
|
||||
save_game.store_line(JSON.new().stringify(node_data))
|
||||
save_game.close()
|
||||
save_file.store_line(JSON.stringify(node_data))
|
||||
save_file.close()
|
||||
|
||||
func load_game():
|
||||
var save_game = File.new()
|
||||
if not save_game.file_exists("user://savegame.save"):
|
||||
return false # Error! We don't have a save to load.
|
||||
if not FileAccess.file_exists("user://savegame.save"):
|
||||
return # Error! We don't have a save to load.
|
||||
|
||||
# Load the file line by line and process that dictionary to restore
|
||||
# the object it represents.
|
||||
save_game.open("user://savegame.save", File.READ)
|
||||
while save_game.get_position() < save_game.get_length():
|
||||
var save_file = FileAccess.open("user://savegame.save", FileAccess.READ)
|
||||
while save_file.get_position() < save_file.get_length():
|
||||
# Get the saved dictionary from the next line in the save file
|
||||
var test_json_conv = JSON.new()
|
||||
test_json_conv.parse(save_game.get_line())
|
||||
test_json_conv.parse(save_file.get_line())
|
||||
var node_data = test_json_conv.get_data()
|
||||
|
||||
# Call the node's save function
|
||||
|
|
@ -76,7 +74,7 @@ func load_game():
|
|||
else:
|
||||
print("Cannot load node ", node_data["path"])
|
||||
|
||||
save_game.close()
|
||||
save_file.close()
|
||||
return true
|
||||
|
||||
func start_fresh():
|
||||
|
|
@ -86,11 +84,11 @@ func start_fresh():
|
|||
# Signals
|
||||
#
|
||||
func _on_Taquin_state_changed(previous, new):
|
||||
print("Taquin state: ", Taquin.State.keys()[previous], " -> ", Taquin.State.keys()[new])
|
||||
print("Taquin state: ", taquin.State.keys()[previous], " -> ", taquin.State.keys()[new])
|
||||
match new:
|
||||
Taquin.State.WINNING:
|
||||
taquin.State.WINNING:
|
||||
print("Solved!")
|
||||
Taquin.State.GAME_OVER:
|
||||
taquin.State.GAME_OVER:
|
||||
pass
|
||||
|
||||
func _on_New_game_pressed():
|
||||
|
|
|
|||
1
src/Main.gd.uid
Normal file
1
src/Main.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://rn30misiiww4
|
||||
|
|
@ -1,21 +1,20 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://cj4uqgtnylppu"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/Main.gd" id="1"]
|
||||
[ext_resource type="Script" uid="uid://rn30misiiww4" path="res://src/Main.gd" id="1"]
|
||||
[ext_resource type="PackedScene" path="res://src/Taquin.tscn" id="2"]
|
||||
[ext_resource type="PackedScene" path="res://src/NewGamePanel.tscn" id="3"]
|
||||
[ext_resource type="PackedScene" path="res://src/DepthButton.tscn" id="4"]
|
||||
[ext_resource type="Theme" path="res://assets/taqin_theme.tres" id="5"]
|
||||
[ext_resource type="Theme" uid="uid://b7gu1bjpj8ixp" path="res://assets/taqin_theme.tres" id="5"]
|
||||
|
||||
[node name="Main" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("5")
|
||||
script = ExtResource("1")
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Background" type="Panel" parent="."]
|
||||
layout_mode = 0
|
||||
|
|
@ -58,7 +57,6 @@ layout_mode = 2
|
|||
text = "Hints"
|
||||
|
||||
[node name="NewGamePanel" parent="." instance=ExtResource("3")]
|
||||
pivot_offset = Vector2(4, 4)
|
||||
|
||||
[connection signal="about_to_popup" from="NewGamePanel" to="." method="_on_NewGamePanel_about_to_show"]
|
||||
[connection signal="popup_hide" from="NewGamePanel" to="." method="_on_NewGamePanel_popup_hide"]
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ func _init():
|
|||
var err = preferences.load(pref_path)
|
||||
|
||||
func _ready():
|
||||
pivot_offset = size / 2
|
||||
#pivot_offset = size / 2
|
||||
|
||||
assert(popup.theme != null)
|
||||
var popup_style : = popup.get_stylebox("panel", "PopupPanel") as StyleBoxFlat
|
||||
var popup_style : = popup.get_theme_stylebox("panel", "PopupPanel") as StyleBoxFlat
|
||||
assert(popup_style != null)
|
||||
var panel_style := panel.get_stylebox("panel", "Panel") as StyleBoxFlat
|
||||
var panel_style := panel.get_theme_stylebox("panel", "Panel") as StyleBoxFlat
|
||||
assert(panel_style != null)
|
||||
var modified_panel_style = panel_style.duplicate()
|
||||
modified_panel_style.corner_radius_bottom_left = popup_style.corner_radius_bottom_left
|
||||
|
|
@ -67,7 +67,7 @@ func _ready():
|
|||
edit_panel.hide()
|
||||
|
||||
var button_max_width: int = $EditPanel/VBoxContainer.size.x / 3.5
|
||||
var button_width := min(200, button_max_width)
|
||||
var button_width: int = min(200, button_max_width)
|
||||
print_debug("button max width = ", button_max_width)
|
||||
easy_button.custom_minimum_size.x = button_width
|
||||
normal_button.custom_minimum_size.x = button_width
|
||||
|
|
@ -131,7 +131,7 @@ func _update_description():
|
|||
# $Panel/Description.text = "Dimension: %d x %d\nIterations: %d" % [columns, rows, iterations]
|
||||
desc.clear()
|
||||
|
||||
desc.push_align(RichTextLabel.ALIGNMENT_CENTER)
|
||||
desc.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
desc.add_text("Board: ")
|
||||
|
||||
desc.push_bold()
|
||||
|
|
@ -155,11 +155,8 @@ func _update_description():
|
|||
func _set_artwork(tex: Texture2D) -> void:
|
||||
preview.texture = tex
|
||||
|
||||
var file = File.new()
|
||||
if file.open(cached_artwork_path, File.WRITE) != OK:
|
||||
assert(false)
|
||||
var file = FileAccess.open(cached_artwork_path, FileAccess.WRITE)
|
||||
file.store_var(tex.get_data(), true)
|
||||
file.close()
|
||||
|
||||
#
|
||||
# Signals
|
||||
|
|
|
|||
1
src/NewGamePanel.gd.uid
Normal file
1
src/NewGamePanel.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dbsvkfo8rwlk3
|
||||
1
src/Piece.gd.uid
Normal file
1
src/Piece.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cqq4ynmtdbb8q
|
||||
243
src/Piece.tscn
243
src/Piece.tscn
|
|
@ -1,11 +1,11 @@
|
|||
[gd_scene load_steps=19 format=2]
|
||||
[gd_scene load_steps=19 format=3 uid="uid://b5sfgghyt7kn3"]
|
||||
|
||||
[ext_resource path="res://src/Piece.gd" type="Script" id=1]
|
||||
[ext_resource path="res://assets/artworks/escher_lizards.jpg" type="Texture2D" id=3]
|
||||
[ext_resource type="Script" uid="uid://cqq4ynmtdbb8q" path="res://src/Piece.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://b87nwpig87ssi" path="res://assets/artworks/escher_lizards.jpg" id="3"]
|
||||
|
||||
[sub_resource type="VisualShaderNodeExpression" id=1]
|
||||
[sub_resource type="VisualShaderNodeExpression" id="1"]
|
||||
output_port_for_preview = 0
|
||||
size = Vector2( 657, 584 )
|
||||
size = Vector2(657, 584)
|
||||
expression = "// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
|
||||
vec2 rel_p = input.xy - vec2(0.5, 0.5);
|
||||
float box_size = 0.4;
|
||||
|
|
@ -20,15 +20,15 @@ vec2 d_thick = abs(rel_p) - box_thick;
|
|||
float dist_thick = length(max(d_thick, 0.0)) + min(max(d_thick.x, d_thick.y), 0.0);
|
||||
is_thickness = rel_p.y > 0.0 && dist_thick > (0.5 - box_size);"
|
||||
|
||||
[sub_resource type="VisualShaderNodeColorConstant" id=2]
|
||||
constant = Color( 0.733333, 0.34902, 0.0666667, 1 )
|
||||
[sub_resource type="VisualShaderNodeColorConstant" id="2"]
|
||||
constant = Color(0.733333, 0.34902, 0.0666667, 1)
|
||||
|
||||
[sub_resource type="VisualShaderNodeSwitch" id=3]
|
||||
[sub_resource type="VisualShaderNodeSwitch" id="3"]
|
||||
output_port_for_preview = 0
|
||||
|
||||
[sub_resource type="VisualShaderNodeExpression" id=4]
|
||||
[sub_resource type="VisualShaderNodeExpression" id="4"]
|
||||
output_port_for_preview = 0
|
||||
size = Vector2( 545, 407 )
|
||||
size = Vector2(545, 407)
|
||||
expression = "float speed = 2.0;
|
||||
float delta = mod(t * speed, 3) - 1.0;
|
||||
float slope = 1.5;
|
||||
|
|
@ -37,65 +37,61 @@ if (abs(input0.x - ((1.0 - input0.y + delta) / slope)) < thickness) {
|
|||
output0 = vec3(0.5);
|
||||
}"
|
||||
|
||||
[sub_resource type="VisualShaderNodeColorOp" id=5]
|
||||
[sub_resource type="VisualShaderNodeColorOp" id="5"]
|
||||
|
||||
[sub_resource type="VisualShaderNodeInput" id=6]
|
||||
[sub_resource type="VisualShaderNodeInput" id="6"]
|
||||
input_name = "time"
|
||||
|
||||
[sub_resource type="VisualShaderNodeSwitch" id=7]
|
||||
[sub_resource type="VisualShaderNodeSwitch" id="7"]
|
||||
|
||||
[sub_resource type="VisualShaderNodeBooleanParameter" id=8]
|
||||
uniform_name = "reflection"
|
||||
[sub_resource type="VisualShaderNodeBooleanParameter" id="8"]
|
||||
parameter_name = "reflection"
|
||||
|
||||
[sub_resource type="VisualShaderNodeTexture2DParameter" id=9]
|
||||
[sub_resource type="VisualShaderNodeTexture2DParameter" id="9"]
|
||||
output_port_for_preview = 0
|
||||
uniform_name = "artwork"
|
||||
parameter_name = "artwork"
|
||||
texture_type = 1
|
||||
|
||||
[sub_resource type="VisualShaderNodeInput" id=10]
|
||||
[sub_resource type="VisualShaderNodeInput" id="10"]
|
||||
output_port_for_preview = 0
|
||||
input_name = "uv"
|
||||
|
||||
[sub_resource type="VisualShaderNodeVectorOp" id=11]
|
||||
[sub_resource type="VisualShaderNodeVectorOp" id="11"]
|
||||
output_port_for_preview = 0
|
||||
default_input_values = [ 0, Vector3( 0, 0, 0 ), 1, Vector3( 0.25, 0.25, 1 ) ]
|
||||
default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(0.25, 0.25, 1)]
|
||||
operator = 2
|
||||
|
||||
[sub_resource type="VisualShaderNodeVectorOp" id=12]
|
||||
default_input_values = [ 0, Vector3( 0, 0, 0 ), 1, Vector3( 0.8, 0.1, 0 ) ]
|
||||
[sub_resource type="VisualShaderNodeVectorOp" id="12"]
|
||||
default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(0.8, 0.1, 0)]
|
||||
|
||||
[sub_resource type="VisualShaderNodeVec3Parameter" id=13]
|
||||
uniform_name = "scale"
|
||||
[sub_resource type="VisualShaderNodeVec3Parameter" id="13"]
|
||||
parameter_name = "scale"
|
||||
|
||||
[sub_resource type="VisualShaderNodeVec3Parameter" id=14]
|
||||
uniform_name = "offset"
|
||||
[sub_resource type="VisualShaderNodeVec3Parameter" id="14"]
|
||||
parameter_name = "offset"
|
||||
|
||||
[sub_resource type="VisualShader" id=15]
|
||||
[sub_resource type="VisualShader" id="15"]
|
||||
code = "shader_type canvas_item;
|
||||
render_mode blend_mix;
|
||||
|
||||
uniform bool reflection;
|
||||
uniform sampler2D artwork : source_color;
|
||||
uniform vec3 scale;
|
||||
uniform vec3 offset;
|
||||
uniform sampler2D artwork : source_color;
|
||||
|
||||
|
||||
|
||||
void vertex() {
|
||||
// Output:0
|
||||
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
// Input:4
|
||||
vec3 n_out4p0 = vec3(UV, 0.0);
|
||||
vec2 n_out4p0 = UV;
|
||||
|
||||
|
||||
uint n_out13p0;
|
||||
uint n_out13p1;
|
||||
// Expression:13
|
||||
bool n_out13p0;
|
||||
bool n_out13p1;
|
||||
n_out13p0 = false;
|
||||
n_out13p1 = false;
|
||||
{
|
||||
// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
|
||||
vec2 rel_p = n_out4p0.xy - vec2(0.5, 0.5);
|
||||
vec2 rel_p = int(n_out4p0.x).xy - vec2(0.5, 0.5);
|
||||
float box_size = 0.4;
|
||||
vec2 box = vec2(box_size, box_size);
|
||||
vec2 d = abs(rel_p) - box; // mirroring
|
||||
|
|
@ -109,102 +105,86 @@ void fragment() {
|
|||
n_out13p1 = rel_p.y > 0.0 && dist_thick > (0.5 - box_size);
|
||||
}
|
||||
|
||||
// Color:15
|
||||
vec3 n_out15p0 = vec3(0.733333, 0.349020, 0.066667);
|
||||
float n_out15p1 = 1.000000;
|
||||
|
||||
// BooleanUniform:24
|
||||
// ColorConstant:15
|
||||
vec4 n_out15p0 = vec4(0.733333, 0.349020, 0.066667, 1.000000);
|
||||
|
||||
|
||||
// BooleanParameter:24
|
||||
bool n_out24p0 = reflection;
|
||||
|
||||
// VectorUniform:7
|
||||
|
||||
// Vector3Parameter:7
|
||||
vec3 n_out7p0 = scale;
|
||||
|
||||
// VectorOp:5
|
||||
vec3 n_out5p0 = n_out4p0 * n_out7p0;
|
||||
|
||||
// VectorUniform:8
|
||||
// VectorOp:5
|
||||
vec3 n_out5p0 = vec3(n_out4p0, 0.0) * n_out7p0;
|
||||
|
||||
|
||||
// Vector3Parameter:8
|
||||
vec3 n_out8p0 = offset;
|
||||
|
||||
|
||||
// VectorOp:6
|
||||
vec3 n_out6p0 = n_out5p0 + n_out8p0;
|
||||
|
||||
// TextureUniform:25
|
||||
vec3 n_out25p0;
|
||||
float n_out25p1;
|
||||
{
|
||||
vec4 n_tex_read = texture(artwork, n_out6p0.xy);
|
||||
n_out25p0 = n_tex_read.rgb;
|
||||
n_out25p1 = n_tex_read.a;
|
||||
}
|
||||
|
||||
// Input:22
|
||||
float n_out22p0 = TIME;
|
||||
|
||||
|
||||
int n_out19p0;
|
||||
// Expression:19
|
||||
vec3 n_out19p0;
|
||||
n_out19p0 = vec3(0.0, 0.0, 0.0);
|
||||
n_out19p0 = 0;
|
||||
{
|
||||
float speed = 2.0;
|
||||
float delta = mod(n_out22p0 * speed, 3) - 1.0;
|
||||
float slope = 1.5;
|
||||
float thickness = 0.05;
|
||||
if (abs(n_out6p0.x - ((1.0 - n_out6p0.y + delta) / slope)) < thickness) {
|
||||
if (abs(int(n_out6p0.x).x - ((1.0 - int(n_out6p0.x).y + delta) / slope)) < thickness) {
|
||||
n_out19p0 = vec3(0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ColorOp:21
|
||||
vec3 n_out21p0 = vec3(1.0) - (vec3(1.0) - n_out25p0) * (vec3(1.0) - n_out19p0);
|
||||
vec3 n_out21p0 = vec3(1.0) - (vec3(1.0) - ) * (vec3(1.0) - vec3(float(n_out19p0)));
|
||||
|
||||
// VectorSwitch:23
|
||||
vec3 n_out23p0;
|
||||
if(n_out24p0)
|
||||
{
|
||||
n_out23p0 = n_out21p0;
|
||||
}
|
||||
else
|
||||
{
|
||||
n_out23p0 = n_out25p0;
|
||||
}
|
||||
|
||||
// VectorSwitch:17
|
||||
vec3 n_out17p0;
|
||||
if(n_out13p1)
|
||||
{
|
||||
n_out17p0 = n_out15p0;
|
||||
}
|
||||
else
|
||||
{
|
||||
n_out17p0 = n_out23p0;
|
||||
}
|
||||
float n_out23p0;
|
||||
// Switch:23
|
||||
n_out23p0 = mix(, n_out21p0.x, float(n_out24p0));
|
||||
|
||||
|
||||
float n_out17p0;
|
||||
// Switch:17
|
||||
n_out17p0 = mix(n_out23p0, n_out15p0.x, float(n_out13p1 > 0u ? true : false));
|
||||
|
||||
|
||||
// Output:0
|
||||
COLOR.rgb = n_out17p0;
|
||||
COLOR.a = n_out13p0 ? 1.0 : 0.0;
|
||||
COLOR.rgb = vec3(n_out17p0);
|
||||
COLOR.a = float(n_out13p0);
|
||||
|
||||
}
|
||||
|
||||
void light() {
|
||||
// Output:0
|
||||
|
||||
}
|
||||
"
|
||||
mode = 1
|
||||
flags/light_only = false
|
||||
nodes/fragment/0/position = Vector2( 1680, 260 )
|
||||
nodes/fragment/4/node = SubResource( 10 )
|
||||
nodes/fragment/4/position = Vector2( 0, 260 )
|
||||
nodes/fragment/5/node = SubResource( 11 )
|
||||
nodes/fragment/5/position = Vector2( 280, -20 )
|
||||
nodes/fragment/6/node = SubResource( 12 )
|
||||
nodes/fragment/6/position = Vector2( 540, 140 )
|
||||
nodes/fragment/7/node = SubResource( 13 )
|
||||
nodes/fragment/7/position = Vector2( -20, 60 )
|
||||
nodes/fragment/8/node = SubResource( 14 )
|
||||
nodes/fragment/8/position = Vector2( 300, 240 )
|
||||
nodes/fragment/13/node = SubResource( 1 )
|
||||
nodes/fragment/13/position = Vector2( 340, 400 )
|
||||
nodes/fragment/13/size = Vector2( 657, 584 )
|
||||
nodes/fragment/0/position = Vector2(1680, 260)
|
||||
nodes/fragment/4/node = SubResource("10")
|
||||
nodes/fragment/4/position = Vector2(0, 260)
|
||||
nodes/fragment/5/node = SubResource("11")
|
||||
nodes/fragment/5/position = Vector2(280, -20)
|
||||
nodes/fragment/6/node = SubResource("12")
|
||||
nodes/fragment/6/position = Vector2(540, 140)
|
||||
nodes/fragment/7/node = SubResource("13")
|
||||
nodes/fragment/7/position = Vector2(-20, 60)
|
||||
nodes/fragment/8/node = SubResource("14")
|
||||
nodes/fragment/8/position = Vector2(300, 240)
|
||||
nodes/fragment/13/node = SubResource("1")
|
||||
nodes/fragment/13/position = Vector2(340, 400)
|
||||
nodes/fragment/13/size = Vector2(657, 584)
|
||||
nodes/fragment/13/input_ports = "0,1,input;"
|
||||
nodes/fragment/13/output_ports = "0,2,alpha_mask;1,2,is_thickness;"
|
||||
nodes/fragment/13/expression = "// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
|
||||
|
|
@ -220,13 +200,13 @@ vec2 box_thick = vec2(box_size, box_size - thickness);
|
|||
vec2 d_thick = abs(rel_p) - box_thick;
|
||||
float dist_thick = length(max(d_thick, 0.0)) + min(max(d_thick.x, d_thick.y), 0.0);
|
||||
is_thickness = rel_p.y > 0.0 && dist_thick > (0.5 - box_size);"
|
||||
nodes/fragment/15/node = SubResource( 2 )
|
||||
nodes/fragment/15/position = Vector2( 1480, -40 )
|
||||
nodes/fragment/17/node = SubResource( 3 )
|
||||
nodes/fragment/17/position = Vector2( 1460, 80 )
|
||||
nodes/fragment/19/node = SubResource( 4 )
|
||||
nodes/fragment/19/position = Vector2( 420, -500 )
|
||||
nodes/fragment/19/size = Vector2( 545, 407 )
|
||||
nodes/fragment/15/node = SubResource("2")
|
||||
nodes/fragment/15/position = Vector2(1480, -40)
|
||||
nodes/fragment/17/node = SubResource("3")
|
||||
nodes/fragment/17/position = Vector2(1460, 80)
|
||||
nodes/fragment/19/node = SubResource("4")
|
||||
nodes/fragment/19/position = Vector2(420, -500)
|
||||
nodes/fragment/19/size = Vector2(545, 407)
|
||||
nodes/fragment/19/input_ports = "0,1,input0;1,0,t;"
|
||||
nodes/fragment/19/output_ports = "0,1,output0;"
|
||||
nodes/fragment/19/expression = "float speed = 2.0;
|
||||
|
|
@ -236,51 +216,44 @@ float thickness = 0.05;
|
|||
if (abs(input0.x - ((1.0 - input0.y + delta) / slope)) < thickness) {
|
||||
output0 = vec3(0.5);
|
||||
}"
|
||||
nodes/fragment/21/node = SubResource( 5 )
|
||||
nodes/fragment/21/position = Vector2( 1220, -200 )
|
||||
nodes/fragment/22/node = SubResource( 6 )
|
||||
nodes/fragment/22/position = Vector2( 160, -300 )
|
||||
nodes/fragment/23/node = SubResource( 7 )
|
||||
nodes/fragment/23/position = Vector2( 1200, 20 )
|
||||
nodes/fragment/24/node = SubResource( 8 )
|
||||
nodes/fragment/24/position = Vector2( 1200, -60 )
|
||||
nodes/fragment/25/node = SubResource( 9 )
|
||||
nodes/fragment/25/position = Vector2( 840, 20 )
|
||||
nodes/fragment/connections = PackedInt32Array( 5, 0, 6, 0, 13, 0, 0, 1, 4, 0, 5, 0, 4, 0, 13, 0, 13, 1, 17, 0, 15, 0, 17, 1, 17, 0, 0, 0, 8, 0, 6, 1, 7, 0, 5, 1, 19, 0, 21, 1, 22, 0, 19, 1, 6, 0, 19, 0, 24, 0, 23, 0, 21, 0, 23, 1, 23, 0, 17, 2, 6, 0, 25, 0, 25, 0, 23, 2, 25, 0, 21, 0 )
|
||||
nodes/fragment/21/node = SubResource("5")
|
||||
nodes/fragment/21/position = Vector2(1220, -200)
|
||||
nodes/fragment/22/node = SubResource("6")
|
||||
nodes/fragment/22/position = Vector2(160, -300)
|
||||
nodes/fragment/23/node = SubResource("7")
|
||||
nodes/fragment/23/position = Vector2(1200, 20)
|
||||
nodes/fragment/24/node = SubResource("8")
|
||||
nodes/fragment/24/position = Vector2(1200, -60)
|
||||
nodes/fragment/25/node = SubResource("9")
|
||||
nodes/fragment/25/position = Vector2(840, 20)
|
||||
nodes/fragment/connections = PackedInt32Array(5, 0, 6, 0, 13, 0, 0, 1, 4, 0, 5, 0, 4, 0, 13, 0, 13, 1, 17, 0, 15, 0, 17, 1, 17, 0, 0, 0, 8, 0, 6, 1, 7, 0, 5, 1, 19, 0, 21, 1, 22, 0, 19, 1, 6, 0, 19, 0, 24, 0, 23, 0, 21, 0, 23, 1, 23, 0, 17, 2, 25, 0, 23, 2, 25, 0, 21, 0)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=16]
|
||||
shader = SubResource( 15 )
|
||||
shader_param/reflection = false
|
||||
shader_param/scale = Vector3( 0.25, 0.25, 1 )
|
||||
shader_param/offset = Vector3( 0, 0, 0 )
|
||||
shader_param/artwork = ExtResource( 3 )
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_e6sxn"]
|
||||
shader = SubResource("15")
|
||||
|
||||
[node name="Piece" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
texture = ExtResource( 3 )
|
||||
script = ExtResource("1")
|
||||
texture = ExtResource("3")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
material = SubResource( 16 )
|
||||
material = SubResource("ShaderMaterial_e6sxn")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_right = 160.0
|
||||
offset_bottom = 160.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
color = Color(0.7393426, 0.3112301, 0.2024486, 1)
|
||||
|
||||
[node name="Label" type="Label" parent="ColorRect"]
|
||||
visible = false
|
||||
clip_contents = true
|
||||
layout_mode = 0
|
||||
offset_left = 10.0
|
||||
offset_top = 10.0
|
||||
offset_right = 50.0
|
||||
offset_bottom = 50.0
|
||||
scale = Vector2( 3, 3 )
|
||||
clip_contents = true
|
||||
scale = Vector2(3, 3)
|
||||
size_flags_vertical = 1
|
||||
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "0"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
|
|
|||
1
src/Styles.gd.uid
Normal file
1
src/Styles.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cjynnh7od7kav
|
||||
|
|
@ -87,7 +87,7 @@ func _ready() -> void:
|
|||
if autoload_fresh_game:
|
||||
start_fresh()
|
||||
if artwork_texture == null:
|
||||
artwork_texture = NewGamePanel.default_artwork_texture
|
||||
artwork_texture = $NewGamePanel.default_artwork_texture
|
||||
new_game(NewGamePanel.normal_columns, NewGamePanel.normal_rows, NewGamePanel.normal_iterations, artwork_texture)
|
||||
|
||||
func _unhandled_input(event):
|
||||
|
|
@ -98,7 +98,7 @@ func _gui_input(event):
|
|||
if $AnimationPlayer.is_playing():
|
||||
# Disable input during animation
|
||||
return
|
||||
if hint_active or hint_tween.is_active():
|
||||
if hint_active or hint_tween:
|
||||
return
|
||||
|
||||
match current_state:
|
||||
|
|
@ -218,7 +218,7 @@ func sliding_piece_for_direction(direction) -> Piece:
|
|||
|
||||
if (destination.x < 0 || destination.x >= columns
|
||||
|| destination.y < 0 || destination.y >= rows):
|
||||
print("\/!\\ Impossible move")
|
||||
print("/!\\ Impossible move")
|
||||
return null
|
||||
|
||||
var piece = pieces[destination.x][destination.y]
|
||||
|
|
@ -238,7 +238,7 @@ func move_piece(direction, speed: float) -> bool:
|
|||
assert(moving_piece_animation != null)
|
||||
assert(moving_piece_animation.get_track_count() > 0)
|
||||
|
||||
var moving_piece_track_index: int = moving_piece_animation.find_track(current_animation_path)
|
||||
var moving_piece_track_index: int = moving_piece_animation.find_track(current_animation_path, Animation.TYPE_ANIMATION)
|
||||
|
||||
assert(moving_piece_track_index != -1)
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ func commit_slide(audio: bool, check_solved: bool):
|
|||
|
||||
ensure_validity()
|
||||
reset_slide()
|
||||
update()
|
||||
#update()
|
||||
if check_solved:
|
||||
check_solved()
|
||||
|
||||
|
|
@ -377,7 +377,7 @@ func save() -> Dictionary:
|
|||
func load(saved_state) -> bool:
|
||||
print("load save state: ", saved_state)
|
||||
if not saved_state.has_all(["rows", "columns", "pieces", "hidden_piece"]):
|
||||
assert(false, "Invalid save state")
|
||||
#assert(false, "Invalid save state")
|
||||
return false
|
||||
rows = saved_state["rows"]
|
||||
columns = saved_state["columns"]
|
||||
|
|
@ -447,8 +447,8 @@ func new_game(columns: int, rows: int, shuffle_iterations: int, artwork_texture:
|
|||
|
||||
func start_fresh():
|
||||
if artwork_texture == null:
|
||||
print_debug("Load texture from: ", NewGamePanel.default_artwork_path)
|
||||
artwork_texture = Utils.load_texture_from_path(NewGamePanel.default_artwork_path)
|
||||
print_debug("Load texture from: ", $NewGamePanel.default_artwork_path)
|
||||
artwork_texture = Utils.load_texture_from_path($NewGamePanel.default_artwork_path)
|
||||
|
||||
new_game(NewGamePanel.normal_columns, NewGamePanel.normal_rows, NewGamePanel.normal_iterations, artwork_texture)
|
||||
|
||||
|
|
|
|||
1
src/Taquin.gd.uid
Normal file
1
src/Taquin.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://xctq46c6kgwo
|
||||
|
|
@ -8,11 +8,8 @@ static func load_texture_from_path(path: String) -> Texture2D:
|
|||
return texture
|
||||
|
||||
static func deserialize_texture(path: String) -> Texture2D:
|
||||
var file := File.new()
|
||||
if file.open(path, File.READ) != OK:
|
||||
return null
|
||||
var file := FileAccess.open(path, FileAccess.READ)
|
||||
var img: Image = file.get_var(true)
|
||||
file.close()
|
||||
var img_tex = ImageTexture.new()
|
||||
img_tex.create_from_image(img)
|
||||
return img_tex
|
||||
|
|
|
|||
1
src/Utils.gd.uid
Normal file
1
src/Utils.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c0m3ub6h2dq8c
|
||||
Loading…
Add table
Add a link
Reference in a new issue