Skip to content

Commit

Permalink
still android shits
Browse files Browse the repository at this point in the history
- hxvlc
- sustain fix in chart editor
  • Loading branch information
charlesisfeline committed May 20, 2024
1 parent 9ba25b5 commit d1b9d4b
Show file tree
Hide file tree
Showing 29 changed files with 1,348 additions and 391 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@
"args": ["-debug", "-DANIMDEBUG", "-DFORCE_DEBUG_VERSION"]
},
{
"label": "Windows / Debug (Debug hxCodec)",
"label": "Windows / Debug (Debug hxvlc)",
"target": "windows",
"args": ["-debug", "-DHXC_LIBVLC_LOGGING", "-DFORCE_DEBUG_VERSION"]
"args": ["-debug", "-DHXVLC_LOGGING", "-DFORCE_DEBUG_VERSION"]
},
{
"label": "HashLink / Debug (Straight to Animation Editor)",
Expand Down
8 changes: 5 additions & 3 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@
<assets path='example_mods' rename='mods' embed='false' type='template' />
</section>

<assets path="art/readme.txt" rename="do NOT readme.txt" library="art"/>
<assets path="CHANGELOG.md" rename="changelog.txt" library="art"/>
<assets path="art/readme.txt" rename="do NOT readme.txt" library="art" unless="mobile"/>
<assets path="CHANGELOG.md" rename="changelog.txt" library="art" unless="mobile"/>

<assets path="assets/fonts" />

<assets path="assets/vpad" if="mobile" />

<!-- _______________________________ Libraries ______________________________ -->

<haxelib name="lime" /> <!-- Game engine backend -->
Expand All @@ -142,7 +144,7 @@
<haxelib name="flixel-text-input" /> <!-- Improved text field rendering for HaxeUI -->
<haxelib name="polymod" /> <!-- Modding framework -->
<haxelib name="flxanimate" /> <!-- Texture atlas rendering -->
<haxelib name="hxCodec" if="desktop || mobile" unless="hl" /> <!-- Video playback, planning to switch to hxvlc soon -->
<haxelib name="hxvlc" if="desktop || mobile" unless="hl" /> <!-- Video playback, planning to switch to hxvlc soon -->
<haxelib name="discord_rpc" if="desktop" unless="hl" /> <!-- Discord RPC -->
<haxelib name="extension-androidtools" if="android" /> <!-- Android Functions -->
<haxelib name="funkin.vis"/> <!-- Used for Nene/ABot, only works on web platforms for now -->
Expand Down
2 changes: 1 addition & 1 deletion assets
8 changes: 3 additions & 5 deletions hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@
"version": "2.5.0"
},
{
"name": "hxCodec",
"type": "git",
"dir": null,
"ref": "61b98a7a353b7f529a8fec84ed9afc919a2dffdd",
"url": "https://github.com/FunkinCrew/hxCodec"
"name": "hxvlc",
"type": "haxelib",
"version": "1.5.2"
},
{
"name": "hxcpp",
Expand Down
2 changes: 2 additions & 0 deletions source/funkin/InitState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class InitState extends FlxState
funkin.util.plugins.VolumePlugin.initialize();
funkin.util.plugins.WatchPlugin.initialize();

funkin.util.plugins.VirtualGamepadPlugin.initialize();

//
// GAME DATA PARSING
//
Expand Down
4 changes: 2 additions & 2 deletions source/funkin/graphics/video/FlxVideo.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import openfl.net.NetStream;

/**
* Plays a video via a NetStream. Only works on HTML5.
* This does NOT replace hxCodec, nor does hxCodec replace this.
* hxCodec only works on desktop and does not work on HTML5!
* This does NOT replace hxvlc, nor does hxvlc replace this.
* hxvlc only works on desktop and does not work on HTML5!
*/
class FlxVideo extends FunkinSprite
{
Expand Down
155 changes: 114 additions & 41 deletions source/funkin/input/Controls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import flixel.math.FlxAngle;
import flixel.math.FlxPoint;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
/* #if mobile
import funkin.mobile.FunkinButton;
import funkin.mobile.FunkinHitbox;
import funkin.mobile.FunkinVirtualPad;
#end */
import lime.ui.Haptic;

/**
Expand Down Expand Up @@ -321,6 +326,78 @@ class Controls extends FlxActionSet
setKeyboardScheme(scheme, false);
}

/* #if mobile
public var trackedInputs:Array<FlxActionInput> = [];
public function addButton(action:FlxActionDigital, button:FunkinButton, state:FlxInputState):Void
{
final input:FlxActionInputDigitalIFlxInput = new FlxActionInputDigitalIFlxInput(button, state);
trackedInputs.push(input);
action.add(input);
}
public function setHitbox(hitbox:FunkinHitbox):Void
{
inline forEachBound(Control.NOTE_LEFT, (action, state) -> addButton(action, hitbox.hints[0], state));
inline forEachBound(Control.NOTE_DOWN, (action, state) -> addButton(action, hitbox.hints[1], state));
inline forEachBound(Control.NOTE_UP, (action, state) -> addButton(action, hitbox.hints[2], state));
inline forEachBound(Control.NOTE_RIGHT, (action, state) -> addButton(action, hitbox.hints[3], state));
}
public function setVPad(vPad:FunkinVirtualPad, dPad:FunkinDPadMode, action:FunkinActionMode):Void
{
switch (dPad)
{
case UP_DOWN:
inline forEachBound(Control.UI_UP, (action, state) -> addButton(action, vPad.buttonUp, state));
inline forEachBound(Control.UI_DOWN, (action, state) -> addButton(action, vPad.buttonDown, state));
case LEFT_RIGHT:
inline forEachBound(Control.UI_LEFT, (action, state) -> addButton(action, vPad.buttonLeft, state));
inline forEachBound(Control.UI_RIGHT, (action, state) -> addButton(action, vPad.buttonRight, state));
case UP_LEFT_RIGHT:
inline forEachBound(Control.UI_UP, (action, state) -> addButton(action, vPad.buttonUp, state));
inline forEachBound(Control.UI_LEFT, (action, state) -> addButton(action, vPad.buttonLeft, state));
inline forEachBound(Control.UI_RIGHT, (action, state) -> addButton(action, vPad.buttonRight, state));
case LEFT_FULL | RIGHT_FULL:
inline forEachBound(Control.UI_UP, (action, state) -> addButton(action, vPad.buttonUp, state));
inline forEachBound(Control.UI_DOWN, (action, state) -> addButton(action, vPad.buttonDown, state));
inline forEachBound(Control.UI_LEFT, (action, state) -> addButton(action, vPad.buttonLeft, state));
inline forEachBound(Control.UI_RIGHT, (action, state) -> addButton(action, vPad.buttonRight, state));
case NONE: // do nothing
}
switch (action)
{
case A:
inline forEachBound(Control.ACCEPT, (action, state) -> addButton(action, vPad.buttonA, state));
case B:
inline forEachBound(Control.BACK, (action, state) -> addButton(action, vPad.buttonB, state));
case A_B | A_B_C | A_B_X_Y | A_B_C_X_Y_Z:
inline forEachBound(Control.ACCEPT, (action, state) -> addButton(action, vPad.buttonA, state));
inline forEachBound(Control.BACK, (action, state) -> addButton(action, vPad.buttonB, state));
case NONE: // do nothing
}
}
public function removeVControlsInput(tInputs:Array<FlxActionInput>):Void
{
for (action in digitalActions)
{
var i:Int = action.inputs.length;
while (i-- > 0)
{
var j:Int = tInputs.length;
while (j-- > 0)
{
if (tInputs[j] == action.inputs[i]) action.remove(action.inputs[i]);
}
}
}
}
#end
*/
override function update()
{
super.update();
Expand Down Expand Up @@ -635,11 +712,10 @@ class Controls extends FlxActionSet
forEachBound(control, function(action, state) addKeys(action, keys, state));
}

public function bindSwipe(control:Control, swipeDir:Int = FlxDirectionFlags.UP, ?swpLength:Float = 90)
{
forEachBound(control, function(action, press) action.add(new FlxActionInputDigitalMobileSwipeGameplay(swipeDir, press, swpLength)));
}

/* public function bindSwipe(control:Control, swipeDir:Int = FlxDirectionFlags.UP, ?swpLength:Float = 90)
{
forEachBound(control, function(action, press) action.add(new FlxActionInputDigitalMobileSwipeGameplay(swipeDir, press, swpLength)));
}*/
/**
* Sets all actions that pertain to the binder to trigger when the supplied keys are used.
* If binder is a literal you can inline this
Expand Down Expand Up @@ -696,7 +772,7 @@ class Controls extends FlxActionSet
bindKeys(Control.VOLUME_MUTE, getDefaultKeybinds(scheme, Control.VOLUME_MUTE));
bindKeys(Control.FULLSCREEN, getDefaultKeybinds(scheme, Control.FULLSCREEN));

bindMobileLol();
// bindMobileLol();
}

function getDefaultKeybinds(scheme:KeyboardScheme, control:Control):Array<FlxKey>
Expand Down Expand Up @@ -785,30 +861,29 @@ class Controls extends FlxActionSet
return [];
}

function bindMobileLol()
{
#if FLX_TOUCH
// MAKE BETTER TOUCH BIND CODE

bindSwipe(Control.NOTE_UP, FlxDirectionFlags.UP, 40);
bindSwipe(Control.NOTE_DOWN, FlxDirectionFlags.DOWN, 40);
bindSwipe(Control.NOTE_LEFT, FlxDirectionFlags.LEFT, 40);
bindSwipe(Control.NOTE_RIGHT, FlxDirectionFlags.RIGHT, 40);

// feels more like drag when up/down are inversed
bindSwipe(Control.UI_UP, FlxDirectionFlags.DOWN);
bindSwipe(Control.UI_DOWN, FlxDirectionFlags.UP);
bindSwipe(Control.UI_LEFT, FlxDirectionFlags.LEFT);
bindSwipe(Control.UI_RIGHT, FlxDirectionFlags.RIGHT);
#end
/* function bindMobileLol()
{
#if FLX_TOUCH
// MAKE BETTER TOUCH BIND CODE
#if android
forEachBound(Control.BACK, function(action, pres) {
action.add(new FlxActionInputDigitalAndroid(FlxAndroidKey.BACK, JUST_PRESSED));
});
#end
}
bindSwipe(Control.NOTE_UP, FlxDirectionFlags.UP, 40);
bindSwipe(Control.NOTE_DOWN, FlxDirectionFlags.DOWN, 40);
bindSwipe(Control.NOTE_LEFT, FlxDirectionFlags.LEFT, 40);
bindSwipe(Control.NOTE_RIGHT, FlxDirectionFlags.RIGHT, 40);
// feels more like drag when up/down are inversed
bindSwipe(Control.UI_UP, FlxDirectionFlags.DOWN);
bindSwipe(Control.UI_DOWN, FlxDirectionFlags.UP);
bindSwipe(Control.UI_LEFT, FlxDirectionFlags.LEFT);
bindSwipe(Control.UI_RIGHT, FlxDirectionFlags.RIGHT);
#end
#if android
forEachBound(Control.PAUSE, function(action, pres) {
action.add(new FlxActionInputDigitalAndroid(FlxAndroidKey.BACK, JUST_RELEASED));
});
#end
}*/
function removeKeyboard()
{
for (action in this.digitalActions)
Expand Down Expand Up @@ -948,13 +1023,12 @@ class Controls extends FlxActionSet
forEachBound(control, function(action, state) addButtons(action, buttons, state, id));
}

public function touchShit(control:Control, id)
{
forEachBound(control, function(action, state) {
// action
});
}

/* public function touchShit(control:Control, id)
{
forEachBound(control, function(action, state) {
// action
});
}*/
/**
* Sets all actions that pertain to the binder to trigger when the supplied keys are used.
* If binder is a literal you can inline this
Expand Down Expand Up @@ -1316,8 +1390,8 @@ class FunkinAction extends FlxActionDigital
}
}

class FlxActionInputDigitalMobileSwipeGameplay extends FlxActionInputDigital
{
/*class FlxActionInputDigitalMobileSwipeGameplay extends FlxActionInputDigital
{
var touchMap:Map<Int, Swipes> = new Map();
var vibrationSteps:Int = 5;
Expand Down Expand Up @@ -1387,13 +1461,13 @@ class FlxActionInputDigitalMobileSwipeGameplay extends FlxActionInputDigital
touchMap.remove(touch.touchPointID);
}
/* switch (inputID)
switch (inputID)
{
case FlxDirectionFlags.UP:
return
case FlxDirectionFlags.DOWN:
}
*/
}
#end
}
Expand Down Expand Up @@ -1435,8 +1509,7 @@ class FlxActionInputDigitalMobileSwipeGameplay extends FlxActionInputDigital
swipe.initTouchPos.set(swipe.curTouchPos.x, swipe.curTouchPos.y);
return true;
}
}

}*/
// Maybe this can be committed to main HaxeFlixel repo?
#if android
class FlxActionInputDigitalAndroid extends FlxActionInputDigital
Expand Down
Loading

0 comments on commit d1b9d4b

Please sign in to comment.