Difference between revisions of "Creating a new widget"

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search
Line 1: Line 1:
 
Creating a new type of widget for CEGUI is relatively easy once you know all the details. CEGUI gives you a lot of freedom in creating a new widget, you can basically create anything you want and it is relatively easy once you know all the basics. This page will help you understand the changes you need to undertake to make a new widget (and possibly get it accepted into the CEGUI codebase, which would help the entire community).
 
Creating a new type of widget for CEGUI is relatively easy once you know all the details. CEGUI gives you a lot of freedom in creating a new widget, you can basically create anything you want and it is relatively easy once you know all the basics. This page will help you understand the changes you need to undertake to make a new widget (and possibly get it accepted into the CEGUI codebase, which would help the entire community).
  
A widget mainly consists of two parts:
+
A widget can be broken down into two defining parts:
 
* The logic part
 
* The logic part
 
* The rendering part
 
* The rendering part

Revision as of 12:14, 11 January 2015

Creating a new type of widget for CEGUI is relatively easy once you know all the details. CEGUI gives you a lot of freedom in creating a new widget, you can basically create anything you want and it is relatively easy once you know all the basics. This page will help you understand the changes you need to undertake to make a new widget (and possibly get it accepted into the CEGUI codebase, which would help the entire community).

A widget can be broken down into two defining parts:

  • The logic part
  • The rendering part

The logic part is encapsuled in classes that derive from the CEGUI::Window class. In version 0.8.X, these "widget logic" classes are located in cegui/src/widgets and the headers in cegui/include/CEGUI/widgets. Examples are ProgressBar, ToggleButton, PushButton, HorizontalLayoutContainer, etc. In these classes the inputs, interactions, events and might be used to define the current "state" (clicked, pushed, etc) of the widget for rendering.

The rendering part consists of the C++ class and the XML defining the "look".