Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add improved FlxInputText to core Flixel #3219

Merged
merged 50 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
cce7231
Initial text input implementation
Starmapo Jun 19, 2024
9908757
Fix code climate?
Starmapo Jun 19, 2024
2922838
Add missing FLX_MOUSE check
Starmapo Jun 19, 2024
dd2ff7e
Add multiline variable
Starmapo Jun 19, 2024
54a650c
Place caret at closest character to mouse
Starmapo Jun 19, 2024
73220a2
Selection boxes + selected text color
Starmapo Jun 19, 2024
99055c7
Implement text selection with mouse & text scrolling
Starmapo Jun 20, 2024
8ea7c58
Fix selection not working correctly when mouse is out of bounds
Starmapo Jun 21, 2024
090642b
Mouse wheel scrolling
Starmapo Jun 21, 2024
20afded
Implemented double press and dragging
Starmapo Jun 21, 2024
9064680
Action callbacks
Starmapo Jun 21, 2024
2257a36
Fix "final" keyword screwing up code climate
Starmapo Jun 21, 2024
2e043ab
Various fixes & improvements
Starmapo Jun 22, 2024
febc1f3
Add `forceCase` and filterMode`
Starmapo Jun 22, 2024
abbc89b
Added background for text input
Starmapo Jun 23, 2024
9e14f27
Some improvements
Starmapo Jun 24, 2024
8010c88
Added `editable` and selectable` variables
Starmapo Jun 24, 2024
678c129
Flixel hotkeys (volume & debugger) are now disabled while inputting text
Starmapo Jun 25, 2024
21d996f
Caret flashing timer
Starmapo Jun 25, 2024
87da676
Optimized selection box sprites (only visible lines are accounted for…
Starmapo Jun 27, 2024
d286bc3
Various fixes for Flash
Starmapo Jun 27, 2024
2dfba26
Fixed text selection and scrolling on other platforms
Starmapo Jun 28, 2024
d53767f
Fixed text selection with word wrapping enabled
Starmapo Jun 28, 2024
262a7a0
Added touch support
Starmapo Jun 30, 2024
2aa0176
Added documentation
Starmapo Jul 5, 2024
9a8d3cc
Add documentation to `multiline` variable
Starmapo Jul 13, 2024
0d35d34
Add `mouseWheelEnabled` variable
Starmapo Jul 13, 2024
a0042fc
Replaced `PREVIOUS_LINE` and `NEXT_LINE` with `WORD_LEFT` and `WORD_R…
Starmapo Jul 14, 2024
6eafd06
Various fixes
Starmapo Jul 14, 2024
3126a33
Merge branch 'dev' into new-text-input
Starmapo Jul 15, 2024
9b5161a
Merge branch 'dev' into new-text-input
Starmapo Jul 15, 2024
e9fc095
Various more fixes
Starmapo Jul 15, 2024
a8d5277
Move input text "frontend" to a manager plugin
Starmapo Jul 15, 2024
14f9731
Fixed missing rename
Starmapo Jul 15, 2024
4ae5c24
Replace `callback` with `onTextChange` and `onScrollChange` signals
Starmapo Jul 16, 2024
47c1966
Move `ENTER_ACTION` over to `onEnter`
Starmapo Jul 16, 2024
070c7f0
Implement `destroy()` for FlxInputTextManager
Starmapo Jul 19, 2024
bb7f700
add onTypingAction
Geokureli Jul 23, 2024
8c05933
allow custom manager
Geokureli Jul 23, 2024
ae1644b
add setManager
Geokureli Jul 23, 2024
c3b7622
remove focus setter for setFocus
Geokureli Jul 24, 2024
2046850
better destroy/init
Geokureli Jul 24, 2024
f7895dc
use case ifs
Geokureli Jul 24, 2024
6664a93
improve mac key behavior
Geokureli Jul 24, 2024
f3d2597
fix selection start/end issue
Geokureli Jul 24, 2024
2a69a6e
remove set_hasFocus for startFocus and endFocus
Geokureli Jul 26, 2024
af4de4a
use final signals
Geokureli Jul 26, 2024
ef09deb
let openfl handle maxChars
Geokureli Jul 26, 2024
fdf3f1d
inline setters remove redundancies
Geokureli Jul 26, 2024
949f3bd
simplify caret blink
Geokureli Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions flixel/FlxG.hx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package flixel;

import openfl.Lib;
import openfl.display.DisplayObject;
import openfl.display.Stage;
import openfl.display.StageDisplayState;
import openfl.net.URLRequest;
import flixel.effects.postprocess.PostProcess;
import flixel.math.FlxMath;
import flixel.math.FlxRandom;
Expand All @@ -28,6 +23,11 @@ import flixel.system.scaleModes.RatioScaleMode;
import flixel.util.FlxCollision;
import flixel.util.FlxSave;
import flixel.util.typeLimit.NextState;
import openfl.Lib;
import openfl.display.DisplayObject;
import openfl.display.Stage;
import openfl.display.StageDisplayState;
import openfl.net.URLRequest;
#if FLX_TOUCH
import flixel.input.touch.FlxTouchManager;
#end
Expand Down
10 changes: 7 additions & 3 deletions flixel/input/keyboard/FlxKeyboard.hx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package flixel.input.keyboard;

#if FLX_KEYBOARD
import openfl.events.KeyboardEvent;
import flixel.FlxG;
import flixel.input.FlxInput;
import flixel.system.replay.CodeValuePair;
import flixel.text.FlxInputText;
import openfl.events.KeyboardEvent;

/**
* Keeps track of what keys are pressed and how with handy Bools or strings.
Expand Down Expand Up @@ -101,7 +102,7 @@ class FlxKeyboard extends FlxKeyManager<FlxKey, FlxKeyList>

// Debugger toggle
#if FLX_DEBUG
if (FlxG.game.debugger != null && inKeyArray(FlxG.debugger.toggleKeys, event))
if (FlxG.game.debugger != null && inKeyArray(FlxG.debugger.toggleKeys, event) && !FlxInputText.globalManager.isTyping)
{
FlxG.debugger.visible = !FlxG.debugger.visible;
}
Expand All @@ -114,7 +115,10 @@ class FlxKeyboard extends FlxKeyManager<FlxKey, FlxKeyList>

// Attempted to cancel the replay?
#if FLX_RECORD
if (FlxG.game.replaying && !inKeyArray(FlxG.debugger.toggleKeys, event) && inKeyArray(FlxG.vcr.cancelKeys, event))
if (FlxG.game.replaying
&& !inKeyArray(FlxG.debugger.toggleKeys, event)
&& inKeyArray(FlxG.vcr.cancelKeys, event)
&& !FlxInputText.globalManager.isTyping)
{
FlxG.vcr.cancelReplay();
}
Expand Down
3 changes: 3 additions & 0 deletions flixel/system/frontEnds/PluginFrontEnd.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package flixel.system.frontEnds;

import flixel.input.mouse.FlxMouseEvent;
import flixel.input.mouse.FlxMouseEventManager;
import flixel.text.FlxInputText;
import flixel.text.FlxInputTextManager;
import flixel.tweens.FlxTween;
import flixel.util.FlxStringUtil;
import flixel.util.FlxTimer;
Expand Down Expand Up @@ -138,6 +140,7 @@ class PluginFrontEnd
addPlugin(FlxTimer.globalManager = new FlxTimerManager());
addPlugin(FlxTween.globalManager = new FlxTweenManager());
addPlugin(FlxMouseEvent.globalManager = new FlxMouseEventManager());
addPlugin(FlxInputText.globalManager = new FlxInputTextManager());
}

/**
Expand Down
18 changes: 11 additions & 7 deletions flixel/system/frontEnds/SoundFrontEnd.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import flixel.FlxG;
import flixel.group.FlxGroup;
import flixel.input.keyboard.FlxKey;
import flixel.math.FlxMath;
import flixel.system.FlxAssets;
import flixel.sound.FlxSound;
import flixel.sound.FlxSoundGroup;
import flixel.system.FlxAssets;
import flixel.system.ui.FlxSoundTray;
import flixel.text.FlxInputText;
import flixel.util.FlxSignal;
import openfl.Assets;
import openfl.media.Sound;
Expand Down Expand Up @@ -394,12 +395,15 @@ class SoundFrontEnd
list.update(elapsed);

#if FLX_KEYBOARD
if (FlxG.keys.anyJustReleased(muteKeys))
toggleMuted();
else if (FlxG.keys.anyJustReleased(volumeUpKeys))
changeVolume(0.1);
else if (FlxG.keys.anyJustReleased(volumeDownKeys))
changeVolume(-0.1);
if (!FlxInputText.globalManager.isTyping)
{
if (FlxG.keys.anyJustReleased(muteKeys))
toggleMuted();
else if (FlxG.keys.anyJustReleased(volumeUpKeys))
changeVolume(0.1);
else if (FlxG.keys.anyJustReleased(volumeDownKeys))
changeVolume(-0.1);
}
#end
}

Expand Down
Loading
Loading