Engine works. Button passes it’s value to the LED, and the LED checks it’s value and lights up. The potential question now, is is my current mechanism for pinging the connection a bottleneck? I mean it is, but how bad of one. Right now, Connections are kept in an array in the Workspace. Connections have two modules as properties moduleA and moduleB. So, when the button is pressed, it first has to find all the connections where moduleA is the button, then pass moduleA’s value to moduleB’s engine. The more modules I have the slower this process will be obviously, but how fast will it reach critical mass. I will probably need to devise some benchmarking. Anyway…
So I took a little detour on actual progress, and took a stab a some alternative looks for the modules. To this point the modules were drawn using the drawing api in as3. I decided to design a button and an led in the Flash IDE and then bring them into my project as graphical assets. I’d ultimately like to have skins for this, I could do an original NeatTools skin, but I though I would try an remove some of the ambiguity of the original modules, and make them a little prettier. No functionality yet, I have the LED on state ready to go, I just need to code it.
So like last time, i’m starting by hard-wiring a connection to start with, then I’ll go back to how to create them dynamically. And since my last post, I’ve rethought the connections questions and I’m going to make it more outside in, rather than trying to figure out some hacky way of having children and grandchildren telling parents what to do. So… to that end, I created a neatWorkspace class. Structure as follows:
Workspace is the parent of everything (so far). It has children button and LED. They have children input and output (or in buttons case, inputs and outputs) Workspace also has a child Connection A, which contains a reference to button and LED, and which output of button will be connecting to what input of LED. Connection A has a child neatWire (the graphic connection) which is a line from button output, to LED input.
the wires fail if you try to create new ones by dragging out lines, but they’re just holdovers, I haven’t revisited them yet.
So, I’ve started over with NeatTools. There has been some recent interest in rebooting the real NeatTools, which got me more interested in the AS3 versions again. Last time, I got bogged down with figuring out how to manage the connections, so I’m rebuilding it from scratch, and hopefully I can figure out the best way to handle these pesky connections between modules. I have a lot of questions about how to handle them though.
- Should connections be independent objects with references to the modules they connect?
- Should modules contain the connection object instead?
- Should connections just be imaginary and instead should modules contain a reference to any module they are connected to?
- Should there be duplicate references (ie, should moduleA know it’s connected to moduleB and vice versa)?
- Should modules only know what they’re outputting to, but not care what might be plugged into the back of them?
Anyway, here’s the current version. You can drag out a line from the outputs, but the connection function doesn’t do really anything at the moment, it just draws a strange line (so I can see something happened).
Getting back to NeatTools related stuff, I’ve been playing around with the Android SDK and the Adobe Air 2.5 SDK, with support for Android. As one of my first tests, I created an Android version of the NeatTool AS3. Now, I don’t have an actual android phone. Or any phone for that matter, but I do have the emulator that comes with the SDK and here’s a screen shot:
It seems to work as well as the Flash version does, which isn’t all that well, but anyway. New links can be created, broken, modules can be clicked on or moved around. I’d be interested to see how well the connections would work with a touch screen, but until I can get my hands on an actual device, this will have to wait.