Free and Open Source real time strategy game with a new take on micro-management

Difference between revisions of "GUI Theming"

From Globulation2

Jump to: navigation, search
(Explanation about color theme)
 
(New style explanation)
Line 1: Line 1:
GUI theming is made at three levels in glob2: color theming, background theming and button theming.
GUI theming is made at two levels in glob2: widget theming and background theming


==Color theming==
==Widget theming==


Widget drawing is done by the Style helper object, declared in libgag/include/GUIStyle.h. It has a default implementation in libgag/src/GUIStyle.cpp. Glob2 reimplements it partially in src/Glob2Style.h/.cpp to have things like bitmapped buttons, etc...
All widget share some color constants. They are defined in the GAGGUI::ColorTheme namespace and initialized in the beginning of the libgag/src/GUIBase.cpp file.


==Background theming==
==Background theming==


Each GUI screen inherits from the Glob2Screen class, defined in src/Glob2Screen.h and implemented in src/Glob2Screen.cpp. This class reimplement the Screen::paint virtual method so that a custom paint method is implemented.
Each GUI screen inherits from the Glob2Screen class, defined in src/Glob2Screen.h and implemented in src/Glob2Screen.cpp. This class reimplement the Screen::paint virtual method so that a custom paint method is implemented.

==Button theming==

Button can have associated bitmaps. To do so, when you create the button, pass the name of a valid loaded sprite and two valid frame numbers, the first for idle and the second for highlighted state. If you pass no sprite name ("") and -1 to frame numbers, bitmap are disabled and default color theme is used.

Revision as of 16:06, 3 January 2006

GUI theming is made at two levels in glob2: widget theming and background theming

Widget theming

Widget drawing is done by the Style helper object, declared in libgag/include/GUIStyle.h. It has a default implementation in libgag/src/GUIStyle.cpp. Glob2 reimplements it partially in src/Glob2Style.h/.cpp to have things like bitmapped buttons, etc...

Background theming

Each GUI screen inherits from the Glob2Screen class, defined in src/Glob2Screen.h and implemented in src/Glob2Screen.cpp. This class reimplement the Screen::paint virtual method so that a custom paint method is implemented.

Misc