Thursday, November 10, 2011

Work Progress - Nov 9 - Nov 15

Demo: "Stable SB app" link above

Work done: Finish drop-down menu. The sample script asks the skateboarder to yell after pressing "a" key. On contacting Arc5, the yell message is changed to "Reaching Arc5". On reaching the edge, it sends a message "Stop" to the stage. When the stage receives that message, it will stop the simulation.


  • The pull-down menu is forbidden from being replaced and dragged away.
  • The script can be loaded correctly. You may check this out by pressing "a" key to ask the skateboarder to yell and pressing "b" to ask the skateboarder to stop yelling. This script is made by the "Save As" feature of the program. This means the save feature has also been implemented correctly.
  • Changing the order of the objects in the object manager doesn't change the currently selected object in the drop-down menu. To test it out, change the object order in the object manager with the up and down arrows and then start the simulation. Everything should be the same.
  • Changing the name of an object will trigger the respective name in the pull-down menu to change. To test it out, make sure the object "Jessie" is selected. Change the selected item of a pull-down menu in the scriptlet panel to be "Jessie". Then change the name of Jessie to something else. The pull-down menu should now display the new name.
Programmer note:
  • One can set a static list as the respective ArgVal using the [...] syntax. For example, in Skateboarder.java of SB app,
    @AutomatableEventList(name="On key Pressed", desc="Fired when a key is pressed", argNames={"key"}, argDesc={""}, argTypes={"String"}, argVals={"[a,b,c,d,e,f,g]"})
    public PEventList ekeyPressed = new PEventList(this);
  • We have an example dynamic list (fill in "@ValueListObjectNames" in the argVals field) that essentially pull the list of values from a class method. For example, in PObjectJBox2d.java of SB app,
    @AutomatableEventList(name="On Touching", desc="Fired when it is touching something", argNames={""}, argDesc={""}, argTypes={"PObject"}, argVals={"@ValueListObjectNames"})
    public PEventList eTouching = new PEventList(this);
  • It is also possible for an application to implement their own dynamic lists. In that case, one needs to extend from AbstractValueList to define the function used to generate the list of values. He then needs to extend from AbstractStatementFactory to define the key String and PType value that are necessary to trigger the production of the respective PStatementDynamicConst. Finally, in the Engine class of his own application, he needs to instantiate the respective Statement Factory and call Engine.AttachStatementFactory(.) to include the factory into consideration. Have a look at ValueListObjectNames.java and StatementFactoryCloning.java for an example.

No comments:

Post a Comment