/AuroraDocs/OSSLFunctions/osDrawFilledRectangle.lsl

https://bitbucket.org/VirtualReality/software-testing · Unknown · 43 lines · 43 code · 0 blank · 0 comment · 0 complexity · ce07a7319cb118dc5992f895bbc0c542 MD5 · raw file

  1. // ----------------------------------------------------------------
  2. // Example / Sample Script to show function use.
  3. //
  4. // Script Title: osDrawFilledRectangle.lsl
  5. // Script Author:
  6. // Threat Level: None
  7. // Script Source: SUPPLEMENTAL http://opensimulator.org/wiki/osDrawFilledRectangle
  8. //
  9. // Notes: See Script Source reference for more detailed information
  10. // This sample is full opensource and available to use as you see fit and desire.
  11. // Threat Levels only apply to OSSL & AA Functions
  12. // See http://opensimulator.org/wiki/Threat_level
  13. //================================================================
  14. // Inworld Script Line: osDrawFilledRectangle( string drawList, integer width, integer height );
  15. //
  16. // Example of osDrawFilledRectangle
  17. integer Touched = FALSE;
  18. default
  19. {
  20. state_entry()
  21. {
  22. llSay(0,"Touch to see osDrawFilledRectangle create a Red Rectangle figure on the prim");
  23. }
  24. touch_end(integer num)
  25. {
  26. if(Touched)
  27. {
  28. Touched = FALSE;
  29. llSetTexture(TEXTURE_PLYWOOD, ALL_SIDES);
  30. }
  31. else
  32. {
  33. Touched = TRUE;
  34. string DrawList = "";
  35. DrawList = osSetPenSize( DrawList, 3 ); // Set the pen width to 3 pixels
  36. DrawList = osSetPenColor( DrawList, "Red" ); // Set the pen color to red
  37. DrawList = osMovePen( DrawList, 28, 78 ); // Upper left corner at <28,78>
  38. DrawList = osDrawFilledRectangle( DrawList, 200, 100 ); // 200 pixels by 100 pixels
  39. // Now to draw image
  40. osSetDynamicTextureData( "", "vector", DrawList, "width:256,height:256", 0 );
  41. }
  42. }
  43. }