SByIo Library

by Bandock
Screen-based input and output with extra power provided by modern day BYOND technology.
ID:110760
 
Screen-based input and output library that enables creating text objects within a single icon state as well utilize onscreen input (Notes are provided in the document included with the library about onscreen input).

You can do many things with text objects and even use descendants like item text objects. Provides even a helpful menu object that keeps menu items organized. This library is based off the "Strategic Warfare Prototype" version of Text Objects and "SkyDrop Delivery" version of Text Objects with improvements that enables a more programmer friendly environment.

This library is now in the public domain. GitHub link should still be available in the forums. Whatever is in the library can be used for research (possibly lead to better capabilitites) and anything imaginable.

V2B Release (July 26th, 2012):
- Fix to make it compatible with stable v494 or later. Due to the changes needed, mob.loc is now set to null by default. There might be a better change in the near future to prevent the need for mob.loc alteration.

V2A Release (October 11th, 2011):
- Few changes made to the Command procedure of the /ItemTextObj type. No longer calls the Unselect procedure for keyboard input and instead used by the ClearInputFocus procedure.
- GetSelectedMenuItem procedure has been added to the /MenuObj type. Very handy when one needs to obtain the currently selected item text object of the menu.
- SetInputFocus has been altered a bit to wait for the window to be focused. This is to prevent issues with keyboard only input for particular menu objects.

V2 Release (September 30th, 2011):
- Efficient Item Text Object Highlighting (uses icon states instead of constant redrawing)
- Onscreen Input (/InputObj type)
- Multi-line support for Text Objects
- Menu objects now inherit from the /InputObj type to enable keyboard input upon focus.
- New highlighting options for Item Text Objects that allows for using icons as side cursors next to items.
- Menu spacing mode support for menu objects, which currently allow for vertical and horizontal listing.
- Update procedure was added to the /FontObj type to commit any changes made to the font object to any existing text object that uses it.

V1A Release (February 28th, 2011):
- Items in menu objects will now properly line up on different icon size settings.

V1 Release (February 24th, 2011):
- Initial Release

Features Currently:
Single Icon State Text Objects
Alpha Control to provide nifty text effects
Changeable Text Objects
Clickable Item Text Objects
Menu Objects composed of multiple Item Text Objects (using specified settings)
Map Text Object Support (There are cases you can place them on the map.)
Font Objects (to enable custom font support through DMI access and allow for multiple text objects to use it)
Input Objects (for onscreen input and menu objects at this time)
Lookin' good!
Thanks! :D
It looks very hard to use. There are some functions with tons of arguments. Can you even remember what all of these values mean?

MainMenuObj = new(Font1,12,OUTLINE|HICON,"#FFF",0xFF,"#FFF","#FF0",null,'DemoCursor.dmi',0,0,MVSPACING)


None of those arguments appear to be things that have to be passed to the constructor, they're all things that can be set later. It might seem simple to set them all in the constructor but it makes it very difficult to use because you have to remember what those 12 arguments are. You can do two things:

1. Give most of the arguments default values, this way you only need to pass to the constructor things that aren't default (ex: font, icon).

2. Make the variables initialized separately from the constructor or use named arguments. I might be able to remember that the MenuObj object has an "alpha" var, but I can guarantee I'll never remember that it's the 5th argument passed to the constructor.

The demo is quite a mess because you're creating tons of objects, each with tons of parameters.

It also seems quite limited by only supporting fixed-width fonts.
Fortunately, you can adjust the sizes of fonts (through font objects). I haven't included default values yet, though I actually have thought about implementing them since V2. Glad you brought it up Forum_account since including default values should make it far less tedious. Also been contemplating changing certain arguments around or reducing the number to streamline the whole process.

MenuObj is supposed to utilize the alpha value sooner or later, but right now doesn't do anything yet. About the demo source, it is very likely to be revamped due to several issues that can pop up when being hosted.

Example: When I recently hosted an earlier SByIo Demo with partial V3 implementation and even back in pre-release V2 where the whole server (on the client's side) was lagging like crazy. That was due to the fact too many objects remained without properly clearing them out when not in use.


Anyhow, /FontObj (Font Object) can be used to specify what fonts you'll be using and what settings to apply for them. If you leave the width and/or height at 0, they will use the font icon's default Width and/or Height. Other than that, they're freely adjustable. Due to currently needing to create your own fonts file (which can be of any size and are adjustable), I made sure I provided a default font set (DMI form).

Anyhow, I'll work on default argument usage (something I been meaning to do) and improve the demo source. Named arguments are still useful (something a great advantage for DM, unlike C++ which still needs to be done in order).
I meant that the library appears to assume that every character in the font has the same width. It's not like this text here, where the letter "i" is more narrow than the letter "w". If you use a monospaced font like Courier New it'd be fine, but fonts like Arial wouldn't look right.
Forum_account wrote:
I meant that the library appears to assume that every character in the font has the same width. It's not like this text here, where the letter "i" is more narrow than the letter "w". If you use a monospaced font like Courier New it'd be fine, but fonts like Arial wouldn't look right.

Ah, that's what you're talking about. I'll see if I can implement a way to properly read characters of different width within the same font set. :D

I'll put that on my list of new features for the next release.
For some reason this wont run for me =/
Yeah, it's an issue with certain v494 builds or later. Haven't placed the fixed version on the hub yet. When I get a chance, I'll provide a fixed stable release that works under v495/v496 and even some builds of v494.
Ahh, well just notify me when you do.

P.S thanks for the quick reply!
You're welcome. ;D

Yeah, I'll go ahead and fix it up.

Edit: There, it is now fixed.
Thank you for this library. I don't contain the knowledge myself to make this but after looking through I finally understand how to do it. :) I am including this in my upcoming Kingdom Hearts game and I will give credit!
You are very welcome Ganing. :D