- Lets start! |
- ||||||||||
-
- As always, we include the header files (conio and curses for getting - user input from the console), and use the irrlicht namespaces. We also - store a pointer to the Irrlicht device, a counter variable for changing - the creation position of a window, and a pointer to a listbox. -
The Event Receiver is not only capable of getting keyboard and mouse
- input events, but also events of the graphical user interface (gui).
- There are events for almost everything: Button click, Listbox selection
- change, events that say that a element was hovered and so on. To be
- able to react to some of these events, we create
If a scrollbar changed its scroll position, and it is 'our' scrollbar
- (the one with id 104), then we change the
If a button was clicked, it could be one of 'our' three buttons. If
- it is the first, we shut down the engine.
Ok, now for the more interesting part. First, create the Irrlicht device. - As in some examples before, we ask the user which driver he wants to - use for this example: -
The creation was successful, now we set the event receiver and store - pointers to the driver and to the gui environment. -
We add three buttons. The first one closes the engine. The second creates - a window and the third opens a file open dialog. The third parameter is - the id of the button, with which we can easily identify the button in - the event receiver. -
Now, we add a static text and a scrollbar, which modifies the transparency
- of all gui elements. We set the maximum value of the scrollbar to 255,
- because that's the maximal value for a color value.
- To make the font a little bit nicer, we load an external font and set it - as new font in the skin. An at last, we create a nice Irrlicht Engine logo - in the top left corner. - -
That's all, we only have to draw everything. -
|
-
- - + + +
+ Lets start! |
+ ||||||||||
+
+ As always, we include the header files (conio and curses for getting + user input from the console), and use the irrlicht namespaces. We also + store a pointer to the Irrlicht device, a counter variable for changing + the creation position of a window, and a pointer to a listbox. +
The Event Receiver is not only capable of getting keyboard and mouse
+ input events, but also events of the graphical user interface (gui).
+ There are events for almost everything: Button click, Listbox selection
+ change, events that say that a element was hovered and so on. To be
+ able to react to some of these events, we create
If a scrollbar changed its scroll position, and it is 'our' scrollbar
+ (the one with id 104), then we change the
If a button was clicked, it could be one of 'our' three buttons. If
+ it is the first, we shut down the engine.
Ok, now for the more interesting part. First, create the Irrlicht device. + As in some examples before, we ask the user which driver he wants to + use for this example: +
The creation was successful, now we set the event receiver and store + pointers to the driver and to the gui environment. +
We add three buttons. The first one closes the engine. The second creates + a window and the third opens a file open dialog. The third parameter is + the id of the button, with which we can easily identify the button in + the event receiver. +
Now, we add a static text and a scrollbar, which modifies the transparency
+ of all gui elements. We set the maximum value of the scrollbar to 255,
+ because that's the maximal value for a color value.
+ To make the font a little bit nicer, we load an external font and set it + as new font in the skin. An at last, we create a nice Irrlicht Engine logo + in the top left corner. + +
That's all, we only have to draw everything. +
|
+
+ + -- cgit v1.1