screen.adoc 3.1 KB

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