Everything seems to work

This commit is contained in:
Oleksiy 2021-10-30 21:58:27 +03:00
parent 64bcda5ec8
commit ef82795615
19 changed files with 226 additions and 33 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
TapTapTapTap.apk
TapTapTapTap.apk.idsig

BIN
Button Pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

34
Button Pressed.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Button Pressed.png-acc2bc337bb9dfcad2aec007d83448b3.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Button Pressed.png"
dest_files=[ "res://.import/Button Pressed.png-acc2bc337bb9dfcad2aec007d83448b3.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

34
Button.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Button.png-db95f38c36cb47c93767cda66da72387.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Button.png"
dest_files=[ "res://.import/Button.png-db95f38c36cb47c93767cda66da72387.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Inter-Black.otf Normal file

Binary file not shown.

BIN
Inter-Regular.otf Normal file

Binary file not shown.

35
Main.gd
View File

@ -3,23 +3,24 @@ extends Control
var times = []
var i = 0
var bpm: float
onready var button = $Button
onready var DisplayBPM = $Label
onready var BPMNumber = $"BPMNumber"
func _ready():
button.connect("pressed", self, "_button_pressed")
func _button_pressed():
func count():
times.append(OS.get_ticks_usec())
if (i!=0):
var delta = times[i]-times[i-1]
print(delta)
if (i > 8 && delta > 240000000 / bpm):
i = 0
bpm = 0
else:
bpm = 60000000 / delta
i += 1
DisplayBPM.text = str(bpm) + "BPM"
else:
var avgDelta
#RESET STUFF THAT DIDN'T WORK
#var delta
#if (avgDelta && delta>(avgDelta*2)):
# i=0
# times.clear()
# bpm=0
#print(str(delta) + " " + str(avgDelta))
if (i>3):
avgDelta = ((times[i]-times[i-1]) + (times[i-1]-times[i-2]) + (times[i-2]-times[i-3]) + (times[i-3]-times[i-4]))/4
bpm = 60000000 / avgDelta
BPMNumber.text = str(bpm) + "BPM"
# delta = (times[i]-times[i-1])
i += 1
func _on_Tap_button_down():
count()

View File

@ -1,6 +1,13 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Main.gd" type="Script" id=1]
[ext_resource path="res://Button.png" type="Texture" id=2]
[ext_resource path="res://Button Pressed.png" type="Texture" id=3]
[ext_resource path="res://Inter-Black.otf" type="DynamicFontData" id=4]
[sub_resource type="DynamicFont" id=1]
size = 128
font_data = ExtResource( 4 )
[node name="Control" type="Control"]
anchor_left = 0.5
@ -16,12 +23,17 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="."]
[node name="BPMNumber" type="Label" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
margin_left = -147.0
margin_right = 147.0
margin_bottom = 141.0
anchor_bottom = 0.5
margin_left = -261.0
margin_top = -469.0
margin_right = 262.0
margin_bottom = -314.0
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 1, 0.486275, 0, 1 )
text = "--"
align = 1
valign = 1
@ -29,16 +41,19 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Button" type="Button" parent="."]
[node name="TapButton" type="TextureButton" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -310.0
margin_top = -133.0
margin_right = 310.0
margin_bottom = 132.0
text = "Tap"
margin_left = -510.0
margin_top = -206.0
margin_right = 510.0
margin_bottom = 814.0
texture_normal = ExtResource( 2 )
texture_pressed = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="button_down" from="TapButton" to="." method="_on_Tap_button_down"]

0
README.MD Normal file
View File

BIN
Splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

34
Splash.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Splash.png-a2c00b34950005c5d52b66725d00fc48.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Splash.png"
dest_files=[ "res://.import/Splash.png-a2c00b34950005c5d52b66725d00fc48.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
adaptive-icon-bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/adaptive-icon-bg.png-fce29ad796cd4d22acea1631bf4ccf25.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://adaptive-icon-bg.png"
dest_files=[ "res://.import/adaptive-icon-bg.png-fce29ad796cd4d22acea1631bf4ccf25.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
adaptive-icon-fg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/adaptive-icon-fg.png-62e92cc71449296474250401da45150b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://adaptive-icon-fg.png"
dest_files=[ "res://.import/adaptive-icon-fg.png-62e92cc71449296474250401da45150b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -33,16 +33,16 @@ version/name="1.0"
package/unique_name="org.godotengine.$genname"
package/name=""
package/signed=true
launcher_icons/main_192x192=""
launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
launcher_icons/main_192x192="res://icon.png"
launcher_icons/adaptive_foreground_432x432="res://adaptive-icon-fg.png"
launcher_icons/adaptive_background_432x432="res://adaptive-icon-bg.png"
graphics/32_bits_framebuffer=true
graphics/opengl_debug=false
xr_features/xr_mode=0
xr_features/degrees_of_freedom=0
xr_features/hand_tracking=0
xr_features/focus_awareness=false
screen/immersive_mode=true
screen/immersive_mode=false
screen/support_small=true
screen/support_normal=true
screen/support_large=true

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -12,6 +12,9 @@ config_version=4
config/name="TapTapTapTap"
run/main_scene="res://Main.tscn"
boot_splash/image="res://Splash.png"
boot_splash/fullsize=false
boot_splash/bg_color=Color( 0, 0, 0, 1 )
config/icon="res://icon.png"
[display]
@ -30,4 +33,5 @@ common/enable_pause_aware_picking=true
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0, 0, 0, 1 )
environment/default_environment="res://default_env.tres"