ScriptBasics.dpr 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. (* Setting up a simple scripted scene.
  2. This demo shows how to manipulate GLScene objects though
  3. a couple of basic scripts. The TGLDWS2ActiveBehaviour is
  4. a behaviour style component that wraps a DelphiWebScriptII
  5. program and script. Once compiled and executed it will
  6. remain active until it is deactivated, destroyed or
  7. recompiled.
  8. There are a couple of procedures that the active script will
  9. recognize and execute while active. The OnBeginProgram and
  10. OnProgress procedures. If these procedures are found in the
  11. compiled program it will call them from the behaviour. The
  12. OnBeginProgram is called when the program starts, just after
  13. compiling. The OnProgress procedure is called when the
  14. behaviour progresses. The OnBeginProgram event is used here
  15. to grab the instance of the object being scripted and the
  16. OnProgress is used to manipulate the GLScene object.
  17. The DWS2Program property is the compiled program, this can
  18. be used to call on internal variables or functions from
  19. Delphi. This can be used to create other custom events.
  20. InvalidateScript is called after the script text is altered
  21. to alert the behaviour that the program needs to be
  22. recompiled. OnBeginProgram will be called again once the
  23. program is compiled and restarted. The Active property can
  24. be used to halt and start DWS2Program's execution.
  25. *)
  26. program ScriptBasics;
  27. uses
  28. Vcl.Forms,
  29. ScriptBasicsFm in 'ScriptBasicsFm.pas';
  30. {$R *.res}
  31. begin
  32. Application.Initialize;
  33. Application.CreateForm(TForm1, Form1);
  34. Application.Run;
  35. end.