diff --git a/InputHandler.gd b/InputHandler.gd index fa397aa..f47f02a 100644 --- a/InputHandler.gd +++ b/InputHandler.gd @@ -51,6 +51,10 @@ func print_pressed(col: int): ########################################################################## # draw fingers points on screen func _draw(): + var fps = Performance.get_monitor(Performance.TIME_FPS) + var audio_latency = Performance.get_monitor(Performance.AUDIO_OUTPUT_LATENCY) + set_text("FPS: %.0f\nAudio Latency: %.2fms"%[fps, audio_latency*1000]) + # draw points for i in touch_points: var point = touch_points[i] @@ -64,6 +68,9 @@ func _draw(): # # Draw line # draw_line(touch_positions[i], touch_positions[i+1], Color(1,1,1,1)) +func _process(delta): + update() + func update_data(): touch_positions.clear() for i in touch_points: @@ -119,7 +126,7 @@ func _input(event): # write how many fingers are tapping the screen func set_fingers(value): fingers = max(value, 0) - set_text("Fingers: %d" % fingers) +# set_text("Fingers: %d" % fingers) func set_button_state(index: int, state: bool): var new_state = int(state) diff --git a/Menu.gd b/Menu.gd index c6a5a64..cd6d092 100644 --- a/Menu.gd +++ b/Menu.gd @@ -106,7 +106,7 @@ func _ready(): print("Root for songs and scores is: ", userroot) scan_library() $"/root/main/NoteHandler".connect("finished_song", self, "finished_song") - load_score("20191211T234131.json") # For testing purposes +# load_score("20191211T234131.json") # For testing purposes # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): @@ -202,6 +202,7 @@ func _draw_song_select(center: Vector2) -> Array: return touchrects func _draw_chart_select(center: Vector2) -> Array: + # Select difficulty for chosen song var size = 192 var spacer_x = 12 var touchrects = [] @@ -214,6 +215,20 @@ func _draw_chart_select(center: Vector2) -> Array: x += size + spacer_x draw_string_centered(TitleFont, Vector2(center.x, center.y+size+64), song_defs[song_key]["title"], Color(0.95, 0.95, 1.0)) touchrects.append({rect=Rect2(center.x-450.0, center.y+310.0, 900.0, 300.0), chart_idx=-1}) + + + # TODO: This is relatively expensive so we probably want to calculate this stuff once instead of every frame + var all_notes = FileLoader.SRT.load_file(song_defs[song_key].directory + "/" + song_defs[song_key].chart_filelist[selected_difficulty]) + var note_counts = {Note.NOTE_TAP: 0, Note.NOTE_HOLD: 0, Note.NOTE_SLIDE: 0} + for note in all_notes: + note_counts[note.type] += 1 + + var notestrs = ["Taps:", "Holds:", "Slides:"] + var notetypes = [0, 1, 2] + for i in len(notestrs): + draw_string_centered(TitleFont, Vector2(center.x-50, center.y+size+128+i*50), notestrs[i], Color(0.95, 0.95, 1.0)) + draw_string_centered(TitleFont, Vector2(center.x+50, center.y+size+128+i*50), str(note_counts[notetypes[i]]), Color(0.95, 0.95, 1.0)) + return touchrects func _draw_score_screen(center: Vector2) -> Array: diff --git a/Note.gd b/Note.gd index 5e2e32c..297c754 100644 --- a/Note.gd +++ b/Note.gd @@ -7,7 +7,6 @@ enum {NOTE_TAP, NOTE_HOLD, NOTE_SLIDE, NOTE_ARROW, NOTE_TOUCH, NOTE_TOUCH_HOLD, enum SlideType {CHORD, ARC_CW, ARC_ACW} const DEATH_DELAY := 1.0 # This is touchy with the judgement windows and variable bpm. const RELEASE_SCORE_TYPES := [NOTE_HOLD, NOTE_SLIDE, NOTE_TOUCH_HOLD, NOTE_ROLL] -const NOTE_TAP1 = 0 class NoteBase: var time_hit: float setget set_time_hit diff --git a/Receptors.gd b/Receptors.gd index 5f1552f..4ccc645 100644 --- a/Receptors.gd +++ b/Receptors.gd @@ -115,10 +115,7 @@ func _draw(): var ideal_ring_area = PI * (pow(GameTheme.receptor_ring_radius+receptor_px/2+shadow_px, 2) - pow(GameTheme.receptor_ring_radius-receptor_px/2-shadow_px, 2)) var quad_area = 4*pow(GameTheme.receptor_ring_radius+receptor_px/2+shadow_px, 2) - var fps = Performance.get_monitor(Performance.TIME_FPS) - var audio_latency = Performance.get_monitor(Performance.AUDIO_OUTPUT_LATENCY) # $"/root/main/InputHandler".text = "Vertices: %d*2 Skew: %.3f\nArea: %.0f\n(%.0f%% ideal ring)\n(%.0f%% quad)\nFPS: %.0f"%[mesh_v, skew, estimated_area, 100.0*estimated_area/ideal_ring_area, 100.0*estimated_area/quad_area, fps] - $"/root/main/InputHandler".text = "FPS: %.0f\nAudio Latency: %.2fms"%[fps, audio_latency*1000] material.set_shader_param("dot_radius", 0.5*receptor_px/GameTheme.receptor_ring_radius) material.set_shader_param("line_thickness", 0.5*ring_px/GameTheme.receptor_ring_radius) @@ -135,18 +132,20 @@ func set_ring_skew(skew: int): ring_skew = skew update_ring_mesh() -func _ready(): +func set_receptor_positions(skew:=0.0): var receptor_array_image := Image.new() receptor_array_image.create(8, 8, false, Image.FORMAT_RF) receptor_array_image.lock() for i in Rules.COLS: - receptor_array_image.set_pixel(i%8, i/8, Color(GameTheme.RADIAL_COL_ANGLES[i], 0.0, 0.0)) + receptor_array_image.set_pixel(i%8, i/8, Color(GameTheme.RADIAL_COL_ANGLES[i]+skew, 0.0, 0.0)) receptor_array_image.unlock() var receptor_data_tex = ImageTexture.new() receptor_data_tex.create_from_image(receptor_array_image, 0) set_texture(receptor_data_tex) material.set_shader_param("num_receptors", Rules.COLS) +func _ready(): + set_receptor_positions() update_ring_mesh() # $"../InputHandler/VerticesSlider".connect("value_changed", self, "set_ring_vertex_count") # $"../InputHandler/SkewSlider".connect("value_changed", self, "set_ring_skew") @@ -154,4 +153,5 @@ func _ready(): func _process(delta): if not Engine.editor_hint: + set_receptor_positions(sin(OS.get_ticks_msec()*0.001*0.0125*PI)*PI) update() diff --git a/assets/MenuScoreFont.tres b/assets/MenuScoreFont.tres new file mode 100644 index 0000000..3c27304 --- /dev/null +++ b/assets/MenuScoreFont.tres @@ -0,0 +1,12 @@ +[gd_resource type="DynamicFont" load_steps=3 format=2] + +[ext_resource path="res://assets/NotoSans-Regular.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://assets/NotoSansJP-Regular.otf" type="DynamicFontData" id=2] + +[resource] +size = 96 +outline_size = 2 +outline_color = Color( 0, 0, 0, 1 ) +use_filter = true +font_data = ExtResource( 2 ) +fallback/0 = ExtResource( 1 ) diff --git a/assets/NotoSans.tres b/assets/NotoSans.tres new file mode 100644 index 0000000..ea93b27 --- /dev/null +++ b/assets/NotoSans.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/NotoSans-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 32 +font_data = ExtResource( 1 ) diff --git a/assets/miss.wav b/assets/miss.wav new file mode 100644 index 0000000..20f963b Binary files /dev/null and b/assets/miss.wav differ diff --git a/export_presets.cfg b/export_presets.cfg index a64cb66..18530ee 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -7,7 +7,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="/home/luke/Rhythm.x86_64" +export_path="../../Rhythm.x86_64" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" @@ -20,6 +20,7 @@ texture_format/etc=false texture_format/etc2=false texture_format/no_bptc_fallbacks=true binary_format/64_bits=true +binary_format/embed_pck=false custom_template/release="" custom_template/debug="" @@ -32,7 +33,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="/home/luke/Rhythm.apk" +export_path="../../Rhythm.apk" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" @@ -40,9 +41,13 @@ script_encryption_key="" [preset.1.options] graphics/32_bits_framebuffer=true +xr_features/xr_mode=0 +xr_features/degrees_of_freedom=0 +xr_features/hand_tracking=0 one_click_deploy/clear_previous_install=false -custom_package/debug="" -custom_package/release="" +custom_template/debug="" +custom_template/release="" +custom_template/use_custom_build=false command_line/extra_args="" version/code=1 version/name="1.0" @@ -56,11 +61,9 @@ screen/support_normal=true screen/support_large=true screen/support_xlarge=true screen/opengl_debug=false -launcher_icons/xxxhdpi_192x192="" -launcher_icons/xxhdpi_144x144="" -launcher_icons/xhdpi_96x96="" -launcher_icons/hdpi_72x72="" -launcher_icons/mdpi_48x48="" +launcher_icons/main_192x192="" +launcher_icons/adaptive_foreground_432x432="" +launcher_icons/adaptive_background_432x432="" keystore/debug="" keystore/debug_user="" keystore/debug_password="" @@ -220,3 +223,26 @@ permissions/write_sms=false permissions/write_social_stream=false permissions/write_sync_settings=false permissions/write_user_dictionary=true + +[preset.2] + +name="HTML5" +platform="HTML5" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.2.options] + +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=false +html/custom_html_shell="" +html/head_include="" +custom_template/release="" +custom_template/debug="" diff --git a/main.tscn b/main.tscn index 2dc7b9c..0916543 100644 --- a/main.tscn +++ b/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=2] +[gd_scene load_steps=22 format=2] [ext_resource path="res://main.gd" type="Script" id=1] [ext_resource path="res://video.gd" type="Script" id=2] @@ -17,7 +17,6 @@ [ext_resource path="res://Bezel.gd" type="Script" id=15] [ext_resource path="res://assets/NotoSans.tres" type="DynamicFont" id=16] [ext_resource path="res://InputHandler.gd" type="Script" id=17] -[ext_resource path="res://assets/test/TIT FOR TAT.avi" type="VideoStream" id=18] [sub_resource type="ShaderMaterial" id=1] shader = ExtResource( 4 ) @@ -62,18 +61,6 @@ __meta__ = { "_edit_vertical_guides_": [ ] } -[node name="VideoPlayer" type="VideoPlayer" parent="."] -visible = false -margin_left = -640.0 -margin_top = -360.0 -margin_right = 640.0 -margin_bottom = 360.0 -stream = ExtResource( 18 ) -volume_db = -80.0 -__meta__ = { -"_edit_use_anchors_": false -} - [node name="music" type="AudioStreamPlayer" parent="."] [node name="video" type="VideoPlayer" parent="."] @@ -92,6 +79,7 @@ __meta__ = { } [node name="ScreenFilter" type="Node2D" parent="."] +visible = false script = ExtResource( 3 ) [node name="Receptors" type="MeshInstance2D" parent="."] @@ -152,7 +140,8 @@ margin_top = -540.0 margin_right = 540.0 margin_bottom = 540.0 custom_fonts/font = ExtResource( 16 ) -text = "Fingers on the screen:" +text = "FPS: +Audio Latency:" script = ExtResource( 17 ) __meta__ = { "_edit_use_anchors_": false @@ -163,6 +152,9 @@ margin_top = 136.0 margin_right = 116.0 margin_bottom = 150.0 text = "Subsampling (X, Y)" +__meta__ = { +"_edit_use_anchors_": false +} [node name="SSXSlider" type="HSlider" parent="InputHandler"] margin_left = 10.0 @@ -202,11 +194,20 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="Label2" type="Label" parent="InputHandler"] +margin_top = 200.0 +margin_right = 133.0 +margin_bottom = 214.0 +text = "Screen Filter Opacity" +__meta__ = { +"_edit_use_anchors_": false +} + [node name="FilterSlider" type="HSlider" parent="InputHandler"] margin_left = 16.0 -margin_top = 400.0 +margin_top = 218.0 margin_right = 316.0 -margin_bottom = 416.0 +margin_bottom = 234.0 max_value = 1.0 step = 0.01 value = 0.2 diff --git a/project.godot b/project.godot index c648e86..a886a63 100644 --- a/project.godot +++ b/project.godot @@ -35,6 +35,7 @@ SFXPlayer="*res://SFXPlayer.gd" [debug] +settings/fps/force_fps=120 gdscript/warnings/unused_variable=false gdscript/warnings/shadowed_variable=false gdscript/warnings/unused_argument=false @@ -47,7 +48,6 @@ gdscript/warnings/integer_division=false window/size/width=1920 window/size/height=1080 window/size/fullscreen=true -window/vsync/use_vsync=false window/handheld/orientation="sensor" window/stretch/mode="2d" window/stretch/aspect="keep_height" @@ -60,6 +60,6 @@ singletons_disabled=[ ] [rendering] vram_compression/import_etc=true -environment/default_clear_color=Color( 0, 0, 0, 1 ) +environment/default_clear_color=Color( 0.16, 0.16, 0.16, 1 ) quality/filters/msaa=1 environment/default_environment="res://default_env.tres"