Difference between revisions of "GUI Extension"
m |
|||
(3 intermediate revisions by one other user not shown) | |||
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. |
− | released = 2010-01-25 | + | |horde3dversion = svn head |
− | + | |released = 2010-01-25 | |
− | author = Mathias Gottschlag| | + | |author = Mathias Gottschlag| |
}} | }} | ||
|} | |} |
Latest revision as of 20:29, 25 January 2010
|
|