Adventure Game Studio | Forums

AGS Support => Modules, Plugins & Tools => Topic started by: Snarky on Wed 28/03/2018 15:39:51

Title: MODULE: TextField v1.2.0
Post by: Snarky on Wed 28/03/2018 15:39:51
This is a quick little module I made for the AGS Awards client. It provides one-line text input fields, as a replacement for the AGS TextInput control.

Ways in which TextField is better than TextInput:
-It has a blinking text cursor
-You can position the cursor anywhere in the text (using mouse or arrow keys), and edit at that point
-It has a notion of focus, so that you can have multiple TextFields displayed without all the text being entered into all the fields
-You can define a max string length the field will accept
-You can make the border partially transparent
-You can add more advanced logic to it, e.g. to only accept certain character types, or to *** out the display of the text

Ways in which TextField is worse than TextInput:
-It's implemented in script, so on slow computers or in a resource-intensive game it could be less responsive than TextInput
-You have to do a little bit of setup to make it work
-You can't link the OnActivate event, so it's a little more complicated to respond when the player presses Return/Enter

The TextField module is available on Github (https://github.com/messengerbag/TextField).

Download TextField v1.2.0 (https://github.com/messengerbag/TextField/releases/download/v1.2.0/TextField-1.2.0.scm)

You can also try it out in a demo game for the Clipboard plugin:

Download Clipboard Demo (https://github.com/messengerbag/Clipboard/releases/download/v0.4/Clipboard.Demo.zip)

Changelog:
1.2.0 (https://github.com/messengerbag/TextField/releases/tag/v1.2.0)
- Fixes crash if TextField initialized with non-empty String
- Adds support for Clipboard plugin (http://www.adventuregamestudio.co.uk/forums/index.php?topic=55922.0)

1.1.0 (https://github.com/messengerbag/TextField/releases/tag/v1.1.0)
- Initial release
- Fixes poor SHIFT-key detection

1.0.0
- Unreleased (used in AGS Awards 2017 client)
Title: Re: MODULE: TextField v1.1.0
Post by: selmiak on Wed 28/03/2018 17:19:03
nice. What I really missed during the awards ceremony was copy+paste. Is it possible to implement this?
Title: Re: MODULE: TextField v1.1.0
Post by: Snarky on Wed 28/03/2018 17:42:57
It would be pretty easy to do copy-paste between different text fields within an AGS game, but presumably you mean copy-paste from other applications.

That would require a plugin, in order to access the Windows clipboard. I have looked into it a tiny bit, and it's probably not very hard if you know your way around the APIs and libraries and build processes, but... I don't.

See thread here: http://www.adventuregamestudio.co.uk/forums/index.php?topic=55797.0
Title: Re: MODULE: TextField v1.1.0
Post by: arj0n on Thu 29/03/2018 15:27:09
Haven't tested this yet, but it looks like this could be very useful for textparser games. Thanx for making this!
Title: Re: MODULE: TextField v1.2.0
Post by: Snarky on Fri 30/03/2018 14:18:59
Quote from: selmiak on Wed 28/03/2018 17:19:03
nice. What I really missed during the awards ceremony was copy+paste. Is it possible to implement this?
Quote from: Snarky on Wed 28/03/2018 17:42:57
That would require a plugin, in order to access the Windows clipboard. I have looked into it a tiny bit, and it's probably not very hard if you know your way around the APIs and libraries and build processes, but... I don't.

I decided to go ahead and figure it out, and here's (http://www.adventuregamestudio.co.uk/forums/index.php?topic=55922.0) a plugin to do it. This module has been updated with support for the plugin, although because I haven't implemented selection, Ctrl-C will copy the entire text of the field.
Title: Re: ENGINE PLUGIN: Clipboard v0.4
Post by: Gurok on Fri 30/03/2018 16:04:24
Quote from: Snarky on Fri 30/03/2018 15:41:18
Thanks. Sure, undo/history would be useful to have, but it wouldn't be part of the plugin, but rather something you implement in your game logic. I'll think about adding it to the TextField module.

Windows Forms stuff gives you one level of undo built into the control from memory. It might be nice to provide that, then let people implement their own if they need to.
Title: Re: ENGINE PLUGIN: Clipboard v0.4
Post by: Snarky on Fri 30/03/2018 16:25:27
It's something to think about for the TextField module. In that case I'd almost certainly make the size of the history buffer (how many levels of undo you can backtrack) configurable.
Title: Re: MODULE: TextField v1.2.0
Post by: selmiak on Fri 30/03/2018 19:10:25
that was fast (and hopefully easy enough). Thanks snarky  :-D
Title: Re: MODULE: TextField v1.2.0
Post by: Monsieur OUXX on Mon 16/04/2018 10:58:46
Snarky, if you could extend this to multiple lines, I'd be eternally grateful to you.
Also I'd really encourage you to implement highlight and simple copy/paste (data stays within AGS). You could probably get some inspiration about mouse-control and highlight from my (almost working but eternally slightly broken) module, TextArea (http://www.adventuregamestudio.co.uk/forums/index.php?topic=51280.0).

I realy need a text area component, but I've never managed to release one that's bug free.