-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a88d5ed
commit 149a36e
Showing
238 changed files
with
2,510 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
extends PanelContainer | ||
|
||
signal pressed | ||
|
||
var img_normal setget set_image_normal | ||
var img_pressed | ||
var img_hover | ||
var img_margin = 0 | ||
var orig_backcol | ||
|
||
func _ready(): | ||
if img_normal: | ||
$TextureRect.texture = img_normal | ||
orig_backcol = get_stylebox("panel").bg_color | ||
|
||
|
||
get_stylebox("panel").content_margin_left = img_margin | ||
get_stylebox("panel").content_margin_right = img_margin | ||
get_stylebox("panel").content_margin_top = img_margin | ||
get_stylebox("panel").content_margin_bottom = img_margin | ||
|
||
func _on_GenericGridItem_mouse_entered(): | ||
if img_hover: | ||
$TextureRect.texture = img_hover | ||
|
||
get_stylebox("panel").bg_color = orig_backcol * 1.25 | ||
|
||
func _on_GenericGridItem_mouse_exited(): | ||
if img_normal: | ||
$TextureRect.texture = img_normal | ||
|
||
get_stylebox("panel").bg_color = orig_backcol | ||
|
||
func _on_GenericGridItem_gui_input(event): | ||
if event is InputEventMouseButton: | ||
if event.pressed and event.button_index == BUTTON_LEFT: | ||
if img_pressed: | ||
$TextureRect.texture = img_pressed | ||
emit_signal("pressed") | ||
else: | ||
$TextureRect.texture = img_normal | ||
|
||
func set_image_normal(setVal): | ||
$TextureRect.texture = setVal | ||
img_normal = setVal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,37 @@ | ||
[gd_scene format=2] | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[node name="GenericGridItem" type="TextureButton"] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
focus_mode = 0 | ||
[ext_resource path="res://Scenes/GenericGridItem.gd" type="Script" id=1] | ||
|
||
[sub_resource type="StyleBoxFlat" id=1] | ||
resource_local_to_scene = true | ||
content_margin_left = 0.0 | ||
content_margin_right = 0.0 | ||
content_margin_top = 0.0 | ||
content_margin_bottom = 0.0 | ||
bg_color = Color( 0.20976, 0.1932, 0.23, 1 ) | ||
border_width_left = 1 | ||
border_width_top = 1 | ||
border_width_right = 1 | ||
border_width_bottom = 1 | ||
border_color = Color( 1, 1, 1, 0.25098 ) | ||
shadow_color = Color( 0.117647, 0.113725, 0.133333, 1 ) | ||
shadow_size = 1 | ||
shadow_offset = Vector2( 8, 8 ) | ||
|
||
[node name="GenericGridItem" type="PanelContainer"] | ||
mouse_filter = 1 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
custom_styles/panel = SubResource( 1 ) | ||
script = ExtResource( 1 ) | ||
|
||
[node name="TextureRect" type="TextureRect" parent="."] | ||
mouse_filter = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
expand = true | ||
stretch_mode = 5 | ||
stretch_mode = 6 | ||
|
||
[connection signal="gui_input" from="." to="." method="_on_GenericGridItem_gui_input"] | ||
[connection signal="mouse_entered" from="." to="." method="_on_GenericGridItem_mouse_entered"] | ||
[connection signal="mouse_exited" from="." to="." method="_on_GenericGridItem_mouse_exited"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.