screen.adoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. = screen
  2. :revnumber: 2.0
  3. :revdate: 2020/07/25
  4. == The Screen Class
  5. You can create a screen using one of the two provided constructors as shown in the xref:gui/tonegodgui/quickstart.adoc[Quick Start Guide].
  6. [source,java]
  7. ----
  8. // this = any JME Application
  9. Screen screen = new Screen(this);
  10. guiNode.addControl(screen);
  11. ----
  12. Optionally, you can provide a path to a custom Style theme:
  13. [source,java]
  14. ----
  15. // this = any JME Application
  16. Screen screen = new Screen(this, "tonegod/gui/style/def/style_map.xml");
  17. guiNode.addControl(screen);
  18. ----
  19. To make use of custom cursors, call this method prior to initializing the screen:
  20. [source,java]
  21. ----
  22. screen.setUseCustomCursors(true);
  23. ----
  24. You can disable and re-enable custom cursors at any point, but they must be initialized with the screen to be loaded.
  25. Cursor Effects can be enabled/disabled at anytime by calling:
  26. [source,java]
  27. ----
  28. screen.setUseCursorEffects(boolean useCursorEffects);
  29. ----
  30. Tool Tips can be enabled/disabled at anytime by calling:
  31. [source,java]
  32. ----
  33. screen.setUseToolTips(boolean useToolTips);
  34. ----
  35. Audio can be enabled/disabled at anytime by calling:
  36. [source,java]
  37. ----
  38. screen.setUseUIAudio(boolean useUIAudio);
  39. ----
  40. === Application quick references methods:
  41. [source,java]
  42. ----
  43. screen.getApplication();
  44. // Screen dimensions
  45. screen.getWidth();
  46. screen.getHeight();
  47. // Mouse position
  48. screen.getMouseXY(); // returns a Vector2f containing current mouse x/y
  49. ----
  50. === Methods for adding remove base level controls:
  51. [source,java]
  52. ----
  53. screen.addElement(Element element);
  54. screen.removeElement(Element element);
  55. ----
  56. === Z-Order Methods:
  57. [source,java]
  58. ----
  59. // Bring the specified Element to the front
  60. screen.updateZOrder(Element topMost);
  61. ----
  62. === Accessing the EffectManager:
  63. [source,java]
  64. ----
  65. screen.getEffectManager();
  66. ----
  67. === Retrieving a Style:
  68. [source,java]
  69. ----
  70. screen.getStyle(String tagName);
  71. ----
  72. === Custom Cursor Related Methods:
  73. [source,java]
  74. ----
  75. screen.setCursor(Screen.CursorType cur); // called by controls
  76. screen.setForcedCursor(Screen.CursorType cur); // Overrides control manipulation of cursor.
  77. screen.releaseForcedCursor(); // Release cursor manipulation back to controls
  78. ----
  79. === Retrieving Elements
  80. [source,java]
  81. ----
  82. // Recursive search
  83. screen.getElementById(String UID);
  84. ----
  85. === UI Global Alpha Settings:
  86. [source,java]
  87. ----
  88. screen.setGlobalAlpha(float globalAlpha);
  89. screen.getGlobalAlpha();
  90. ----
  91. === UI Global Audio Settings:
  92. [source,java]
  93. ----
  94. screen.setUseUIAudio(boolean useUIAudio);
  95. screen.getUseUIAudio();
  96. screen.setUIAudioVolume(float uiAudioVolume);
  97. screen.getUIAudioVolume();
  98. screen.playAudioNode(String key, float volume);
  99. ----
  100. === Enabling Global Texture Atlas Use
  101. Keep in mind, that it is possible to enable texture atlas usage per element without enabling global texture atlas use.
  102. [source,java]
  103. ----
  104. screen.setUseTextureAtlas(boolean useTextureAtlas, String texturePath);
  105. screen.getUseTextureAtlas();
  106. screen.getAtlasTexture();
  107. ----