-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Import from project * add icon * Add icon and add blurb in readme
- Loading branch information
1 parent
a3233c3
commit 796de2d
Showing
50 changed files
with
1,047 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.DS_Store | ||
.#* | ||
*~ | ||
example/addons | ||
build |
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,2 +1,27 @@ | ||
# godot-hotbars | ||
# godot hotbars | ||
Godot Engine (v3.0) Hotbars | ||
|
||
## Running the example | ||
|
||
1. Click start menu, type `Command Prompt` | ||
1. Right-click `Command Prompt` and click on `Run as Administrator` | ||
1. Run the commands below, assuming you checked out the repo into a `Documents\src\godot-hotbars` directory. | ||
|
||
```powershell | ||
cd c:\Users\YOUR_USERNAME\Documents\src\godot-hotbars\example | ||
mklink /D addons c:\Users\YOUR_USERNAME\Documents\src\godot-hotbars\addons | ||
``` | ||
|
||
## Examples | ||
|
||
### main | ||
|
||
Programmatic creation of both horizontal and vertical hotbars using a hotbar_factory.gd | ||
|
||
### horizontal_hotbar | ||
|
||
Static, scene-based horizontal hotbar | ||
|
||
### vertical_hotbar | ||
|
||
Static, scene-based vertical hotbar |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/base_button.png-5d078388714b0cfa16ae2dabd2f2e9b5.stex" | ||
|
||
[deps] | ||
|
||
source_md5="50b3cbcdc451d6dca5009dad618dec6b" | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=true | ||
svg/scale=1.0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/base_button_01.png-1c94e8af473df0ecb0c2f2f50e65e4b5.stex" | ||
|
||
[deps] | ||
|
||
source_md5="5d283258cbef3f068297bea74fb6bd4b" | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=true | ||
svg/scale=1.0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/base_button_02.png-ede854f1fbf45504aee891e207bcc3bd.stex" | ||
|
||
[deps] | ||
|
||
source_md5="77df310c40732efc46661959e8244f87" | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=true | ||
svg/scale=1.0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/gear.png-f4315373955e44fccf72dabf71348b06.stex" | ||
|
||
[deps] | ||
|
||
source_md5="b36246746d4ca6c6d162519c433a69e4" | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=true | ||
svg/scale=1.0 |
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,9 @@ | ||
extends TextureButton | ||
|
||
export(String) var hotbar_text = "" | ||
|
||
func _ready(): | ||
set_label(hotbar_text) | ||
|
||
func set_label(text): | ||
get_node("label").set_text(text) |
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,53 @@ | ||
[gd_scene load_steps=4 format=2] | ||
|
||
[ext_resource path="res://addons/godot-hotbars/base_button_01.png" type="Texture" id=1] | ||
[ext_resource path="res://addons/godot-hotbars/hover_button_02.png" type="Texture" id=2] | ||
[ext_resource path="res://addons/godot-hotbars/hotbar_button.gd" type="Script" id=3] | ||
|
||
[node name="button" type="TextureButton"] | ||
|
||
anchor_left = 0.0 | ||
anchor_top = 0.0 | ||
anchor_right = 0.0 | ||
anchor_bottom = 0.0 | ||
rect_pivot_offset = Vector2( 0, 0 ) | ||
rect_clip_content = false | ||
mouse_filter = 0 | ||
size_flags_horizontal = 1 | ||
size_flags_vertical = 1 | ||
toggle_mode = false | ||
enabled_focus_mode = 2 | ||
shortcut = null | ||
group = null | ||
texture_normal = ExtResource( 1 ) | ||
texture_hover = ExtResource( 2 ) | ||
script = ExtResource( 3 ) | ||
_sections_unfolded = [ "Rect", "Textures" ] | ||
__meta__ = { | ||
"_edit_group_": true | ||
} | ||
hotbar_text = "1" | ||
|
||
[node name="label" type="Label" parent="."] | ||
|
||
anchor_left = 0.0 | ||
anchor_top = 0.0 | ||
anchor_right = 0.0 | ||
anchor_bottom = 0.0 | ||
margin_top = 10.0 | ||
margin_right = 32.0 | ||
margin_bottom = 24.0 | ||
rect_pivot_offset = Vector2( 0, 0 ) | ||
rect_clip_content = false | ||
mouse_filter = 2 | ||
size_flags_horizontal = 1 | ||
size_flags_vertical = 4 | ||
text = "0" | ||
align = 1 | ||
valign = 1 | ||
percent_visible = 1.0 | ||
lines_skipped = 0 | ||
max_lines_visible = -1 | ||
_sections_unfolded = [ "Anchor", "Rect" ] | ||
|
||
|
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,67 @@ | ||
const HotbarButton = preload("res://addons/godot-hotbars/hotbar_button.tscn") | ||
#const DragDrop = preload("res://addons/com.brandonlamb.ui.hotbars/drag_drop.gd") | ||
const MoveButton = preload("res://addons/godot-hotbars/move_button.tscn") | ||
|
||
const MIN_BUTTONS = 1 | ||
const MAX_BUTTONS = 10 | ||
|
||
func create(num_columns = 10, num_buttons = 10): | ||
""" | ||
Create a hotbar, add specified number of buttons | ||
""" | ||
if num_buttons < MIN_BUTTONS || num_buttons > MAX_BUTTONS: | ||
print("Invalid number of buttons for hotbar") | ||
return | ||
|
||
if num_columns > 1 && num_buttons > 1: | ||
num_columns += 1 | ||
|
||
# Create panel container to add buttons grid container and buttons | ||
var container = PanelContainer.new() | ||
# container.set_script(DragDrop) | ||
container.set_name("hotbar") | ||
|
||
# Add move button to panel container | ||
# var move_button = Button.new() | ||
# var move_button = TextureButton.new() | ||
var move_button = MoveButton.instance() | ||
move_button.use_snap = false | ||
move_button.snap_size = 64 | ||
|
||
# var t = Texture.new("res://addons/com.brandonlamb.ui.hotbars/gear.png") | ||
# t.set_path("res://addons/com.brandonlamb.ui.hotbars/gear.png") | ||
# move_button.set_normal_texture(t) | ||
|
||
move_button.set_name("move_button") | ||
# move_button.set_size(Vector2(32, 32)) | ||
# move_button.set_text(": :") | ||
# move_button.set_flat(true) | ||
# move_button.set_toggle_mode(true) | ||
|
||
# Add a grid container as a child of the panel container to provide nicely | ||
# spaced buttons | ||
var buttons = GridContainer.new() | ||
buttons.set_name("buttons") | ||
buttons.set_columns(num_columns) | ||
buttons.add_child(move_button) | ||
container.add_child(buttons) | ||
|
||
# Add buttons to hotbar as btn_0, btn_1, etc | ||
for i in range(num_buttons): | ||
var button = HotbarButton.instance() | ||
button.set_name("btn_" + str(i)) | ||
#button.set_label(str(i + 1)) | ||
button.hotbar_text = str(i + 1) | ||
button.set_size(Vector2(32, 32)) | ||
buttons.add_child(button) | ||
|
||
# Set size of panel container to the size of the grid container | ||
# as this will be used with dragging support to know the bounds of the hotbar | ||
container.set_size(buttons.get_size()) | ||
|
||
move_button.get_rect().position = Vector2(0, -20) | ||
move_button.get_rect().size = Vector2(20, 20) | ||
move_button.set_size(Vector2(20, 20)) | ||
move_button.set_position(Vector2(0, -20)) | ||
|
||
return container |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/hover_button_02.png-57ca9fe5b40d1bab11bea6e7d104f5fb.stex" | ||
|
||
[deps] | ||
|
||
source_md5="ee50b4892b89bae5d4495189f4ffe20c" | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=true | ||
svg/scale=1.0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/icon.png-7f82ba8042ee5c1e28efede8a428582b.stex" | ||
|
||
[deps] | ||
|
||
source_md5="ae7e641067601e2184afcade49abd283" | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=true | ||
svg/scale=1.0 |
Oops, something went wrong.