Skip to content

Commit

Permalink
Add extra charter controls (#412)
Browse files Browse the repository at this point in the history
* add new charter controls

* typo....

* boundin fix

---------

Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
  • Loading branch information
bctix and NexIsDumb authored Nov 27, 2024
1 parent 454bb73 commit 32a0eda
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions source/funkin/editors/charter/Charter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ class Charter extends UIState {
null,
{
label: "↑ Speed 25%",
keybind: [PERIOD],
onSelect: _playback_speed_raise
},
{
Expand All @@ -349,6 +350,7 @@ class Charter extends UIState {
},
{
label: "↓ Speed 25%",
keybind: [COMMA],
onSelect: _playback_speed_lower
},
null,
Expand All @@ -362,6 +364,22 @@ class Charter extends UIState {
keybind: [D],
onSelect: _playback_forward
},
{
label: "Go to start of section",
keybind: [SHIFT, S],
onSelect: _playback_section_start
},
null,
{
label: "Go back a step",
keybind: [W],
onSelect: _playback_back_step
},
{
label: "Go forward a step",
keybind: [S],
onSelect: _playback_forward_step
},
null,
{
label: "Metronome",
Expand Down Expand Up @@ -1579,6 +1597,18 @@ class Charter extends UIState {
if (FlxG.sound.music.playing) return;
Conductor.songPosition += (Conductor.beatsPerMeasure * __crochet);
}
function _playback_section_start(_) {
if(FlxG.sound.music.playing) return;
Conductor.songPosition = (Conductor.beatsPerMeasure * (60000 / Conductor.bpm)) * curMeasure;
}
function _playback_back_step(_) {
if (FlxG.sound.music.playing) return;
Conductor.songPosition -= Conductor.stepCrochet;
}
function _playback_forward_step(_) {
if (FlxG.sound.music.playing) return;
Conductor.songPosition += Conductor.stepCrochet;
}
function _song_start(_) {
if (FlxG.sound.music.playing) return;
Conductor.songPosition = 0;
Expand Down
1 change: 1 addition & 0 deletions source/funkin/editors/ui/UISlider.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class UISlider extends UISprite {

public var value(default, set):Float = 0;
public function set_value(newVal:Float):Float {
newVal = FlxMath.bound(newVal, segments[0].start, segments[segments.length-1].end);
__barProgress = __calcProgress(newVal); if (onChange != null) onChange(newVal);
if (valueStepper != null) valueStepper.value = newVal;
return value = newVal;
Expand Down

0 comments on commit 32a0eda

Please sign in to comment.