Difference between revisions of "GUI Extension"
(Small additions/fixes) |
m |
||
| (4 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
[[category: Extensions]] | [[category: Extensions]] | ||
| − | {| border="0" | + | {| border="0" |
| {{ContentBlock|width=800|color=white |content=The GUI extensions adds a GUi system to Horde3D which can be used to display both 3D GUIs and 2D menus. This is done by defining a common GUI scene node which renders 2D geometry at the local xy plane of the scene node. All GUI elements are skinnable. The GUI uses wchar_t for all strings. | | {{ContentBlock|width=800|color=white |content=The GUI extensions adds a GUi system to Horde3D which can be used to display both 3D GUIs and 2D menus. This is done by defining a common GUI scene node which renders 2D geometry at the local xy plane of the scene node. All GUI elements are skinnable. The GUI uses wchar_t for all strings. | ||
| Line 35: | Line 35: | ||
The following code creates a GUI with one button and one edit box: | The following code creates a GUI with one button and one edit box: | ||
| − | < | + | {{CppSourceCode|description=Creating a GUI|code= |
| + | <source lang="cpp" line="0"> | ||
H3DRes fontMatRes = h3dAddResource( H3DResTypes::Material, "overlays/font.material.xml", 0 ); | H3DRes fontMatRes = h3dAddResource( H3DResTypes::Material, "overlays/font.material.xml", 0 ); | ||
// GUI skin | // GUI skin | ||
| Line 64: | Line 65: | ||
// Set an action ID for the button | // Set an action ID for the button | ||
h3dguiSetElementParamI( gui, button, H3DElementParam::ActionIdI, 1 ); | h3dguiSetElementParamI( gui, button, H3DElementParam::ActionIdI, 1 ); | ||
| − | </ | + | </source>}} |
Mouse and keyboard input are injected like this: | Mouse and keyboard input are injected like this: | ||
| − | < | + | {{CppSourceCode|description=Generating events|code= |
| + | <source lang="cpp" line="0"> | ||
// Insert printable char | // Insert printable char | ||
h3dguiInsertChar( gui, 'A' ); | h3dguiInsertChar( gui, 'A' ); | ||
| Line 77: | Line 79: | ||
// Insert left mouse button event (0 = left mouse button, 1 = pressed) | // Insert left mouse button event (0 = left mouse button, 1 = pressed) | ||
h3dguiSetMouseButton( gui, 0, 1 ); | h3dguiSetMouseButton( gui, 0, 1 ); | ||
| − | </ | + | </source>}} |
Events from the GUI are handled like this: | Events from the GUI are handled like this: | ||
| − | < | + | {{CppSourceCode|description=Handling events|code= |
| + | <source lang="cpp" line="0"> | ||
while( h3dguiHasEvent( gui ) ) | while( h3dguiHasEvent( gui ) ) | ||
{ | { | ||
| Line 90: | Line 93: | ||
} | } | ||
} | } | ||
| − | </ | + | </source>}} |
There also is an example showing how to use a 3D GUI in the repository at Extensions/GUI/Sample. | There also is an example showing how to use a 3D GUI in the repository at Extensions/GUI/Sample. | ||
| Line 109: | Line 112: | ||
}} <!-- Right panel --> | }} <!-- Right panel --> | ||
| − | | valign="top" |{{Extension_Summary| | + | |valign="top" |{{Extension_Summary |
| − | name = GUI Extension| | + | |name = GUI Extension |
| − | screenshot = | + | |screenshot = H3DGUIsmall.jpg |
| − | description = The GUI extension adds a tightly integrated GUI system to Horde3D.| | + | |description = The GUI extension adds a tightly integrated GUI system to Horde3D. |
| − | horde3dversion = svn head| | + | |horde3dversion = svn head |
| − | author = Mathias Gottschlag| | + | |released = 2010-01-25 |
| + | |author = Mathias Gottschlag| | ||
}} | }} | ||
|} | |} | ||
Latest revision as of 20:29, 25 January 2010
|
|
||||||||||||||||||||||||

