-
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.
feat: add Godot basic visualizer (#72)
- Loading branch information
Showing
23 changed files
with
917 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Normalize EOL for all files that Git considers text files. | ||
* text=auto eol=lf |
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,4 @@ | ||
# Godot 4+ specific ignores | ||
.godot/ | ||
/android/ | ||
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
extends Camera2D | ||
|
||
var is_mouse_pressed | ||
var curr_mouse_position | ||
var prev_mouse_position | ||
var next_camera_position = null | ||
var prev_camera_position = position | ||
|
||
var mouse_pressed_timer = Timer.new() | ||
const mouse_pressed_threshold: float = 0.2 | ||
const camera_drag: float = 0.05 | ||
|
||
|
||
func _ready(): | ||
mouse_pressed_timer.one_shot = true | ||
add_child(mouse_pressed_timer) | ||
|
||
prev_mouse_position = get_viewport().get_mouse_position() | ||
|
||
func _process(delta): | ||
curr_mouse_position = get_viewport().get_mouse_position() | ||
if is_mouse_pressed: | ||
next_camera_position = position - (curr_mouse_position - prev_mouse_position) / zoom | ||
elif next_camera_position: position = position + (next_camera_position - position) * camera_drag | ||
prev_mouse_position = curr_mouse_position | ||
|
||
func _input(event): | ||
if event is InputEventMouseButton: | ||
is_mouse_pressed = event.pressed | ||
if is_mouse_pressed: | ||
if mouse_pressed_timer.is_stopped(): | ||
mouse_pressed_timer.start(mouse_pressed_threshold) | ||
else: | ||
if !mouse_pressed_timer.is_stopped(): | ||
mouse_pressed_timer.stop() | ||
elif event is InputEventMouseMotion: | ||
if is_mouse_pressed: | ||
if mouse_pressed_timer.is_stopped(): | ||
prev_camera_position -= event.relative / zoom | ||
position = prev_camera_position | ||
else: | ||
prev_camera_position = position |
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,41 @@ | ||
[preset.0] | ||
|
||
name="Web" | ||
platform="Web" | ||
runnable=true | ||
advanced_options=false | ||
dedicated_server=false | ||
custom_features="" | ||
export_filter="all_resources" | ||
include_filter="" | ||
exclude_filter="" | ||
export_path="build/visualizer.html" | ||
encryption_include_filters="" | ||
encryption_exclude_filters="" | ||
encrypt_pck=false | ||
encrypt_directory=false | ||
script_export_mode=2 | ||
|
||
[preset.0.options] | ||
|
||
custom_template/debug="" | ||
custom_template/release="" | ||
variant/extensions_support=false | ||
variant/thread_support=false | ||
vram_texture_compression/for_desktop=true | ||
vram_texture_compression/for_mobile=false | ||
html/export_icon=true | ||
html/custom_html_shell="" | ||
html/head_include="" | ||
html/canvas_resize_policy=2 | ||
html/focus_canvas_on_start=true | ||
html/experimental_virtual_keyboard=false | ||
progressive_web_app/enabled=false | ||
progressive_web_app/ensure_cross_origin_isolation_headers=true | ||
progressive_web_app/offline_page="" | ||
progressive_web_app/display=1 | ||
progressive_web_app/orientation=0 | ||
progressive_web_app/icon_144x144="" | ||
progressive_web_app/icon_180x180="" | ||
progressive_web_app/icon_512x512="" | ||
progressive_web_app/background_color=Color(0, 0, 0, 1) |
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,37 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://c8va8sqjmb80f" | ||
path="res://.godot/imported/fuel.svg-29fac8b52e8845235da2498e00ec672a.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://fuel.svg" | ||
dest_files=["res://.godot/imported/fuel.svg-29fac8b52e8845235da2498e00ec672a.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 | ||
svg/scale=1.0 | ||
editor/scale_with_editor_scale=false | ||
editor/convert_colors_with_editor_theme=false |
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,8 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://q0rcij55u7bg"] | ||
|
||
[ext_resource type="Texture2D" uid="uid://c8va8sqjmb80f" path="res://fuel.svg" id="1_tg1ui"] | ||
|
||
[node name="Fuel" type="Node2D"] | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="."] | ||
texture = ExtResource("1_tg1ui") |
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,37 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://mgknilsnf8no" | ||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://icon.svg" | ||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 | ||
svg/scale=1.0 | ||
editor/scale_with_editor_scale=false | ||
editor/convert_colors_with_editor_theme=false |
Oops, something went wrong.