saggui-svn Mailing List for Simplified All Gaming GUI
Status: Beta
Brought to you by:
juvinious
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(30) |
Jul
(86) |
Aug
(19) |
Sep
(30) |
Oct
(32) |
Nov
(29) |
Dec
(25) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(47) |
Feb
(55) |
Mar
(9) |
Apr
(17) |
May
(21) |
Jun
|
Jul
(8) |
Aug
(15) |
Sep
(4) |
Oct
|
Nov
|
Dec
(6) |
2008 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sag...@li...> - 2010-03-04 13:19:47
|
Revision: 481 http://saggui.svn.sourceforge.net/saggui/?rev=481&view=rev Author: juvinious Date: 2010-03-04 13:19:31 +0000 (Thu, 04 Mar 2010) Log Message: ----------- Branching trunk for a complete overhaul. Added Paths: ----------- branches/0.51/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2008-06-03 19:02:55
|
Revision: 480 http://saggui.svn.sourceforge.net/saggui/?rev=480&view=rev Author: juvinious Date: 2008-06-03 12:02:52 -0700 (Tue, 03 Jun 2008) Log Message: ----------- const correctness issues fixed Modified Paths: -------------- trunk/CHANGELOG trunk/examples/gamedemo/include/gamedemo_gfx.h trunk/examples/widgets/src/widgets.cpp trunk/include/saggui/bitmap_font.h trunk/include/saggui/font.h trunk/include/saggui/font_base.h trunk/include/saggui/graphics.h trunk/modules/allegro/include/al_font.h trunk/modules/allegro/src/al_font.cpp trunk/modules/freetype/include/ft_font.h trunk/modules/freetype/src/ft_font.cpp trunk/modules/profiler/include/profilefont.h trunk/modules/profiler/src/profilefont.cpp trunk/modules/sdlgl/include/sdlgl_gfx.h trunk/modules/sdlgl/src/sdlgl_gfx.cpp trunk/src/bitmap_font.cpp trunk/src/font.cpp trunk/src/graphics.cpp trunk/src/keys.cpp trunk/src/mouse_manager.cpp trunk/src/resource_manager.cpp trunk/src/widgets/input_box.cpp trunk/utils/bmpdump/bmpdump-alleg.cpp trunk/utils/bmpdump/bmpdump-sdl.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/CHANGELOG 2008-06-03 19:02:52 UTC (rev 480) @@ -1,5 +1,6 @@ 0.50 02-13-08 - Tagged. API and roadmap changes are likely to occur above 0.50. +- Corrected some issues throughout with const correctness - Added the ability to mouseManager to disable mouse - Fixed some install issues in CMakeLists.txt - Moved over sagguixml into the main module since it really doesn't need to be seperated as a module Modified: trunk/examples/gamedemo/include/gamedemo_gfx.h =================================================================== --- trunk/examples/gamedemo/include/gamedemo_gfx.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/examples/gamedemo/include/gamedemo_gfx.h 2008-06-03 19:02:52 UTC (rev 480) @@ -4,7 +4,7 @@ #define ctrlPanel_W 640 #define ctrlPanel_H 200 -static char *ctrlPanel[] = { +static const char *ctrlPanel[] = { "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264", "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3f5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5164","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264", "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5264","#3f5064","#3f4f65","#3f4f65","#3f4e65","#3f4f65","#3f4f65","#3f4f65","#3f4f65","#3f4f65","#3f4f64","#3f4e64","#3f4e64","#3f4e64","#3f4e64","#3f4e64","#3f4f64","#3f4f64","#3f4e64","#3f4e64","#3f4e64","#3f4e64","#3f4e64","#3e4e64","#3e4e64","#3e4e64","#3e4e64","#3e4e64","#3e4d64","#3e4e64","#3d4e64","#3d4e64","#3d4e64","#3d4d64","#3d4d64","#3d4e64","#3d4e64","#3d4d64","#3c4d63","#3c4d62","#3c4d61","#3c4d61","#3c4d61","#3c4d61","#3c4d61","#3c4d61","#3c4d61","#3c4d61","#3c4d61","#3c4d61","#3c4d61","#3c4d60","#3c4d61","#3c4d60","#3c4d60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e60","#3c4e61","#3c4e61","#3c4e61","#3d4e61","#3d4e61","#3d4e61","#3d4f61","#3d4f61","#3d4f61","#3d4f61","#3d4f61","#3d4f62","#3d4f62","#3d4f62","#3d4f62","#3d4f62","#3d4f62","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3d5062","#3e5062","#3e5062","#3e5063","#3e5063","#3e5063","#3e5063","#3e5063","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163","#3e5163", @@ -209,7 +209,7 @@ #define btn1_W 32 #define btn1_H 32 -static char *btn1[] = { +static const char *btn1[] = { "#ff00ff","#ff00ff","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#ff00ff","#ff00ff", "#ff00ff","#008080","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#008080","#ff00ff", "#008080","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#008080", @@ -246,7 +246,7 @@ #define btn2_W 32 #define btn2_H 32 -static char *btn2[] = { +static const char *btn2[] = { "#ff00ff","#ff00ff","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#ff00ff","#ff00ff", "#ff00ff","#008080","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#008080","#ff00ff", "#008080","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#008080", @@ -283,7 +283,7 @@ #define btn3_W 32 #define btn3_H 32 -static char *btn3[] = { +static const char *btn3[] = { "#ff00ff","#ff00ff","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#008080","#ff00ff","#ff00ff", "#ff00ff","#008080","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#008080","#ff00ff", "#008080","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#8080ff","#008080", @@ -320,7 +320,7 @@ #define quitbtn_W 64 #define quitbtn_H 16 -static char *quitbtn[] = { +static const char *quitbtn[] = { "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#ff00ff","#ff00ff","#ff00ff","#ff00ff", "#ff00ff","#ff00ff","#ff00ff","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#ff00ff","#ff00ff","#ff00ff", "#ff00ff","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#ff00ff", @@ -341,7 +341,7 @@ #define menubtn_W 64 #define menubtn_H 16 -static char *menubtn[] = { +static const char *menubtn[] = { "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#ff00ff","#ff00ff","#ff00ff","#ff00ff", "#ff00ff","#ff00ff","#ff00ff","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#ff00ff","#ff00ff","#ff00ff", "#ff00ff","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#10c4d1","#0a7a82","#0a7a82","#0a7a82","#0a7a82","#ff00ff", Modified: trunk/examples/widgets/src/widgets.cpp =================================================================== --- trunk/examples/widgets/src/widgets.cpp 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/examples/widgets/src/widgets.cpp 2008-06-03 19:02:52 UTC (rev 480) @@ -45,7 +45,7 @@ #define LOGO_W 287 #define LOGO_H 72 -static char *LOGO[] = { +static const char *LOGO[] = { "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff", "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#7624de","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#7624de","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff", "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#8512d8","#5948e9","#3b6cf4","#8512d8","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#8512d8","#5948e9","#3b6cf4","#8512d8","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff", Modified: trunk/include/saggui/bitmap_font.h =================================================================== --- trunk/include/saggui/bitmap_font.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/include/saggui/bitmap_font.h 2008-06-03 19:02:52 UTC (rev 480) @@ -104,7 +104,7 @@ bool load(graphic *bmp, const std::string & charSet); //! Load from graphic - bool load(char *data[], int width, int height, const std::string & charSet); + bool load(const char *data[], int width, int height, const std::string & charSet); //! Get text length double getLength(const std::string & text); Modified: trunk/include/saggui/font.h =================================================================== --- trunk/include/saggui/font.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/include/saggui/font.h 2008-06-03 19:02:52 UTC (rev 480) @@ -101,7 +101,7 @@ bool load(graphic *bmp, const std::string & charSet); //! Load from graphic - bool load(char *data[], int width, int height, const std::string & charSet); + bool load(const char *data[], int width, int height, const std::string & charSet); //! Get text length double getLength(const std::string & text); Modified: trunk/include/saggui/font_base.h =================================================================== --- trunk/include/saggui/font_base.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/include/saggui/font_base.h 2008-06-03 19:02:52 UTC (rev 480) @@ -90,7 +90,7 @@ virtual bool load(graphic *bmp, const std::string & charSet)=0; //! Load from graphic - virtual bool load(char *data[], int width, int height, const std::string & charSet)=0; + virtual bool load(const char *data[], int width, int height, const std::string & charSet)=0; //! Get text length virtual double getLength(const std::string & text)=0; Modified: trunk/include/saggui/graphics.h =================================================================== --- trunk/include/saggui/graphics.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/include/saggui/graphics.h 2008-06-03 19:02:52 UTC (rev 480) @@ -139,7 +139,7 @@ // Bitmap Routines //! Load bitmap from from memory - virtual void loadBmp(char *data[], int width, int height); + virtual void loadBmp(const char *data[], int width, int height); //! Load bitmap form a file virtual void loadBmp(const std::string & filename, const rgba & color=rgba::NOCOLOR)=0; @@ -190,7 +190,7 @@ bool arrayDump; //! loaded file from int array - char **dataDump; + const char **dataDump; //! Destroy Bitmap virtual bool destroyBmp()=0; Modified: trunk/modules/allegro/include/al_font.h =================================================================== --- trunk/modules/allegro/include/al_font.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/modules/allegro/include/al_font.h 2008-06-03 19:02:52 UTC (rev 480) @@ -78,7 +78,7 @@ bool load(graphic *bmp, const std::string & charSet); //! Load from graphic - bool load(char *data[], int width, int height, const std::string & charSet); + bool load(const char *data[], int width, int height, const std::string & charSet); //! Get text length double getLength(const std::string & text); Modified: trunk/modules/allegro/src/al_font.cpp =================================================================== --- trunk/modules/allegro/src/al_font.cpp 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/modules/allegro/src/al_font.cpp 2008-06-03 19:02:52 UTC (rev 480) @@ -92,7 +92,7 @@ } //! Load from graphic - bool alFont::load(char *data[], int width, int height, const std::string & charSet) + bool alFont::load(const char *data[], int width, int height, const std::string & charSet) { return false; } Modified: trunk/modules/freetype/include/ft_font.h =================================================================== --- trunk/modules/freetype/include/ft_font.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/modules/freetype/include/ft_font.h 2008-06-03 19:02:52 UTC (rev 480) @@ -192,7 +192,7 @@ bool load(graphic *bmp, const std::string & charSet); //! Load from graphic - bool load(char *data[], int width, int height, const std::string & charSet); + bool load(const char *data[], int width, int height, const std::string & charSet); //! Get text length double getLength(const std::string & text); Modified: trunk/modules/freetype/src/ft_font.cpp =================================================================== --- trunk/modules/freetype/src/ft_font.cpp 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/modules/freetype/src/ft_font.cpp 2008-06-03 19:02:52 UTC (rev 480) @@ -304,7 +304,7 @@ } //! Load from graphic - bool freetype::load(char *data[], int width, int height, const std::string & charSet) + bool freetype::load(const char *data[], int width, int height, const std::string & charSet) { return false; } Modified: trunk/modules/profiler/include/profilefont.h =================================================================== --- trunk/modules/profiler/include/profilefont.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/modules/profiler/include/profilefont.h 2008-06-03 19:02:52 UTC (rev 480) @@ -69,7 +69,7 @@ bool load(graphic *bmp, const std::string & charSet); //! Load from graphic - bool load(char *data[], int width, int height, const std::string & charSet); + bool load(const char *data[], int width, int height, const std::string & charSet); //! Get text length double getLength(const std::string & text); Modified: trunk/modules/profiler/src/profilefont.cpp =================================================================== --- trunk/modules/profiler/src/profilefont.cpp 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/modules/profiler/src/profilefont.cpp 2008-06-03 19:02:52 UTC (rev 480) @@ -79,7 +79,7 @@ } //! Load from graphic - bool profileFont::load(char *data[], int width, int height, const std::string & charSet) + bool profileFont::load(const char *data[], int width, int height, const std::string & charSet) { return true; } Modified: trunk/modules/sdlgl/include/sdlgl_gfx.h =================================================================== --- trunk/modules/sdlgl/include/sdlgl_gfx.h 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/modules/sdlgl/include/sdlgl_gfx.h 2008-06-03 19:02:52 UTC (rev 480) @@ -106,7 +106,7 @@ using graphic::loadBmp; //! Load bitmap from from memory - void loadBmp(char *data[], int width, int height); + void loadBmp(const char *data[], int width, int height); //! Load bitmap from file (and save filename) void loadBmp(const std::string & filename, const rgba &color=NULL); Modified: trunk/modules/sdlgl/src/sdlgl_gfx.cpp =================================================================== --- trunk/modules/sdlgl/src/sdlgl_gfx.cpp 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/modules/sdlgl/src/sdlgl_gfx.cpp 2008-06-03 19:02:52 UTC (rev 480) @@ -116,7 +116,7 @@ // ol::Bitmap Routines //! Load bitmap from memory - void sdlglGraphic::loadBmp(char *data[], int width, int height) + void sdlglGraphic::loadBmp(const char *data[], int width, int height) { SDL_Surface *temp = getNewSurface(width,height,32); Modified: trunk/src/bitmap_font.cpp =================================================================== --- trunk/src/bitmap_font.cpp 2008-02-13 13:57:53 UTC (rev 479) +++ trunk/src/bitmap_font.cpp 2008-06-03 19:02:52 UTC (rev 480) @@ -50,7 +50,7 @@ #define unkChar_W 10 #define unkChar_H 17 - static char *unkChar[] = { + static const char *unkChar[] = { "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff", "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff", "#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff", @@ -72,7 +72,7 @@ #define defaultFont_W 665 #define defaultFont_H 8 - static char *defaultFont[] = { + static const char *defaultFont[] = { "#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#000000","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#000000","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#000000","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#000000","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ffff00","#000000","#000000","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#000000","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00", "#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#000000","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#000000","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#ff00ff","#ff00ff","#000000","#000000","#ff00ff","#ffff00","#000000","#000000","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00", "#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ffff00","#000000","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ffff00","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#ffff00","#ff00ff","#000000","#ff00ff","#ff00ff","#ff00ff","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#000000","#000000","#000000","#000000","#000000","#ff00ff","#ff00ff","#ffff00","#000000","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00ff","#ff00... [truncated message content] |
From: <sag...@li...> - 2008-02-13 13:58:00
|
Revision: 479 http://saggui.svn.sourceforge.net/saggui/?rev=479&view=rev Author: juvinious Date: 2008-02-13 05:57:53 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Modified changelog to accomodate tagging Modified Paths: -------------- trunk/CHANGELOG Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-12-20 13:37:12 UTC (rev 478) +++ trunk/CHANGELOG 2008-02-13 13:57:53 UTC (rev 479) @@ -1,4 +1,5 @@ -0.50 +0.50 02-13-08 +- Tagged. API and roadmap changes are likely to occur above 0.50. - Added the ability to mouseManager to disable mouse - Fixed some install issues in CMakeLists.txt - Moved over sagguixml into the main module since it really doesn't need to be seperated as a module This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-12-20 13:37:20
|
Revision: 478 http://saggui.svn.sourceforge.net/saggui/?rev=478&view=rev Author: juvinious Date: 2007-12-20 05:37:12 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Tagging at 0.50 to proceed with API assessment and changes Added Paths: ----------- tags/0.50/ Copied: tags/0.50 (from rev 477, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-12-18 13:20:19
|
Revision: 477 http://saggui.svn.sourceforge.net/saggui/?rev=477&view=rev Author: juvinious Date: 2007-12-18 05:20:09 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Removed header from xml demos that is no longer needed Modified Paths: -------------- trunk/examples/xml/src/allegro.cpp trunk/examples/xml/src/allegrogl.cpp trunk/examples/xml/src/openlayer.cpp trunk/examples/xml/src/sdl.cpp trunk/examples/xml/src/sdlgl.cpp Modified: trunk/examples/xml/src/allegro.cpp =================================================================== --- trunk/examples/xml/src/allegro.cpp 2007-12-18 05:24:37 UTC (rev 476) +++ trunk/examples/xml/src/allegro.cpp 2007-12-18 13:20:09 UTC (rev 477) @@ -38,7 +38,6 @@ #include <saggui_alleg.h> #include <saggui.h> -#include <saggui_xml.h> using namespace saggui; Modified: trunk/examples/xml/src/allegrogl.cpp =================================================================== --- trunk/examples/xml/src/allegrogl.cpp 2007-12-18 05:24:37 UTC (rev 476) +++ trunk/examples/xml/src/allegrogl.cpp 2007-12-18 13:20:09 UTC (rev 477) @@ -38,7 +38,6 @@ #include <saggui_agl.h> #include <saggui.h> -#include <saggui_xml.h> using namespace saggui; Modified: trunk/examples/xml/src/openlayer.cpp =================================================================== --- trunk/examples/xml/src/openlayer.cpp 2007-12-18 05:24:37 UTC (rev 476) +++ trunk/examples/xml/src/openlayer.cpp 2007-12-18 13:20:09 UTC (rev 477) @@ -38,7 +38,6 @@ #include <saggui_ol.h> #include <saggui.h> -#include <saggui_xml.h> using namespace saggui; Modified: trunk/examples/xml/src/sdl.cpp =================================================================== --- trunk/examples/xml/src/sdl.cpp 2007-12-18 05:24:37 UTC (rev 476) +++ trunk/examples/xml/src/sdl.cpp 2007-12-18 13:20:09 UTC (rev 477) @@ -38,7 +38,6 @@ #include <saggui_sdl.h> #include <saggui.h> -#include <saggui_xml.h> using namespace saggui; Modified: trunk/examples/xml/src/sdlgl.cpp =================================================================== --- trunk/examples/xml/src/sdlgl.cpp 2007-12-18 05:24:37 UTC (rev 476) +++ trunk/examples/xml/src/sdlgl.cpp 2007-12-18 13:20:09 UTC (rev 477) @@ -38,7 +38,6 @@ #include <saggui_sdlgl.h> #include <saggui.h> -#include <saggui_xml.h> using namespace saggui; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-12-18 05:25:07
|
Revision: 476 http://saggui.svn.sourceforge.net/saggui/?rev=476&view=rev Author: juvinious Date: 2007-12-17 21:24:37 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Added the ability to disable mouse Modified Paths: -------------- trunk/CHANGELOG trunk/include/saggui/mouse_manager.h trunk/src/gui_manager.cpp trunk/src/mouse_manager.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-12-18 03:17:22 UTC (rev 475) +++ trunk/CHANGELOG 2007-12-18 05:24:37 UTC (rev 476) @@ -1,6 +1,7 @@ 0.50 +- Added the ability to mouseManager to disable mouse - Fixed some install issues in CMakeLists.txt -- Moved over sagguixml into the main module since it reality doesn't need to be seperated as a module +- Moved over sagguixml into the main module since it really doesn't need to be seperated as a module - Fixed roundRect so that it's accurate - Changed arc to be more accurate, borrowed read in comments - Fixed gamedemo's buttons and other visual elements Modified: trunk/include/saggui/mouse_manager.h =================================================================== --- trunk/include/saggui/mouse_manager.h 2007-12-18 03:17:22 UTC (rev 475) +++ trunk/include/saggui/mouse_manager.h 2007-12-18 05:24:37 UTC (rev 476) @@ -172,6 +172,9 @@ //! Right mouse click state mouseStates mRightClickState; + //! Enabled + bool enabled; + //! Evaluate mouse and fire events void update(); @@ -247,6 +250,12 @@ //! Set currentMousePosition static void setPosition(int x, int y); + //! Enable mouse + static void enable(bool e); + + //! Enable mouse + static bool isEnabled(); + //! \name Signals static signal1<const coord &> move; Modified: trunk/src/gui_manager.cpp =================================================================== --- trunk/src/gui_manager.cpp 2007-12-18 03:17:22 UTC (rev 475) +++ trunk/src/gui_manager.cpp 2007-12-18 05:24:37 UTC (rev 476) @@ -163,7 +163,7 @@ (mouseManager::getInstance())->drag=false; currentWindowFocused = 0; } - (mouseManager::getInstance())->checkHover(parents); + if(mouseManager::getInstance()->isEnabled())(mouseManager::getInstance())->checkHover(parents); } // Raises window or its parent to the top of the vector @@ -547,7 +547,7 @@ void guiManager::updateLogic() { // Update the mouse - (mouseManager::getInstance())->update(); + if(mouseManager::getInstance()->isEnabled())mouseManager::getInstance()->update(); // Update the keys (Regardless of active state) (keyInputManager::getInstance())->update(); @@ -580,13 +580,13 @@ // Draw the mouse and to screen if(graphic::buffered) { - (mouseManager::getInstance())->render(dest); + if(mouseManager::getInstance()->isEnabled())(mouseManager::getInstance())->render(dest); dest->renderBmp(0,0,0,0,dest->getBmpWidth(), dest->getBmpHeight(),rgba::NOCOLOR, getSysScreen()); } else { - (mouseManager::getInstance())->render(getSysScreen()); + if(mouseManager::getInstance()->isEnabled())(mouseManager::getInstance())->render(getSysScreen()); getSysScreen()->renderBmp(0,0,0,0,getSysScreen()->getBmpWidth(), getSysScreen()->getBmpHeight(),rgba::NOCOLOR, getSysScreen()); } Modified: trunk/src/mouse_manager.cpp =================================================================== --- trunk/src/mouse_manager.cpp 2007-12-18 03:17:22 UTC (rev 475) +++ trunk/src/mouse_manager.cpp 2007-12-18 05:24:37 UTC (rev 476) @@ -271,6 +271,7 @@ mRightClickTicks.reset(); mMaxTicks=400; winEvents=true; + enabled = true; //! connect slots leftDown.connect(this, &mouseManager::onLeftDown); @@ -1068,6 +1069,26 @@ (getInstance())->mousePointer->setPosition(x,y); } } + + //! Enable mouse + void mouseManager::enable(bool e) + { + if((getInstance())->mousePointer) + { + (getInstance())->enabled = e; + } + } + + //! Enable mouse + bool mouseManager::isEnabled() + { + if((getInstance())->mousePointer) + { + return (getInstance())->enabled; + } + + return false; + } } #endif /* MOUSE_MANAGER_CPP */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-12-18 03:17:25
|
Revision: 475 http://saggui.svn.sourceforge.net/saggui/?rev=475&view=rev Author: juvinious Date: 2007-12-17 19:17:22 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Moved xml module into main module. Fixed typos in CMakeLists.txt regarding install Modified Paths: -------------- trunk/CHANGELOG trunk/CMakeLists.txt trunk/cmake/saggui.h.in trunk/examples/xml/CMakeLists.txt Added Paths: ----------- trunk/include/saggui/xml/ trunk/include/saggui/xml/sagguixml.h trunk/include/saggui/xml/tinystr.h trunk/include/saggui/xml/tinyxml.h trunk/src/xml/ trunk/src/xml/sagguixml.cpp trunk/src/xml/tinystr.cpp trunk/src/xml/tinyxml.cpp trunk/src/xml/tinyxmlerror.cpp trunk/src/xml/tinyxmlparser.cpp Removed Paths: ------------- trunk/modules/sagguixml/ Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-12-14 14:20:39 UTC (rev 474) +++ trunk/CHANGELOG 2007-12-18 03:17:22 UTC (rev 475) @@ -1,4 +1,6 @@ 0.50 +- Fixed some install issues in CMakeLists.txt +- Moved over sagguixml into the main module since it reality doesn't need to be seperated as a module - Fixed roundRect so that it's accurate - Changed arc to be more accurate, borrowed read in comments - Fixed gamedemo's buttons and other visual elements Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-12-14 14:20:39 UTC (rev 474) +++ trunk/CMakeLists.txt 2007-12-18 03:17:22 UTC (rev 475) @@ -216,16 +216,17 @@ aux_source_directory(src BASE_SRC) aux_source_directory(src/widgets WIDGET_SRC) aux_source_directory(src/schemes SCHEME_SRC) +aux_source_directory(src/xml XML_SRC) # ------------------------------------------------------- # Include directory # ------------------------------------------------------- -include_directories(include ${CMAKE_BINARY_DIR}/include include/saggui include/saggui/widgets include/saggui/schemes ${FREETYPE_INCLUDE}) +include_directories(include ${CMAKE_BINARY_DIR}/include include/saggui include/saggui/widgets include/saggui/schemes include/saggui/xml ${FREETYPE_INCLUDE}) # ------------------------------------------------------- # SAGGUI Library # ------------------------------------------------------- -add_library (saggui ${CREATE_STATIC_LIB} ${BASE_SRC} ${WIDGET_SRC} ${SCHEME_SRC}) +add_library (saggui ${CREATE_STATIC_LIB} ${BASE_SRC} ${WIDGET_SRC} ${SCHEME_SRC} ${XML_SRC}) target_link_libraries(saggui ${REQUIRED_LIBS}) # ------------------------------------------------------- @@ -261,7 +262,6 @@ endif(ENABLE_SDLGL) add_subdirectory(${CMAKE_SOURCE_DIR}/modules/profiler) -add_subdirectory(${CMAKE_SOURCE_DIR}/modules/sagguixml) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/demo) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/gamedemo) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/widgets) @@ -280,22 +280,14 @@ if(CMAKE_PATCH_VERSION EQUAL 3 OR CMAKE_PATCH_VERSION LESS 3) file(GLOB BASE_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/*.h) file(GLOB WIDGET_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/widgets/*.h) - file(GLOB SCHEMES_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/widgets/*.h) + file(GLOB SCHEMES_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/schemes/*.h) + file(GLOB SCHEMES_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/xml/*.h) install(FILES ${BASE_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui) install(FILES ${WIDGET_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/widgets) install(FILES ${SCHEMES_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/schemes) + install(FILES ${XML_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/xml) else(CMAKE_PATCH_VERSION EQUAL 3 OR CMAKE_PATCH_VERSION LESS 3) install(DIRECTORY include/saggui DESTINATION ${CMAKE_INSTALL_PREFIX}/include PATTERN ".svn" EXCLUDE PATTERN "*~" EXCLUDE) endif(CMAKE_PATCH_VERSION EQUAL 3 OR CMAKE_PATCH_VERSION LESS 3) install(TARGETS saggui DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) endif(NOT MSVC) - - - file(GLOB ALLEGRO_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/allegro/*.h) - install(FILES ${ALLEGRO_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/allegro) - file(GLOB OPENLAYER_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/openlayer/*.h) - install(FILES ${OPENLAYER_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/openlayer) - file(GLOB SDL_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/sdl/*.h) - install(FILES ${SDL_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/sdl) - file(GLOB SDLGL_HEADERS ${CMAKE_SOURCE_DIR}/include/saggui/sdlgl/*.h) - install(FILES ${SDLGL_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/sdlgl) \ No newline at end of file Modified: trunk/cmake/saggui.h.in =================================================================== --- trunk/cmake/saggui.h.in 2007-12-14 14:20:39 UTC (rev 474) +++ trunk/cmake/saggui.h.in 2007-12-18 03:17:22 UTC (rev 475) @@ -103,6 +103,9 @@ //! Headers for included schemes #include "saggui/schemes/defaultscheme.h" +//! Header for xml creational engine +#include "saggui/xml/sagguixml.h" + #endif Modified: trunk/examples/xml/CMakeLists.txt =================================================================== --- trunk/examples/xml/CMakeLists.txt 2007-12-14 14:20:39 UTC (rev 474) +++ trunk/examples/xml/CMakeLists.txt 2007-12-18 03:17:22 UTC (rev 475) @@ -26,34 +26,34 @@ if(ENABLE_ALLEGRO) include_directories(${ALLEGRO_INCLUDE_DIR}) add_executable(xml-allegro src/allegro.cpp) - target_link_libraries(xml-allegro saggui-xml saggui-alleg saggui) - add_dependencies(xml-allegro saggui-xml saggui-alleg saggui) + target_link_libraries(xml-allegro saggui-alleg saggui) + add_dependencies(xml-allegro saggui-alleg saggui) endif(ENABLE_ALLEGRO) if(ENABLE_ALLEGROGL) include_directories(${ALLEGRO_INCLUDE_DIR}) add_executable(xml-allegrogl src/allegrogl.cpp) - target_link_libraries(xml-allegrogl saggui-xml saggui-agl saggui-alleg saggui) - add_dependencies(xml-allegrogl saggui-xml saggui-agl saggui-alleg saggui) + target_link_libraries(xml-allegrogl saggui-agl saggui-alleg saggui) + add_dependencies(xml-allegrogl saggui-agl saggui-alleg saggui) endif(ENABLE_ALLEGROGL) if(ENABLE_OPENLAYER) include_directories(${FREETYPE_INCLUDE_DIR} ${ALLEGRO_INCLUDE_DIR} ${ALLEGROGL_INCLUDE_DIR} ${OPENLAYER_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) add_executable(xml-openlayer src/openlayer.cpp) - target_link_libraries(xml-openlayer saggui-xml saggui-ol saggui-agl saggui-alleg saggui) - add_dependencies(xml-openlayer ${FREETYPE_LIBRARIES} saggui-xml saggui-ol saggui-agl saggui-alleg saggui) + target_link_libraries(xml-openlayer saggui-ol saggui-agl saggui-alleg saggui) + add_dependencies(xml-openlayer ${FREETYPE_LIBRARIES} saggui-ol saggui-agl saggui-alleg saggui) endif(ENABLE_OPENLAYER) if(ENABLE_SDL) include_directories(${SDL_INCLUDE_DIR}) add_executable(xml-sdl src/sdl.cpp) - target_link_libraries(xml-sdl saggui-xml saggui-sdl saggui) - add_dependencies(xml-sdl saggui-xml saggui-sdl saggui) + target_link_libraries(xml-sdl saggui-sdl saggui) + add_dependencies(xml-sdl saggui-sdl saggui) endif(ENABLE_SDL) if(ENABLE_SDLGL) include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) add_executable(xml-sdlgl src/sdlgl.cpp) - target_link_libraries(xml-sdlgl saggui-xml saggui-sdlgl saggui-sdl saggui) - add_dependencies(xml-sdlgl saggui-xml saggui-sdlgl saggui-sdl saggui) + target_link_libraries(xml-sdlgl saggui-sdlgl saggui-sdl saggui) + add_dependencies(xml-sdlgl saggui-sdlgl saggui-sdl saggui) endif(ENABLE_SDLGL) Added: trunk/include/saggui/xml/sagguixml.h =================================================================== --- trunk/include/saggui/xml/sagguixml.h (rev 0) +++ trunk/include/saggui/xml/sagguixml.h 2007-12-18 03:17:22 UTC (rev 475) @@ -0,0 +1,114 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef XML_ENGINE_H +#define XML_ENGINE_H + +#include "saggui/creationengine.h" + + +class TiXmlElement; +class TiXmlNode; +class TiXmlDocument; + +//! Simplified All Gaming Graphical User Interface +/*! + This is the naming convention for this SAGGUI lib. +*/ +namespace saggui +{ + //! The XML Creational Engine Class + /*! + * Create widgets utilizing XML. + */ + class SAGGUI_EXT_EXPORT xmlEngine : public creationEngine + { + public: + //! constructor + xmlEngine(); + + //! destructor + virtual ~xmlEngine(); + + //! load data + virtual void load(const std::string &filename) throw (sagguiException); + + //! Create windows from xml + virtual void parseWindows(TiXmlElement *element, window *parent) throw (sagguiException); + + protected: + //! Document + TiXmlDocument *doc; + + //! Do windows children + virtual void children(TiXmlElement *element, window *parent); + + //! Specific to checkbox + virtual void checkbox(TiXmlElement *element, window *parent); + + //! Specific to dialog + virtual void doDialog(TiXmlElement *element, window *parent); + + //! Specific to inputbox + virtual void inputbox(TiXmlElement *element, window *parent); + + //! Specific to label + virtual void doLabel(TiXmlElement *element, window *parent); + + //! Specific to listbox + virtual void listbox(TiXmlElement *element, window *parent); + + //! Specific to progressbar + virtual void progressbar(TiXmlElement *element, window *parent); + + //! Specific to pushbutton + virtual void pushbutton(TiXmlElement *element, window *parent); + + //! Specific to radial + virtual void doRadial(TiXmlElement *element, window *parent); + + //! Specific to scrollbar + virtual void scrollbar(TiXmlElement *element, window *parent); + + //! Specific to textbox + virtual void textbox(TiXmlElement *element, window *parent); + + }; +} + +#endif Added: trunk/include/saggui/xml/tinystr.h =================================================================== --- trunk/include/saggui/xml/tinystr.h (rev 0) +++ trunk/include/saggui/xml/tinystr.h 2007-12-18 03:17:22 UTC (rev 475) @@ -0,0 +1,319 @@ +/* +www.sourceforge.net/projects/tinyxml +Original file by Yves Berquin. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +/* + * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005. + * + * - completely rewritten. compact, clean, and fast implementation. + * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems) + * - fixed reserve() to work as per specification. + * - fixed buggy compares operator==(), operator<(), and operator>() + * - fixed operator+=() to take a const ref argument, following spec. + * - added "copy" constructor with length, and most compare operators. + * - added swap(), clear(), size(), capacity(), operator+(). + */ + +#ifndef TIXML_USE_STL + +#ifndef TIXML_STRING_INCLUDED +#define TIXML_STRING_INCLUDED + +#include <assert.h> +#include <string.h> + +/* The support for explicit isn't that universal, and it isn't really + required - it is used to check that the TiXmlString class isn't incorrectly + used. Be nice to old compilers and macro it here: +*/ +#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + #define TIXML_EXPLICIT explicit +#elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + #define TIXML_EXPLICIT explicit +#else + #define TIXML_EXPLICIT +#endif + + +/* + TiXmlString is an emulation of a subset of the std::string template. + Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. + Only the member functions relevant to the TinyXML project have been implemented. + The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase + a string and there's no more room, we allocate a buffer twice as big as we need. +*/ +class TiXmlString +{ + public : + // The size type used + typedef size_t size_type; + + // Error value for find primitive + static const size_type npos; // = -1; + + + // TiXmlString empty constructor + TiXmlString () : rep_(&nullrep_) + { + } + + // TiXmlString copy constructor + TiXmlString ( const TiXmlString & copy) : rep_(0) + { + init(copy.length()); + memcpy(start(), copy.data(), length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) + { + init( static_cast<size_type>( strlen(copy) )); + memcpy(start(), copy, length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) + { + init(len); + memcpy(start(), str, len); + } + + // TiXmlString destructor + ~TiXmlString () + { + quit(); + } + + // = operator + TiXmlString& operator = (const char * copy) + { + return assign( copy, (size_type)strlen(copy)); + } + + // = operator + TiXmlString& operator = (const TiXmlString & copy) + { + return assign(copy.start(), copy.length()); + } + + + // += operator. Maps to append + TiXmlString& operator += (const char * suffix) + { + return append(suffix, static_cast<size_type>( strlen(suffix) )); + } + + // += operator. Maps to append + TiXmlString& operator += (char single) + { + return append(&single, 1); + } + + // += operator. Maps to append + TiXmlString& operator += (const TiXmlString & suffix) + { + return append(suffix.data(), suffix.length()); + } + + + // Convert a TiXmlString into a null-terminated char * + const char * c_str () const { return rep_->str; } + + // Convert a TiXmlString into a char * (need not be null terminated). + const char * data () const { return rep_->str; } + + // Return the length of a TiXmlString + size_type length () const { return rep_->size; } + + // Alias for length() + size_type size () const { return rep_->size; } + + // Checks if a TiXmlString is empty + bool empty () const { return rep_->size == 0; } + + // Return capacity of string + size_type capacity () const { return rep_->capacity; } + + + // single char extraction + const char& at (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // [] operator + char& operator [] (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // find a char in a string. Return TiXmlString::npos if not found + size_type find (char lookup) const + { + return find(lookup, 0); + } + + // find a char in a string from an offset. Return TiXmlString::npos if not found + size_type find (char tofind, size_type offset) const + { + if (offset >= length()) return npos; + + for (const char* p = c_str() + offset; *p != '\0'; ++p) + { + if (*p == tofind) return static_cast< size_type >( p - c_str() ); + } + return npos; + } + + void clear () + { + //Lee: + //The original was just too strange, though correct: + // TiXmlString().swap(*this); + //Instead use the quit & re-init: + quit(); + init(0,0); + } + + /* Function to reserve a big amount of data when we know we'll need it. Be aware that this + function DOES NOT clear the content of the TiXmlString if any exists. + */ + void reserve (size_type cap); + + TiXmlString& assign (const char* str, size_type len); + + TiXmlString& append (const char* str, size_type len); + + void swap (TiXmlString& other) + { + Rep* r = rep_; + rep_ = other.rep_; + other.rep_ = r; + } + + private: + + void init(size_type sz) { init(sz, sz); } + void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } + char* start() const { return rep_->str; } + char* finish() const { return rep_->str + rep_->size; } + + struct Rep + { + size_type size, capacity; + char str[1]; + }; + + void init(size_type sz, size_type cap) + { + if (cap) + { + // Lee: the original form: + // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap)); + // doesn't work in some cases of new being overloaded. Switching + // to the normal allocation, although use an 'int' for systems + // that are overly picky about structure alignment. + const size_type bytesNeeded = sizeof(Rep) + cap; + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); + rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); + + rep_->str[ rep_->size = sz ] = '\0'; + rep_->capacity = cap; + } + else + { + rep_ = &nullrep_; + } + } + + void quit() + { + if (rep_ != &nullrep_) + { + // The rep_ is really an array of ints. (see the allocator, above). + // Cast it back before delete, so the compiler won't incorrectly call destructors. + delete [] ( reinterpret_cast<int*>( rep_ ) ); + } + } + + Rep * rep_; + static Rep nullrep_; + +} ; + + +inline bool operator == (const TiXmlString & a, const TiXmlString & b) +{ + return ( a.length() == b.length() ) // optimization on some platforms + && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare +} +inline bool operator < (const TiXmlString & a, const TiXmlString & b) +{ + return strcmp(a.c_str(), b.c_str()) < 0; +} + +inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } +inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } +inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } +inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } + +inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } +inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } +inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } +inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } + +TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); +TiXmlString operator + (const TiXmlString & a, const char* b); +TiXmlString operator + (const char* a, const TiXmlString & b); + + +/* + TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. + Only the operators that we need for TinyXML have been developped. +*/ +class TiXmlOutStream : public TiXmlString +{ +public : + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const TiXmlString & in) + { + *this += in; + return *this; + } + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const char * in) + { + *this += in; + return *this; + } + +} ; + +#endif // TIXML_STRING_INCLUDED +#endif // TIXML_USE_STL Added: trunk/include/saggui/xml/tinyxml.h =================================================================== --- trunk/include/saggui/xml/tinyxml.h (rev 0) +++ trunk/include/saggui/xml/tinyxml.h 2007-12-18 03:17:22 UTC (rev 475) @@ -0,0 +1,1804 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#ifndef TINYXML_INCLUDED +#define TINYXML_INCLUDED + +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4530 ) +#pragma warning( disable : 4786 ) +#endif + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#define TIXML_USE_STL + +// Help out windows: +#if defined( _DEBUG ) && !defined( DEBUG ) +#define DEBUG +#endif + +#ifdef TIXML_USE_STL + #include <string> + #include <iostream> + #include <sstream> + #define TIXML_STRING std::string +#else + #include "tinystr.h" + #define TIXML_STRING TiXmlString +#endif + +// Deprecated library function hell. Compilers want to use the +// new safe versions. This probably doesn't fully address the problem, +// but it gets closer. There are too many compilers for me to fully +// test. If you get compilation troubles, undefine TIXML_SAFE +#define TIXML_SAFE + +#ifdef TIXML_SAFE + #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + // Microsoft visual studio, version 2005 and higher. + #define TIXML_SNPRINTF _snprintf_s + #define TIXML_SNSCANF _snscanf_s + #define TIXML_SSCANF sscanf_s + #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + //#pragma message( "Using _sn* functions." ) + #define TIXML_SNPRINTF _snprintf + #define TIXML_SNSCANF _snscanf + #define TIXML_SSCANF sscanf + #elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + //#warning( "Using sn* functions." ) + #define TIXML_SNPRINTF snprintf + #define TIXML_SNSCANF snscanf + #define TIXML_SSCANF sscanf + #else + #define TIXML_SSCANF sscanf + #endif +#endif + +class TiXmlDocument; +class TiXmlElement; +class TiXmlComment; +class TiXmlUnknown; +class TiXmlAttribute; +class TiXmlText; +class TiXmlDeclaration; +class TiXmlParsingData; + +const int TIXML_MAJOR_VERSION = 2; +const int TIXML_MINOR_VERSION = 5; +const int TIXML_PATCH_VERSION = 3; + +/* Internal structure for tracking location of items + in the XML file. +*/ +struct TiXmlCursor +{ + TiXmlCursor() { Clear(); } + void Clear() { row = col = -1; } + + int row; // 0 based. + int col; // 0 based. +}; + + +/** + If you call the Accept() method, it requires being passed a TiXmlVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves + are simple called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, <b>no children of this node or its sibilings</b> will be Visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. + + You should never change the document from a callback. + + @sa TiXmlNode::Accept() +*/ +class TiXmlVisitor +{ +public: + virtual ~TiXmlVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } + /// Visit a document. + virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } + + /// Visit an element. + virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } + /// Visit an element. + virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } + + /// Visit a declaration + virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } + /// Visit a text node + virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } + /// Visit a comment node + virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } + /// Visit an unknow node + virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } +}; + +// Only used by Attribute::Query functions +enum +{ + TIXML_SUCCESS, + TIXML_NO_ATTRIBUTE, + TIXML_WRONG_TYPE +}; + + +// Used by the parsing routines. +enum TiXmlEncoding +{ + TIXML_ENCODING_UNKNOWN, + TIXML_ENCODING_UTF8, + TIXML_ENCODING_LEGACY +}; + +const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; + +/** TiXmlBase is a base class for every class in TinyXml. + It does little except to establish that TinyXml classes + can be printed and provide some utility functions. + + In XML, the document and elements can contain + other elements and other types of nodes. + + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) + + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) + + A Decleration contains: Attributes (not on tree) + @endverbatim +*/ +class TiXmlBase +{ + friend class TiXmlNode; + friend class TiXmlElement; + friend class TiXmlDocument; + +public: + TiXmlBase() : userData(0) {} + virtual ~TiXmlBase() {} + + /** All TinyXml classes can print themselves to a filestream + or the string class (TiXmlString in non-STL mode, std::string + in STL mode.) Either or both cfile and str can be null. + + This is a formatted print, and will insert + tabs and newlines. + + (For an unformatted stream, use the << operator.) + */ + virtual void Print( FILE* cfile, int depth ) const = 0; + + /** The world does not agree on whether white space should be kept or + not. In order to make everyone happy, these global, static functions + are provided to set whether or not TinyXml will condense all white space + into a single space or not. The default is to condense. Note changing this + value is not thread safe. + */ + static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } + + /// Return the current white space setting. + static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } + + /** Return the position, in the original source file, of this node or attribute. + The row and column are 1-based. (That is the first row and first column is + 1,1). If the returns values are 0 or less, then the parser does not have + a row and column value. + + Generally, the row and column value will be set when the TiXmlDocument::Load(), + TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set + when the DOM was created from operator>>. + + The values reflect the initial load. Once the DOM is modified programmatically + (by adding or changing nodes and attributes) the new values will NOT update to + reflect changes in the document. + + There is a minor performance cost to computing the row and column. Computation + can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. + + @sa TiXmlDocument::SetTabSize() + */ + int Row() const { return location.row + 1; } + int Column() const { return location.col + 1; } ///< See Row() + + void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. + void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. + const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. + + // Table that returs, for a given lead byte, the total number of bytes + // in the UTF-8 sequence. + static const int utf8ByteTable[256]; + + virtual const char* Parse( const char* p, + TiXmlParsingData* data, + TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; + + /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, + or they will be transformed into entities! + */ + static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); + + enum + { + TIXML_NO_ERROR = 0, + TIXML_ERROR, + TIXML_ERROR_OPENING_FILE, + TIXML_ERROR_OUT_OF_MEMORY, + TIXML_ERROR_PARSING_ELEMENT, + TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, + TIXML_ERROR_READING_ELEMENT_VALUE, + TIXML_ERROR_READING_ATTRIBUTES, + TIXML_ERROR_PARSING_EMPTY, + TIXML_ERROR_READING_END_TAG, + TIXML_ERROR_PARSING_UNKNOWN, + TIXML_ERROR_PARSING_COMMENT, + TIXML_ERROR_PARSING_DECLARATION, + TIXML_ERROR_DOCUMENT_EMPTY, + TIXML_ERROR_EMBEDDED_NULL, + TIXML_ERROR_PARSING_CDATA, + TIXML_ERROR_DOCUMENT_TOP_ONLY, + + TIXML_ERROR_STRING_COUNT + }; + +protected: + + static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + } + inline static bool IsWhiteSpace( int c ) + { + if ( c < 256 ) + return IsWhiteSpace( (char) c ); + return false; // Again, only truly correct for English/Latin...but usually works. + } + + #ifdef TIXML_USE_STL + static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); + static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); + #endif + + /* Reads an XML name into the string provided. Returns + a pointer just past the last character of the name, + or 0 if the function has an error. + */ + static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); + + /* Reads text. Returns a pointer past the given end tag. + Wickedly complex options, but it keeps the (sensitive) code in one place. + */ + static const char* ReadText( const char* in, // where to start + TIXML_STRING* text, // the string read + bool ignoreWhiteSpace, // whether to keep the white space + const char* endTag, // what ends this text + bool ignoreCase, // whether to ignore case in the end tag + TiXmlEncoding encoding ); // the current encoding + + // If an entity has been found, transform it into a character. + static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); + + // Get a character, while interpreting entities. + // The length can be from 0 to 4 bytes. + inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) + { + assert( p ); + if ( encoding == TIXML_ENCODING_UTF8 ) + { + *length = utf8ByteTable[ *((const unsigned char*)p) ]; + assert( *length >= 0 && *length < 5 ); + } + else + { + *length = 1; + } + + if ( *length == 1 ) + { + if ( *p == '&' ) + return GetEntity( p, _value, length, encoding ); + *_value = *p; + return p+1; + } + else if ( *length ) + { + //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), + // and the null terminator isn't needed + for( int i=0; p[i] && i<*length; ++i ) { + _value[i] = p[i]; + } + return p + (*length); + } + else + { + // Not valid text. + return 0; + } + } + + // Return true if the next characters in the stream are any of the endTag sequences. + // Ignore case only works for english, and should only be relied on when comparing + // to English words: StringEqual( p, "version", true ) is fine. + static bool StringEqual( const char* p, + const char* endTag, + bool ignoreCase, + TiXmlEncoding encoding ); + + static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; + + TiXmlCursor location; + + /// Field containing a generic user pointer + void* userData; + + // None of these methods are reliable for any language except English. + // Good for approximation, not great for accuracy. + static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); + static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); + inline static int ToLower( int v, TiXmlEncoding encoding ) + { + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( v < 128 ) return tolower( v ); + return v; + } + else + { + return tolower( v ); + } + } + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + +private: + TiXmlBase( const TiXmlBase& ); // not implemented. + void operator=( const TiXmlBase& base ); // not allowed. + + struct Entity + { + const char* str; + unsigned int strLength; + char chr; + }; + enum + { + NUM_ENTITY = 5, + MAX_ENTITY_LENGTH = 6 + + }; + static Entity entity[ NUM_ENTITY ]; + static bool condenseWhiteSpace; +}; + + +/** The parent class for everything in the Document Object Model. + (Except for attributes). + Nodes have siblings, a parent, and children. A node can be + in a document, or stand on its own. The type of a TiXmlNode + can be queried, and it can be cast to its more defined type. +*/ +class TiXmlNode : public TiXmlBase +{ + friend class TiXmlDocument; + friend class TiXmlElement; + +public: + #ifdef TIXML_USE_STL + + /** An input stream operator, for every class. Tolerant of newlines and + formatting, but doesn't expect them. + */ + friend std::istream& operator >> (std::istream& in, TiXmlNode& base); + + /** An output stream operator, for every class. Note that this outputs + without any newlines or formatting, as opposed to Print(), which + includes tabs and new lines. + + The operator<< and operator>> are not completely symmetric. Writing + a node to a stream is very well defined. You'll get a nice stream + of output, without any extra whitespace or newlines. + + But reading is not as well defined. (As it always is.) If you create + a TiXmlElement (for example) and read that from an input stream, + the text needs to define an element or junk will result. This is + true of all input streams, but it's worth keeping in mind. + + A TiXmlDocument will read nodes until it reads a root element, and + all the children of that root element. + */ + friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); + + /// Appends the XML node or attribute to a std::string. + friend std::string& operator<< (std::string& out, const TiXmlNode& base ); + + #endif + + /** The types of XML nodes supported by TinyXml. (All the + unsupported types are picked up by UNKNOWN.) + */ + enum NodeType + { + DOCUMENT, + ELEMENT, + COMMENT, + UNKNOWN, + TEXT, + DECLARATION, + TYPECOUNT + }; + + virtual ~TiXmlNode(); + + /** The meaning of 'value' changes for the specific type of + TiXmlNode. + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + + The subclasses will wrap this function. + */ + const char *Value() const { return value.c_str (); } + + #ifdef TIXML_USE_STL + /** Return Value() as a std::string. If you only use STL, + this is more efficient than calling Value(). + Only available in STL mode. + */ + const std::string& ValueStr() const { return value; } + #endif + + const TIXML_STRING& ValueTStr() const { return value; } + + /** Changes the value of the node. Defined as: + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + void SetValue(const char * _value) { value = _value;} + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Delete all the children of this node. Does not affect 'this'. + void Clear(); + + /// One step up the DOM. + TiXmlNode* Parent() { return parent; } + const TiXmlNode* Parent() const { return parent; } + + const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. + TiXmlNode* FirstChild() { return firstChild; } + const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. + /// The first child of this node with the matching 'value'. Will be null if none found. + TiXmlNode* FirstChild( const char * _value ) { + // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) + // call the method, cast the return back to non-const. + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); + } + const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. + TiXmlNode* LastChild() { return lastChild; } + + const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. + TiXmlNode* LastChild( const char * _value ) { + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. + #endif + + /** An alternate way to walk the children of a node. + One way to iterate over nodes is: + @verbatim + for( child = parent->FirstChild(); child; child = child->NextSibling() ) + @endverbatim + + IterateChildren does the same thing with the syntax: + @verbatim + child = 0; + while( child = parent->IterateChildren( child ) ) + @endverbatim + + IterateChildren takes the previous child as input and finds + the next one. If the previous child is null, it returns the + first. IterateChildren will return null when done. + */ + const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); + } + + /// This flavor of IterateChildren searches for children with a particular 'value' + const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + #endif + + /** Add a new node related to this. Adds a child past the LastChild. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); + + + /** Add a new node related to this. Adds a child past the LastChild. + + NOTE: the node to be added is passed by pointer, and will be + henceforth owned (and deleted) by tinyXml. This method is efficient + and avoids an extra copy, but should be used with care as it + uses a different memory model than the other insert functions. + + @sa InsertEndChild + */ + TiXmlNode* LinkEndChild( TiXmlNode* addThis ); + + /** Add a new node related to this. Adds a child before the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); + + /** Add a new node related to this. Adds a child after the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); + + /** Replace a child of this node. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); + + /// Delete a child of this node. + bool RemoveChild( TiXmlNode* removeThis ); + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling() const { return prev; } + TiXmlNode* PreviousSibling() { return prev; } + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling( const char * ) const; + TiXmlNode* PreviousSibling( const char *_prev ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Navigate to a sibling node. + const TiXmlNode* NextSibling() const { return next; } + TiXmlNode* NextSibling() { return next; } + + /// Navigate to a sibling node with the given 'value'. + const TiXmlNode* NextSibling( const char * ) const; + TiXmlNode* NextSibling( const char* _next ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement() const; + TiXmlElement* NextSiblingElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement( const char * ) const; + TiXmlElement* NextSiblingElement( const char *_next ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement() const; + TiXmlElement* FirstChildElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); + } + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement( const char * _value ) const; + TiXmlElement* FirstChildElement( const char * _value ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /** Query the type (as an enumerated value, above) of this node. + The possible types are: DOCUMENT, ELEMENT, COMMENT, + UNKNOWN, TEXT, and DECLARATION. + */ + int Type() const { return type; } + + /** Return a pointer to the Document this node lives in. + Returns null if not in a document. + */ + const TiXmlDocument* GetDocument() const; + TiXmlDocument* GetDocument() { + return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); + } + + /// Returns true if this node has no children. + bool NoChildren() const { return !firstChild; } + + virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + /** Create an exact duplicate of this node and return it. The memory must be deleted + by the caller. + */ + virtual TiXmlNode* Clone() const = 0; + + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. + + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( TiXmlVisitor* visitor ) const = 0; + +protected: + TiXmlNode( NodeType _type ); + + // Copy to the allocated object. Shared functionality between Clone, Copy constructor, + // and the assignment operator. + void CopyTo( TiXmlNode* target ) const; + + #ifdef TIXML_USE_STL + // The real work of the input operator. + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; + #endif + + // Figure out what is at *p, and parse it. Returns null if it is not an xml node. + TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); + + TiXmlNode* parent; + NodeType type; + + TiXmlNode* firstChild; + TiXmlNode* lastChild; + + TIXML_STRING value; + + TiXmlNode* prev; + TiXmlNode* next; + +private: + TiXmlNode( const TiXmlNode& ); // not implemented. + void operator=( const TiXmlNode& base ); // not allowed. +}; + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not TiXmlNodes, since they are not + part of the tinyXML document object model. There are other + suggested ways to look at this problem. +*/ +class TiXmlAttribute : public TiXmlBase +{ + friend class TiXmlAttributeSet; + +public: + /// Construct an empty attribute. + TiXmlAttribute() : TiXmlBase() + { + document = 0; + prev = next = 0; + } + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlAttribute( const std::string& _name, const std::string& _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + #endif + + /// Construct an attribute with a name and value. + TiXmlAttribute( const char * _name, const char * _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + + const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. + const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. + #ifdef TIXML_USE_STL + const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. + #endif + int IntValue() const; ///< Return the value of this attribute, converted to an integer. + double DoubleValue() const; ///< Return the value of this attribute, converted to a double. + + // Get the tinyxml string representation + const TIXML_STRING& NameTStr() const { return name; } + + /** QueryIntValue examines the value string. It is an alternative to the + IntValue() method with richer error checking. + If the value is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. + + A specialized but useful call. Note that for success it returns 0, + which is the opposite of almost all other TinyXml calls. + */ + int QueryIntValue( int* _value ) const; + /// QueryDoubleValue examines the value string. See QueryIntValue(). + int QueryDoubleValue( double* _value ) const; + + void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. + void SetValue( const char* _value ) { value = _value; } ///< Set the value. + + void SetIntValue( int _value ); ///< Set the value from an integer. + void SetDoubleValue( double _value ); ///< Set the value from a double. + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetName( const std::string& _name ) { name = _name; } + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Get the next sibling attribute in the DOM. Returns null at end. + const TiXmlAttribute* Next() const; + TiXmlAttribute* Next() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + } + + /// Get the previous sibling attribute in the DOM. Returns null at beginning. + const TiXmlAttribute* Previous() const; + TiXmlAttribute* Previous() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + } + + bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } + bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } + bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + + /* Attribute parsing starts: first letter of the name + returns: the next char after the value end quote + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + // Prints this Attribute to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } + void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + + // [internal use] + // Set the document pointer so the attribute can report errors. + void SetDocument( TiXmlDocument* doc ) { document = doc; } + +private: + TiXmlAttribute( const TiXmlAttribute& ); // not implemented. + void operator=( const TiXmlAttribute& base ); // not allowed. + + TiXmlDocument* document; // A pointer back to a document, for error reporting. + TIXML_STRING name; + TIXML_STRING value; + TiXmlAttribute* prev; + TiXmlAttribute* next; +}; + + +/* A class used to manage a group of attributes. + It is only used internally, both by the ELEMENT and the DECLARATION. + + The set can be changed transparent to the Element and Declaration + classes that use it, but NOT transparent to the Attribute + which has to implement a next() and previous() method. Which makes + it a bit problematic and prevents the use of STL. + + This version is implemented with circular lists because: + - I like circular lists + - it demonstrates some independence from the (typical) doubly linked list. +*/ +class TiXmlAttributeSet +{ +public: + TiXmlAttributeSet(); + ~TiXmlAttributeSet(); + + void Add( TiXmlAttribute* attribute ); + void Remove( TiXmlAttribute* attribute ); + + const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + + const TiXmlAttribute* Find( const char* _name ) const; + TiXmlAttribute* Find( const char* _name ) { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) ); + } + #ifdef TIXML_USE_STL + const TiXmlAttribute* Find( const std::string& _name ) const; + TiXmlAttribute* Find( const std::string& _name ) { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) ); + } + + #endif + +private: + //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), + //*ME: this class must be also use a hidden/disabled copy-constructor !!! + TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed + void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) + + TiXmlAttribute sentinel; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class TiXmlElement : public TiXmlNode +{ +public: + /// Construct an element. + TiXmlElement (const char * in_value); + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlElement( const std::string& _value ); + #endif + + TiXmlElement( const TiXmlElement& ); + + void operator=( const TiXmlElement& base ); + + virtual ~TiXmlElement(); + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + */ + const char* Attribute( const char* name ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an integer, + the integer value will be put in the return 'i', if 'i' + is non-null. + */ + const char* Attribute( const char* name, int* i ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an double, + the double value will be put in the return 'd', if 'd' + is non-null. + */ + const char* Attribute( const char* name, double* d ) const; + + /** QueryIntAttribute examines the attribute - it is an alternative to the + Attribute() method with richer error checking. + If the attribute is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. If the attribute + does not exist, then TIXML_NO_ATTRIBUTE is returned. + */ + int QueryIntAttribute( const char* name, int* _value ) const; + /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). + int QueryDoubleAttribute( const char* name, double* _value ) const; + /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). + int QueryFloatAttribute( const char* name, float* _value ) const { + double d; + int result = QueryDoubleAttribute( name, &d ); + if ( result == TIXML_SUCCESS ) { + *_value = (float)d; + } + return result; + } + + #ifdef TIXML_USE_STL + /** Template form of the attribute query which will try to read the + attribute into the specified type. Very easy, very powerful, but + be careful to make sure to call this with the correct type. + + NOTE: This method doesn't work correctly for 'string' types. + + @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE + */ + template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + + std::stringstream sstream( node->ValueStr() ); + sstream >> *outValue; + if ( !sstream.fail() ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; + } + /* + This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string" + but template specialization is hard to get working cross-compiler. Leaving the bug for now. + + // The above will fail for std::string because the space character is used as a seperator. + // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string + template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + *outValue = node->ValueStr(); + return TIXML_SUCCESS; + } + */ + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, const char * _value ); + + #ifdef TIXML_USE_STL + const std::string* Attribute( const std::string& name ) const; + const std::string* Attribute( const std::string& name, int* i ) const; + const std::string* Attribute( const std::string& name, double* d ) const; + int QueryIntAttribute( const std::string& name, int* _value ) const; + int QueryDoubleAttribute( const std::string& name, double* _value ) const; + + /// STL std::string form. + void SetAttribute( const std::string& name, const std::string& _value ); + ///< STL std::string form. + void SetAttribute( const std::string& name, int _value ); + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or chan... [truncated message content] |
From: <sag...@li...> - 2007-12-14 14:21:02
|
Revision: 474 http://saggui.svn.sourceforge.net/saggui/?rev=474&view=rev Author: juvinious Date: 2007-12-14 06:20:39 -0800 (Fri, 14 Dec 2007) Log Message: ----------- Made roundrect quite more accurate Modified Paths: -------------- trunk/CHANGELOG trunk/include/saggui/graphics.h trunk/src/graphics.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-12-05 15:30:28 UTC (rev 473) +++ trunk/CHANGELOG 2007-12-14 14:20:39 UTC (rev 474) @@ -1,4 +1,6 @@ 0.50 +- Fixed roundRect so that it's accurate +- Changed arc to be more accurate, borrowed read in comments - Fixed gamedemo's buttons and other visual elements - Fixed pushButton to center icon properly when added - api changes in guiManager: setScreen -> setBuffer ; some methods got some exceptions added Modified: trunk/include/saggui/graphics.h =================================================================== --- trunk/include/saggui/graphics.h 2007-12-05 15:30:28 UTC (rev 473) +++ trunk/include/saggui/graphics.h 2007-12-14 14:20:39 UTC (rev 474) @@ -70,7 +70,9 @@ virtual ~graphic(); //! PI - static double S_PI; + const static double S_PI; + const static double DEG_TO_RAD; + const static double RAD_TO_DEG; //! Check if bitmap has been initialized bool isInitialized(); Modified: trunk/src/graphics.cpp =================================================================== --- trunk/src/graphics.cpp 2007-12-05 15:30:28 UTC (rev 473) +++ trunk/src/graphics.cpp 2007-12-14 14:20:39 UTC (rev 474) @@ -46,8 +46,15 @@ { bool graphic::buffered = false; graphic *graphic::screenBitmap = 0; - double graphic::S_PI = 3.14159265358979323846; + const double graphic::S_PI = 3.14159265358979323846; + const double graphic::DEG_TO_RAD = 180.0/S_PI; + const double graphic::RAD_TO_DEG = S_PI/180.0; + void round_double (double dbl_to_round , int &rounded_num) { + rounded_num = static_cast<int>(dbl_to_round); + if ((dbl_to_round - static_cast<double>(rounded_num)) >= 0.5) {rounded_num++;} + } + // Constructor graphic::graphic() { @@ -102,46 +109,84 @@ return screenBitmap; } - //! Draw an arc to bitmap or passed bitmap + /* Draw an arc to bitmap or passed bitmap + Borrowed code from a post on a.cc: + http://www.allegro.cc/forums/thread/594175 + */ void graphic::doArc(double x, double y, double startAngle, double radius, const rgba &color, graphic *bmp) { - float angleIncrement = std::min(( 2.0 * asin( 1.0/radius )/1.0 ), 0.35 * S_PI ); - float endAngle = startAngle + S_PI/2; + int q = 0;// for counters + double d_q = 0.0;// for percentage of loop completed + double d_q_plus_one = 0.0; - float prevX = x + cos(startAngle) * radius; - float prevY = y + sin(startAngle) * radius; - - if(!bmp) - { - for( float a = startAngle; a < endAngle; a += angleIncrement ) - { - float cosa = cos(a); - float sina = sin(a); - - float newX = x + cosa * radius; - float newY = y + sina * radius; - - doLine(prevX,prevY,newX,newY,color); - prevX = newX; - prevY = newY; + const double d_angular_length_deg = 0.030; + const double d_start_angle_rad = startAngle*DEG_TO_RAD; + const double d_angular_length_rad = d_angular_length_deg*DEG_TO_RAD; + const double d_arc_distance_between_points = 0.25*pow(2.0 , static_cast<double>(10) / 10.0); + double d_angular_length_rad_per_segment = 0.0; + + double arc_length = radius*d_angular_length_rad; + if (arc_length < 0.0) {arc_length *= -1.0;} + const double d_num_segments = arc_length / d_arc_distance_between_points; + + int num_segments = 0; + round_double(d_num_segments , num_segments); + + if (num_segments == 0) {num_segments += 1;} // need at least one segment (two points) + const int num_points = num_segments + 1; + const double d_num_points_minus_one = static_cast<double>(num_points - 1); + + int arc_point_x;//[num_points]; + int arc_point_y;//[num_points]; + int arc_point2_x;//[num_points]; + int arc_point2_y;//[num_points]; + double d_arc_point_x = 0.0; + double d_arc_point_y = 0.0; + double d_arc_point2_x = 0.0; + double d_arc_point2_y = 0.0; + + double current_angle_rad = 0.0; + double current_angle2_rad = 0.0; + + if (d_arc_distance_between_points <= 1.0) { + for (q = 0 ; q < num_points ; q++) { + d_q = static_cast<double>(q); + current_angle_rad = d_start_angle_rad + (d_q / d_num_points_minus_one)*d_angular_length_rad; + d_arc_point_x = x + radius*cos(current_angle_rad); + d_arc_point_y = y + radius*sin(current_angle_rad); + + round_double(d_arc_point_x , arc_point_x); + round_double(d_arc_point_y , arc_point_y); + + if(!bmp)placePixel(arc_point_x,arc_point_y,color); + else bmp->placePixel(arc_point_x,arc_point_y,color); } - doLine(prevX,prevY, x + cos(endAngle) * radius, y + sin(endAngle) * radius,color); } - else - { - for( float a = startAngle; a < endAngle; a += angleIncrement ) - { - float cosa = cos(a); - float sina = sin(a); - - float newX = x + cosa * radius; - float newY = y + sina * radius; - - bmp->doLine(prevX,prevY,newX,newY,color); - prevX = newX; - prevY = newY; + if (d_arc_distance_between_points > 1.0) { + + d_angular_length_rad_per_segment = d_angular_length_rad / d_num_points_minus_one; + for (q = 0 ; q < num_segments ; q++) { + d_q = static_cast<double>(q); + d_q_plus_one = static_cast<double>(q + 1); + + current_angle_rad = d_start_angle_rad + d_q*d_angular_length_rad_per_segment; + current_angle2_rad = d_start_angle_rad + d_q_plus_one*d_angular_length_rad_per_segment; + + d_arc_point_x = x + radius*cos(current_angle_rad); + d_arc_point_y = y + radius*sin(current_angle_rad); + + round_double(d_arc_point_x , arc_point_x); + round_double(d_arc_point_y , arc_point_y); + + d_arc_point2_x = x + radius*cos(current_angle2_rad); + d_arc_point2_y = y + radius*sin(current_angle2_rad); + + round_double(d_arc_point2_x , arc_point2_x); + round_double(d_arc_point2_y , arc_point2_y); + + if(!bmp)doLine(arc_point_x,arc_point_y, arc_point2_x, arc_point2_y,color); + else bmp->doLine(arc_point_x,arc_point_y, arc_point2_x, arc_point2_y,color); } - bmp->doLine(prevX,prevY, x + cos(endAngle) * radius, y + sin(endAngle) * radius,color); } } @@ -155,10 +200,10 @@ doLine(x+radius, y+height, x+width-radius,y+height, color); doLine(x, y+radius,x, y+height-radius, color); doLine(x+width, y+radius,x+width, y+height-radius, color); - doArc(x+radius, y+radius, S_PI, radius, color); - doArc(x+radius + (width - radius *2), y+radius, -S_PI/2, radius, color); - doArc(x+width-radius, y+height-radius, 0, radius ,color); - doArc(x+radius, y+height-radius, S_PI/2, radius, color); + doArc(x+radius, y+radius, S_PI-1.115, radius, color); + doArc(x+radius + (width - radius *2), y+radius, -S_PI/2 +0.116, radius, color); + doArc(x+width-radius, y+height-radius, -0.110, radius ,color); + doArc(x+radius, y+height-radius, S_PI/2-0.119, radius, color); } else { @@ -166,10 +211,10 @@ bmp->doLine(x+radius, y+height, x+width-radius,y+height, color); bmp->doLine(x, y+radius,x, y+height-radius, color); bmp->doLine(x+width, y+radius,x+width, y+height-radius, color); - bmp->doArc(x+radius, y+radius, S_PI, radius, color); - bmp->doArc(x+radius + (width - radius *2), y+radius, -S_PI/2, radius, color); - bmp->doArc(x+width-radius, y+height-radius, 0, radius ,color); - bmp->doArc(x+radius, y+height-radius, S_PI/2, radius, color); + bmp->doArc(x+radius, y+radius, S_PI-1.115, radius, color); + bmp->doArc(x+radius + (width - radius *2), y+radius, -S_PI/2 +0.116, radius, color); + bmp->doArc(x+width-radius, y+height-radius, -0.110, radius ,color); + bmp->doArc(x+radius, y+height-radius, S_PI/2-0.119, radius, color); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-12-05 15:30:31
|
Revision: 473 http://saggui.svn.sourceforge.net/saggui/?rev=473&view=rev Author: juvinious Date: 2007-12-05 07:30:28 -0800 (Wed, 05 Dec 2007) Log Message: ----------- Fixed pushbutton to center icons. Fixed gamedemos buttons and some visual elements. Modified Paths: -------------- trunk/CHANGELOG trunk/examples/gamedemo/include/gamedemo.h trunk/examples/gamedemo/src/gamedemo.cpp trunk/src/widgets/pushbutton.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-09-21 12:08:27 UTC (rev 472) +++ trunk/CHANGELOG 2007-12-05 15:30:28 UTC (rev 473) @@ -1,4 +1,6 @@ 0.50 +- Fixed gamedemo's buttons and other visual elements +- Fixed pushButton to center icon properly when added - api changes in guiManager: setScreen -> setBuffer ; some methods got some exceptions added - Some code cleanup and renamed some stuff which could impact the previous api - Moved getColor from creationEngine to rgba Modified: trunk/examples/gamedemo/include/gamedemo.h =================================================================== --- trunk/examples/gamedemo/include/gamedemo.h 2007-09-21 12:08:27 UTC (rev 472) +++ trunk/examples/gamedemo/include/gamedemo.h 2007-12-05 15:30:28 UTC (rev 473) @@ -140,6 +140,8 @@ private: void showText(const coord &c); void hideText(const coord &c); + + filledDecor decor; public: icon(window *parent, graphic *bmp, double x, double y, double width=32, double height=32); ~icon(); Modified: trunk/examples/gamedemo/src/gamedemo.cpp =================================================================== --- trunk/examples/gamedemo/src/gamedemo.cpp 2007-09-21 12:08:27 UTC (rev 472) +++ trunk/examples/gamedemo/src/gamedemo.cpp 2007-12-05 15:30:28 UTC (rev 473) @@ -237,7 +237,7 @@ { //foreground = rgba(0,128,128,255);//rgba(67,87,106,255); //background = foreground; - topPadding = bottomPadding = leftPadding = rightPadding = 4; + topPadding = bottomPadding = leftPadding = rightPadding = 1; onPaintBackground.connect(this,&filledDecor::doBackground); onPaintForeground.connect(this,&filledDecor::doForeground); } @@ -311,6 +311,7 @@ b1.position.set(x,y,width,height); b1.onHover.connect(this,&icon::showText); b1.onHoverOut.connect(this,&icon::hideText); + b1.setStyle(&decor); text.setAttribute(AT_Visible,false); text.setAutoResize(true); text.setText("Not Available"); Modified: trunk/src/widgets/pushbutton.cpp =================================================================== --- trunk/src/widgets/pushbutton.cpp 2007-09-21 12:08:27 UTC (rev 472) +++ trunk/src/widgets/pushbutton.cpp 2007-12-05 15:30:28 UTC (rev 473) @@ -144,8 +144,8 @@ iconPosition.setY(topPadding + 1); } - iconPosition.setX(leftPadding + 1); - iconPosition.setY(topPadding + 1); + iconPosition.setX(1); + iconPosition.setY(1); // This is to ensure that the text actually fixes itself onTextChanged(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-09-21 12:08:32
|
Revision: 472 http://saggui.svn.sourceforge.net/saggui/?rev=472&view=rev Author: juvinious Date: 2007-09-21 05:08:27 -0700 (Fri, 21 Sep 2007) Log Message: ----------- Added other widget specific parsing in xmlengine Modified Paths: -------------- trunk/CHANGELOG trunk/modules/sagguixml/include/sagguixml.h trunk/modules/sagguixml/src/sagguixml.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-09-03 13:22:37 UTC (rev 471) +++ trunk/CHANGELOG 2007-09-21 12:08:27 UTC (rev 472) @@ -1,4 +1,5 @@ 0.50 +- api changes in guiManager: setScreen -> setBuffer ; some methods got some exceptions added - Some code cleanup and renamed some stuff which could impact the previous api - Moved getColor from creationEngine to rgba - Converted all paint signals to use the new paintEvent class Modified: trunk/modules/sagguixml/include/sagguixml.h =================================================================== --- trunk/modules/sagguixml/include/sagguixml.h 2007-09-03 13:22:37 UTC (rev 471) +++ trunk/modules/sagguixml/include/sagguixml.h 2007-09-21 12:08:27 UTC (rev 472) @@ -78,15 +78,36 @@ //! Do windows children virtual void children(TiXmlElement *element, window *parent); - //! Specific to listbox - virtual void listbox(TiXmlElement *element, window *parent); + //! Specific to checkbox + virtual void checkbox(TiXmlElement *element, window *parent); + //! Specific to dialog + virtual void doDialog(TiXmlElement *element, window *parent); + //! Specific to inputbox virtual void inputbox(TiXmlElement *element, window *parent); - //! Specific to inputbox + //! Specific to label virtual void doLabel(TiXmlElement *element, window *parent); + //! Specific to listbox + virtual void listbox(TiXmlElement *element, window *parent); + + //! Specific to progressbar + virtual void progressbar(TiXmlElement *element, window *parent); + + //! Specific to pushbutton + virtual void pushbutton(TiXmlElement *element, window *parent); + + //! Specific to radial + virtual void doRadial(TiXmlElement *element, window *parent); + + //! Specific to scrollbar + virtual void scrollbar(TiXmlElement *element, window *parent); + + //! Specific to textbox + virtual void textbox(TiXmlElement *element, window *parent); + }; } Modified: trunk/modules/sagguixml/src/sagguixml.cpp =================================================================== --- trunk/modules/sagguixml/src/sagguixml.cpp 2007-09-03 13:22:37 UTC (rev 471) +++ trunk/modules/sagguixml/src/sagguixml.cpp 2007-09-21 12:08:27 UTC (rev 472) @@ -39,9 +39,20 @@ #include "sagguixml.h" #include "tinyxml.h" #include "window.h" -#include "widgets/listbox.h" +#include "widgets/abstractbutton.h" +#include "widgets/box.h" +#include "widgets/button.h" +#include "widgets/buttongroup.h" +#include "widgets/checkbox.h" +#include "widgets/dialog.h" #include "widgets/input_box.h" #include "widgets/label.h" +#include "widgets/listbox.h" +#include "widgets/progress_bar.h" +#include "widgets/pushbutton.h" +#include "widgets/radial.h" +#include "widgets/scroll_bar.h" +#include "widgets/text_box.h" namespace saggui { @@ -175,10 +186,15 @@ if(!tempWin)throw sagguiException("Failed to load window: " + std::string(element->Value()) + "!"); // Do specific child related elements - if(temp.getType() == windowMarkup::LISTBOX) + + if(temp.getType() == windowMarkup::CHECKBOX) { - listbox(element, tempWin); + checkbox(element, tempWin); } + else if(temp.getType() == windowMarkup::DIALOG) + { + doDialog(element, tempWin); + } else if(temp.getType() == windowMarkup::INPUTBOX) { inputbox(element, tempWin); @@ -187,6 +203,30 @@ { doLabel(element, tempWin); } + else if(temp.getType() == windowMarkup::LISTBOX) + { + listbox(element, tempWin); + } + else if(temp.getType() == windowMarkup::PROGRESSBAR) + { + progressbar(element, tempWin); + } + else if(temp.getType() == windowMarkup::PUSHBUTTON) + { + pushbutton(element, tempWin); + } + else if(temp.getType() == windowMarkup::RADIAL) + { + doRadial(element, tempWin); + } + else if(temp.getType() == windowMarkup::SCROLLBAR) + { + scrollbar(element, tempWin); + } + else if(temp.getType() == windowMarkup::TEXTBOX) + { + textbox(element, tempWin); + } else { children(element, tempWin); @@ -208,28 +248,18 @@ } } - void xmlEngine::listbox(TiXmlElement *element, window *parent) + void xmlEngine::checkbox(TiXmlElement *element, window *parent) { - TiXmlNode *child = element->FirstChild(); - listBox *temp = dynamic_cast<listBox *>(parent); + checkBox *temp = dynamic_cast<checkBox *>(parent); if(!temp)return; - bool hasItems = false; - while(child != NULL) - { - TiXmlElement *elem = child->ToElement(); - if(elem->Value() == std::string("li")) - { - if(!hasItems) - { - hasItems=true; - temp->clearItems(); - } - temp->addItem(elem->FirstChild()->Value()); - } - child = child->NextSibling(); - } } + void xmlEngine::doDialog(TiXmlElement *element, window *parent) + { + dialog *temp = dynamic_cast<dialog *>(parent); + if(!temp)return; + } + void xmlEngine::inputbox(TiXmlElement *element, window *parent) { inputBox *temp = dynamic_cast<inputBox *>(parent); @@ -286,5 +316,58 @@ temp->onResize.emit(); } } + + void xmlEngine::listbox(TiXmlElement *element, window *parent) + { + TiXmlNode *child = element->FirstChild(); + listBox *temp = dynamic_cast<listBox *>(parent); + if(!temp)return; + bool hasItems = false; + while(child != NULL) + { + TiXmlElement *elem = child->ToElement(); + if(elem->Value() == std::string("li")) + { + if(!hasItems) + { + hasItems=true; + temp->clearItems(); + } + temp->addItem(elem->FirstChild()->Value()); + } + child = child->NextSibling(); + } + } + + void xmlEngine::progressbar(TiXmlElement *element, window *parent) + { + progressBar *temp = dynamic_cast<progressBar *>(parent); + if(!temp)return; + } + + void xmlEngine::pushbutton(TiXmlElement *element, window *parent) + { + pushButton *temp = dynamic_cast<pushButton *>(parent); + if(!temp)return; + } + + void xmlEngine::doRadial(TiXmlElement *element, window *parent) + { + radial *temp = dynamic_cast<radial *>(parent); + if(!temp)return; + } + + void xmlEngine::scrollbar(TiXmlElement *element, window *parent) + { + scrollBar *temp = dynamic_cast<scrollBar *>(parent); + if(!temp)return; + } + + void xmlEngine::textbox(TiXmlElement *element, window *parent) + { + textBox *temp = dynamic_cast<textBox *>(parent); + if(!temp)return; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-09-05 07:09:34
|
Revision: 465 http://saggui.svn.sourceforge.net/saggui/?rev=465&view=rev Author: juvinious Date: 2007-08-26 22:54:00 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Fixed issue in windows with xml demo Modified Paths: -------------- trunk/examples/xml/src/allegro.cpp trunk/modules/sagguixml/include/sagguixml.h trunk/modules/sagguixml/src/sagguixml.cpp Modified: trunk/examples/xml/src/allegro.cpp =================================================================== --- trunk/examples/xml/src/allegro.cpp 2007-08-26 20:07:44 UTC (rev 464) +++ trunk/examples/xml/src/allegro.cpp 2007-08-27 05:54:00 UTC (rev 465) @@ -1,5 +1,43 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <saggui_alleg.h> #include <saggui.h> -#include <saggui_alleg.h> #include <saggui_xml.h> using namespace saggui; Modified: trunk/modules/sagguixml/include/sagguixml.h =================================================================== --- trunk/modules/sagguixml/include/sagguixml.h 2007-08-26 20:07:44 UTC (rev 464) +++ trunk/modules/sagguixml/include/sagguixml.h 2007-08-27 05:54:00 UTC (rev 465) @@ -84,6 +84,9 @@ //! Specific to inputbox virtual void inputbox(TiXmlElement *element, window *parent); + //! Specific to inputbox + virtual void doLabel(TiXmlElement *element, window *parent); + }; } Modified: trunk/modules/sagguixml/src/sagguixml.cpp =================================================================== --- trunk/modules/sagguixml/src/sagguixml.cpp 2007-08-26 20:07:44 UTC (rev 464) +++ trunk/modules/sagguixml/src/sagguixml.cpp 2007-08-27 05:54:00 UTC (rev 465) @@ -41,6 +41,7 @@ #include "window.h" #include "widgets/listbox.h" #include "widgets/input_box.h" +#include "widgets/label.h" namespace saggui { @@ -182,6 +183,10 @@ { inputbox(element, tempWin); } + else if(temp.getType() == windowMarkup::LABEL) + { + doLabel(element, tempWin); + } else { children(element, tempWin); @@ -258,5 +263,28 @@ temp->setLimit(atoi(element->Attribute("limit"))); } } + + void xmlEngine::doLabel(TiXmlElement *element, window *parent) + { + label *temp = dynamic_cast<label *>(parent); + if(!temp)return; + if(element->Attribute("valign")) + { + temp->setVerticalAlign(inputBox::textAlign(atoi(element->Attribute("valign")))); + } + if(element->Attribute("halign")) + { + temp->setHorizontalAlign(inputBox::textAlign(atoi(element->Attribute("halign")))); + } + if(element->Attribute("font-color")) + { + temp->setColor(getColor(element->Attribute("font-color"))); + } + if(element->Attribute("auto-resize")) + { + temp->setAutoResize(bool(element->Attribute("auto-resize"))); + temp->onResize.emit(); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-09-03 13:22:41
|
Revision: 471 http://saggui.svn.sourceforge.net/saggui/?rev=471&view=rev Author: juvinious Date: 2007-09-03 06:22:37 -0700 (Mon, 03 Sep 2007) Log Message: ----------- Several changes, check changelog Modified Paths: -------------- trunk/CHANGELOG trunk/examples/demo/src/allegro.cpp trunk/examples/demo/src/allegrogl.cpp trunk/examples/demo/src/openlayer.cpp trunk/examples/demo/src/profiler.cpp trunk/examples/demo/src/sdl.cpp trunk/examples/demo/src/sdlgl.cpp trunk/examples/gamedemo/src/allegro.cpp trunk/examples/gamedemo/src/allegrogl.cpp trunk/examples/gamedemo/src/gamedemo.cpp trunk/examples/gamedemo/src/openlayer.cpp trunk/examples/gamedemo/src/profiler.cpp trunk/examples/gamedemo/src/sdl.cpp trunk/examples/gamedemo/src/sdlgl.cpp trunk/examples/widgets/src/allegro.cpp trunk/examples/widgets/src/allegrogl.cpp trunk/examples/widgets/src/openlayer.cpp trunk/examples/widgets/src/profiler.cpp trunk/examples/widgets/src/sdl.cpp trunk/examples/widgets/src/sdlgl.cpp trunk/examples/xml/CMakeLists.txt trunk/examples/xml/src/allegro.cpp trunk/examples/xml/src/allegrogl.cpp trunk/examples/xml/src/openlayer.cpp trunk/examples/xml/src/sdl.cpp trunk/examples/xml/src/sdlgl.cpp trunk/include/saggui/creationengine.h trunk/include/saggui/graphics.h trunk/include/saggui/gui_manager.h trunk/include/saggui/resource_manager.h trunk/include/saggui/rgba.h trunk/include/saggui/window.h trunk/modules/allegro/src/al_font.cpp trunk/modules/allegro/src/al_gfx.cpp trunk/modules/openlayer/src/ol_gfx.cpp trunk/modules/sagguixml/src/sagguixml.cpp trunk/modules/sdl/src/sdl_gfx.cpp trunk/src/creationengine.cpp trunk/src/gui_manager.cpp trunk/src/rgba.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/CHANGELOG 2007-09-03 13:22:37 UTC (rev 471) @@ -1,4 +1,6 @@ 0.50 +- Some code cleanup and renamed some stuff which could impact the previous api +- Moved getColor from creationEngine to rgba - Converted all paint signals to use the new paintEvent class - Added paintEvent class for passing paint info for onPaint events - Added xml demo for allegro to the repository Modified: trunk/examples/demo/src/allegro.cpp =================================================================== --- trunk/examples/demo/src/allegro.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/demo/src/allegro.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -354,34 +354,34 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(blackCol); + (guiManager::getBuffer())->clearBmp(blackCol); - //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getSystemBuffer());} + //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getBuffer());} - testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getSystemBuffer(),1,"Press ESC to quit"); - testFont->render(320,16,whiteCol,guiManager::getSystemBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); - testFont->render(320,32,whiteCol,guiManager::getSystemBuffer(),1,"Press 1 to toggle GUI"); - testFont->render(320,48,whiteCol,guiManager::getSystemBuffer(),1,"Press 2 to add a new window"); - testFont->render(320,64,whiteCol,guiManager::getSystemBuffer(),1,"Press 3 to delete last window created"); - testFont->render(320,80,whiteCol,guiManager::getSystemBuffer(),1,"Press 4 to toggle buffered mode"); - testFont->render(320,96,whiteCol,guiManager::getSystemBuffer(),1,"Press UP to increase opacity"); - testFont->render(320,112,whiteCol,guiManager::getSystemBuffer(),1,"Press DOWN to decrease opacity"); - testFont->render(320,128,whiteCol,guiManager::getSystemBuffer(),1,"Press Right to increase font size"); - testFont->render(320,144,whiteCol,guiManager::getSystemBuffer(),1,"Press Left to decrease font size"); + testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getBuffer(),1,"Press ESC to quit"); + testFont->render(320,16,whiteCol,guiManager::getBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); + testFont->render(320,32,whiteCol,guiManager::getBuffer(),1,"Press 1 to toggle GUI"); + testFont->render(320,48,whiteCol,guiManager::getBuffer(),1,"Press 2 to add a new window"); + testFont->render(320,64,whiteCol,guiManager::getBuffer(),1,"Press 3 to delete last window created"); + testFont->render(320,80,whiteCol,guiManager::getBuffer(),1,"Press 4 to toggle buffered mode"); + testFont->render(320,96,whiteCol,guiManager::getBuffer(),1,"Press UP to increase opacity"); + testFont->render(320,112,whiteCol,guiManager::getBuffer(),1,"Press DOWN to decrease opacity"); + testFont->render(320,128,whiteCol,guiManager::getBuffer(),1,"Press Right to increase font size"); + testFont->render(320,144,whiteCol,guiManager::getBuffer(),1,"Press Left to decrease font size"); - testFont->render(320,398,whiteCol,guiManager::getSystemBuffer(),1,"FPS:%d",fps); - testFont->render(320,412,whiteCol,guiManager::getSystemBuffer(),1,"Current Key:%d",currentKey.getValue()); + testFont->render(320,398,whiteCol,guiManager::getBuffer(),1,"FPS:%d",fps); + testFont->render(320,412,whiteCol,guiManager::getBuffer(),1,"Current Key:%d",currentKey.getValue()); - testFont->render(320,428,whiteCol,guiManager::getSystemBuffer(),1,"Font size: %d",fontSizeH); - testFont->render(320,444,whiteCol,guiManager::getSystemBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); - testFont->render(320,460,whiteCol,guiManager::getSystemBuffer(),1,guiManager::getMouseButtonInfoWM()); + testFont->render(320,428,whiteCol,guiManager::getBuffer(),1,"Font size: %d",fontSizeH); + testFont->render(320,444,whiteCol,guiManager::getBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + testFont->render(320,460,whiteCol,guiManager::getBuffer(),1,guiManager::getMouseButtonInfoWM()); - testFont->render(640,240,whiteCol,guiManager::getSystemBuffer(),2,"Testing right aligned"); + testFont->render(640,240,whiteCol,guiManager::getBuffer(),2,"Testing right aligned"); - //guiManager::getSystemBuffer()->doArc(50,50,AL_PI/2,15.0,rgba::WHITE); - guiManager::getSystemBuffer()->doRoundRectfill(50,50,100,100,radius,rgba::GRAY); - guiManager::getSystemBuffer()->doRoundRect(50,50,100,100,radius,rgba::WHITE); + //guiManager::getBuffer()->doArc(50,50,AL_PI/2,15.0,rgba::WHITE); + guiManager::getBuffer()->doRoundRectfill(50,50,100,100,radius,rgba::GRAY); + guiManager::getBuffer()->doRoundRect(50,50,100,100,radius,rgba::WHITE); guiManager::renderWindows(); Modified: trunk/examples/demo/src/allegrogl.cpp =================================================================== --- trunk/examples/demo/src/allegrogl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/demo/src/allegrogl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -343,32 +343,32 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(blackCol); + (guiManager::getBuffer())->clearBmp(blackCol); allegro_gl_set_allegro_mode(); - //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getSystemBuffer());} + //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getBuffer());} - testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getSystemBuffer(),1,"Press ESC to quit"); - testFont->render(320,16,whiteCol,guiManager::getSystemBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); - testFont->render(320,32,whiteCol,guiManager::getSystemBuffer(),1,"Press 1 to toggle GUI"); - testFont->render(320,48,whiteCol,guiManager::getSystemBuffer(),1,"Press 2 to add a new window"); - testFont->render(320,64,whiteCol,guiManager::getSystemBuffer(),1,"Press 3 to delete last window created"); - testFont->render(320,80,whiteCol,guiManager::getSystemBuffer(),1,"Press 4 to toggle buffered mode"); - testFont->render(320,96,whiteCol,guiManager::getSystemBuffer(),1,"Press UP to increase opacity"); - testFont->render(320,112,whiteCol,guiManager::getSystemBuffer(),1,"Press DOWN to decrease opacity"); - testFont->render(320,128,whiteCol,guiManager::getSystemBuffer(),1,"Press Right to increase font size"); - testFont->render(320,144,whiteCol,guiManager::getSystemBuffer(),1,"Press Left to decrease font size"); + testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getBuffer(),1,"Press ESC to quit"); + testFont->render(320,16,whiteCol,guiManager::getBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); + testFont->render(320,32,whiteCol,guiManager::getBuffer(),1,"Press 1 to toggle GUI"); + testFont->render(320,48,whiteCol,guiManager::getBuffer(),1,"Press 2 to add a new window"); + testFont->render(320,64,whiteCol,guiManager::getBuffer(),1,"Press 3 to delete last window created"); + testFont->render(320,80,whiteCol,guiManager::getBuffer(),1,"Press 4 to toggle buffered mode"); + testFont->render(320,96,whiteCol,guiManager::getBuffer(),1,"Press UP to increase opacity"); + testFont->render(320,112,whiteCol,guiManager::getBuffer(),1,"Press DOWN to decrease opacity"); + testFont->render(320,128,whiteCol,guiManager::getBuffer(),1,"Press Right to increase font size"); + testFont->render(320,144,whiteCol,guiManager::getBuffer(),1,"Press Left to decrease font size"); - testFont->render(320,398,whiteCol,guiManager::getSystemBuffer(),1,"FPS:%d",fps); - testFont->render(320,412,whiteCol,guiManager::getSystemBuffer(),1,"Current Key:%d",currentKey.getValue()); + testFont->render(320,398,whiteCol,guiManager::getBuffer(),1,"FPS:%d",fps); + testFont->render(320,412,whiteCol,guiManager::getBuffer(),1,"Current Key:%d",currentKey.getValue()); - testFont->render(320,428,whiteCol,guiManager::getSystemBuffer(),1,"Font size: %d",fontSizeH); - testFont->render(320,444,whiteCol,guiManager::getSystemBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); - testFont->render(320,460,whiteCol,guiManager::getSystemBuffer(),1,guiManager::getMouseButtonInfoWM()); + testFont->render(320,428,whiteCol,guiManager::getBuffer(),1,"Font size: %d",fontSizeH); + testFont->render(320,444,whiteCol,guiManager::getBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + testFont->render(320,460,whiteCol,guiManager::getBuffer(),1,guiManager::getMouseButtonInfoWM()); - testFont->render(640,240,whiteCol,guiManager::getSystemBuffer(),2,"Testing right aligned"); + testFont->render(640,240,whiteCol,guiManager::getBuffer(),2,"Testing right aligned"); guiManager::renderWindows(); Modified: trunk/examples/demo/src/openlayer.cpp =================================================================== --- trunk/examples/demo/src/openlayer.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/demo/src/openlayer.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -343,30 +343,30 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(blackCol); + (guiManager::getBuffer())->clearBmp(blackCol); - //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getSystemBuffer());} + //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getBuffer());} - testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getSystemBuffer(),1,"Press ESC to quit"); - testFont->render(320,16,whiteCol,guiManager::getSystemBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); - testFont->render(320,32,whiteCol,guiManager::getSystemBuffer(),1,"Press 1 to toggle GUI"); - testFont->render(320,48,whiteCol,guiManager::getSystemBuffer(),1,"Press 2 to add a new window"); - testFont->render(320,64,whiteCol,guiManager::getSystemBuffer(),1,"Press 3 to delete last window created"); - testFont->render(320,80,whiteCol,guiManager::getSystemBuffer(),1,"Press 4 to toggle buffered mode"); - testFont->render(320,96,whiteCol,guiManager::getSystemBuffer(),1,"Press UP to increase opacity"); - testFont->render(320,112,whiteCol,guiManager::getSystemBuffer(),1,"Press DOWN to decrease opacity"); - testFont->render(320,128,whiteCol,guiManager::getSystemBuffer(),1,"Press Right to increase font size"); - testFont->render(320,144,whiteCol,guiManager::getSystemBuffer(),1,"Press Left to decrease font size"); + testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getBuffer(),1,"Press ESC to quit"); + testFont->render(320,16,whiteCol,guiManager::getBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); + testFont->render(320,32,whiteCol,guiManager::getBuffer(),1,"Press 1 to toggle GUI"); + testFont->render(320,48,whiteCol,guiManager::getBuffer(),1,"Press 2 to add a new window"); + testFont->render(320,64,whiteCol,guiManager::getBuffer(),1,"Press 3 to delete last window created"); + testFont->render(320,80,whiteCol,guiManager::getBuffer(),1,"Press 4 to toggle buffered mode"); + testFont->render(320,96,whiteCol,guiManager::getBuffer(),1,"Press UP to increase opacity"); + testFont->render(320,112,whiteCol,guiManager::getBuffer(),1,"Press DOWN to decrease opacity"); + testFont->render(320,128,whiteCol,guiManager::getBuffer(),1,"Press Right to increase font size"); + testFont->render(320,144,whiteCol,guiManager::getBuffer(),1,"Press Left to decrease font size"); - testFont->render(320,398,whiteCol,guiManager::getSystemBuffer(),1,"FPS:%d",fps); - testFont->render(320,412,whiteCol,guiManager::getSystemBuffer(),1,"Current Key:%d",currentKey.getValue()); + testFont->render(320,398,whiteCol,guiManager::getBuffer(),1,"FPS:%d",fps); + testFont->render(320,412,whiteCol,guiManager::getBuffer(),1,"Current Key:%d",currentKey.getValue()); - testFont->render(320,428,whiteCol,guiManager::getSystemBuffer(),1,"Font size: %d",fontSizeH); - testFont->render(320,444,whiteCol,guiManager::getSystemBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); - testFont->render(320,460,whiteCol,guiManager::getSystemBuffer(),1,guiManager::getMouseButtonInfoWM()); + testFont->render(320,428,whiteCol,guiManager::getBuffer(),1,"Font size: %d",fontSizeH); + testFont->render(320,444,whiteCol,guiManager::getBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + testFont->render(320,460,whiteCol,guiManager::getBuffer(),1,guiManager::getMouseButtonInfoWM()); - testFont->render(640,240,whiteCol,guiManager::getSystemBuffer(),2,"Testing right aligned"); + testFont->render(640,240,whiteCol,guiManager::getBuffer(),2,"Testing right aligned"); guiManager::renderWindows(); Modified: trunk/examples/demo/src/profiler.cpp =================================================================== --- trunk/examples/demo/src/profiler.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/demo/src/profiler.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -342,30 +342,30 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(blackCol); + (guiManager::getBuffer())->clearBmp(blackCol); - //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getSystemBuffer());} + //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getBuffer());} - testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getSystemBuffer(),1,"Press ESC to quit"); - testFont->render(320,16,whiteCol,guiManager::getSystemBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); - testFont->render(320,32,whiteCol,guiManager::getSystemBuffer(),1,"Press 1 to toggle GUI"); - testFont->render(320,48,whiteCol,guiManager::getSystemBuffer(),1,"Press 2 to add a new window"); - testFont->render(320,64,whiteCol,guiManager::getSystemBuffer(),1,"Press 3 to delete last window created"); - testFont->render(320,80,whiteCol,guiManager::getSystemBuffer(),1,"Press 4 to toggle buffered mode"); - testFont->render(320,96,whiteCol,guiManager::getSystemBuffer(),1,"Press UP to increase opacity"); - testFont->render(320,112,whiteCol,guiManager::getSystemBuffer(),1,"Press DOWN to decrease opacity"); - testFont->render(320,128,whiteCol,guiManager::getSystemBuffer(),1,"Press Right to increase font size"); - testFont->render(320,144,whiteCol,guiManager::getSystemBuffer(),1,"Press Left to decrease font size"); + testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getBuffer(),1,"Press ESC to quit"); + testFont->render(320,16,whiteCol,guiManager::getBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); + testFont->render(320,32,whiteCol,guiManager::getBuffer(),1,"Press 1 to toggle GUI"); + testFont->render(320,48,whiteCol,guiManager::getBuffer(),1,"Press 2 to add a new window"); + testFont->render(320,64,whiteCol,guiManager::getBuffer(),1,"Press 3 to delete last window created"); + testFont->render(320,80,whiteCol,guiManager::getBuffer(),1,"Press 4 to toggle buffered mode"); + testFont->render(320,96,whiteCol,guiManager::getBuffer(),1,"Press UP to increase opacity"); + testFont->render(320,112,whiteCol,guiManager::getBuffer(),1,"Press DOWN to decrease opacity"); + testFont->render(320,128,whiteCol,guiManager::getBuffer(),1,"Press Right to increase font size"); + testFont->render(320,144,whiteCol,guiManager::getBuffer(),1,"Press Left to decrease font size"); - testFont->render(320,398,whiteCol,guiManager::getSystemBuffer(),1,"FPS:%d",fps); - testFont->render(320,412,whiteCol,guiManager::getSystemBuffer(),1,"Current Key:%d",currentKey.getValue()); + testFont->render(320,398,whiteCol,guiManager::getBuffer(),1,"FPS:%d",fps); + testFont->render(320,412,whiteCol,guiManager::getBuffer(),1,"Current Key:%d",currentKey.getValue()); - testFont->render(320,428,whiteCol,guiManager::getSystemBuffer(),1,"Font size: %d",fontSizeH); - testFont->render(320,444,whiteCol,guiManager::getSystemBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); - testFont->render(320,460,whiteCol,guiManager::getSystemBuffer(),1,guiManager::getMouseButtonInfoWM()); + testFont->render(320,428,whiteCol,guiManager::getBuffer(),1,"Font size: %d",fontSizeH); + testFont->render(320,444,whiteCol,guiManager::getBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + testFont->render(320,460,whiteCol,guiManager::getBuffer(),1,guiManager::getMouseButtonInfoWM()); - testFont->render(640,240,whiteCol,guiManager::getSystemBuffer(),2,"Testing right aligned"); + testFont->render(640,240,whiteCol,guiManager::getBuffer(),2,"Testing right aligned"); guiManager::renderWindows(); Modified: trunk/examples/demo/src/sdl.cpp =================================================================== --- trunk/examples/demo/src/sdl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/demo/src/sdl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -342,30 +342,30 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(blackCol); + (guiManager::getBuffer())->clearBmp(blackCol); - //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getSystemBuffer());} + //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getBuffer());} - testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getSystemBuffer(),1,"Press ESC to quit"); - testFont->render(320,16,whiteCol,guiManager::getSystemBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); - testFont->render(320,32,whiteCol,guiManager::getSystemBuffer(),1,"Press 1 to toggle GUI"); - testFont->render(320,48,whiteCol,guiManager::getSystemBuffer(),1,"Press 2 to add a new window"); - testFont->render(320,64,whiteCol,guiManager::getSystemBuffer(),1,"Press 3 to delete last window created"); - testFont->render(320,80,whiteCol,guiManager::getSystemBuffer(),1,"Press 4 to toggle buffered mode"); - testFont->render(320,96,whiteCol,guiManager::getSystemBuffer(),1,"Press UP to increase opacity"); - testFont->render(320,112,whiteCol,guiManager::getSystemBuffer(),1,"Press DOWN to decrease opacity"); - testFont->render(320,128,whiteCol,guiManager::getSystemBuffer(),1,"Press Right to increase font size"); - testFont->render(320,144,whiteCol,guiManager::getSystemBuffer(),1,"Press Left to decrease font size"); + testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getBuffer(),1,"Press ESC to quit"); + testFont->render(320,16,whiteCol,guiManager::getBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); + testFont->render(320,32,whiteCol,guiManager::getBuffer(),1,"Press 1 to toggle GUI"); + testFont->render(320,48,whiteCol,guiManager::getBuffer(),1,"Press 2 to add a new window"); + testFont->render(320,64,whiteCol,guiManager::getBuffer(),1,"Press 3 to delete last window created"); + testFont->render(320,80,whiteCol,guiManager::getBuffer(),1,"Press 4 to toggle buffered mode"); + testFont->render(320,96,whiteCol,guiManager::getBuffer(),1,"Press UP to increase opacity"); + testFont->render(320,112,whiteCol,guiManager::getBuffer(),1,"Press DOWN to decrease opacity"); + testFont->render(320,128,whiteCol,guiManager::getBuffer(),1,"Press Right to increase font size"); + testFont->render(320,144,whiteCol,guiManager::getBuffer(),1,"Press Left to decrease font size"); - testFont->render(320,398,whiteCol,guiManager::getSystemBuffer(),1,"FPS:%d",fps); - testFont->render(320,412,whiteCol,guiManager::getSystemBuffer(),1,"Current Key:%d",currentKey.getValue()); + testFont->render(320,398,whiteCol,guiManager::getBuffer(),1,"FPS:%d",fps); + testFont->render(320,412,whiteCol,guiManager::getBuffer(),1,"Current Key:%d",currentKey.getValue()); - testFont->render(320,428,whiteCol,guiManager::getSystemBuffer(),1,"Font size: %d",fontSizeH); - testFont->render(320,444,whiteCol,guiManager::getSystemBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); - testFont->render(320,460,whiteCol,guiManager::getSystemBuffer(),1,guiManager::getMouseButtonInfoWM()); + testFont->render(320,428,whiteCol,guiManager::getBuffer(),1,"Font size: %d",fontSizeH); + testFont->render(320,444,whiteCol,guiManager::getBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + testFont->render(320,460,whiteCol,guiManager::getBuffer(),1,guiManager::getMouseButtonInfoWM()); - testFont->render(640,240,whiteCol,guiManager::getSystemBuffer(),2,"Testing right aligned"); + testFont->render(640,240,whiteCol,guiManager::getBuffer(),2,"Testing right aligned"); guiManager::renderWindows(); Modified: trunk/examples/demo/src/sdlgl.cpp =================================================================== --- trunk/examples/demo/src/sdlgl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/demo/src/sdlgl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -412,30 +412,30 @@ { if(fpsTimer.secs()<=1)fpsCounter++; beginDraw(); - (guiManager::getSystemBuffer())->clearBmp(blackCol); + (guiManager::getBuffer())->clearBmp(blackCol); - //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getSystemBuffer());} + //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getBuffer());} - testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getSystemBuffer(),1,"Press ESC to quit"); - testFont->render(320,16,whiteCol,guiManager::getSystemBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); - testFont->render(320,32,whiteCol,guiManager::getSystemBuffer(),1,"Press 1 to toggle GUI"); - testFont->render(320,48,whiteCol,guiManager::getSystemBuffer(),1,"Press 2 to add a new window"); - testFont->render(320,64,whiteCol,guiManager::getSystemBuffer(),1,"Press 3 to delete last window created"); - testFont->render(320,80,whiteCol,guiManager::getSystemBuffer(),1,"Press 4 to toggle buffered mode"); - testFont->render(320,96,whiteCol,guiManager::getSystemBuffer(),1,"Press UP to increase opacity"); - testFont->render(320,112,whiteCol,guiManager::getSystemBuffer(),1,"Press DOWN to decrease opacity"); - testFont->render(320,128,whiteCol,guiManager::getSystemBuffer(),1,"Press Right to increase font size"); - testFont->render(320,144,whiteCol,guiManager::getSystemBuffer(),1,"Press Left to decrease font size"); + testFont->render(320,1,rgba(255,0,0,whiteCol.alpha),guiManager::getBuffer(),1,"Press ESC to quit"); + testFont->render(320,16,whiteCol,guiManager::getBuffer(),1,"Press Alt-Enter to toggle Fullscreen"); + testFont->render(320,32,whiteCol,guiManager::getBuffer(),1,"Press 1 to toggle GUI"); + testFont->render(320,48,whiteCol,guiManager::getBuffer(),1,"Press 2 to add a new window"); + testFont->render(320,64,whiteCol,guiManager::getBuffer(),1,"Press 3 to delete last window created"); + testFont->render(320,80,whiteCol,guiManager::getBuffer(),1,"Press 4 to toggle buffered mode"); + testFont->render(320,96,whiteCol,guiManager::getBuffer(),1,"Press UP to increase opacity"); + testFont->render(320,112,whiteCol,guiManager::getBuffer(),1,"Press DOWN to decrease opacity"); + testFont->render(320,128,whiteCol,guiManager::getBuffer(),1,"Press Right to increase font size"); + testFont->render(320,144,whiteCol,guiManager::getBuffer(),1,"Press Left to decrease font size"); - testFont->render(320,398,whiteCol,guiManager::getSystemBuffer(),1,"FPS:%d",fps); - testFont->render(320,412,whiteCol,guiManager::getSystemBuffer(),1,"Current Key:%d",currentKey.getValue()); + testFont->render(320,398,whiteCol,guiManager::getBuffer(),1,"FPS:%d",fps); + testFont->render(320,412,whiteCol,guiManager::getBuffer(),1,"Current Key:%d",currentKey.getValue()); - testFont->render(320,428,whiteCol,guiManager::getSystemBuffer(),1,"Font size: %d",fontSizeH); - testFont->render(320,444,whiteCol,guiManager::getSystemBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); - testFont->render(320,460,whiteCol,guiManager::getSystemBuffer(),1,guiManager::getMouseButtonInfoWM()); + testFont->render(320,428,whiteCol,guiManager::getBuffer(),1,"Font size: %d",fontSizeH); + testFont->render(320,444,whiteCol,guiManager::getBuffer(),1,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + testFont->render(320,460,whiteCol,guiManager::getBuffer(),1,guiManager::getMouseButtonInfoWM()); - testFont->render(640,240,whiteCol,guiManager::getSystemBuffer(),2,"Testing right aligned"); + testFont->render(640,240,whiteCol,guiManager::getBuffer(),2,"Testing right aligned"); guiManager::renderWindows(); Modified: trunk/examples/gamedemo/src/allegro.cpp =================================================================== --- trunk/examples/gamedemo/src/allegro.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/gamedemo/src/allegro.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -157,10 +157,10 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(rgba::BLACK); + (guiManager::getBuffer())->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getSystemBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); guiManager::renderWindows(); Modified: trunk/examples/gamedemo/src/allegrogl.cpp =================================================================== --- trunk/examples/gamedemo/src/allegrogl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/gamedemo/src/allegrogl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -157,12 +157,12 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(rgba::BLACK); + (guiManager::getBuffer())->clearBmp(rgba::BLACK); allegro_gl_set_allegro_mode(); - resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getSystemBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); guiManager::renderWindows(); Modified: trunk/examples/gamedemo/src/gamedemo.cpp =================================================================== --- trunk/examples/gamedemo/src/gamedemo.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/gamedemo/src/gamedemo.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -63,15 +63,15 @@ guiManager::drawUnderWindows.connect(this,&stars::render); for(int i = 0; i < rand()%500 + 300;++i) { - back.push_back(coord(rand()%(int)guiManager::getSystemBuffer()->getBmpWidth(),rand()%(int)guiManager::getSystemBuffer()->getBmpHeight(),0,0)); + back.push_back(coord(rand()%(int)guiManager::getBuffer()->getBmpWidth(),rand()%(int)guiManager::getBuffer()->getBmpHeight(),0,0)); } for(int i = 0; i < rand()%300 + 100;++i) { - mid.push_back(coord(rand()%(int)guiManager::getSystemBuffer()->getBmpWidth(),rand()%(int)guiManager::getSystemBuffer()->getBmpHeight(),0,0)); + mid.push_back(coord(rand()%(int)guiManager::getBuffer()->getBmpWidth(),rand()%(int)guiManager::getBuffer()->getBmpHeight(),0,0)); } for(int i = 0; i < rand()%100 + 50;++i) { - front.push_back(coord(rand()%(int)guiManager::getSystemBuffer()->getBmpWidth(),rand()%(int)guiManager::getSystemBuffer()->getBmpHeight(),0,0)); + front.push_back(coord(rand()%(int)guiManager::getBuffer()->getBmpWidth(),rand()%(int)guiManager::getBuffer()->getBmpHeight(),0,0)); } } stars::~stars() @@ -82,17 +82,17 @@ for(vector<coord>::iterator i = back.begin();i<back.end();++i) { (*i).x+= 1; - if((*i).x > guiManager::getSystemBuffer()->getBmpWidth())(*i).x = 0; + if((*i).x > guiManager::getBuffer()->getBmpWidth())(*i).x = 0; } for(vector<coord>::iterator i = mid.begin();i<mid.end();++i) { (*i).x+= 1.8; - if((*i).x > guiManager::getSystemBuffer()->getBmpWidth())(*i).x = 0; + if((*i).x > guiManager::getBuffer()->getBmpWidth())(*i).x = 0; } for(vector<coord>::iterator i = front.begin();i<front.end();++i) { (*i).x+= 2.5; - if((*i).x > guiManager::getSystemBuffer()->getBmpWidth())(*i).x = 0; + if((*i).x > guiManager::getBuffer()->getBmpWidth())(*i).x = 0; } } void stars::render(graphic *buffer) Modified: trunk/examples/gamedemo/src/openlayer.cpp =================================================================== --- trunk/examples/gamedemo/src/openlayer.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/gamedemo/src/openlayer.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -163,10 +163,10 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(rgba::BLACK); + (guiManager::getBuffer())->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getSystemBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); guiManager::renderWindows(); Modified: trunk/examples/gamedemo/src/profiler.cpp =================================================================== --- trunk/examples/gamedemo/src/profiler.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/gamedemo/src/profiler.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -156,10 +156,10 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(rgba::BLACK); + (guiManager::getBuffer())->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getSystemBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); guiManager::renderWindows(); Modified: trunk/examples/gamedemo/src/sdl.cpp =================================================================== --- trunk/examples/gamedemo/src/sdl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/gamedemo/src/sdl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -157,10 +157,10 @@ if(draw) { if(fpsTimer.secs()<=1)fpsCounter++; - (guiManager::getSystemBuffer())->clearBmp(rgba::BLACK); + (guiManager::getBuffer())->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getSystemBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); guiManager::renderWindows(); Modified: trunk/examples/gamedemo/src/sdlgl.cpp =================================================================== --- trunk/examples/gamedemo/src/sdlgl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/gamedemo/src/sdlgl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -227,10 +227,10 @@ { if(fpsTimer.secs()<=1)fpsCounter++; beginDraw(); - (guiManager::getSystemBuffer())->clearBmp(rgba::BLACK); + (guiManager::getBuffer())->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getSystemBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); + resourceManager::getFont()->render(0,0,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(0,50,rgba::WHITE,guiManager::getBuffer(),0,"Mouse Hovers Over: %d", guiManager::getMouseOverWinIDWM()); guiManager::renderWindows(); Modified: trunk/examples/widgets/src/allegro.cpp =================================================================== --- trunk/examples/widgets/src/allegro.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/widgets/src/allegro.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -93,7 +93,7 @@ { if(fpsTimer.secs()<=1)fpsCounter++; - resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getSystemBuffer(),1,"FPS: %d",fps); + resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getBuffer(),1,"FPS: %d",fps); guiManager::renderWindows(); Modified: trunk/examples/widgets/src/allegrogl.cpp =================================================================== --- trunk/examples/widgets/src/allegrogl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/widgets/src/allegrogl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -95,7 +95,7 @@ allegro_gl_set_allegro_mode(); - resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getSystemBuffer(),1,"FPS: %d",fps); + resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getBuffer(),1,"FPS: %d",fps); guiManager::renderWindows(); Modified: trunk/examples/widgets/src/openlayer.cpp =================================================================== --- trunk/examples/widgets/src/openlayer.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/widgets/src/openlayer.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -93,7 +93,7 @@ { if(fpsTimer.secs()<=1)fpsCounter++; - resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getSystemBuffer(),1,"FPS: %d",fps); + resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getBuffer(),1,"FPS: %d",fps); guiManager::renderWindows(); Modified: trunk/examples/widgets/src/profiler.cpp =================================================================== --- trunk/examples/widgets/src/profiler.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/widgets/src/profiler.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -93,7 +93,7 @@ { if(fpsTimer.secs()<=1)fpsCounter++; - resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getSystemBuffer(),1,"FPS: %d",fps); + resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getBuffer(),1,"FPS: %d",fps); guiManager::renderWindows(); Modified: trunk/examples/widgets/src/sdl.cpp =================================================================== --- trunk/examples/widgets/src/sdl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/widgets/src/sdl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -93,7 +93,7 @@ { if(fpsTimer.secs()<=1)fpsCounter++; - resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getSystemBuffer(),1,"FPS: %d",fps); + resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getBuffer(),1,"FPS: %d",fps); guiManager::renderWindows(); Modified: trunk/examples/widgets/src/sdlgl.cpp =================================================================== --- trunk/examples/widgets/src/sdlgl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/widgets/src/sdlgl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -163,7 +163,7 @@ beginDraw(); - resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getSystemBuffer(),1,"FPS: %d",fps); + resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getBuffer(),1,"FPS: %d",fps); guiManager::renderWindows(); Modified: trunk/examples/xml/CMakeLists.txt =================================================================== --- trunk/examples/xml/CMakeLists.txt 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/xml/CMakeLists.txt 2007-09-03 13:22:37 UTC (rev 471) @@ -38,10 +38,10 @@ endif(ENABLE_ALLEGROGL) if(ENABLE_OPENLAYER) - include_directories(${ALLEGRO_INCLUDE_DIR} ${ALLEGROGL_INCLUDE_DIR} ${OPENLAYER_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) + include_directories(${FREETYPE_INCLUDE_DIR} ${ALLEGRO_INCLUDE_DIR} ${ALLEGROGL_INCLUDE_DIR} ${OPENLAYER_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) add_executable(xml-openlayer src/openlayer.cpp) target_link_libraries(xml-openlayer saggui-xml saggui-ol saggui-agl saggui-alleg saggui) - add_dependencies(xml-openlayer saggui-xml saggui-ol saggui-agl saggui-alleg saggui) + add_dependencies(xml-openlayer ${FREETYPE_LIBRARIES} saggui-xml saggui-ol saggui-agl saggui-alleg saggui) endif(ENABLE_OPENLAYER) if(ENABLE_SDL) Modified: trunk/examples/xml/src/allegro.cpp =================================================================== --- trunk/examples/xml/src/allegro.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/xml/src/allegro.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -74,7 +74,7 @@ std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; } - listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + listBox *bleh = xml.find<listBox>("list"); if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; // Main loop @@ -113,9 +113,9 @@ { if(fpsTimer.secs()<=1)fpsCounter++; - guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + guiManager::getBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getBuffer(),0,"Press 1 to reload xml file"); guiManager::renderWindows(); Modified: trunk/examples/xml/src/allegrogl.cpp =================================================================== --- trunk/examples/xml/src/allegrogl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/xml/src/allegrogl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -74,7 +74,7 @@ std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; } - listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + listBox *bleh = xml.find<listBox>("list"); if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; // Main loop @@ -116,9 +116,9 @@ allegro_gl_set_allegro_mode(); - guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + guiManager::getBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getBuffer(),0,"Press 1 to reload xml file"); guiManager::renderWindows(); Modified: trunk/examples/xml/src/openlayer.cpp =================================================================== --- trunk/examples/xml/src/openlayer.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/xml/src/openlayer.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -74,7 +74,7 @@ std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; } - listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + listBox *bleh = xml.find<listBox>("list"); if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; // Main loop @@ -113,9 +113,9 @@ { if(fpsTimer.secs()<=1)fpsCounter++; - guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + guiManager::getBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getBuffer(),0,"Press 1 to reload xml file"); guiManager::renderWindows(); Modified: trunk/examples/xml/src/sdl.cpp =================================================================== --- trunk/examples/xml/src/sdl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/xml/src/sdl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -74,7 +74,7 @@ std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; } - listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + listBox *bleh = xml.find<listBox>("list"); if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; // Main loop @@ -113,9 +113,9 @@ { if(fpsTimer.secs()<=1)fpsCounter++; - guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + guiManager::getBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getBuffer(),0,"Press 1 to reload xml file"); guiManager::renderWindows(); Modified: trunk/examples/xml/src/sdlgl.cpp =================================================================== --- trunk/examples/xml/src/sdlgl.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/examples/xml/src/sdlgl.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -109,8 +109,15 @@ { resourceManager::registerBackend<SDLGL_SAGGUI>(); - guiManager::setup("sdl"); - + try + { + guiManager::setup("sdlgl"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't set up system!\n" << e.getReason(); + return 1; + } // Create a timer to regulate the logic loop guiTimer timer, fpsTimer; int fps=0,fpsCounter =0; @@ -121,9 +128,13 @@ bool quit = false; // Set the resolution of the demo - if(!guiManager::setupScreen(640,480,32,fullscreen, buffered)) + try { - std::cout << "Couldn't create display\n"; + guiManager::setupScreen(640,480,32,fullscreen, buffered); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't create display!\n" << e.getReason(); return 1; } glMatrixMode(GL_PROJECTION); // projection transforms @@ -142,7 +153,7 @@ std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; } - listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + listBox *bleh = xml.find<listBox>("list"); if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; // Main loop @@ -182,9 +193,9 @@ if(fpsTimer.secs()<=1)fpsCounter++; beginDraw(); - guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); - resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); - resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + guiManager::getBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getBuffer(),0,"Press 1 to reload xml file"); guiManager::renderWindows(); Modified: trunk/include/saggui/creationengine.h =================================================================== --- trunk/include/saggui/creationengine.h 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/include/saggui/creationengine.h 2007-09-03 13:22:37 UTC (rev 471) @@ -133,7 +133,7 @@ virtual void load(const std::string &filename)=0; //! find - window *find(const std::string &id); + template<typename T>T *find(const std::string &id){ return dynamic_cast<T *>(windows.find(id)->second); } /*! Get a window according to a windowMarkup which automatically adds to the list of windows \n * this is to allow the engine itself to add parameters or fill information about the widget \n @@ -141,9 +141,6 @@ */ window *createWindow(windowMarkup &win); - //! Usefull tool to convert colors - static rgba getColor(const std::string &color); - protected: //! Add a window to the list Modified: trunk/include/saggui/graphics.h =================================================================== --- trunk/include/saggui/graphics.h 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/include/saggui/graphics.h 2007-09-03 13:22:37 UTC (rev 471) @@ -61,64 +61,6 @@ class SAGGUI_EXPORT graphic { - private: - //! ID of bitmap to keep track of it - int ID; - - //! Is this graphic a screen bitmap - bool isScreen; - - //! Is buffered? - static bool buffered; - - //! Is a background bitmap buffer - bool bitmapBuffer; - - //! Screen bitmap - static graphic *screenBitmap; - - //! Comparison of IDs - bool operator==(graphic *bmp); - - //! Set screen Bitmap - void setScreenBmp(void *s); - - //! min (borrowed from allegro) - static inline double Min(double x, double y){ return (((x) < (y)) ? (x) : (y)); } - - //! max (borrowed from allegro) - static inline double Max(double x, double y){ return (((x) > (y)) ? (x) : (y)); } - - //! mid (borrowed from allegro) - static inline double Mid(double x,double y,double z){ return (Max((x), Min((y), (z)))); } - - friend class graphicManager; - friend class fontManager; - friend class resourceManager; - friend class guiManager; - friend class system; - - protected: - - // Bitmap related - //! Loaded filename, if nothing will be blank - std::string loadedFile; - - //! initialized - bool initialized; - - //! Bitmap1 - void *bitmap; - - //! Array dump - bool arrayDump; - - //! loaded file from int array - char **dataDump; - - //! Destroy Bitmap - virtual bool destroyBmp()=0; - public: //!Constructor @@ -216,7 +158,7 @@ virtual void resetClip()=0; //! Get the current buffer bitmap for the set system - template <class Buff>Buff getBmp() { return static_cast<Buff>(bitmap); } + template <typename T>T *getBmp() { return static_cast<T *>(bitmap); } //! Get bitmap Height virtual double getBmpHeight(void)=0; @@ -229,6 +171,65 @@ //! Render a certain area of a bitmap virtual void renderBmp(double x1, double y1, double x2, double y2, double width, double height, const rgba &color, graphic *b=0)=0; + + protected: + + // Bitmap related + //! Loaded filename, if nothing will be blank + std::string loadedFile; + + //! initialized + bool initialized; + + //! Bitmap1 + void *bitmap; + + //! Array dump + bool arrayDump; + + //! loaded file from int array + char **dataDump; + + //! Destroy Bitmap + virtual bool destroyBmp()=0; + + private: + //! ID of bitmap to keep track of it + int ID; + + //! Is this graphic a screen bitmap + bool isScreen; + + //! Is buffered? + static bool buffered; + + //! Is a background bitmap buffer + bool bitmapBuffer; + + //! Screen bitmap + static graphic *screenBitmap; + + //! Comparison of IDs + bool operator==(graphic *bmp); + + //! Set screen Bitmap + void setScreenBmp(void *s); + + //! min (borrowed from allegro) + static inline double Min(double x, double y){ return (((x) < (y)) ? (x) : (y)); } + + //! max (borrowed from allegro) + static inline double Max(double x, double y){ return (((x) > (y)) ? (x) : (y)); } + + //! mid (borrowed from allegro) + static inline double Mid(double x,double y,double z){ return (Max((x), Min((y), (z)))); } + + friend class graphicManager; + friend class fontManager; + friend class resourceManager; + friend class guiManager; + friend class system; + }; } Modified: trunk/include/saggui/gui_manager.h =================================================================== --- trunk/include/saggui/gui_manager.h 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/include/saggui/gui_manager.h 2007-09-03 13:22:37 UTC (rev 471) @@ -48,6 +48,7 @@ #include "dllspec.h" #include "window.h" #include "sigslot.h" +#include "sagguiexception.h" #include "debug.h" @@ -75,13 +76,13 @@ //! \name Public Members //! Setup - static void setup(const std::string & sys, bool systemInitCalls=true); + static void setup(const std::string & sys, bool systemInitCalls=true) throw(sagguiException); - //! Set system screen - static void setScreen(void *s, bool bitmapBuffers=true); + //! Set system buffer + static void setBuffer(void *s, bool bitmapBuffers=true); //! Resolution - static bool setupScreen(double width, double height, double depth=32, bool fullscreen=false, bool bitmapBuffers=true); + static bool setupScreen(double width, double height, double depth=32, bool fullscreen=false, bool bitmapBuffers=true) throw(sagguiException); //! Add window static void addWindow(window *w); @@ -101,8 +102,8 @@ //! Toggle if the system is active static void toggleActive(); - //! Get the current graphic bitmap - static graphic *getSystemBuffer(); + //! Get the current graphic buffer + static graphic *getBuffer(); //! Get the current set screen static graphic *getScreen(); @@ -157,7 +158,7 @@ ~guiManager(); //! Set screen - void setSystemScreen(void *s, bool bitmapBuffers); + void setSysBuffer(void *s, bool bitmapBuffers); //! Set resolution bool setResolution(double width, double height, double depth=32, bool fullscreen=false, bool bitmapBuffers=true); Modified: trunk/include/saggui/resource_manager.h =================================================================== --- trunk/include/saggui/resource_manager.h 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/include/saggui/resource_manager.h 2007-09-03 13:22:37 UTC (rev 471) @@ -66,6 +66,25 @@ */ class SAGGUI_EXPORT resourceManager { + public: + + //! Register backend library (ie allegro) with SAGGUI + /*! Registers the library with SAGGUI so it can be used */ + template <typename t>static void registerBackend() { libraryFactory::registerLibrary(new t); } + + //! Register font library (ie freetype) with SAGGUI + /*! Registers the library with SAGGUI so it can be used */ + template <typename t>static void registerFont() { fontManager::registerType(new t); } + + //! Create graphic from current set lib + static graphic *createGraphic(); + + //! Delete graphic from current set library_factory + static void destroyGraphic(graphic *bmp); + + //! Get font + static font *getFont(int ID=1); + private: //! Constructor resourceManager(); @@ -114,24 +133,6 @@ friend class guiManager; friend class font; - public: - - //! Register backend library (ie allegro) with SAGGUI - /*! Registers the library with SAGGUI so it can be used */ - template <typename t>static void registerBackend() { libraryFactory::registerLibrary(new t); } - - //! Register font library (ie freetype) with SAGGUI - /*! Registers the library with SAGGUI so it can be used */ - template <typename t>static void registerFont() { fontManager::registerType(new t); } - - //! Create graphic from current set lib - static graphic *createGraphic(); - - //! Delete graphic from current set library_factory - static void destroyGraphic(graphic *bmp); - - //! Get font - static font *getFont(int ID=1); }; } Modified: trunk/include/saggui/rgba.h =================================================================== --- trunk/include/saggui/rgba.h 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/include/saggui/rgba.h 2007-09-03 13:22:37 UTC (rev 471) @@ -112,7 +112,10 @@ //! get rgba value in the form of an unsigned integer const unsigned int get(); + //! Usefull tool to convert colors from strings + static rgba getColor(const std::string &color); + //! \name Static Colors static const rgba WHITE; static const rgba BLACK; Modified: trunk/include/saggui/window.h =================================================================== --- trunk/include/saggui/window.h 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/include/saggui/window.h 2007-09-03 13:22:37 UTC (rev 471) @@ -56,8 +56,8 @@ namespace saggui { //! Forward decleration of guiManager and mouseManager - class guiManager; // Requires forward declaration - class mouseManager; + //class guiManager; // Requires forward declaration + //class mouseManager; class style; class graphic; class rgba; Modified: trunk/modules/allegro/src/al_font.cpp =================================================================== --- trunk/modules/allegro/src/al_font.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/modules/allegro/src/al_font.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -140,15 +140,15 @@ switch(alignment) { case 0: - textout_ex(bmp->getBmp<BITMAP *>(), currentFont, str.str().c_str(), int(x), int(y), makecol(int(color.red), int(color.green), int(color.blue)), + textout_ex(bmp->getBmp<BITMAP>(), currentFont, str.str().c_str(), int(x), int(y), makecol(int(color.red), int(color.green), int(color.blue)), -1); break; case 1: - textout_centre_ex(bmp->getBmp<BITMAP *>(), currentFont, str.str().c_str(), int(x), int(y), makecol(int(color.red), int(color.green), int(color.blue)), + textout_centre_ex(bmp->getBmp<BITMAP>(), currentFont, str.str().c_str(), int(x), int(y), makecol(int(color.red), int(color.green), int(color.blue)), -1); break; case 2: - textout_right_ex(bmp->getBmp<BITMAP *>(), currentFont, str.str().c_str(), int(x), int(y), makecol(int(color.red), int(color.green), int(color.blue)), + textout_right_ex(bmp->getBmp<BITMAP>(), currentFont, str.str().c_str(), int(x), int(y), makecol(int(color.red), int(color.green), int(color.blue)), -1); break; } Modified: trunk/modules/allegro/src/al_gfx.cpp =================================================================== --- trunk/modules/allegro/src/al_gfx.cpp 2007-09-01 14:42:39 UTC (rev 470) +++ trunk/modules/allegro/src/al_gfx.cpp 2007-09-03 13:22:37 UTC (rev 471) @@ -77,7 +77,7 @@ { if(initialized) { - if(!isBuffered() && !getBmp<BITMAP *>()) + if(!isBuffered() && !getBmp<BITMAP>()) { if(color==rgba::NOCOLOR || color.alpha == 255) { @@ -91,31 +91,31 @@ solid_mode(); } } - else if(!bmp && getBmp<BITMAP *>()) + else if(!bmp && getBmp<BITMAP>()) { if(color==rgba::NOCOLOR || color.alpha == 255) { - line(getBmp<BITMAP *>(), (int)x1, (int)y1, (int)x2, (int)y2, make_allegro_color(color)); + line(getBmp<BITMAP>(), (int)x1, (int)y1, (int)x2, (int)y2, make_allegro_color(color)); } else { set_trans_blender((int)color.red, (int)color.green, (int)color.blue, (int)color.alpha); drawing_mode(DRAW_MODE_TRANS, 0, 0, 0); - line(getBmp<BITMAP *>(), (int)x1, (int)y1, (int)x2, (int)y2, make_allegro_color(color)); + line(getBmp<BITMAP>(), (int)x1, (int)y1, (int)x2, (int)y2, make_allegro_color(color)); solid_mode(); } } - else if(bmp && bmp->getBmp<BITMAP *>()) + else if(bmp && bmp->getBmp<BITMAP>()) { if(color==rgba::NOCOLOR || color.alpha == 255) { - line(bmp->getBmp<BITMAP *>(), (int)x1, (int)y1, (int)x2, (int)y2, make_allegro_color(color)); + line(bmp->getBmp<BITMAP>(), (int)x1, (int)y1, (int)x2, (int)y2, make_allegro_color(color)); } else { set_trans_blender((int)color.red, (int)color.green, (int)color.blue, (int)color.alpha); drawing_mode(DRAW_MODE_TRANS, 0, 0, 0); - line(bmp->getBmp<BITMAP *>(), (int)x1, (int)y1, (int)x2, (int)y2, make_allegro_color(color)); + line(bmp->getBmp<BITMAP>(), (int)x1, (int)y1, (int)x2, (int)y2, make_allegro_color(color)); solid_mode(); } } @@ -128,7 +128,7 @@ { if(initialized) { - if(!isBuffered() && !getBmp<BITMAP *>()) + if(!isBuffered() && !getBmp<BITMAP>()) { if(color==rgba::NOCOLOR || color.alpha == 255) { @@ -142,31 +142,31 @@ solid_mode(); } } - else if(!bmp && getBmp<BITMAP *>()) + else if(!bmp && getBmp<BITMAP>()) { if(color==rgba::NOCOLOR || color.alpha == 255) { - putpixel(getBmp<BITMAP *>(), (int)x, (int)y, make_allegro_color(color)); + putpixel(getBmp<BITMAP>(), (int)x, (int)y, make_allegro_color(color)); } else { set_trans_blender((int)color.red, (int)color.green, (int)color.blue, (int)color.alpha); drawing_mode(DRAW_MODE_TRANS, 0, 0, 0); - putpixel(getBmp<BITMAP *>(), (int)x, (int)y, make_allegro_color(color)); + putpixel(getBmp<BITMAP>(), (int)x, (int)y, make_allegro_color(color)); solid_mode(); } } - else if(bmp && bmp->getBmp<BITMAP *>()) + else if(bmp && bmp->getBmp<BITMAP>()) { if(color==rgba::NOCOLOR || color.alpha == 255) { - putpixel(bmp->getBmp<BITMAP *>(), (int)x, (int)y, make_allegro_color(color)); + putpixel(bmp->getBmp<BITMAP>(), (int)x, (int)y, make_allegro_color(color)); } else { set_trans_blender((int)color.red, (int)color.green, (int)color.blue, (int)color.alpha); drawing_mode(DRAW_MODE_TRANS, 0, 0, 0); - putpixel(bmp->getBmp<BITMAP *>(), (int)x, (int)y, make_allegro_color(color)); + putpixel(bmp->getBmp<BITMAP>(), (int)x, (int)y, make_allegro_color(color)); solid_mode(); } } @@ -178,17 +178,17 @@ int pixel=0; if(initialized) { - if(!isBuffered() && !getBmp<BITMAP *>()) + if(!isBuffered() && !getBmp<BITMAP>()) { pixel = getpixel(screen, (int)x, (int)y); } - else if(!bmp && getBmp<BITMAP *>()) + else if(!bmp && getBmp<BITMAP>()) { - pixel = getpixel(getBmp<BITMAP *>(), (int)x, (int)y); + pixel = getpixel(get... [truncated message content] |
From: <sag...@li...> - 2007-09-01 14:42:44
|
Revision: 470 http://saggui.svn.sourceforge.net/saggui/?rev=470&view=rev Author: juvinious Date: 2007-09-01 07:42:39 -0700 (Sat, 01 Sep 2007) Log Message: ----------- Added other xml demos Modified Paths: -------------- trunk/examples/xml/CMakeLists.txt Added Paths: ----------- trunk/examples/xml/src/allegrogl.cpp trunk/examples/xml/src/openlayer.cpp trunk/examples/xml/src/sdl.cpp trunk/examples/xml/src/sdlgl.cpp Modified: trunk/examples/xml/CMakeLists.txt =================================================================== --- trunk/examples/xml/CMakeLists.txt 2007-08-31 14:48:53 UTC (rev 469) +++ trunk/examples/xml/CMakeLists.txt 2007-09-01 14:42:39 UTC (rev 470) @@ -29,3 +29,31 @@ target_link_libraries(xml-allegro saggui-xml saggui-alleg saggui) add_dependencies(xml-allegro saggui-xml saggui-alleg saggui) endif(ENABLE_ALLEGRO) + +if(ENABLE_ALLEGROGL) + include_directories(${ALLEGRO_INCLUDE_DIR}) + add_executable(xml-allegrogl src/allegrogl.cpp) + target_link_libraries(xml-allegrogl saggui-xml saggui-agl saggui-alleg saggui) + add_dependencies(xml-allegrogl saggui-xml saggui-agl saggui-alleg saggui) +endif(ENABLE_ALLEGROGL) + +if(ENABLE_OPENLAYER) + include_directories(${ALLEGRO_INCLUDE_DIR} ${ALLEGROGL_INCLUDE_DIR} ${OPENLAYER_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) + add_executable(xml-openlayer src/openlayer.cpp) + target_link_libraries(xml-openlayer saggui-xml saggui-ol saggui-agl saggui-alleg saggui) + add_dependencies(xml-openlayer saggui-xml saggui-ol saggui-agl saggui-alleg saggui) +endif(ENABLE_OPENLAYER) + +if(ENABLE_SDL) + include_directories(${SDL_INCLUDE_DIR}) + add_executable(xml-sdl src/sdl.cpp) + target_link_libraries(xml-sdl saggui-xml saggui-sdl saggui) + add_dependencies(xml-sdl saggui-xml saggui-sdl saggui) +endif(ENABLE_SDL) + +if(ENABLE_SDLGL) + include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) + add_executable(xml-sdlgl src/sdlgl.cpp) + target_link_libraries(xml-sdlgl saggui-xml saggui-sdlgl saggui-sdl saggui) + add_dependencies(xml-sdlgl saggui-xml saggui-sdlgl saggui-sdl saggui) +endif(ENABLE_SDLGL) Copied: trunk/examples/xml/src/allegrogl.cpp (from rev 469, trunk/examples/xml/src/allegro.cpp) =================================================================== --- trunk/examples/xml/src/allegrogl.cpp (rev 0) +++ trunk/examples/xml/src/allegrogl.cpp 2007-09-01 14:42:39 UTC (rev 470) @@ -0,0 +1,145 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <saggui_agl.h> +#include <saggui.h> +#include <saggui_xml.h> + +using namespace saggui; + +int main() +{ + resourceManager::registerBackend<AGL_SAGGUI>(); + + guiManager::setup("agl"); + + // Create a timer to regulate the logic loop + guiTimer timer, fpsTimer; + int fps=0,fpsCounter =0; + + // Some Variables + bool fullscreen = false; + bool buffered = true; + bool quit = false; + + // Set the resolution of the demo + if(!guiManager::setupScreen(640,480,32,fullscreen, buffered)) + { + std::cout << "Couldn't create display\n"; + return 1; + } + + xmlEngine xml; + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + + listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; + + // Main loop + while(!quit){ + + bool draw=false; + while (timer.msecs() >= 1000/60) + { + draw = true; + if(keyInputManager::keyState(keys::ESC)) + { + quit=true; + draw=false; + break; + } + + if(keyInputManager::keyState(keys::NUM_1,true)) + { + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + break; + } + + guiManager::update(); + + timer.reset(); + } + + if(draw) + { + if(fpsTimer.secs()<=1)fpsCounter++; + + allegro_gl_set_allegro_mode(); + + + guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + + guiManager::renderWindows(); + + + + allegro_gl_unset_allegro_mode(); + allegro_gl_flip(); + + } + + if(fpsTimer.secs()>=1) + { + fpsTimer.reset(); + fps=fpsCounter; + fpsCounter=0; + } + while((timer.msecs())==0)timer.sleep(1); + + } + + return 0; +} +END_OF_MAIN() + Copied: trunk/examples/xml/src/openlayer.cpp (from rev 469, trunk/examples/xml/src/allegro.cpp) =================================================================== --- trunk/examples/xml/src/openlayer.cpp (rev 0) +++ trunk/examples/xml/src/openlayer.cpp 2007-09-01 14:42:39 UTC (rev 470) @@ -0,0 +1,139 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <saggui_ol.h> +#include <saggui.h> +#include <saggui_xml.h> + +using namespace saggui; + +int main() +{ + resourceManager::registerBackend<OPENLAYER_SAGGUI>(); + + guiManager::setup("ol"); + + // Create a timer to regulate the logic loop + guiTimer timer, fpsTimer; + int fps=0,fpsCounter =0; + + // Some Variables + bool fullscreen = false; + bool buffered = true; + bool quit = false; + + // Set the resolution of the demo + if(!guiManager::setupScreen(640,480,32,fullscreen, buffered)) + { + std::cout << "Couldn't create display\n"; + return 1; + } + + xmlEngine xml; + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + + listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; + + // Main loop + while(!quit){ + + bool draw=false; + while (timer.msecs() >= 1000/60) + { + draw = true; + if(keyInputManager::keyState(keys::ESC)) + { + quit=true; + draw=false; + break; + } + + if(keyInputManager::keyState(keys::NUM_1,true)) + { + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + break; + } + + guiManager::update(); + + timer.reset(); + } + + if(draw) + { + if(fpsTimer.secs()<=1)fpsCounter++; + + guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + + guiManager::renderWindows(); + + + + } + + if(fpsTimer.secs()>=1) + { + fpsTimer.reset(); + fps=fpsCounter; + fpsCounter=0; + } + while((timer.msecs())==0)timer.sleep(1); + + } + + return 0; +} +END_OF_MAIN() + Copied: trunk/examples/xml/src/sdl.cpp (from rev 469, trunk/examples/xml/src/allegro.cpp) =================================================================== --- trunk/examples/xml/src/sdl.cpp (rev 0) +++ trunk/examples/xml/src/sdl.cpp 2007-09-01 14:42:39 UTC (rev 470) @@ -0,0 +1,139 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <saggui_sdl.h> +#include <saggui.h> +#include <saggui_xml.h> + +using namespace saggui; + +int main() +{ + resourceManager::registerBackend<SDL_SAGGUI>(); + + guiManager::setup("sdl"); + + // Create a timer to regulate the logic loop + guiTimer timer, fpsTimer; + int fps=0,fpsCounter =0; + + // Some Variables + bool fullscreen = false; + bool buffered = true; + bool quit = false; + + // Set the resolution of the demo + if(!guiManager::setupScreen(640,480,32,fullscreen, buffered)) + { + std::cout << "Couldn't create display\n"; + return 1; + } + + xmlEngine xml; + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + + listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; + + // Main loop + while(!quit){ + + bool draw=false; + while (timer.msecs() >= 1000/60) + { + draw = true; + if(keyInputManager::keyState(keys::ESC)) + { + quit=true; + draw=false; + break; + } + + if(keyInputManager::keyState(keys::NUM_1,true)) + { + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + break; + } + + guiManager::update(); + + timer.reset(); + } + + if(draw) + { + if(fpsTimer.secs()<=1)fpsCounter++; + + guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + + guiManager::renderWindows(); + + + + } + + if(fpsTimer.secs()>=1) + { + fpsTimer.reset(); + fps=fpsCounter; + fpsCounter=0; + } + while((timer.msecs())==0)timer.sleep(1); + + } + + SDL_Quit(); + return 0; +} + Added: trunk/examples/xml/src/sdlgl.cpp =================================================================== --- trunk/examples/xml/src/sdlgl.cpp (rev 0) +++ trunk/examples/xml/src/sdlgl.cpp 2007-09-01 14:42:39 UTC (rev 470) @@ -0,0 +1,213 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <saggui_sdlgl.h> +#include <saggui.h> +#include <saggui_xml.h> + +using namespace saggui; + +void beginDraw() +{ + glPushAttrib( + GL_COLOR_BUFFER_BIT | + GL_CURRENT_BIT | + GL_DEPTH_BUFFER_BIT | + GL_ENABLE_BIT | + GL_FOG_BIT | + GL_LIGHTING_BIT | + GL_LINE_BIT | + GL_POINT_BIT | + GL_POLYGON_BIT | + GL_SCISSOR_BIT | + GL_STENCIL_BUFFER_BIT | + GL_TEXTURE_BIT | + GL_TRANSFORM_BIT | + GL_POINT_BIT | + GL_LINE_BIT + ); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + glOrtho(0.0, (double)640, (double)480, 0.0, -1.0, 1.0); + + glDisable(GL_LIGHTING); + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_TEXTURE_2D); + + glEnable(GL_SCISSOR_TEST); + glPointSize(1.0); + glLineWidth(1.0); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); +} + +void endDraw() +{ + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + + glPopAttrib(); + +} + +int main() +{ + resourceManager::registerBackend<SDLGL_SAGGUI>(); + + guiManager::setup("sdl"); + + // Create a timer to regulate the logic loop + guiTimer timer, fpsTimer; + int fps=0,fpsCounter =0; + + // Some Variables + bool fullscreen = false; + bool buffered = true; + bool quit = false; + + // Set the resolution of the demo + if(!guiManager::setupScreen(640,480,32,fullscreen, buffered)) + { + std::cout << "Couldn't create display\n"; + return 1; + } + glMatrixMode(GL_PROJECTION); // projection transforms + glLoadIdentity(); // reset the matrix + glOrtho (0.0, 640, 480, 0.0, -1.0, 1.0); // 2D mode - 640x480 with a Z of -1 to 1 + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + xmlEngine xml; + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + + listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; + + // Main loop + while(!quit){ + + bool draw=false; + while (timer.msecs() >= 1000/60) + { + draw = true; + if(keyInputManager::keyState(keys::ESC)) + { + quit=true; + draw=false; + break; + } + + if(keyInputManager::keyState(keys::NUM_1,true)) + { + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + break; + } + + guiManager::update(); + + timer.reset(); + } + + if(draw) + { + if(fpsTimer.secs()<=1)fpsCounter++; + beginDraw(); + + guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + + guiManager::renderWindows(); + + + + glFinish(); + SDL_GL_SwapBuffers(); + + endDraw(); + + } + + if(fpsTimer.secs()>=1) + { + fpsTimer.reset(); + fps=fpsCounter; + fpsCounter=0; + } + while((timer.msecs())==0)timer.sleep(1); + + } + + SDL_Quit(); + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-31 14:48:59
|
Revision: 469 http://saggui.svn.sourceforge.net/saggui/?rev=469&view=rev Author: juvinious Date: 2007-08-31 07:48:53 -0700 (Fri, 31 Aug 2007) Log Message: ----------- Finished changes for paintEvent Modified Paths: -------------- trunk/CHANGELOG trunk/cmake/saggui.h.in trunk/examples/demo/include/test_classes.h trunk/examples/demo/src/test_classes.cpp trunk/examples/gamedemo/include/gamedemo.h trunk/examples/gamedemo/src/gamedemo.cpp trunk/include/saggui/schemes/defaultscheme.h trunk/include/saggui/style.h trunk/include/saggui/widgets/abstractbutton.h trunk/include/saggui/widgets/box.h trunk/include/saggui/widgets/button.h trunk/include/saggui/widgets/checkbox.h trunk/include/saggui/widgets/input_box.h trunk/include/saggui/widgets/listbox.h trunk/include/saggui/widgets/progress_bar.h trunk/include/saggui/widgets/pushbutton.h trunk/include/saggui/widgets/radial.h trunk/include/saggui/widgets/scroll_bar.h trunk/include/saggui/widgets/text_box.h trunk/src/gui_manager.cpp trunk/src/schemes/defaultscheme.cpp trunk/src/style.cpp trunk/src/widgets/box.cpp trunk/src/widgets/button.cpp trunk/src/widgets/checkbox.cpp trunk/src/widgets/input_box.cpp trunk/src/widgets/listbox.cpp trunk/src/widgets/progress_bar.cpp trunk/src/widgets/pushbutton.cpp trunk/src/widgets/radial.cpp trunk/src/widgets/scroll_bar.cpp trunk/src/widgets/text_box.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/CHANGELOG 2007-08-31 14:48:53 UTC (rev 469) @@ -1,4 +1,5 @@ 0.50 +- Converted all paint signals to use the new paintEvent class - Added paintEvent class for passing paint info for onPaint events - Added xml demo for allegro to the repository - Completed some more widget information in sagguixml making it quite useable Modified: trunk/cmake/saggui.h.in =================================================================== --- trunk/cmake/saggui.h.in 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/cmake/saggui.h.in 2007-08-31 14:48:53 UTC (rev 469) @@ -72,6 +72,7 @@ #include "saggui/mouse_events.h" #include "saggui/mouse.h" #include "saggui/mouse_manager.h" +#include "saggui/paintevent.h" #include "saggui/resource_manager.h" #include "saggui/rgba.h" #include "saggui/scheme.h" Modified: trunk/examples/demo/include/test_classes.h =================================================================== --- trunk/examples/demo/include/test_classes.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/examples/demo/include/test_classes.h 2007-08-31 14:48:53 UTC (rev 469) @@ -77,9 +77,9 @@ ~testDecorator(); - void doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape); + void doBackground(saggui::paintEvent &e); - void doForeground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape); + void doForeground(saggui::paintEvent &e); lines *line; saggui::rgba circleColor1; Modified: trunk/examples/demo/src/test_classes.cpp =================================================================== --- trunk/examples/demo/src/test_classes.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/examples/demo/src/test_classes.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -163,33 +163,33 @@ // Nothing } - void testDecorator::doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape) + void testDecorator::doBackground(saggui::paintEvent &e) { line->update(); - bmp->doRectfill(size.x,size.y,size.width,size.height,colors[saggui::S_StandardBg]); - bmp->doCirclefill(size.x+100, size.y+100, 50,circleColor1); - bmp->doCirclefill(size.x+80, size.y+80, 5,circleColor2); - bmp->doCirclefill(size.x+110, size.y+80, 5,circleColor2); - bmp->doCirclefill(size.x+95, size.y+120, 15,circleColor3); - line->draw(bmp); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,e.getColors()[saggui::S_StandardBg]); + e.getGraphic()->doCirclefill(e.getPosition().x+100, e.getPosition().y+100, 50,circleColor1); + e.getGraphic()->doCirclefill(e.getPosition().x+80, e.getPosition().y+80, 5,circleColor2); + e.getGraphic()->doCirclefill(e.getPosition().x+110, e.getPosition().y+80, 5,circleColor2); + e.getGraphic()->doCirclefill(e.getPosition().x+95, e.getPosition().y+120, 15,circleColor3); + line->draw(e.getGraphic()); } - void testDecorator::doForeground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape) + void testDecorator::doForeground(saggui::paintEvent &e) { //foreground.set(rand()%255,rand()%255,rand()%255,rand()%255); // Do top - bmp->doRectfill(size.x,size.y,size.width-1,1+topPadding,colors[saggui::S_StandardFg]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width-1,1+topPadding,e.getColors()[saggui::S_StandardFg]); // Do left - bmp->doRectfill(size.x,size.y,1+leftPadding,size.height-1,colors[saggui::S_StandardFg]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,1+leftPadding,e.getPosition().height-1,e.getColors()[saggui::S_StandardFg]); // Do right - bmp->doRectfill(size.x+(size.width-1)-rightPadding,size.y+1,rightPadding+1,size.height-1,colors[saggui::S_StandardFg]); + e.getGraphic()->doRectfill(e.getPosition().x+(e.getPosition().width-1)-rightPadding,e.getPosition().y+1,rightPadding+1,e.getPosition().height-1,e.getColors()[saggui::S_StandardFg]); // Do bottom - bmp->doRectfill(size.x+1,size.y+(size.height-1)-bottomPadding,size.width-1,bottomPadding+1,colors[saggui::S_StandardFg]); + e.getGraphic()->doRectfill(e.getPosition().x+1,e.getPosition().y+(e.getPosition().height-1)-bottomPadding,e.getPosition().width-1,bottomPadding+1,e.getColors()[saggui::S_StandardFg]); } //Constructor Modified: trunk/examples/gamedemo/include/gamedemo.h =================================================================== --- trunk/examples/gamedemo/include/gamedemo.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/examples/gamedemo/include/gamedemo.h 2007-08-31 14:48:53 UTC (rev 469) @@ -98,7 +98,7 @@ ~blankDecor(); - void doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape); + void doBackground(paintEvent &e); }; class basicDecor : public saggui::style @@ -108,9 +108,9 @@ ~basicDecor(); - void doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape); + void doBackground(paintEvent &e); - void doForeground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape); + void doForeground(paintEvent &e); }; class filledDecor : public saggui::style @@ -120,9 +120,9 @@ ~filledDecor(); - void doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape); + void doBackground(paintEvent &e); - void doForeground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape); + void doForeground(paintEvent &e); }; class plainDecor : public saggui::style @@ -132,7 +132,7 @@ ~plainDecor(); - void doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape); + void doBackground(paintEvent &e); }; class icon : public has_slots<> Modified: trunk/examples/gamedemo/src/gamedemo.cpp =================================================================== --- trunk/examples/gamedemo/src/gamedemo.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/examples/gamedemo/src/gamedemo.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -182,9 +182,9 @@ { } -void blankDecor::doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape) +void blankDecor::doBackground(paintEvent &e) { - bmp->clearBmp(rgba::PINK); + e.getGraphic()->clearBmp(rgba::PINK); } basicDecor::basicDecor() @@ -200,37 +200,37 @@ { } -void basicDecor::doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape) +void basicDecor::doBackground(paintEvent &e) { - rgba temp(colors[saggui::S_StandardBg].red-40,colors[saggui::S_StandardBg].green-40,colors[saggui::S_StandardBg].blue-40,255); - bmp->doRectfill(size.x,size.y,size.width,size.height,temp); - bmp->doRectfill(size.x+5,size.y+5,size.width-10,size.height-10,colors[saggui::S_StandardBg]); - bmp->doRectfill(size.x,size.y,2,2,rgba::PINK); - bmp->doRectfill(size.x,size.y+size.height-2,2,2,rgba::PINK); - bmp->doRectfill(size.x+size.width-2,size.y,2,2,rgba::PINK); - bmp->doRectfill(size.x+size.width-2,size.y+size.height-2,2,2,rgba::PINK); - bmp->placePixel(size.x+2,size.y+2,temp); - bmp->placePixel(size.x+size.width-2,size.y+size.height-2,temp); - bmp->placePixel(size.x+2,size.y+size.height-2,temp); - bmp->placePixel(size.x+size.width-2,size.y+2,temp); + rgba temp(e.getColors()[saggui::S_StandardBg].red-40,e.getColors()[saggui::S_StandardBg].green-40,e.getColors()[saggui::S_StandardBg].blue-40,255); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,temp); + e.getGraphic()->doRectfill(e.getPosition().x+5,e.getPosition().y+5,e.getPosition().width-10,e.getPosition().height-10,e.getColors()[saggui::S_StandardBg]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,2,2,rgba::PINK); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y+e.getPosition().height-2,2,2,rgba::PINK); + e.getGraphic()->doRectfill(e.getPosition().x+e.getPosition().width-2,e.getPosition().y,2,2,rgba::PINK); + e.getGraphic()->doRectfill(e.getPosition().x+e.getPosition().width-2,e.getPosition().y+e.getPosition().height-2,2,2,rgba::PINK); + e.getGraphic()->placePixel(e.getPosition().x+2,e.getPosition().y+2,temp); + e.getGraphic()->placePixel(e.getPosition().x+e.getPosition().width-2,e.getPosition().y+e.getPosition().height-2,temp); + e.getGraphic()->placePixel(e.getPosition().x+2,e.getPosition().y+e.getPosition().height-2,temp); + e.getGraphic()->placePixel(e.getPosition().x+e.getPosition().width-2,e.getPosition().y+2,temp); } -void basicDecor::doForeground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape) +void basicDecor::doForeground(paintEvent &e) { - bmp->doLine(size.x+3,size.y,size.x+size.width-3,size.y,colors[saggui::S_StandardFg]); - bmp->doLine(size.x,size.y+3,size.x,size.y+size.height-3,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+3,size.y+size.height,size.x+size.width-3,size.y+size.height,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+size.width,size.y+3,size.x+size.width,size.y+size.height-3,colors[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+3,e.getPosition().y,e.getPosition().x+e.getPosition().width-3,e.getPosition().y,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+3,e.getPosition().x,e.getPosition().y+e.getPosition().height-3,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+3,e.getPosition().y+e.getPosition().height,e.getPosition().x+e.getPosition().width-3,e.getPosition().y+e.getPosition().height,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width,e.getPosition().y+3,e.getPosition().x+e.getPosition().width,e.getPosition().y+e.getPosition().height-3,e.getColors()[saggui::S_StandardFg]); - bmp->doLine(size.x,size.y+3,size.x+3,size.y,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+size.width-3,size.y,size.x+size.width,size.y+3,colors[saggui::S_StandardFg]); - bmp->doLine(size.x,size.y+size.height-3,size.x+3,size.y+size.height,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+size.width-3,size.y+size.height,size.x+size.width,size.y+size.height-3,colors[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+3,e.getPosition().x+3,e.getPosition().y,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width-3,e.getPosition().y,e.getPosition().x+e.getPosition().width,e.getPosition().y+3,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+e.getPosition().height-3,e.getPosition().x+3,e.getPosition().y+e.getPosition().height,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width-3,e.getPosition().y+e.getPosition().height,e.getPosition().x+e.getPosition().width,e.getPosition().y+e.getPosition().height-3,e.getColors()[saggui::S_StandardFg]); - bmp->doLine(size.x+4,size.y+4,size.x+size.width-4,size.y+4,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+4,size.y+4,size.x+4,size.y+size.height-4,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+4,size.y+size.height-4,size.x+size.width-4,size.y+size.height-4,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+size.width-4,size.y+4,size.x+size.width-4,size.y+size.height-4,colors[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+4,e.getPosition().y+4,e.getPosition().x+e.getPosition().width-4,e.getPosition().y+4,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+4,e.getPosition().y+4,e.getPosition().x+4,e.getPosition().y+e.getPosition().height-4,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+4,e.getPosition().y+e.getPosition().height-4,e.getPosition().x+e.getPosition().width-4,e.getPosition().y+e.getPosition().height-4,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width-4,e.getPosition().y+4,e.getPosition().x+e.getPosition().width-4,e.getPosition().y+e.getPosition().height-4,e.getColors()[saggui::S_StandardFg]); } filledDecor::filledDecor() @@ -246,30 +246,30 @@ { } -void filledDecor::doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape) +void filledDecor::doBackground(paintEvent &e) { - bmp->doRectfill(size.x,size.y,size.width,size.height,colors[saggui::S_StandardBg]); - bmp->doRectfill(size.x,size.y,2,2,rgba::PINK); - bmp->doRectfill(size.x,size.y+size.height-2,2,2,rgba::PINK); - bmp->doRectfill(size.x+size.width-2,size.y,2,2,rgba::PINK); - bmp->doRectfill(size.x+size.width-2,size.y+size.height-2,2,2,rgba::PINK); - bmp->placePixel(size.x+2,size.y+2,colors[saggui::S_StandardBg]); - bmp->placePixel(size.x+size.width-2,size.y+size.height-2,colors[saggui::S_StandardBg]); - bmp->placePixel(size.x+2,size.y+size.height-2,colors[saggui::S_StandardBg]); - bmp->placePixel(size.x+size.width-2,size.y+2,colors[saggui::S_StandardBg]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,e.getColors()[saggui::S_StandardBg]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,2,2,rgba::PINK); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y+e.getPosition().height-2,2,2,rgba::PINK); + e.getGraphic()->doRectfill(e.getPosition().x+e.getPosition().width-2,e.getPosition().y,2,2,rgba::PINK); + e.getGraphic()->doRectfill(e.getPosition().x+e.getPosition().width-2,e.getPosition().y+e.getPosition().height-2,2,2,rgba::PINK); + e.getGraphic()->placePixel(e.getPosition().x+2,e.getPosition().y+2,e.getColors()[saggui::S_StandardBg]); + e.getGraphic()->placePixel(e.getPosition().x+e.getPosition().width-2,e.getPosition().y+e.getPosition().height-2,e.getColors()[saggui::S_StandardBg]); + e.getGraphic()->placePixel(e.getPosition().x+2,e.getPosition().y+e.getPosition().height-2,e.getColors()[saggui::S_StandardBg]); + e.getGraphic()->placePixel(e.getPosition().x+e.getPosition().width-2,e.getPosition().y+2,e.getColors()[saggui::S_StandardBg]); } -void filledDecor::doForeground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape) +void filledDecor::doForeground(paintEvent &e) { - bmp->doLine(size.x+3,size.y,size.x+size.width-3,size.y,colors[saggui::S_StandardFg]); - bmp->doLine(size.x,size.y+3,size.x,size.y+size.height-3,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+3,size.y+size.height,size.x+size.width-3,size.y+size.height,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+size.width,size.y+3,size.x+size.width,size.y+size.height-3,colors[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+3,e.getPosition().y,e.getPosition().x+e.getPosition().width-3,e.getPosition().y,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+3,e.getPosition().x,e.getPosition().y+e.getPosition().height-3,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+3,e.getPosition().y+e.getPosition().height,e.getPosition().x+e.getPosition().width-3,e.getPosition().y+e.getPosition().height,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width,e.getPosition().y+3,e.getPosition().x+e.getPosition().width,e.getPosition().y+e.getPosition().height-3,e.getColors()[saggui::S_StandardFg]); - bmp->doLine(size.x,size.y+3,size.x+3,size.y,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+size.width-3,size.y,size.x+size.width,size.y+3,colors[saggui::S_StandardFg]); - bmp->doLine(size.x,size.y+size.height-3,size.x+3,size.y+size.height,colors[saggui::S_StandardFg]); - bmp->doLine(size.x+size.width-3,size.y+size.height,size.x+size.width,size.y+size.height-3,colors[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+3,e.getPosition().x+3,e.getPosition().y,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width-3,e.getPosition().y,e.getPosition().x+e.getPosition().width,e.getPosition().y+3,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+e.getPosition().height-3,e.getPosition().x+3,e.getPosition().y+e.getPosition().height,e.getColors()[saggui::S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width-3,e.getPosition().y+e.getPosition().height,e.getPosition().x+e.getPosition().width,e.getPosition().y+e.getPosition().height-3,e.getColors()[saggui::S_StandardFg]); } plainDecor::plainDecor() @@ -283,9 +283,9 @@ { } -void plainDecor::doBackground(const saggui::coord &size, saggui::graphic *bmp, const std::vector<saggui::rgba> &colors, const uint32_t &flags, const saggui::shapeType &shape) +void plainDecor::doBackground(paintEvent &e) { - bmp->doRectfill(size.x,size.y,size.width,size.height,rgba::PINK); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,rgba::PINK); } void icon::showText(const coord &c) Modified: trunk/include/saggui/schemes/defaultscheme.h =================================================================== --- trunk/include/saggui/schemes/defaultscheme.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/schemes/defaultscheme.h 2007-08-31 14:48:53 UTC (rev 469) @@ -88,10 +88,10 @@ ~basicStyle(); //! Allows us to draw both to the actual widget - void drawBackground(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + void drawBackground(paintEvent &e); //! Allows us to draw both to the parent graphic for bordering - void drawForeground(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + void drawForeground(paintEvent &e); }; //! The Button window style @@ -106,10 +106,10 @@ ~buttonStyle(); //! Allows us to draw both to the actual widget - void drawBackground(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + void drawBackground(paintEvent &e); //! Allows us to draw both to the parent graphic for bordering - void drawForeground(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + void drawForeground(paintEvent &e); }; } Modified: trunk/include/saggui/style.h =================================================================== --- trunk/include/saggui/style.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/style.h 2007-08-31 14:48:53 UTC (rev 469) @@ -42,6 +42,7 @@ #include "common.h" #include "sigslot.h" #include "dllspec.h" +#include "paintevent.h" #include <vector> //! Simplified All Gaming Graphical User Interface @@ -69,8 +70,8 @@ friend class guiManager; protected: //! \name SIGNALS - signal5<const coord &, graphic *, const std::vector<rgba> &, const uint32_t &, const shapeType &> onPaintBackground; - signal5<const coord &, graphic *, const std::vector<rgba> &, const uint32_t &, const shapeType &> onPaintForeground; + signal1<paintEvent &> onPaintBackground; + signal1<paintEvent &> onPaintForeground; public: //! Constructor @@ -108,10 +109,10 @@ ~defaultStyle(); //! Allows us to draw both to the actual widget - slot drawBackground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + slot drawBackground(paintEvent &e); //! Allows us to draw both to the parent graphic for bordering - slot drawForeground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + slot drawForeground(paintEvent &e); }; //! The Dialog style Class @@ -129,10 +130,10 @@ ~defaultDialogStyle(); //! Allows us to draw both to the actual widget - slot drawBackground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + slot drawBackground(paintEvent &e); //! Allows us to draw both to the parent graphic for bordering - slot drawForeground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + slot drawForeground(paintEvent &e); }; } Modified: trunk/include/saggui/widgets/abstractbutton.h =================================================================== --- trunk/include/saggui/widgets/abstractbutton.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/abstractbutton.h 2007-08-31 14:48:53 UTC (rev 469) @@ -148,7 +148,7 @@ rgba fontColor; //! \name PROTECTED SLOTS - virtual slot paintEvent(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) = 0; + virtual slot paint(paintEvent &e) = 0; virtual slot setClickSystem(mouseButtons type); //! \name PROTECTED SIGNALS Modified: trunk/include/saggui/widgets/box.h =================================================================== --- trunk/include/saggui/widgets/box.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/box.h 2007-08-31 14:48:53 UTC (rev 469) @@ -63,7 +63,7 @@ bool connected; //! \name Slots - virtual void render(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + virtual void render(paintEvent &e); public: //! Constructor box(); Modified: trunk/include/saggui/widgets/button.h =================================================================== --- trunk/include/saggui/widgets/button.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/button.h 2007-08-31 14:48:53 UTC (rev 469) @@ -84,7 +84,7 @@ coord textPosition; //! \name Slots - virtual void render(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + virtual void render(paintEvent &e); //! on Resize virtual void resize(); Modified: trunk/include/saggui/widgets/checkbox.h =================================================================== --- trunk/include/saggui/widgets/checkbox.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/checkbox.h 2007-08-31 14:48:53 UTC (rev 469) @@ -66,7 +66,7 @@ void setClickSystem(mouseButtons type); //! \name Slots - virtual void render(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + virtual void render(paintEvent &e); virtual void clicked(const coord &c); public: //! Constructor Modified: trunk/include/saggui/widgets/input_box.h =================================================================== --- trunk/include/saggui/widgets/input_box.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/input_box.h 2007-08-31 14:48:53 UTC (rev 469) @@ -126,7 +126,7 @@ void update(); //! Draw - void draw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + void draw(paintEvent &e); //! Keypresses void keyPress(const keys &k); Modified: trunk/include/saggui/widgets/listbox.h =================================================================== --- trunk/include/saggui/widgets/listbox.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/listbox.h 2007-08-31 14:48:53 UTC (rev 469) @@ -74,7 +74,7 @@ protected: slot resized(); - slot drawOnButton(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + slot drawOnButton(paintEvent &e); slot showPopUp(); @@ -84,7 +84,7 @@ slot onHoverItem(const coord &pos); - slot onHoverDraw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + slot onHoverDraw(paintEvent &e); slot onSelectItem(const coord &pos); Modified: trunk/include/saggui/widgets/progress_bar.h =================================================================== --- trunk/include/saggui/widgets/progress_bar.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/progress_bar.h 2007-08-31 14:48:53 UTC (rev 469) @@ -71,7 +71,7 @@ rgba color; //! draw the progress bar - void draw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + void draw(paintEvent &e); //! round a number inline double round(double t); Modified: trunk/include/saggui/widgets/pushbutton.h =================================================================== --- trunk/include/saggui/widgets/pushbutton.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/pushbutton.h 2007-08-31 14:48:53 UTC (rev 469) @@ -67,7 +67,7 @@ protected: //! \name PROTECTED SLOTS - virtual slot paintEvent(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + virtual slot paint(paintEvent &e); private: //! Text location coord textPosition; Modified: trunk/include/saggui/widgets/radial.h =================================================================== --- trunk/include/saggui/widgets/radial.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/radial.h 2007-08-31 14:48:53 UTC (rev 469) @@ -67,7 +67,7 @@ void setClickSystem(mouseButtons type); //! \name Slots - virtual void render(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + virtual void render(paintEvent &e); virtual void clicked(const coord &c); public: //! Constructor Modified: trunk/include/saggui/widgets/scroll_bar.h =================================================================== --- trunk/include/saggui/widgets/scroll_bar.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/scroll_bar.h 2007-08-31 14:48:53 UTC (rev 469) @@ -158,9 +158,9 @@ virtual void middleButtonMove(); virtual void middleButtonUp(const coord &c); virtual void resizeButtons(); - virtual void drawButtonTop(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); - virtual void drawButtonBottom(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); - virtual void drawButtonMiddle(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + virtual void drawButtonTop(paintEvent &e); + virtual void drawButtonBottom(paintEvent &e); + virtual void drawButtonMiddle(paintEvent &e); public: //! Constructor scrollBar(); Modified: trunk/include/saggui/widgets/text_box.h =================================================================== --- trunk/include/saggui/widgets/text_box.h 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/include/saggui/widgets/text_box.h 2007-08-31 14:48:53 UTC (rev 469) @@ -116,7 +116,7 @@ void formatText(); //! Render text - void render(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + void render(paintEvent &e); //! Resize viewport void resizeViewPort(int layout, bool enable=false); Modified: trunk/src/gui_manager.cpp =================================================================== --- trunk/src/gui_manager.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/gui_manager.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -249,13 +249,13 @@ paintInfo.setPosition(temp); if((*i)->wStyle) { - (*i)->wStyle->onPaintBackground.emit(temp,(*i)->background,(*i)->wColors, (*i)->attributes, (*i)->shape); + (*i)->wStyle->onPaintBackground.emit(paintInfo); (*i)->onPaint.emit(paintInfo); if(!(*i)->children.empty()) { doWindowRender((*i)->children,(*i)->background); } - (*i)->wStyle->onPaintForeground.emit(temp,(*i)->background,(*i)->wColors, (*i)->attributes, (*i)->shape); + (*i)->wStyle->onPaintForeground.emit(paintInfo); (*i)->background->renderBmp(0,0,(*i)->position.x, (*i)->position.y,(*i)->background->getBmpWidth(), (*i)->background->getBmpHeight(), rgba::NOCOLOR, bmp); } else @@ -277,13 +277,13 @@ paintInfo.setPosition(temp); if((*i)->wStyle) { - (*i)->wStyle->onPaintBackground.emit(temp,bmp,(*i)->wColors, (*i)->attributes, (*i)->shape); + (*i)->wStyle->onPaintBackground.emit(paintInfo); (*i)->onPaint.emit(paintInfo); if(!(*i)->children.empty()) { doWindowRender((*i)->children,bmp); } - (*i)->wStyle->onPaintForeground.emit(temp,bmp,(*i)->wColors, (*i)->attributes, (*i)->shape); + (*i)->wStyle->onPaintForeground.emit(paintInfo); } else { Modified: trunk/src/schemes/defaultscheme.cpp =================================================================== --- trunk/src/schemes/defaultscheme.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/schemes/defaultscheme.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -122,31 +122,31 @@ } - void basicStyle::drawBackground(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void basicStyle::drawBackground(paintEvent &e) { - bmp->doRectfill(pos.x+1,pos.y+1,pos.width-2,pos.height-2,colors[S_StandardBg]); + e.getGraphic()->doRectfill(e.getPosition().x+1,e.getPosition().y+1,e.getPosition().width-2,e.getPosition().height-2,e.getColors()[S_StandardBg]); // Seperate implementation depending on whether its buffered or not //if(bmp::isBuffered()) //{ - if(flags & AT_Filled) + if(e.getAttributes() & AT_Filled) { bool even=true; - for(double y = pos.y+1;y<pos.y+pos.height;++y) + for(double y = e.getPosition().y+1;y<e.getPosition().y+e.getPosition().height;++y) { if(even) { - for(double x = pos.x+2;x<=pos.x+pos.width;x+=2) + for(double x = e.getPosition().x+2;x<=e.getPosition().x+e.getPosition().width;x+=2) { - bmp->placePixel(x,y,rgba::GRAY); + e.getGraphic()->placePixel(x,y,rgba::GRAY); } even=!even; } else { - for(double x = pos.x+1;x<=pos.x+pos.width;x+=2) + for(double x = e.getPosition().x+1;x<=e.getPosition().x+e.getPosition().width;x+=2) { - bmp->placePixel(x,y,rgba::GRAY); + e.getGraphic()->placePixel(x,y,rgba::GRAY); } even=!even; } @@ -160,9 +160,9 @@ } - void basicStyle::drawForeground(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void basicStyle::drawForeground(paintEvent &e) { - bmp->doRect(pos.x,pos.y,pos.width,pos.height,colors[S_StandardFg]); + e.getGraphic()->doRect(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,e.getColors()[S_StandardFg]); } buttonStyle::buttonStyle() @@ -176,31 +176,31 @@ } - void buttonStyle::drawBackground(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void buttonStyle::drawBackground(paintEvent &e) { - bmp->doRectfill(pos.x+1,pos.y+1,pos.width-2,pos.height-2,colors[S_StandardBg]); + e.getGraphic()->doRectfill(e.getPosition().x+1,e.getPosition().y+1,e.getPosition().width-2,e.getPosition().height-2,e.getColors()[S_StandardBg]); // Seperate implementation depending on whether its buffered or not //if(bmp::isBuffered()) //{ - if(flags & AT_Filled) + if(e.getAttributes() & AT_Filled) { bool even=true; - for(double y = pos.y+1;y<pos.y+pos.height;++y) + for(double y = e.getPosition().y+1;y<e.getPosition().y+e.getPosition().height;++y) { if(even) { - for(double x = pos.x+2;x<=pos.x+pos.width;x+=2) + for(double x = e.getPosition().x+2;x<=e.getPosition().x+e.getPosition().width;x+=2) { - bmp->placePixel(x,y,rgba::GRAY); + e.getGraphic()->placePixel(x,y,rgba::GRAY); } even=!even; } else { - for(double x = pos.x+1;x<=pos.x+pos.width;x+=2) + for(double x = e.getPosition().x+1;x<=e.getPosition().x+e.getPosition().width;x+=2) { - bmp->placePixel(x,y,rgba::GRAY); + e.getGraphic()->placePixel(x,y,rgba::GRAY); } even=!even; } @@ -214,9 +214,9 @@ } - void buttonStyle::drawForeground(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void buttonStyle::drawForeground(paintEvent &e) { - bmp->doRect(pos.x,pos.y,pos.width,pos.height,colors[S_StandardFg]); + e.getGraphic()->doRect(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,e.getColors()[S_StandardFg]); } } Modified: trunk/src/style.cpp =================================================================== --- trunk/src/style.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/style.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -68,60 +68,60 @@ } - slot defaultStyle::drawBackground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + slot defaultStyle::drawBackground(paintEvent &e) { - if(shape != S_Circle) + if(e.getShape() != S_Circle) { - if((!(flags & AT_On)) && (flags & AT_Filled))bmp->doDottedRectfill(size.x,size.y,size.width,size.height,2,colors[S_StandardBg],rgba::BLACK); - else if((flags & AT_On) && (flags & AT_Filled))bmp->doDottedRectfill(size.x,size.y,size.width,size.height,2,rgba::GRAY,rgba::BLACK); - else if((flags & AT_Sunken)) + if((!(e.getAttributes() & AT_On)) && (e.getAttributes() & AT_Filled))e.getGraphic()->doDottedRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,2,e.getColors()[S_StandardBg],rgba::BLACK); + else if((e.getAttributes() & AT_On) && (e.getAttributes() & AT_Filled))e.getGraphic()->doDottedRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,2,rgba::GRAY,rgba::BLACK); + else if((e.getAttributes() & AT_Sunken)) { - if((flags & AT_Editable))bmp->doRectfill(size.x,size.y,size.width,size.height,rgba::WHITE); - else if((flags & AT_Pressed))bmp->doRectfill(size.x,size.y,size.width,size.height,rgba::GRAY); - else bmp->doRectfill(size.x,size.y,size.width,size.height,colors[S_WindowBg]); - bmp->doLine(size.x+1,size.y+1,size.x+size.width-1,size.y+1,rgba::BLACK); - bmp->doLine(size.x+1,size.y+1,size.x+1,size.y+size.height-1,rgba::BLACK); + if((e.getAttributes() & AT_Editable))e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,rgba::WHITE); + else if((e.getAttributes() & AT_Pressed))e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,rgba::GRAY); + else e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,e.getColors()[S_WindowBg]); + e.getGraphic()->doLine(e.getPosition().x+1,e.getPosition().y+1,e.getPosition().x+e.getPosition().width-1,e.getPosition().y+1,rgba::BLACK); + e.getGraphic()->doLine(e.getPosition().x+1,e.getPosition().y+1,e.getPosition().x+1,e.getPosition().y+e.getPosition().height-1,rgba::BLACK); } - else if((flags & AT_Horizontal) || (flags & AT_Vertical)) bmp->doRectfill(size.x,size.y,size.width,size.height,colors[S_StandardBg]); - else bmp->doRectGradientV(size.x,size.y,size.width,size.height,size.width,colors[S_StandardBg],colors[S_StandardBgBlend]); + else if((e.getAttributes() & AT_Horizontal) || (e.getAttributes() & AT_Vertical)) e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,e.getColors()[S_StandardBg]); + else e.getGraphic()->doRectGradientV(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,e.getPosition().width,e.getColors()[S_StandardBg],e.getColors()[S_StandardBgBlend]); } - else bmp->doCirclefill(size.x+(size.width/2), size.y+(size.height/2), size.width/2,rgba::GRAY); + else e.getGraphic()->doCirclefill(e.getPosition().x+(e.getPosition().width/2), e.getPosition().y+(e.getPosition().height/2), e.getPosition().width/2,rgba::GRAY); } - slot defaultStyle::drawForeground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + slot defaultStyle::drawForeground(paintEvent &e) { - if(shape != S_Circle) + if(e.getShape() != S_Circle) { - if(flags & AT_Sunken) + if(e.getAttributes() & AT_Sunken) { - bmp->doLine(size.x,size.y,size.x,size.y+size.height,colors[S_StandardFg]); - bmp->doLine(size.x+size.width,size.y,size.x+size.width,size.y+size.height,colors[S_StandardFgBlend]); - bmp->doLine(size.x,size.y,size.x+size.width,size.y,colors[S_StandardFg]); - bmp->doLine(size.x,size.y+size.height,size.x+size.width,size.y+size.height,colors[S_StandardFgBlend]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y,e.getPosition().x,e.getPosition().y+e.getPosition().height,e.getColors()[S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width,e.getPosition().y,e.getPosition().x+e.getPosition().width,e.getPosition().y+e.getPosition().height,e.getColors()[S_StandardFgBlend]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y,e.getPosition().x+e.getPosition().width,e.getPosition().y,e.getColors()[S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+e.getPosition().height,e.getPosition().x+e.getPosition().width,e.getPosition().y+e.getPosition().height,e.getColors()[S_StandardFgBlend]); } else { - bmp->doLine(size.x,size.y,size.x,size.y+size.height,colors[S_StandardFgBlend]); - bmp->doLine(size.x+size.width,size.y,size.x+size.width,size.y+size.height,colors[S_StandardFg]); - if((flags & AT_MouseOver) && (flags && AT_Raised)) + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y,e.getPosition().x,e.getPosition().y+e.getPosition().height,e.getColors()[S_StandardFgBlend]); + e.getGraphic()->doLine(e.getPosition().x+e.getPosition().width,e.getPosition().y,e.getPosition().x+e.getPosition().width,e.getPosition().y+e.getPosition().height,e.getColors()[S_StandardFg]); + if((e.getAttributes() & AT_MouseOver) && (e.getAttributes() && AT_Raised)) { - bmp->doLine(size.x,size.y,size.x + size.width, size.y,rgba::GRAY); - bmp->doLine(size.x,size.y+size.height,size.x + size.width,size.y+size.height,rgba::GRAY); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y,e.getPosition().x + e.getPosition().width, e.getPosition().y,rgba::GRAY); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+e.getPosition().height,e.getPosition().x + e.getPosition().width,e.getPosition().y+e.getPosition().height,rgba::GRAY); } else { - bmp->doLine(size.x,size.y,size.x + size.width,size.y,colors[S_StandardFgBlend]); - bmp->doLine(size.x,size.y+size.height,size.x + size.width,size.y+size.height,colors[S_StandardFg]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y,e.getPosition().x + e.getPosition().width,e.getPosition().y,e.getColors()[S_StandardFgBlend]); + e.getGraphic()->doLine(e.getPosition().x,e.getPosition().y+e.getPosition().height,e.getPosition().x + e.getPosition().width,e.getPosition().y+e.getPosition().height,e.getColors()[S_StandardFg]); } } } else { - bmp->doCircle(size.x+(size.width/2), size.y+(size.height/2), size.width/2,colors[S_StandardFg]); - if((flags & AT_MouseOver) && (flags & AT_Raised))bmp->doCircle(size.x+(size.width/2), size.y+(size.height/2), size.width/2-1,rgba::WHITE); + e.getGraphic()->doCircle(e.getPosition().x+(e.getPosition().width/2), e.getPosition().y+(e.getPosition().height/2), e.getPosition().width/2,e.getColors()[S_StandardFg]); + if((e.getAttributes() & AT_MouseOver) && (e.getAttributes() & AT_Raised))e.getGraphic()->doCircle(e.getPosition().x+(e.getPosition().width/2), e.getPosition().y+(e.getPosition().height/2), e.getPosition().width/2-1,rgba::WHITE); } } @@ -137,26 +137,26 @@ } - slot defaultDialogStyle::drawBackground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + slot defaultDialogStyle::drawBackground(paintEvent &e) { - bmp->doRectfill(size.x,size.y,size.width,size.height,rgba::WHITE); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y,e.getPosition().width,e.getPosition().height,rgba::WHITE); } - slot defaultDialogStyle::drawForeground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + slot defaultDialogStyle::drawForeground(paintEvent &e) { - if(flags & AT_Active) + if(e.getAttributes() & AT_Active) { - bmp->doRectGradientH(size.x,size.y,size.width,topPadding,topPadding,colors[S_ActiveTitleFg],colors[S_ActiveTitleFgBlend]); - bmp->doRectfill(size.x,size.y + topPadding,leftPadding,size.height - topPadding,colors[S_ActiveTitleFg]); - bmp->doRectfill(size.x,size.getY2() - bottomPadding,size.width,bottomPadding,colors[S_ActiveTitleFg]); - bmp->doRectfill(size.getX2()-rightPadding,size.y + topPadding,rightPadding,size.height - topPadding,colors[S_ActiveTitleFg]); + e.getGraphic()->doRectGradientH(e.getPosition().x,e.getPosition().y,e.getPosition().width,topPadding,topPadding,e.getColors()[S_ActiveTitleFg],e.getColors()[S_ActiveTitleFgBlend]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y + topPadding,leftPadding,e.getPosition().height - topPadding,e.getColors()[S_ActiveTitleFg]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().getY2() - bottomPadding,e.getPosition().width,bottomPadding,e.getColors()[S_ActiveTitleFg]); + e.getGraphic()->doRectfill(e.getPosition().getX2()-rightPadding,e.getPosition().y + topPadding,rightPadding,e.getPosition().height - topPadding,e.getColors()[S_ActiveTitleFg]); } else { - bmp->doRectGradientH(size.x,size.y,size.width,topPadding,topPadding,colors[S_InactiveTitleFg],colors[S_InactiveTitleFgBlend]); - bmp->doRectfill(size.x,size.y + topPadding,leftPadding,size.height - topPadding,colors[S_InactiveTitleFg]); - bmp->doRectfill(size.x,size.getY2() - bottomPadding,size.width,bottomPadding,colors[S_InactiveTitleFg]); - bmp->doRectfill(size.getX2()-rightPadding,size.y + topPadding,rightPadding,size.height - topPadding,colors[S_InactiveTitleFg]); + e.getGraphic()->doRectGradientH(e.getPosition().x,e.getPosition().y,e.getPosition().width,topPadding,topPadding,e.getColors()[S_InactiveTitleFg],e.getColors()[S_InactiveTitleFgBlend]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().y + topPadding,leftPadding,e.getPosition().height - topPadding,e.getColors()[S_InactiveTitleFg]); + e.getGraphic()->doRectfill(e.getPosition().x,e.getPosition().getY2() - bottomPadding,e.getPosition().width,bottomPadding,e.getColors()[S_InactiveTitleFg]); + e.getGraphic()->doRectfill(e.getPosition().getX2()-rightPadding,e.getPosition().y + topPadding,rightPadding,e.getPosition().height - topPadding,e.getColors()[S_InactiveTitleFg]); } } } Modified: trunk/src/widgets/box.cpp =================================================================== --- trunk/src/widgets/box.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/widgets/box.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -52,15 +52,15 @@ { } - void box::render(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void box::render(paintEvent &e) { if(connected) { if(position.width != (bitmap->getBmpWidth())+(leftPadding+rightPadding)+2)position.width = (bitmap->getBmpWidth())+(leftPadding+rightPadding)+2; if(position.height != (bitmap->getBmpHeight())+(topPadding+bottomPadding)+2)position.height = (bitmap->getBmpHeight())+(topPadding+bottomPadding)+2; } - if(wStyle)bitmap->renderBmp(0,0,pos.x+leftPadding+1, pos.y+topPadding+1,bitmap->getBmpWidth(),bitmap->getBmpHeight(),colors[S_StandardBg], background); - else bitmap->renderBmp(0,0,pos.x+leftPadding+1, pos.y+topPadding+1,bitmap->getBmpWidth(),bitmap->getBmpHeight(), rgba::NOCOLOR, background); + if(wStyle)bitmap->renderBmp(0,0,e.getPosition().x+leftPadding+1, e.getPosition().y+topPadding+1,bitmap->getBmpWidth(),bitmap->getBmpHeight(),e.getColors()[S_StandardBg], background); + else bitmap->renderBmp(0,0,e.getPosition().x+leftPadding+1, e.getPosition().y+topPadding+1,bitmap->getBmpWidth(),bitmap->getBmpHeight(), rgba::NOCOLOR, background); } void box::setBitmap(graphic *bmp) Modified: trunk/src/widgets/button.cpp =================================================================== --- trunk/src/widgets/button.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/widgets/button.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -58,14 +58,14 @@ { } - void button::render(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void button::render(paintEvent &e) { - if(connected)bitmap->renderBmp(0,0,pos.x + bmpPosition.x, pos.y + bmpPosition.y,bitmap->getBmpWidth(),bitmap->getBmpHeight(), rgba::NOCOLOR, background); + if(connected)bitmap->renderBmp(0,0,e.getPosition().x + bmpPosition.x, e.getPosition().y + bmpPosition.y,bitmap->getBmpWidth(),bitmap->getBmpHeight(), rgba::NOCOLOR, background); if(!currentSetText.empty()) { - currentSetFont->render(pos.x + textPosition.x,pos.y + textPosition.y,textColor,background,0,currentSetText); + currentSetFont->render(e.getPosition().x + textPosition.x,e.getPosition().y + textPosition.y,textColor,background,0,currentSetText); } - //if((flags & AT_Focused) && !(flags & AT_Sunken))bmp->doDottedRect(pos.x+2,pos.y+2,pos.width-4,pos.height-4,2,rgba::BLACK,rgba::INVISIBLE); + //if((flags & AT_Focused) && !(flags & AT_Sunken))bmp->doDottedRect(e.getPosition().x+2,e.getPosition().y+2,e.getPosition().width-4,e.getPosition().height-4,2,rgba::BLACK,rgba::INVISIBLE); } void button::resize() Modified: trunk/src/widgets/checkbox.cpp =================================================================== --- trunk/src/widgets/checkbox.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/widgets/checkbox.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -54,7 +54,7 @@ { } - void checkBox::render(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void checkBox::render(paintEvent &e) { if(status) { @@ -62,20 +62,20 @@ { case C_CheckTick: { - const double min1 = pos.width/7; - const double min2 = pos.width/6; - const double min3 = pos.width/5; - const double min4 = pos.width/4; - bmp->doLine(pos.x+leftPadding+min2, pos.y+topPadding+min4, pos.x+leftPadding+min2, pos.y + pos.height - bottomPadding - min2,rgba::BLACK); - bmp->doLine(pos.x+leftPadding+min3, pos.y+topPadding+min4, pos.x+leftPadding+min3, pos.y + pos.height - bottomPadding - min2,rgba::BLACK); - bmp->doLine(pos.x+leftPadding+min4, pos.y + pos.height - bottomPadding - min3, pos.x + pos.width - rightPadding - min1, pos.y + topPadding+ min2,rgba::BLACK); - bmp->doLine(pos.x+leftPadding+min4, pos.y + pos.height - bottomPadding - min4, pos.x + pos.width - rightPadding - min3, pos.y + topPadding+min3,rgba::BLACK); + const double min1 = e.getPosition().width/7; + const double min2 = e.getPosition().width/6; + const double min3 = e.getPosition().width/5; + const double min4 = e.getPosition().width/4; + e.getGraphic()->doLine(e.getPosition().x+leftPadding+min2, e.getPosition().y+topPadding+min4, e.getPosition().x+leftPadding+min2, e.getPosition().y + e.getPosition().height - bottomPadding - min2,rgba::BLACK); + e.getGraphic()->doLine(e.getPosition().x+leftPadding+min3, e.getPosition().y+topPadding+min4, e.getPosition().x+leftPadding+min3, e.getPosition().y + e.getPosition().height - bottomPadding - min2,rgba::BLACK); + e.getGraphic()->doLine(e.getPosition().x+leftPadding+min4, e.getPosition().y + e.getPosition().height - bottomPadding - min3, e.getPosition().x + e.getPosition().width - rightPadding - min1, e.getPosition().y + topPadding+ min2,rgba::BLACK); + e.getGraphic()->doLine(e.getPosition().x+leftPadding+min4, e.getPosition().y + e.getPosition().height - bottomPadding - min4, e.getPosition().x + e.getPosition().width - rightPadding - min3, e.getPosition().y + topPadding+min3,rgba::BLACK); break; } case C_XTick: { - bmp->doLine(pos.x+leftPadding,pos.y+rightPadding,pos.x+pos.width-rightPadding,pos.y+pos.height-bottomPadding,rgba::BLACK); - bmp->doLine(pos.x+leftPadding,pos.y+pos.height-bottomPadding,pos.x+pos.width-rightPadding,pos.y+topPadding,rgba::BLACK); + e.getGraphic()->doLine(e.getPosition().x+leftPadding,e.getPosition().y+rightPadding,e.getPosition().x+e.getPosition().width-rightPadding,e.getPosition().y+e.getPosition().height-bottomPadding,rgba::BLACK); + e.getGraphic()->doLine(e.getPosition().x+leftPadding,e.getPosition().y+e.getPosition().height-bottomPadding,e.getPosition().x+e.getPosition().width-rightPadding,e.getPosition().y+topPadding,rgba::BLACK); break; } } Modified: trunk/src/widgets/input_box.cpp =================================================================== --- trunk/src/widgets/input_box.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/widgets/input_box.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -142,16 +142,16 @@ } // Draw - void inputBox::draw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void inputBox::draw(paintEvent &e) { if(attributes & AT_Visible) { - currentSetFont->render(pos.x + textX,pos.y + textY,colors[S_WindowText],background,hAlignment,currentSetText); + currentSetFont->render(e.getPosition().x + textX,e.getPosition().y + textY,e.getColors()[S_WindowText],background,hAlignment,currentSetText); if(attributes & AT_Focused) { if(cursorTime.msecs()<=blinkRate) { - background->doLine(pos.x + cursorX,pos.y + cursorY,pos.x + cursorX,pos.y + cursorY+textSizeH,colors[S_Other1]); + background->doLine(e.getPosition().x + cursorX,e.getPosition().y + cursorY,e.getPosition().x + cursorX,e.getPosition().y + cursorY+textSizeH,e.getColors()[S_Other1]); } } } Modified: trunk/src/widgets/listbox.cpp =================================================================== --- trunk/src/widgets/listbox.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/widgets/listbox.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -117,22 +117,22 @@ showListButton.position.set((position.width*.80),0,(position.width*.20)-1,position.height-1); } - slot listBox::drawOnButton(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + slot listBox::drawOnButton(paintEvent &e) { double movex = 0; double movey = 0; - if(flags & AT_Sunken) + if(e.getAttributes() & AT_Sunken) { - movex = 1;//pos.width * 0.10; - movey = 1;//pos.height * 0.10; + movex = 1;//e.getPosition().width * 0.10; + movey = 1;//e.getPosition().height * 0.10; } - const double width = pos.width/3; - const double height = pos.height/3; - bmp->doTriangle(movex + pos.x+((pos.width/2)-(width/2)),movey + pos.y+((pos.height/2)-(height/2)), - movex + pos.x+(pos.width/2),movey + pos.y+((pos.height/2)+(height/2)), - movex + pos.x+((pos.width/2)+(width/2)),movey + pos.y+((pos.height/2)-(height/2)), + const double width = e.getPosition().width/3; + const double height = e.getPosition().height/3; + e.getGraphic()->doTriangle(movex + e.getPosition().x+((e.getPosition().width/2)-(width/2)),movey + e.getPosition().y+((e.getPosition().height/2)-(height/2)), + movex + e.getPosition().x+(e.getPosition().width/2),movey + e.getPosition().y+((e.getPosition().height/2)+(height/2)), + movex + e.getPosition().x+((e.getPosition().width/2)+(width/2)),movey + e.getPosition().y+((e.getPosition().height/2)-(height/2)), rgba::BLACK); } @@ -231,9 +231,9 @@ } } - slot listBox::onHoverDraw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + slot listBox::onHoverDraw(paintEvent &e) { - bmp->doRectfill(0,0,pos.width,pos.height,rgba(50,50,50,100)); + e.getGraphic()->doRectfill(0,0,e.getPosition().width,e.getPosition().height,rgba(50,50,50,100)); } slot listBox::onSelectItem(const coord &pos) Modified: trunk/src/widgets/progress_bar.cpp =================================================================== --- trunk/src/widgets/progress_bar.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/widgets/progress_bar.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -68,25 +68,25 @@ { } - void progressBar::draw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void progressBar::draw(paintEvent &e) { - color.alpha = colors[S_StandardBg].alpha; + color.alpha = e.getColors()[S_StandardBg].alpha; if (type == HORIZONTAL && style == BOTTOM) - background->doRectfill(pos.x, pos.y, round((pos.width/maxProgress)*progress), pos.height, color); + background->doRectfill(e.getPosition().x, e.getPosition().y, round((e.getPosition().width/maxProgress)*progress), e.getPosition().height, color); else if (type == HORIZONTAL && style == TOP) - background->doRectfill(pos.x + round((pos.width/maxProgress)*(maxProgress-progress)), - pos.y, pos.width-1, pos.height-1, color); + background->doRectfill(e.getPosition().x + round((e.getPosition().width/maxProgress)*(maxProgress-progress)), + e.getPosition().y, e.getPosition().width-1, e.getPosition().height-1, color); else if (type == VERTICAL && style == BOTTOM) - background->doRectfill(pos.x, pos.y + round((pos.height/maxProgress)*(maxProgress-progress)), - pos.width-1, pos.height-1, color); + background->doRectfill(e.getPosition().x, e.getPosition().y + round((e.getPosition().height/maxProgress)*(maxProgress-progress)), + e.getPosition().width-1, e.getPosition().height-1, color); else if (type == VERTICAL && style == TOP) - background->doRectfill(pos.x , pos.y, pos.width-1, round(((pos.height-1)/maxProgress)*progress), color); + background->doRectfill(e.getPosition().x , e.getPosition().y, e.getPosition().width-1, round(((e.getPosition().height-1)/maxProgress)*progress), color); else if (type == HORIZONTAL && style == MIDDLE) - background->doRectfill(pos.x + round((pos.width/maxProgress)*(maxProgress-progress)/2), pos.y, - round((pos.width/maxProgress)*progress), pos.height-1, color); + background->doRectfill(e.getPosition().x + round((e.getPosition().width/maxProgress)*(maxProgress-progress)/2), e.getPosition().y, + round((e.getPosition().width/maxProgress)*progress), e.getPosition().height-1, color); else if (type == VERTICAL && style == MIDDLE) - background->doRectfill(pos.x,pos.y + round((pos.height/maxProgress)*(maxProgress-progress)/2), - pos.width, round(((pos.height-1)/maxProgress)*progress), color); + background->doRectfill(e.getPosition().x,e.getPosition().y + round((e.getPosition().height/maxProgress)*(maxProgress-progress)/2), + e.getPosition().width, round(((e.getPosition().height-1)/maxProgress)*progress), color); } Modified: trunk/src/widgets/pushbutton.cpp =================================================================== --- trunk/src/widgets/pushbutton.cpp 2007-08-31 13:24:58 UTC (rev 468) +++ trunk/src/widgets/pushbutton.cpp 2007-08-31 14:48:53 UTC (rev 469) @@ -46,7 +46,7 @@ { pushButton::pushButton() { - onPaint.connect(this, &pushButton::paintEvent); + onPaint.connect(this, &pushButton::paint); textChanged.connect(this,&pushButton::onTextChanged); iconChanged.connect(this,&pushButton::onIconChanged); pressed.connect(this,&pushButton::depress); @@ -56,20 +56,20 @@ pushButton::pushButton(const std::string &text) { - onPaint.connect(this, &pushButton::paintEvent); + onPaint.connect(this, &pushButton::paint); setText(text); } pushButton::pushButton(const std::string &text, graphic *icon) { - onPaint.connect(this, &pushButton::paintEvent); + onPaint.connect(this, &pushButton::paint); setText(text); setIcon(icon); } pushButton::pushButton(graphic *icon) { - onPaint.connect(this, &pushButton::paintEvent); + onPaint.connect(this, &pushButton::paint); setIcon(icon); } @@ -77,15 +77,15 @@ { } - slot pushButton::paintEvent(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + slot pushButton::paint(paintEvent &e) { if(!this->getText().empty()) { - buttonFont->render(pos.x + textPosition.x,pos.y + textPosition.y,fontColor,bmp,0,getText()); + buttonFont->render(e.getPosition().x + textPosition.x,e.getPosition().y + textPosition.y,fontColor,e.getGraphic(),0,getText()); } if(this->getIcon()) { - this->getIcon()->renderBmp(0, 0, pos.x + iconPosition.x, pos.y + iconPosition.y, iconPosition.width, iconPosition.height, rgba::NOCOLOR, bmp); + this->getIcon()->renderBmp(0, 0, e.getPosition().x + iconPosition.x, e.getPosition().y + iconPosition.y, iconPosition.width, iconPosition.height, rgba::NOCOLOR, e.getGraphic()); } } Modified: trunk/src/widgets/radial.cpp =================================================================== --- trunk/... [truncated message content] |
From: <sag...@li...> - 2007-08-31 14:45:37
|
Revision: 464 http://saggui.svn.sourceforge.net/saggui/?rev=464&view=rev Author: juvinious Date: 2007-08-26 13:07:44 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Added xml demo to the repository examples directory. Made several bug fixes listed in changelog. Modified Paths: -------------- trunk/CHANGELOG trunk/CMakeLists.txt trunk/include/saggui/creationengine.h trunk/modules/sagguixml/include/sagguixml.h trunk/modules/sagguixml/src/sagguixml.cpp trunk/src/creationengine.cpp trunk/src/window.cpp Added Paths: ----------- trunk/examples/xml/ trunk/examples/xml/CMakeLists.txt trunk/examples/xml/data/ trunk/examples/xml/data/test.xml trunk/examples/xml/include/ trunk/examples/xml/src/ trunk/examples/xml/src/allegro.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-08-26 10:53:51 UTC (rev 463) +++ trunk/CHANGELOG 2007-08-26 20:07:44 UTC (rev 464) @@ -1,4 +1,8 @@ 0.50 +- Added xml demo for allegro to the repository +- Completed some more widget information in sagguixml making it quite useable +- Added entire widget collection to creationengine for use +- Fixed several severe bug with window removal from guiManager on item deletion - Added in exception handler for saggui (sagguiException) - Added new class creationEngine to facilitate creating widgets via markup. Added an xml extension of that class. - Added new member to system,resourceManager and guiManager to accomodate not having to use guiManagers setResolution Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-08-26 10:53:51 UTC (rev 463) +++ trunk/CMakeLists.txt 2007-08-26 20:07:44 UTC (rev 464) @@ -265,6 +265,7 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/examples/demo) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/gamedemo) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/widgets) +add_subdirectory(${CMAKE_SOURCE_DIR}/examples/xml) add_subdirectory(${CMAKE_SOURCE_DIR}/utils/bmpdump) # ------------------------------------------------------- Copied: trunk/examples/xml/CMakeLists.txt (from rev 461, trunk/examples/demo/CMakeLists.txt) =================================================================== --- trunk/examples/xml/CMakeLists.txt (rev 0) +++ trunk/examples/xml/CMakeLists.txt 2007-08-26 20:07:44 UTC (rev 464) @@ -0,0 +1,31 @@ +# ------------------------------------------------------- +# SAGGUI cmake build script to create demo called from +# main build +# Written by: juvinious +# ------------------------------------------------------- + +include_directories(include) + +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/xml) +configure_file(data/test.xml ${CMAKE_BINARY_DIR}/bin/xml/test.xml COPYONLY) + +if(MSVC) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/examples/xml/xml) +endif(MSVC) + +if(NOT ${CREATE_STATIC_LIB}) + if(MSVC) + remove_definitions(/DSAGGUI_LIB_BUILD) + else(MSVC) + remove_definitions(-DSAGGUI_LIB_BUILD) + endif(MSVC) +endif(NOT ${CREATE_STATIC_LIB}) + +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/xml) + +if(ENABLE_ALLEGRO) + include_directories(${ALLEGRO_INCLUDE_DIR}) + add_executable(xml-allegro src/allegro.cpp) + target_link_libraries(xml-allegro saggui-xml saggui-alleg saggui) + add_dependencies(xml-allegro saggui-xml saggui-alleg saggui) +endif(ENABLE_ALLEGRO) Added: trunk/examples/xml/data/test.xml =================================================================== --- trunk/examples/xml/data/test.xml (rev 0) +++ trunk/examples/xml/data/test.xml 2007-08-26 20:07:44 UTC (rev 464) @@ -0,0 +1,28 @@ +<box id="top" x="80" y="80" width="200" height="200" dragstate="3"> + <box id="sub1" x="20" y="20" width="50" height="50" dragstate="3"> + <box id="sub3" x="5" y="5" width="25" height="25" dragstate="3"/> + </box> + <box id="sub32" x="40" y="40" width="50" height="50" dragstate="3"/> +</box> +<box id="top2" x="280" y="280" width="100" height="100" dragstate="3"> + <box id="sub2" x="20" y="40" width="40" height="20" dragstate="3"/> +</box> + +<textbox id="textbox" x="220" y="240" width="80" height="80" dragstate="3" text="This is a text box. Full of tons of stuff for them to have fun with."/> + +<dialog id="dialog" x="50" y="50" width="120" height="120"/> + +<label id="label" x="50" y="350" width="120" height="120" text="My little label"/> + +<inputbox id="input" x="300" y="300" width="100" height="20" text="Type stuff!" halign="0" font-color="red" blink-speed="800" /> + +<listbox id="list" x="20" y="300" width="100" height="25"> + <li>item1</li> + <li>item2</li> + <li>item3</li> + <li>item4</li> +</listbox> + +<checkbox id="check" checked="1" x="30" y="250" width="25" height="25"/> +<radial id="radial" checked="1" x="60" y="250" width="25" height="25"/> +<pushbutton id="push" text="Hello World" x="400" y="400"/> \ No newline at end of file Added: trunk/examples/xml/src/allegro.cpp =================================================================== --- trunk/examples/xml/src/allegro.cpp (rev 0) +++ trunk/examples/xml/src/allegro.cpp 2007-08-26 20:07:44 UTC (rev 464) @@ -0,0 +1,101 @@ +#include <saggui.h> +#include <saggui_alleg.h> +#include <saggui_xml.h> + +using namespace saggui; + +int main() +{ + resourceManager::registerBackend<ALLEGRO_SAGGUI>(); + + guiManager::setup("allegro"); + + // Create a timer to regulate the logic loop + guiTimer timer, fpsTimer; + int fps=0,fpsCounter =0; + + // Some Variables + bool fullscreen = false; + bool buffered = true; + bool quit = false; + + // Set the resolution of the demo + if(!guiManager::setupScreen(640,480,32,fullscreen, buffered)) + { + std::cout << "Couldn't create display\n"; + return 1; + } + + xmlEngine xml; + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + + listBox *bleh = dynamic_cast<listBox *>(xml.find("list")); + if(bleh)std::cout << "selected item: " << bleh->selectedItem() << "\n"; + + // Main loop + while(!quit){ + + bool draw=false; + while (timer.msecs() >= 1000/60) + { + draw = true; + if(keyInputManager::keyState(keys::ESC)) + { + quit=true; + draw=false; + break; + } + + if(keyInputManager::keyState(keys::NUM_1,true)) + { + try + { + xml.load("test.xml"); + } + catch(const sagguiException &e) + { + std::cout << "Couldn't load xml file! Reason: " + e.getReason() + "\n"; + } + break; + } + + guiManager::update(); + + timer.reset(); + } + + if(draw) + { + if(fpsTimer.secs()<=1)fpsCounter++; + + guiManager::getSystemBuffer()->clearBmp(rgba::BLACK); + resourceManager::getFont()->render(10,10,rgba::WHITE,guiManager::getSystemBuffer(),0,"FPS: %d",fps); + resourceManager::getFont()->render(10,30,rgba::WHITE,guiManager::getSystemBuffer(),0,"Press 1 to reload xml file"); + + guiManager::renderWindows(); + + + + } + + if(fpsTimer.secs()>=1) + { + fpsTimer.reset(); + fps=fpsCounter; + fpsCounter=0; + } + while((timer.msecs())==0)timer.sleep(1); + + } + + return 0; +} +END_OF_MAIN() + Modified: trunk/include/saggui/creationengine.h =================================================================== --- trunk/include/saggui/creationengine.h 2007-08-26 10:53:51 UTC (rev 463) +++ trunk/include/saggui/creationengine.h 2007-08-26 20:07:44 UTC (rev 464) @@ -53,6 +53,7 @@ namespace saggui { class window; + class rgba; //! Class representing basic data of a widget class SAGGUI_EXPORT windowMarkup @@ -140,10 +141,16 @@ */ window *createWindow(windowMarkup &win); + //! Usefull tool to convert colors + static rgba getColor(const std::string &color); + protected: //! Add a window to the list void addWindow(const std::string &id, window *win); + + //! Cleanup ie delete windows and stuff for a reload for example + void cleanup(); private: //! Set windowDefaults defaults Modified: trunk/modules/sagguixml/include/sagguixml.h =================================================================== --- trunk/modules/sagguixml/include/sagguixml.h 2007-08-26 10:53:51 UTC (rev 463) +++ trunk/modules/sagguixml/include/sagguixml.h 2007-08-26 20:07:44 UTC (rev 464) @@ -81,6 +81,9 @@ //! Specific to listbox virtual void listbox(TiXmlElement *element, window *parent); + //! Specific to inputbox + virtual void inputbox(TiXmlElement *element, window *parent); + }; } Modified: trunk/modules/sagguixml/src/sagguixml.cpp =================================================================== --- trunk/modules/sagguixml/src/sagguixml.cpp 2007-08-26 10:53:51 UTC (rev 463) +++ trunk/modules/sagguixml/src/sagguixml.cpp 2007-08-26 20:07:44 UTC (rev 464) @@ -40,6 +40,7 @@ #include "tinyxml.h" #include "window.h" #include "widgets/listbox.h" +#include "widgets/input_box.h" namespace saggui { @@ -56,6 +57,7 @@ void xmlEngine::load(const std::string &filename) throw (sagguiException) { + cleanup(); TiXmlNode *node = 0; doc = new TiXmlDocument(filename); @@ -176,6 +178,10 @@ { listbox(element, tempWin); } + else if(temp.getType() == windowMarkup::INPUTBOX) + { + inputbox(element, tempWin); + } else { children(element, tempWin); @@ -218,5 +224,39 @@ child = child->NextSibling(); } } + + void xmlEngine::inputbox(TiXmlElement *element, window *parent) + { + inputBox *temp = dynamic_cast<inputBox *>(parent); + if(!temp)return; + if(element->Attribute("valign")) + { + temp->setVerticalAlign(inputBox::textAlign(atoi(element->Attribute("valign")))); + } + if(element->Attribute("halign")) + { + temp->setHorizontalAlign(inputBox::textAlign(atoi(element->Attribute("halign")))); + } + if(element->Attribute("font-color")) + { + temp->setTextColor(getColor(element->Attribute("font-color"))); + } + if(element->Attribute("cursor-color")) + { + temp->setCursorColor(getColor(element->Attribute("cursor-color"))); + } + if(element->Attribute("blink-speed")) + { + temp->setCursorBlinkRate(atoi(element->Attribute("blink-speed"))); + } + if(element->Attribute("auto-resize")) + { + temp->setAutoResize(bool(element->Attribute("auto-resize"))); + } + if(element->Attribute("limit")) + { + temp->setLimit(atoi(element->Attribute("limit"))); + } + } } Modified: trunk/src/creationengine.cpp =================================================================== --- trunk/src/creationengine.cpp 2007-08-26 10:53:51 UTC (rev 463) +++ trunk/src/creationengine.cpp 2007-08-26 20:07:44 UTC (rev 464) @@ -66,8 +66,29 @@ const std::string windowMarkup::SCROLLBAR = "scrollbar"; const std::string windowMarkup::TEXTBOX = "textbox"; - rgba getColor(const std::string &color) + windowMarkup::windowMarkup(const std::string &type) + { + addInfo(T_Type, type); + } + windowMarkup::~windowMarkup() + { + // Nothing + } + + // Constructor + creationEngine::creationEngine() { + // Nothing + } + + creationEngine::~creationEngine() + { + // cleanup + cleanup(); + } + + rgba creationEngine::getColor(const std::string &color) + { if(color == "black")return rgba::BLACK; if(color == "white")return rgba::WHITE; if(color == "darkgray")return rgba::DARKGRAY; @@ -89,26 +110,6 @@ return rgba(); } - windowMarkup::windowMarkup(const std::string &type) - { - addInfo(T_Type, type); - } - windowMarkup::~windowMarkup() - { - // Nothing - } - - // Constructor - creationEngine::creationEngine() - { - // Nothing - } - - creationEngine::~creationEngine() - { - - } - window *creationEngine::find(const std::string &id) { return windows.find(id)->second; @@ -298,8 +299,6 @@ try { setWindowDefaults(temp,win); - listBox *t = dynamic_cast<listBox *>(temp); - if(t)t->addItem("EmptyList"); addWindow(win.getString(T_Id),temp); } catch(const sagguiException &e) @@ -552,7 +551,7 @@ if(!win)throw sagguiException("Window not created!"); try { - win->position.x = markup.getDouble(T_X); + win->position.setX(markup.getDouble(T_X)); } catch(const sagguiException &e) { @@ -560,7 +559,7 @@ } try { - win->position.y = markup.getDouble(T_Y); + win->position.setY(markup.getDouble(T_Y)); } catch(const sagguiException &e) { @@ -568,7 +567,7 @@ } try { - win->position.width = markup.getDouble(T_Width); + win->position.setWidth(markup.getDouble(T_Width)); } catch(const sagguiException &e) { @@ -576,7 +575,7 @@ } try { - win->position.height = markup.getDouble(T_Height); + win->position.setHeight(markup.getDouble(T_Height)); } catch(const sagguiException &e) { @@ -639,5 +638,14 @@ // Nothing } } + + void creationEngine::cleanup() + { + // Destroy all created windows + for(std::map<const std::string, window *>::iterator i = windows.begin();i!=windows.end();++i) + { + if(i->second)delete i->second; + } + } } Modified: trunk/src/window.cpp =================================================================== --- trunk/src/window.cpp 2007-08-26 10:53:51 UTC (rev 463) +++ trunk/src/window.cpp 2007-08-26 20:07:44 UTC (rev 464) @@ -77,6 +77,7 @@ window::~window() { // Do some shit + guiManager::removeWindow(this); } bool window::operator==(const window * const w) const This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-31 13:25:04
|
Revision: 468 http://saggui.svn.sourceforge.net/saggui/?rev=468&view=rev Author: juvinious Date: 2007-08-31 06:24:58 -0700 (Fri, 31 Aug 2007) Log Message: ----------- Switiching to use paintEvent instead of the long parameter list Modified Paths: -------------- trunk/include/saggui/paintevent.h trunk/include/saggui/widgets/label.h trunk/include/saggui/window.h trunk/src/gui_manager.cpp trunk/src/paintevent.cpp trunk/src/widgets/label.cpp trunk/src/window.cpp Modified: trunk/include/saggui/paintevent.h =================================================================== --- trunk/include/saggui/paintevent.h 2007-08-30 12:53:21 UTC (rev 467) +++ trunk/include/saggui/paintevent.h 2007-08-31 13:24:58 UTC (rev 468) @@ -50,6 +50,7 @@ */ namespace saggui { + class window; class graphic; class coord; class rgba; @@ -64,6 +65,9 @@ //! Constructor paintEvent(); + //! Ctor for passing a window and extracting info + paintEvent(window *win); + //! Deconstructor ~paintEvent(); Modified: trunk/include/saggui/widgets/label.h =================================================================== --- trunk/include/saggui/widgets/label.h 2007-08-30 12:53:21 UTC (rev 467) +++ trunk/include/saggui/widgets/label.h 2007-08-31 13:24:58 UTC (rev 468) @@ -85,7 +85,7 @@ void update(); //! Draw - void draw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + void draw(paintEvent &e); public: //! Constructor Modified: trunk/include/saggui/window.h =================================================================== --- trunk/include/saggui/window.h 2007-08-30 12:53:21 UTC (rev 467) +++ trunk/include/saggui/window.h 2007-08-31 13:24:58 UTC (rev 468) @@ -45,6 +45,7 @@ #include "dllspec.h" #include "sigslot.h" #include "coord.h" +#include "paintevent.h" #include "debug.h" @@ -113,7 +114,7 @@ signal0<> onMinimize; signal0<> onUpdate; - signal5<const coord &, graphic *, const std::vector<rgba> &, const uint32_t &, const shapeType &> onPaint; + signal1<paintEvent &> onPaint; //! \name Setters and Getters @@ -222,6 +223,7 @@ friend class guiManager; friend class mouseManager; + friend class paintEvent; }; } Modified: trunk/src/gui_manager.cpp =================================================================== --- trunk/src/gui_manager.cpp 2007-08-30 12:53:21 UTC (rev 467) +++ trunk/src/gui_manager.cpp 2007-08-31 13:24:58 UTC (rev 468) @@ -49,6 +49,7 @@ #include "saggui/coord.h" #include "saggui/keys.h" #include "saggui/scheme.h" +#include "saggui/paintevent.h" namespace saggui { @@ -244,10 +245,12 @@ coord temp = (*i)->position; temp.x = 0; temp.y = 0; + paintEvent paintInfo((*i)); + paintInfo.setPosition(temp); if((*i)->wStyle) { (*i)->wStyle->onPaintBackground.emit(temp,(*i)->background,(*i)->wColors, (*i)->attributes, (*i)->shape); - (*i)->onPaint.emit(temp,(*i)->background,(*i)->wColors, (*i)->attributes, (*i)->shape); + (*i)->onPaint.emit(paintInfo); if(!(*i)->children.empty()) { doWindowRender((*i)->children,(*i)->background); @@ -257,7 +260,7 @@ } else { - (*i)->onPaint.emit(temp,(*i)->background,(*i)->wColors, (*i)->attributes, (*i)->shape); + (*i)->onPaint.emit(paintInfo); if(!(*i)->children.empty()) { doWindowRender((*i)->children,(*i)->background); @@ -270,10 +273,12 @@ if(!bmp)continue; coord temp = (*i)->getRelativePosition(); bmp->setClip((*i)->getPosition().clipRect(temp)); + paintEvent paintInfo((*i)); + paintInfo.setPosition(temp); if((*i)->wStyle) { (*i)->wStyle->onPaintBackground.emit(temp,bmp,(*i)->wColors, (*i)->attributes, (*i)->shape); - (*i)->onPaint.emit(temp,bmp,(*i)->wColors, (*i)->attributes, (*i)->shape); + (*i)->onPaint.emit(paintInfo); if(!(*i)->children.empty()) { doWindowRender((*i)->children,bmp); @@ -282,7 +287,7 @@ } else { - (*i)->onPaint.emit(temp,bmp,(*i)->wColors, (*i)->attributes, (*i)->shape); + (*i)->onPaint.emit(paintInfo); if(!(*i)->children.empty()) { doWindowRender((*i)->children,bmp); Modified: trunk/src/paintevent.cpp =================================================================== --- trunk/src/paintevent.cpp 2007-08-30 12:53:21 UTC (rev 467) +++ trunk/src/paintevent.cpp 2007-08-31 13:24:58 UTC (rev 468) @@ -37,6 +37,7 @@ */ #include "saggui/paintevent.h" +#include "saggui/window.h" #include "saggui/graphics.h" #include "saggui/coord.h" #include "saggui/rgba.h" @@ -48,6 +49,12 @@ { // Nothing } + + //init + paintEvent::paintEvent(window *win) : position(&win->position), bitmap(win->background), colors(&win->wColors), attributes(&win->attributes), shape(&win->shape) + { + // Nothing + } //de-init paintEvent::~paintEvent() { Modified: trunk/src/widgets/label.cpp =================================================================== --- trunk/src/widgets/label.cpp 2007-08-30 12:53:21 UTC (rev 467) +++ trunk/src/widgets/label.cpp 2007-08-31 13:24:58 UTC (rev 468) @@ -99,11 +99,11 @@ } // Draw - void label::draw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + void label::draw(paintEvent &e) { if(attributes & AT_Visible) { - currentSetFont->render(pos.x+x1,pos.y+y1,textColor,background,hAlignment,currentSetText); + currentSetFont->render(e.getPosition().x+x1,e.getPosition().y+y1,textColor,e.getGraphic(),hAlignment,currentSetText); } } Modified: trunk/src/window.cpp =================================================================== --- trunk/src/window.cpp 2007-08-30 12:53:21 UTC (rev 467) +++ trunk/src/window.cpp 2007-08-31 13:24:58 UTC (rev 468) @@ -45,6 +45,7 @@ #include "saggui/style.h" #include "saggui/graphics.h" #include "saggui/rgba.h" +#include "saggui/paintevent.h" namespace saggui { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-30 12:53:33
|
Revision: 467 http://saggui.svn.sourceforge.net/saggui/?rev=467&view=rev Author: juvinious Date: 2007-08-30 05:53:21 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Added paintEvent class to pass to onPaint signals instead of a long parameter list Modified Paths: -------------- trunk/CHANGELOG Added Paths: ----------- trunk/include/saggui/paintevent.h trunk/src/paintevent.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-08-29 13:13:34 UTC (rev 466) +++ trunk/CHANGELOG 2007-08-30 12:53:21 UTC (rev 467) @@ -1,4 +1,5 @@ 0.50 +- Added paintEvent class for passing paint info for onPaint events - Added xml demo for allegro to the repository - Completed some more widget information in sagguixml making it quite useable - Added entire widget collection to creationengine for use Copied: trunk/include/saggui/paintevent.h (from rev 461, trunk/include/saggui/key_events.h) =================================================================== --- trunk/include/saggui/paintevent.h (rev 0) +++ trunk/include/saggui/paintevent.h 2007-08-30 12:53:21 UTC (rev 467) @@ -0,0 +1,108 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef PAINT_EVENT_H +#define PAINT_EVENT_H + +#include <vector> +#include "common.h" +#include "dllspec.h" +#include "sagguiexception.h" + +//! Simplified All Gaming Graphical User Interface +/*! + This is the naming convention for this SAGGUI lib. +*/ +namespace saggui +{ + class graphic; + class coord; + class rgba; + //! The Paint Event Class + /*! + * This provides all necessary data about an event with paint properties + */ + + class SAGGUI_EXPORT paintEvent + { + public: + //! Constructor + paintEvent(); + + //! Deconstructor + ~paintEvent(); + + //! Set Position + void setPosition(coord &position); + + //! Get Position + const coord &getPosition() const throw(sagguiException); + + //! Set Graphic + void setGraphic(graphic *bitmap); + + //! Get Graphic + graphic *getGraphic() throw(sagguiException); + + //! Set colors + void setColors(std::vector<rgba> &colors); + + //! Get colors + const std::vector<rgba> &getColors() const throw(sagguiException); + + //! Set attributes + void setAttributes(uint32_t &attributes); + + //! Get attributes + const uint32_t &getAttributes() const throw(sagguiException); + + //! Set shape + void setShape(shapeType &shape); + + //! Get shape + const shapeType &getShape() const throw(sagguiException); + + private: + coord *position; + graphic *bitmap; + std::vector<rgba> *colors; + uint32_t *attributes; + shapeType *shape; + }; +} +#endif Copied: trunk/src/paintevent.cpp (from rev 461, trunk/src/key_events.cpp) =================================================================== --- trunk/src/paintevent.cpp (rev 0) +++ trunk/src/paintevent.cpp 2007-08-30 12:53:21 UTC (rev 467) @@ -0,0 +1,121 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "saggui/paintevent.h" +#include "saggui/graphics.h" +#include "saggui/coord.h" +#include "saggui/rgba.h" + +namespace saggui +{ + //init + paintEvent::paintEvent() : position(0), bitmap(0), colors(0), attributes(0), shape(0) + { + // Nothing + } + //de-init + paintEvent::~paintEvent() + { + // Nothing to be done + } + + // Set Position + void paintEvent::setPosition( coord &position) + { + this->position = &position; + } + + // Get Position + const coord &paintEvent::getPosition() const throw(sagguiException) + { + if(!position)throw sagguiException("coord (position) not set!"); + return *position; + } + + // Set Graphic + void paintEvent::setGraphic(graphic *bitmap) + { + this->bitmap = bitmap; + } + + // Get Graphic + graphic *paintEvent::getGraphic() throw(sagguiException) + { + if(!bitmap)throw sagguiException("graphic (bitmap) not set!"); + return bitmap; + } + + // Set colors + void paintEvent::setColors( std::vector<rgba> &colors) + { + this->colors = &colors; + } + + // Get colors + const std::vector<rgba> &paintEvent::getColors() const throw(sagguiException) + { + if(!colors)throw sagguiException("std::vector<rgba> (colors) not set!"); + return *colors; + } + + // Set attributes + void paintEvent::setAttributes( uint32_t &attributes) + { + this->attributes = &attributes; + } + + // Get attributes + const uint32_t &paintEvent::getAttributes() const throw(sagguiException) + { + if(!attributes)throw sagguiException("uint32_t (attributes) not set!"); + return *attributes; + } + + // Set shape + void paintEvent::setShape( shapeType &shape) + { + this->shape = &shape; + } + + // Get shape + const shapeType &paintEvent::getShape() const throw(sagguiException) + { + if(!shape)throw sagguiException("shapeType (shape) not set!"); + return *shape; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-29 13:13:38
|
Revision: 466 http://saggui.svn.sourceforge.net/saggui/?rev=466&view=rev Author: juvinious Date: 2007-08-29 06:13:34 -0700 (Wed, 29 Aug 2007) Log Message: ----------- Modified doxygen file Modified Paths: -------------- trunk/docs/Doxyfile Modified: trunk/docs/Doxyfile =================================================================== --- trunk/docs/Doxyfile 2007-08-27 05:54:00 UTC (rev 465) +++ trunk/docs/Doxyfile 2007-08-29 13:13:34 UTC (rev 466) @@ -96,7 +96,11 @@ modules/sdl/src \ modules/sdl/include \ modules/sdlgl/src \ - modules/sdlgl/include + modules/sdlgl/include \ + modules/sagguixml/src \ + modules/sagguixml/include \ + modules/profiler/src \ + modules/profiler/include FILE_PATTERNS = *.c \ *.cc \ *.cxx \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-26 12:05:00
|
Revision: 463 http://saggui.svn.sourceforge.net/saggui/?rev=463&view=rev Author: juvinious Date: 2007-08-26 03:53:51 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Some minor fixes and added the rest of the widget set to creationEngine Modified Paths: -------------- trunk/include/saggui/common.h trunk/include/saggui/creationengine.h trunk/modules/sagguixml/include/sagguixml.h trunk/modules/sagguixml/src/sagguixml.cpp trunk/src/creationengine.cpp trunk/src/widgets/label.cpp trunk/src/widgets/listbox.cpp Modified: trunk/include/saggui/common.h =================================================================== --- trunk/include/saggui/common.h 2007-08-26 07:56:51 UTC (rev 462) +++ trunk/include/saggui/common.h 2007-08-26 10:53:51 UTC (rev 463) @@ -300,6 +300,7 @@ * T_Editable - widget set editable if applicable \n * T_Off - widget off if applicable \n * T_On - widget on if applicable \n + * T_Color - color if applicable \n */ enum typeInfo { @@ -323,7 +324,8 @@ T_Modal, T_Editable, T_Off, - T_On + T_On, + T_Color }; } Modified: trunk/include/saggui/creationengine.h =================================================================== --- trunk/include/saggui/creationengine.h 2007-08-26 07:56:51 UTC (rev 462) +++ trunk/include/saggui/creationengine.h 2007-08-26 10:53:51 UTC (rev 463) @@ -59,7 +59,6 @@ { public: static const std::string BOX; - static const std::string BUTTONGROUP; static const std::string CHECKBOX; static const std::string DIALOG; static const std::string INPUTBOX; Modified: trunk/modules/sagguixml/include/sagguixml.h =================================================================== --- trunk/modules/sagguixml/include/sagguixml.h 2007-08-26 07:56:51 UTC (rev 462) +++ trunk/modules/sagguixml/include/sagguixml.h 2007-08-26 10:53:51 UTC (rev 463) @@ -70,14 +70,17 @@ //! Create windows from xml virtual void parseWindows(TiXmlElement *element, window *parent) throw (sagguiException); - - //! Do window specific things if required - virtual void windowExtra(TiXmlElement *element, window *win); protected: //! Document TiXmlDocument *doc; + //! Do windows children + virtual void children(TiXmlElement *element, window *parent); + + //! Specific to listbox + virtual void listbox(TiXmlElement *element, window *parent); + }; } Modified: trunk/modules/sagguixml/src/sagguixml.cpp =================================================================== --- trunk/modules/sagguixml/src/sagguixml.cpp 2007-08-26 07:56:51 UTC (rev 462) +++ trunk/modules/sagguixml/src/sagguixml.cpp 2007-08-26 10:53:51 UTC (rev 463) @@ -39,6 +39,7 @@ #include "sagguixml.h" #include "tinyxml.h" #include "window.h" +#include "widgets/listbox.h" namespace saggui { @@ -155,6 +156,10 @@ { temp.addInfo(T_On,element->Attribute("on")); } + if(element->Attribute("color")) + { + temp.addInfo(T_Color,element->Attribute("color")); + } } catch(const sagguiException &e) { @@ -166,27 +171,52 @@ if(!tempWin)throw sagguiException("Failed to load window: " + std::string(element->Value()) + "!"); - // Do other requirements for window - windowExtra(element, tempWin); + // Do specific child related elements + if(temp.getType() == windowMarkup::LISTBOX) + { + listbox(element, tempWin); + } + else + { + children(element, tempWin); + } - //parsing child elements + // Finally add this to the parent + if(parent)parent->addChild(tempWin); + } + + void xmlEngine::children(TiXmlElement *element, window *parent) + { TiXmlNode *child = element->FirstChild(); while(child != NULL) { TiXmlElement *elem = child->ToElement(); - parseWindows(elem,tempWin); - //child = doc->IterateChildren(child); + parseWindows(elem,parent); child = child->NextSibling(); } - - if(parent)parent->addChild(tempWin); } - - //! Do window specific things if required - void xmlEngine::windowExtra(TiXmlElement *element, window *win) + + void xmlEngine::listbox(TiXmlElement *element, window *parent) { - + TiXmlNode *child = element->FirstChild(); + listBox *temp = dynamic_cast<listBox *>(parent); + if(!temp)return; + bool hasItems = false; + while(child != NULL) + { + TiXmlElement *elem = child->ToElement(); + if(elem->Value() == std::string("li")) + { + if(!hasItems) + { + hasItems=true; + temp->clearItems(); + } + temp->addItem(elem->FirstChild()->Value()); + } + child = child->NextSibling(); + } } } Modified: trunk/src/creationengine.cpp =================================================================== --- trunk/src/creationengine.cpp 2007-08-26 07:56:51 UTC (rev 462) +++ trunk/src/creationengine.cpp 2007-08-26 10:53:51 UTC (rev 463) @@ -55,7 +55,6 @@ namespace saggui { const std::string windowMarkup::BOX = "box"; - const std::string windowMarkup::BUTTONGROUP = "buttongroup"; const std::string windowMarkup::CHECKBOX = "checkbox"; const std::string windowMarkup::DIALOG = "dialog"; const std::string windowMarkup::INPUTBOX = "inputbox"; @@ -67,6 +66,29 @@ const std::string windowMarkup::SCROLLBAR = "scrollbar"; const std::string windowMarkup::TEXTBOX = "textbox"; + rgba getColor(const std::string &color) + { + if(color == "black")return rgba::BLACK; + if(color == "white")return rgba::WHITE; + if(color == "darkgray")return rgba::DARKGRAY; + if(color == "gray")return rgba::GRAY; + if(color == "darkred")return rgba::DARKRED; + if(color == "red")return rgba::RED; + if(color == "darkblue")return rgba::DARKBLUE; + if(color == "blue")return rgba::BLUE; + if(color == "darkgreen")return rgba::DARKGREEN; + if(color == "green")return rgba::GREEN; + if(color == "darkyellow")return rgba::DARKYELLOW; + if(color == "yellow")return rgba::YELLOW; + if(color == "darkteal")return rgba::DARKTEAL; + if(color == "teal")return rgba::TEAL; + if(color == "darkpink")return rgba::DARKPINK; + if(color == "pink")return rgba::PINK; + if(color == "darkorange")return rgba::DARKORANGE; + if(color == "orange")return rgba::ORANGE; + return rgba(); + } + windowMarkup::windowMarkup(const std::string &type) { addInfo(T_Type, type); @@ -146,20 +168,32 @@ } try { - if(win.getType() == windowMarkup::BUTTONGROUP) - { - - } - } - catch(const sagguiException &e) - { - // Nothing - } - try - { if(win.getType() == windowMarkup::CHECKBOX) { - + temp = new checkBox(); + try + { + setWindowDefaults(temp,win); + try + { + checkBox *t = dynamic_cast<checkBox *>(temp); + if(t) + { + t->setEnabled(win.getBool(T_Checked)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -170,7 +204,17 @@ { if(win.getType() == windowMarkup::DIALOG) { - + temp = new dialog(); + try + { + setWindowDefaults(temp,win); + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -181,7 +225,30 @@ { if(win.getType() == windowMarkup::INPUTBOX) { - + temp = new inputBox(); + try + { + setWindowDefaults(temp,win); + try + { + inputBox *t = dynamic_cast<inputBox *>(temp); + if(t) + { + t->setText(win.getString(T_Text)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -192,7 +259,30 @@ { if(win.getType() == windowMarkup::LABEL) { - + temp = new label(); + try + { + setWindowDefaults(temp,win); + try + { + label *t = dynamic_cast<label *>(temp); + if(t) + { + t->setText(win.getString(T_Text)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -204,7 +294,19 @@ { if(win.getType() == windowMarkup::LISTBOX) { - + temp = new listBox(); + try + { + setWindowDefaults(temp,win); + listBox *t = dynamic_cast<listBox *>(temp); + if(t)t->addItem("EmptyList"); + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -216,7 +318,54 @@ { if(win.getType() == windowMarkup::PROGRESSBAR) { - + temp = new progressBar(); + try + { + setWindowDefaults(temp,win); + try + { + progressBar *t = dynamic_cast<progressBar *>(temp); + if(t) + { + t->setMax(win.getDouble(T_Max)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + progressBar *t = dynamic_cast<progressBar *>(temp); + if(t) + { + t->setProgress(win.getDouble(T_Index)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + progressBar *t = dynamic_cast<progressBar *>(temp); + if(t) + { + t->setColor(getColor(win.getString(T_Color))); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -228,7 +377,44 @@ { if(win.getType() == windowMarkup::PUSHBUTTON) { - + temp = new pushButton(); + try + { + setWindowDefaults(temp,win); + try + { + pushButton *t = dynamic_cast<pushButton *>(temp); + if(t) + { + graphic *bmp = resourceManager::createGraphic(); + bmp->loadBmp(win.getString(T_Image)); + t->setIcon(bmp); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + try + { + pushButton *t = dynamic_cast<pushButton *>(temp); + if(t) + { + t->setText(win.getString(T_Text)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -240,7 +426,30 @@ { if(win.getType() == windowMarkup::RADIAL) { - + temp = new radial(); + try + { + setWindowDefaults(temp,win); + try + { + radial *t = dynamic_cast<radial *>(temp); + if(t) + { + t->setEnabled(win.getBool(T_Checked)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -252,7 +461,42 @@ { if(win.getType() == windowMarkup::SCROLLBAR) { - + temp = new scrollBar(); + try + { + setWindowDefaults(temp,win); + try + { + scrollBar *t = dynamic_cast<scrollBar *>(temp); + if(t) + { + t->setMaxSize(win.getInt(T_Max)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + scrollBar *t = dynamic_cast<scrollBar *>(temp); + if(t) + { + t->setIndex(win.getInt(T_Index)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) @@ -263,7 +507,30 @@ { if(win.getType() == windowMarkup::TEXTBOX) { - + temp = new textBox(); + try + { + setWindowDefaults(temp,win); + try + { + textBox *t = dynamic_cast<textBox *>(temp); + if(t) + { + t->setText(win.getString(T_Text)); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } } } catch(const sagguiException &e) Modified: trunk/src/widgets/label.cpp =================================================================== --- trunk/src/widgets/label.cpp 2007-08-26 07:56:51 UTC (rev 462) +++ trunk/src/widgets/label.cpp 2007-08-26 10:53:51 UTC (rev 463) @@ -50,7 +50,8 @@ setFont(resourceManager::getFont()); textColor = rgba::BLACK; autoResizable = false; - hAlignment = vAlignment = MIDDLE; + hAlignment = LEFT; + vAlignment = MIDDLE; x1 = y1 =0; setAttribute(AT_Sunken, true); onPaint.connect(this,&label::draw); Modified: trunk/src/widgets/listbox.cpp =================================================================== --- trunk/src/widgets/listbox.cpp 2007-08-26 07:56:51 UTC (rev 462) +++ trunk/src/widgets/listbox.cpp 2007-08-26 10:53:51 UTC (rev 463) @@ -71,7 +71,7 @@ highlightedItem=0; } - listBox::~listBox() { } + listBox::~listBox() { clearItems(); } // Add item void listBox::addItem(const std::string &text) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-26 11:06:35
|
Revision: 462 http://saggui.svn.sourceforge.net/saggui/?rev=462&view=rev Author: juvinious Date: 2007-08-26 00:56:51 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Cleaned up creationengine and sagguixml, added sagguiexception Modified Paths: -------------- trunk/CHANGELOG trunk/cmake/saggui.h.in trunk/include/saggui/common.h trunk/include/saggui/creationengine.h trunk/modules/sagguixml/include/sagguixml.h trunk/modules/sagguixml/src/sagguixml.cpp trunk/src/creationengine.cpp Added Paths: ----------- trunk/include/saggui/sagguiexception.h trunk/src/sagguiexception.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-08-24 22:20:21 UTC (rev 461) +++ trunk/CHANGELOG 2007-08-26 07:56:51 UTC (rev 462) @@ -1,4 +1,5 @@ 0.50 +- Added in exception handler for saggui (sagguiException) - Added new class creationEngine to facilitate creating widgets via markup. Added an xml extension of that class. - Added new member to system,resourceManager and guiManager to accomodate not having to use guiManagers setResolution - Made several commentary updates throughout the source Modified: trunk/cmake/saggui.h.in =================================================================== --- trunk/cmake/saggui.h.in 2007-08-24 22:20:21 UTC (rev 461) +++ trunk/cmake/saggui.h.in 2007-08-26 07:56:51 UTC (rev 462) @@ -54,6 +54,7 @@ #include "saggui/bitmap_font.h" #include "saggui/common.h" #include "saggui/coord.h" +#include "saggui/creationengine.h" #include "saggui/debug.h" #include "saggui/style.h" #include "saggui/dllspec.h" @@ -74,6 +75,7 @@ #include "saggui/resource_manager.h" #include "saggui/rgba.h" #include "saggui/scheme.h" +#include "saggui/sagguiexception.h" #include "saggui/sigslot.h" #include "saggui/sprite.h" #include "saggui/system_factory.h" Modified: trunk/include/saggui/common.h =================================================================== --- trunk/include/saggui/common.h 2007-08-24 22:20:21 UTC (rev 461) +++ trunk/include/saggui/common.h 2007-08-26 07:56:51 UTC (rev 462) @@ -277,6 +277,54 @@ S_Rectangle, S_Triangle }; + + /*! \ref struct::typeInfo is a list for common widget data used in creationEngine:\n + * T_Type - widget type \n + * T_Id - widget Id name \n + * T_Text - widget text if applicable \n + * T_X - widget x coordinate \n + * T_Y - widget y coordinate \n + * T_Width - widget width \n + * T_Height - widget height \n + * T_Image - widget Image if applicable \n + * T_Min - widget minimal if applicable \n + * T_Max - widget maximum if applicable \n + * T_Index - widget set index if applicable \n + * T_Checked - widget checked if applicable \n + * T_Alignment - widget alignment if applicable \n + * T_DragState - widget dragState if applicable \n + * T_Enabled - widget set enabled if applicable \n + * T_Active - widget set active applicable \n + * T_Visible - widget set visible if applicable \n + * T_Modal - widget set modal if applicable \n + * T_Editable - widget set editable if applicable \n + * T_Off - widget off if applicable \n + * T_On - widget on if applicable \n + */ + enum typeInfo + { + T_Type = 0, + T_Id, + T_Text, + T_X, + T_Y, + T_Width, + T_Height, + T_Image, + T_Min, + T_Max, + T_Index, + T_Checked, + T_Alignment, + T_DragState, + T_Enabled, + T_Active, + T_Visible, + T_Modal, + T_Editable, + T_Off, + T_On + }; } #endif Modified: trunk/include/saggui/creationengine.h =================================================================== --- trunk/include/saggui/creationengine.h 2007-08-24 22:20:21 UTC (rev 461) +++ trunk/include/saggui/creationengine.h 2007-08-26 07:56:51 UTC (rev 462) @@ -41,8 +41,10 @@ #include <string> #include <map> -#include "sigslot.h" +#include <sstream> #include "dllspec.h" +#include "sagguiexception.h" +#include "common.h" //! Simplified All Gaming Graphical User Interface /*! @@ -52,6 +54,67 @@ { class window; + //! Class representing basic data of a widget + class SAGGUI_EXPORT windowMarkup + { + public: + static const std::string BOX; + static const std::string BUTTONGROUP; + static const std::string CHECKBOX; + static const std::string DIALOG; + static const std::string INPUTBOX; + static const std::string LABEL; + static const std::string LISTBOX; + static const std::string PROGRESSBAR; + static const std::string PUSHBUTTON; + static const std::string RADIAL; + static const std::string SCROLLBAR; + static const std::string TEXTBOX; + + //! ctor that sets the kind of widget that this represents + windowMarkup(const std::string &type); + ~windowMarkup(); + + inline const std::string getType() { return getString(T_Type); } + inline void addInfo(typeInfo type, const std::string &data){ markup[type] = data; } + inline const std::string getString(typeInfo type) throw (sagguiException) + { + std::map<typeInfo, std::string>::iterator temp = markup.find(type); + if(temp == markup.end())throw sagguiException("No item stored under that type!"); + return temp->second; + } + inline const int getInt(typeInfo type) throw (sagguiException) + { + std::map<typeInfo, std::string>::iterator temp = markup.find(type); + if(temp == markup.end())throw sagguiException("No item stored under that type!"); + std::istringstream is(temp->second); + int t; + is >> t; + return t; + } + inline const double getDouble(typeInfo type) throw (sagguiException) + { + std::map<typeInfo, std::string>::iterator temp = markup.find(type); + if(temp == markup.end())throw sagguiException("No item stored under that type!"); + std::istringstream is(temp->second); + double t; + is >> t; + return t; + } + inline const bool getBool(typeInfo type) throw (sagguiException) + { + std::map<typeInfo, std::string>::iterator temp = markup.find(type); + if(temp == markup.end())throw sagguiException("No item stored under that type!"); + std::istringstream is(temp->second); + bool t; + is >> t; + return t; + } + + private: + std::map<typeInfo, std::string> markup; + }; + //! The Base Creational Engine Class /*! * This is the Creational Engine class. This provides a means to @@ -70,27 +133,25 @@ virtual void load(const std::string &filename)=0; //! find - window *find(const std::string &name); + window *find(const std::string &id); - //! Get root window - window *getRootWindow(); + /*! Get a window according to a windowMarkup which automatically adds to the list of windows \n + * this is to allow the engine itself to add parameters or fill information about the widget \n + * that isn't covered by the common data in the markup + */ + window *createWindow(windowMarkup &win); protected: - //! Root window of entire engine - window *rootWindow; + //! Add a window to the list + void addWindow(const std::string &id, window *win); + + private: + //! Set windowDefaults defaults + void setWindowDefaults(window *win, windowMarkup &markup) throw(sagguiException); + //! Map of all widgets std::map<const std::string, window *> windows; - - /*! \ref creationEngine::typeInfo is a type list for windows and data:\n - * to store data - * TI_TYPE - widget type \n - */ - enum typeInfo - { - TI_TYPE = 0, - TI_TEXT - }; }; } Added: trunk/include/saggui/sagguiexception.h =================================================================== --- trunk/include/saggui/sagguiexception.h (rev 0) +++ trunk/include/saggui/sagguiexception.h 2007-08-26 07:56:51 UTC (rev 462) @@ -0,0 +1,63 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef SAGGUI_EXCEPTION_H +#define SAGGUI_EXCEPTION_H + +#include <exception> +#include <string> +#include "dllspec.h" + +namespace saggui +{ + class SAGGUI_EXPORT sagguiException : public std::exception + { + public: + sagguiException(); + sagguiException( const std::string & reason ); + + ~sagguiException() throw(); + + inline const std::string & getReason() const{ return reason; } + + protected: + std::string reason; + }; +} + +#endif Modified: trunk/modules/sagguixml/include/sagguixml.h =================================================================== --- trunk/modules/sagguixml/include/sagguixml.h 2007-08-24 22:20:21 UTC (rev 461) +++ trunk/modules/sagguixml/include/sagguixml.h 2007-08-26 07:56:51 UTC (rev 462) @@ -41,6 +41,11 @@ #include "saggui/creationengine.h" + +class TiXmlElement; +class TiXmlNode; +class TiXmlDocument; + //! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. @@ -61,7 +66,18 @@ virtual ~xmlEngine(); //! load data - virtual void load(const std::string &filename); + virtual void load(const std::string &filename) throw (sagguiException); + + //! Create windows from xml + virtual void parseWindows(TiXmlElement *element, window *parent) throw (sagguiException); + + //! Do window specific things if required + virtual void windowExtra(TiXmlElement *element, window *win); + + protected: + //! Document + TiXmlDocument *doc; + }; } Modified: trunk/modules/sagguixml/src/sagguixml.cpp =================================================================== --- trunk/modules/sagguixml/src/sagguixml.cpp 2007-08-24 22:20:21 UTC (rev 461) +++ trunk/modules/sagguixml/src/sagguixml.cpp 2007-08-26 07:56:51 UTC (rev 462) @@ -38,6 +38,7 @@ #include "sagguixml.h" #include "tinyxml.h" +#include "window.h" namespace saggui { @@ -52,9 +53,140 @@ } - void xmlEngine::load(const std::string &filename) + void xmlEngine::load(const std::string &filename) throw (sagguiException) { - // Bam TODO + TiXmlNode *node = 0; + doc = new TiXmlDocument(filename); + + if(!doc->LoadFile())throw sagguiException("Couldn't load file: " + filename); + + node = doc->FirstChild(); + if(!node)throw sagguiException("Document " + filename + " is empty or null!"); + + while(node != NULL) + { + parseWindows(node->ToElement(),0); + node = doc->IterateChildren(node); + } } + + void xmlEngine::parseWindows(TiXmlElement *element, window *parent) throw (sagguiException) + { + windowMarkup temp(element->Value()); + try + { + if(element->Attribute("id")) + { + temp.addInfo(T_Id,element->Attribute("id")); + } + if(element->Attribute("text")) + { + temp.addInfo(T_Text,element->Attribute("text")); + } + if(element->Attribute("x")) + { + temp.addInfo(T_X,element->Attribute("x")); + } + if(element->Attribute("y")) + { + temp.addInfo(T_Y,element->Attribute("y")); + } + if(element->Attribute("width")) + { + temp.addInfo(T_Width,element->Attribute("width")); + } + if(element->Attribute("height")) + { + temp.addInfo(T_Height,element->Attribute("height")); + } + if(element->Attribute("image")) + { + temp.addInfo(T_Image,element->Attribute("image")); + } + if(element->Attribute("min")) + { + temp.addInfo(T_Min,element->Attribute("min")); + } + if(element->Attribute("max")) + { + temp.addInfo(T_Max,element->Attribute("max")); + } + if(element->Attribute("index")) + { + temp.addInfo(T_Index,element->Attribute("index")); + } + if(element->Attribute("checked")) + { + temp.addInfo(T_Checked,element->Attribute("checked")); + } + if(element->Attribute("alignment")) + { + temp.addInfo(T_Alignment,element->Attribute("alignment")); + } + if(element->Attribute("dragstate")) + { + temp.addInfo(T_DragState,element->Attribute("dragstate")); + } + if(element->Attribute("enabled")) + { + temp.addInfo(T_Enabled,element->Attribute("enabled")); + } + if(element->Attribute("active")) + { + temp.addInfo(T_Active,element->Attribute("active")); + } + if(element->Attribute("visible")) + { + temp.addInfo(T_Visible,element->Attribute("visible")); + } + if(element->Attribute("modal")) + { + temp.addInfo(T_Modal,element->Attribute("modal")); + } + if(element->Attribute("Editable")) + { + temp.addInfo(T_Editable,element->Attribute("Editable")); + } + if(element->Attribute("off")) + { + temp.addInfo(T_Off,element->Attribute("off")); + } + if(element->Attribute("on")) + { + temp.addInfo(T_On,element->Attribute("on")); + } + } + catch(const sagguiException &e) + { + std::cout << "Problem: " + e.getReason() + "\n"; + + } + + window *tempWin = createWindow(temp); + + if(!tempWin)throw sagguiException("Failed to load window: " + std::string(element->Value()) + "!"); + + // Do other requirements for window + windowExtra(element, tempWin); + + //parsing child elements + TiXmlNode *child = element->FirstChild(); + + while(child != NULL) + { + TiXmlElement *elem = child->ToElement(); + parseWindows(elem,tempWin); + //child = doc->IterateChildren(child); + child = child->NextSibling(); + } + + if(parent)parent->addChild(tempWin); + } + + //! Do window specific things if required + void xmlEngine::windowExtra(TiXmlElement *element, window *win) + { + + } } Modified: trunk/src/creationengine.cpp =================================================================== --- trunk/src/creationengine.cpp 2007-08-24 22:20:21 UTC (rev 461) +++ trunk/src/creationengine.cpp 2007-08-26 07:56:51 UTC (rev 462) @@ -38,9 +38,44 @@ #include "saggui/creationengine.h" #include "saggui/window.h" +#include "saggui/resource_manager.h" +#include "saggui/widgets/box.h" +#include "saggui/widgets/buttongroup.h" +#include "saggui/widgets/checkbox.h" +#include "saggui/widgets/dialog.h" +#include "saggui/widgets/input_box.h" +#include "saggui/widgets/label.h" +#include "saggui/widgets/listbox.h" +#include "saggui/widgets/progress_bar.h" +#include "saggui/widgets/pushbutton.h" +#include "saggui/widgets/radial.h" +#include "saggui/widgets/scroll_bar.h" +#include "saggui/widgets/text_box.h" namespace saggui { + const std::string windowMarkup::BOX = "box"; + const std::string windowMarkup::BUTTONGROUP = "buttongroup"; + const std::string windowMarkup::CHECKBOX = "checkbox"; + const std::string windowMarkup::DIALOG = "dialog"; + const std::string windowMarkup::INPUTBOX = "inputbox"; + const std::string windowMarkup::LABEL = "label"; + const std::string windowMarkup::LISTBOX = "listbox"; + const std::string windowMarkup::PROGRESSBAR = "progressbar"; + const std::string windowMarkup::PUSHBUTTON = "pushbutton"; + const std::string windowMarkup::RADIAL = "radial"; + const std::string windowMarkup::SCROLLBAR = "scrollbar"; + const std::string windowMarkup::TEXTBOX = "textbox"; + + windowMarkup::windowMarkup(const std::string &type) + { + addInfo(T_Type, type); + } + windowMarkup::~windowMarkup() + { + // Nothing + } + // Constructor creationEngine::creationEngine() { @@ -52,14 +87,290 @@ } - window *creationEngine::find(const std::string &name) + window *creationEngine::find(const std::string &id) { - return windows.find(name)->second; + return windows.find(id)->second; } - window *creationEngine::getRootWindow() + window *creationEngine::createWindow(windowMarkup &win) { - return rootWindow; + window *temp = 0; + try + { + if(win.getType() == windowMarkup::BOX) + { + temp = new box(); + try + { + setWindowDefaults(temp,win); + try + { + box *t = dynamic_cast<box *>(temp); + if(t) + { + graphic *bmp = resourceManager::createGraphic(); + bmp->loadBmp(win.getString(T_Image)); + t->setBitmap(bmp); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + try + { + box *t = dynamic_cast<box *>(temp); + if(t) + { + t->setDrag(mouseDragStates(win.getInt(T_DragState))); + } + } + catch(const sagguiException &e) + { + // Nothing + } + + addWindow(win.getString(T_Id),temp); + } + catch(const sagguiException &e) + { + if(temp)delete temp; + temp = 0; + } + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + if(win.getType() == windowMarkup::BUTTONGROUP) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + if(win.getType() == windowMarkup::CHECKBOX) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + if(win.getType() == windowMarkup::DIALOG) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + if(win.getType() == windowMarkup::INPUTBOX) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + if(win.getType() == windowMarkup::LABEL) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + + try + { + if(win.getType() == windowMarkup::LISTBOX) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + + try + { + if(win.getType() == windowMarkup::PROGRESSBAR) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + + try + { + if(win.getType() == windowMarkup::PUSHBUTTON) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + + try + { + if(win.getType() == windowMarkup::RADIAL) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + + try + { + if(win.getType() == windowMarkup::SCROLLBAR) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + if(win.getType() == windowMarkup::TEXTBOX) + { + + } + } + catch(const sagguiException &e) + { + // Nothing + } + return temp; } + + // Add a window to the list + void creationEngine::addWindow(const std::string &id, window *win) + { + windows[id] = win; + } + + // Set windowDefaults defaults + void creationEngine::setWindowDefaults(window *win, windowMarkup &markup) throw(sagguiException) + { + if(!win)throw sagguiException("Window not created!"); + try + { + win->position.x = markup.getDouble(T_X); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->position.y = markup.getDouble(T_Y); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->position.width = markup.getDouble(T_Width); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->position.height = markup.getDouble(T_Height); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->setAttribute(AT_Enabled, markup.getBool(T_Enabled)); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->setAttribute(AT_Active, markup.getBool(T_Active)); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->setAttribute(AT_Visible, markup.getBool(T_Visible)); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->setAttribute(AT_Modal, markup.getBool(T_Modal)); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->setAttribute(AT_Editable, markup.getBool(T_Editable)); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->setAttribute(AT_Off, markup.getBool(T_Off)); + } + catch(const sagguiException &e) + { + // Nothing + } + try + { + win->setAttribute(AT_On, markup.getBool(T_On)); + } + catch(const sagguiException &e) + { + // Nothing + } + } } Copied: trunk/src/sagguiexception.cpp (from rev 461, trunk/src/creationengine.cpp) =================================================================== --- trunk/src/sagguiexception.cpp (rev 0) +++ trunk/src/sagguiexception.cpp 2007-08-26 07:56:51 UTC (rev 462) @@ -0,0 +1,57 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "saggui/sagguiexception.h" + +namespace saggui +{ + sagguiException::sagguiException() : std::exception() + { + } + + sagguiException::sagguiException( const std::string & reason ) : std::exception() + { + this->reason = reason; + } + + sagguiException::~sagguiException() throw() + { + } + +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-24 22:20:44
|
Revision: 461 http://saggui.svn.sourceforge.net/saggui/?rev=461&view=rev Author: juvinious Date: 2007-08-24 15:20:21 -0700 (Fri, 24 Aug 2007) Log Message: ----------- Updated changelog Modified Paths: -------------- trunk/CHANGELOG Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-08-24 22:19:22 UTC (rev 460) +++ trunk/CHANGELOG 2007-08-24 22:20:21 UTC (rev 461) @@ -1,4 +1,5 @@ 0.50 +- Added new class creationEngine to facilitate creating widgets via markup. Added an xml extension of that class. - Added new member to system,resourceManager and guiManager to accomodate not having to use guiManagers setResolution - Made several commentary updates throughout the source - Added a profiler module to run tests and debug the library This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-24 22:19:47
|
Revision: 460 http://saggui.svn.sourceforge.net/saggui/?rev=460&view=rev Author: juvinious Date: 2007-08-24 15:19:22 -0700 (Fri, 24 Aug 2007) Log Message: ----------- Modified creationEngine and fixed typo in comments in common.h Modified Paths: -------------- trunk/include/saggui/common.h trunk/include/saggui/creationengine.h Modified: trunk/include/saggui/common.h =================================================================== --- trunk/include/saggui/common.h 2007-08-24 21:23:12 UTC (rev 459) +++ trunk/include/saggui/common.h 2007-08-24 22:19:22 UTC (rev 460) @@ -48,7 +48,7 @@ /*! A common set of definitions used throughout SAGGUI which can be easily accessible */ //! \name WINDOW RELATED - /*! Set \ref window::windowType to one of the following:\n + /*! Set \ref winType to one of the following:\n * W_Basic - (default) A basic widget \n * W_PushButton - A button style type of widget \n * W_LineEdit - Input based widget \n Modified: trunk/include/saggui/creationengine.h =================================================================== --- trunk/include/saggui/creationengine.h 2007-08-24 21:23:12 UTC (rev 459) +++ trunk/include/saggui/creationengine.h 2007-08-24 22:19:22 UTC (rev 460) @@ -81,6 +81,16 @@ //! Map of all widgets std::map<const std::string, window *> windows; + + /*! \ref creationEngine::typeInfo is a type list for windows and data:\n + * to store data + * TI_TYPE - widget type \n + */ + enum typeInfo + { + TI_TYPE = 0, + TI_TEXT + }; }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-24 21:23:20
|
Revision: 459 http://saggui.svn.sourceforge.net/saggui/?rev=459&view=rev Author: juvinious Date: 2007-08-24 14:23:12 -0700 (Fri, 24 Aug 2007) Log Message: ----------- Added creational engine to support creating widgets from markup. Added in xml module made with tinyxml. Modified Paths: -------------- trunk/CMakeLists.txt Added Paths: ----------- trunk/include/saggui/creationengine.h trunk/modules/sagguixml/ trunk/modules/sagguixml/CMakeLists.txt trunk/modules/sagguixml/include/ trunk/modules/sagguixml/include/sagguixml.h trunk/modules/sagguixml/include/tinystr.h trunk/modules/sagguixml/include/tinyxml.h trunk/modules/sagguixml/saggui_xml.h trunk/modules/sagguixml/src/ trunk/modules/sagguixml/src/sagguixml.cpp trunk/modules/sagguixml/src/tinystr.cpp trunk/modules/sagguixml/src/tinyxml.cpp trunk/modules/sagguixml/src/tinyxmlerror.cpp trunk/modules/sagguixml/src/tinyxmlparser.cpp trunk/src/creationengine.cpp Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-08-20 20:52:54 UTC (rev 458) +++ trunk/CMakeLists.txt 2007-08-24 21:23:12 UTC (rev 459) @@ -261,6 +261,7 @@ endif(ENABLE_SDLGL) add_subdirectory(${CMAKE_SOURCE_DIR}/modules/profiler) +add_subdirectory(${CMAKE_SOURCE_DIR}/modules/sagguixml) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/demo) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/gamedemo) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/widgets) Copied: trunk/include/saggui/creationengine.h (from rev 458, trunk/include/saggui/font.h) =================================================================== --- trunk/include/saggui/creationengine.h (rev 0) +++ trunk/include/saggui/creationengine.h 2007-08-24 21:23:12 UTC (rev 459) @@ -0,0 +1,87 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CREATION_ENGINE_H +#define CREATION_ENGINE_H + +#include <string> +#include <map> +#include "sigslot.h" +#include "dllspec.h" + +//! Simplified All Gaming Graphical User Interface +/*! + This is the naming convention for this SAGGUI lib. +*/ +namespace saggui +{ + class window; + + //! The Base Creational Engine Class + /*! + * This is the Creational Engine class. This provides a means to + * create custom engine to build widgets by means of xml or some other context. + */ + class SAGGUI_EXPORT creationEngine + { + public: + //! constructor + creationEngine(); + + //! destructor + virtual ~creationEngine(); + + //! load data + virtual void load(const std::string &filename)=0; + + //! find + window *find(const std::string &name); + + //! Get root window + window *getRootWindow(); + + protected: + //! Root window of entire engine + window *rootWindow; + + //! Map of all widgets + std::map<const std::string, window *> windows; + }; +} + +#endif Copied: trunk/modules/sagguixml/CMakeLists.txt (from rev 458, trunk/modules/allegro/CMakeLists.txt) =================================================================== --- trunk/modules/sagguixml/CMakeLists.txt (rev 0) +++ trunk/modules/sagguixml/CMakeLists.txt 2007-08-24 21:23:12 UTC (rev 459) @@ -0,0 +1,28 @@ +# ------------------------------------------------------- +# SAGGUI cmake build script to create sagguixml module called from +# main build +# Written by: juvinious +# ------------------------------------------------------- + +include_directories(include) + +set(XML_SRC src/sagguixml.cpp src/tinystr.cpp src/tinyxml.cpp src/tinyxmlerror.cpp src/tinyxmlparser.cpp) + +add_library(saggui-xml ${CREATE_STATIC_LIB} ${XML_SRC}) +target_link_libraries(saggui-xml) + +file(GLOB HEADERS ${CMAKE_SOURCE_DIR}/modules/sagguixml/include/*.h) +foreach(f ${HEADERS}) + STRING(REGEX REPLACE ".*/" "" name1 ${f}) + configure_file(${f} ${CMAKE_BINARY_DIR}/include/saggui/xml/${name1} COPYONLY) +endforeach(f ${HEADERS}) +configure_file(saggui_xml.h ${CMAKE_BINARY_DIR}/include/saggui_xml.h COPYONLY) + +if(CMAKE_PATCH_VERSION EQUAL 3 OR CMAKE_PATCH_VERSION LESS 3) + file(GLOB HEADERS ${CMAKE_SOURCE_DIR}/modules/sagguixml/include/*.h) + install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/xml) +else(CMAKE_PATCH_VERSION EQUAL 3 OR CMAKE_PATCH_VERSION LESS 3) + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/saggui/xml PATTERN ".svn" EXCLUDE PATTERN "*~" EXCLUDE) +endif(CMAKE_PATCH_VERSION EQUAL 3 OR CMAKE_PATCH_VERSION LESS 3) +install(FILES saggui_xml.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include) +install(TARGETS saggui-xml DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) \ No newline at end of file Added: trunk/modules/sagguixml/include/sagguixml.h =================================================================== --- trunk/modules/sagguixml/include/sagguixml.h (rev 0) +++ trunk/modules/sagguixml/include/sagguixml.h 2007-08-24 21:23:12 UTC (rev 459) @@ -0,0 +1,68 @@ +/* +SAGGUI (Simplified All Gaming Graphical User Interface) +Copyright (c) 2005-2007, Miguel A. Gavidia +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + * Neither the name of the "SAGGUI" nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef XML_ENGINE_H +#define XML_ENGINE_H + +#include "saggui/creationengine.h" + +//! Simplified All Gaming Graphical User Interface +/*! + This is the naming convention for this SAGGUI lib. +*/ +namespace saggui +{ + //! The XML Creational Engine Class + /*! + * Create widgets utilizing XML. + */ + class SAGGUI_EXT_EXPORT xmlEngine : public creationEngine + { + public: + //! constructor + xmlEngine(); + + //! destructor + virtual ~xmlEngine(); + + //! load data + virtual void load(const std::string &filename); + }; +} + +#endif Added: trunk/modules/sagguixml/include/tinystr.h =================================================================== --- trunk/modules/sagguixml/include/tinystr.h (rev 0) +++ trunk/modules/sagguixml/include/tinystr.h 2007-08-24 21:23:12 UTC (rev 459) @@ -0,0 +1,319 @@ +/* +www.sourceforge.net/projects/tinyxml +Original file by Yves Berquin. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +/* + * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005. + * + * - completely rewritten. compact, clean, and fast implementation. + * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems) + * - fixed reserve() to work as per specification. + * - fixed buggy compares operator==(), operator<(), and operator>() + * - fixed operator+=() to take a const ref argument, following spec. + * - added "copy" constructor with length, and most compare operators. + * - added swap(), clear(), size(), capacity(), operator+(). + */ + +#ifndef TIXML_USE_STL + +#ifndef TIXML_STRING_INCLUDED +#define TIXML_STRING_INCLUDED + +#include <assert.h> +#include <string.h> + +/* The support for explicit isn't that universal, and it isn't really + required - it is used to check that the TiXmlString class isn't incorrectly + used. Be nice to old compilers and macro it here: +*/ +#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + #define TIXML_EXPLICIT explicit +#elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + #define TIXML_EXPLICIT explicit +#else + #define TIXML_EXPLICIT +#endif + + +/* + TiXmlString is an emulation of a subset of the std::string template. + Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. + Only the member functions relevant to the TinyXML project have been implemented. + The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase + a string and there's no more room, we allocate a buffer twice as big as we need. +*/ +class TiXmlString +{ + public : + // The size type used + typedef size_t size_type; + + // Error value for find primitive + static const size_type npos; // = -1; + + + // TiXmlString empty constructor + TiXmlString () : rep_(&nullrep_) + { + } + + // TiXmlString copy constructor + TiXmlString ( const TiXmlString & copy) : rep_(0) + { + init(copy.length()); + memcpy(start(), copy.data(), length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) + { + init( static_cast<size_type>( strlen(copy) )); + memcpy(start(), copy, length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) + { + init(len); + memcpy(start(), str, len); + } + + // TiXmlString destructor + ~TiXmlString () + { + quit(); + } + + // = operator + TiXmlString& operator = (const char * copy) + { + return assign( copy, (size_type)strlen(copy)); + } + + // = operator + TiXmlString& operator = (const TiXmlString & copy) + { + return assign(copy.start(), copy.length()); + } + + + // += operator. Maps to append + TiXmlString& operator += (const char * suffix) + { + return append(suffix, static_cast<size_type>( strlen(suffix) )); + } + + // += operator. Maps to append + TiXmlString& operator += (char single) + { + return append(&single, 1); + } + + // += operator. Maps to append + TiXmlString& operator += (const TiXmlString & suffix) + { + return append(suffix.data(), suffix.length()); + } + + + // Convert a TiXmlString into a null-terminated char * + const char * c_str () const { return rep_->str; } + + // Convert a TiXmlString into a char * (need not be null terminated). + const char * data () const { return rep_->str; } + + // Return the length of a TiXmlString + size_type length () const { return rep_->size; } + + // Alias for length() + size_type size () const { return rep_->size; } + + // Checks if a TiXmlString is empty + bool empty () const { return rep_->size == 0; } + + // Return capacity of string + size_type capacity () const { return rep_->capacity; } + + + // single char extraction + const char& at (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // [] operator + char& operator [] (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // find a char in a string. Return TiXmlString::npos if not found + size_type find (char lookup) const + { + return find(lookup, 0); + } + + // find a char in a string from an offset. Return TiXmlString::npos if not found + size_type find (char tofind, size_type offset) const + { + if (offset >= length()) return npos; + + for (const char* p = c_str() + offset; *p != '\0'; ++p) + { + if (*p == tofind) return static_cast< size_type >( p - c_str() ); + } + return npos; + } + + void clear () + { + //Lee: + //The original was just too strange, though correct: + // TiXmlString().swap(*this); + //Instead use the quit & re-init: + quit(); + init(0,0); + } + + /* Function to reserve a big amount of data when we know we'll need it. Be aware that this + function DOES NOT clear the content of the TiXmlString if any exists. + */ + void reserve (size_type cap); + + TiXmlString& assign (const char* str, size_type len); + + TiXmlString& append (const char* str, size_type len); + + void swap (TiXmlString& other) + { + Rep* r = rep_; + rep_ = other.rep_; + other.rep_ = r; + } + + private: + + void init(size_type sz) { init(sz, sz); } + void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } + char* start() const { return rep_->str; } + char* finish() const { return rep_->str + rep_->size; } + + struct Rep + { + size_type size, capacity; + char str[1]; + }; + + void init(size_type sz, size_type cap) + { + if (cap) + { + // Lee: the original form: + // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap)); + // doesn't work in some cases of new being overloaded. Switching + // to the normal allocation, although use an 'int' for systems + // that are overly picky about structure alignment. + const size_type bytesNeeded = sizeof(Rep) + cap; + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); + rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); + + rep_->str[ rep_->size = sz ] = '\0'; + rep_->capacity = cap; + } + else + { + rep_ = &nullrep_; + } + } + + void quit() + { + if (rep_ != &nullrep_) + { + // The rep_ is really an array of ints. (see the allocator, above). + // Cast it back before delete, so the compiler won't incorrectly call destructors. + delete [] ( reinterpret_cast<int*>( rep_ ) ); + } + } + + Rep * rep_; + static Rep nullrep_; + +} ; + + +inline bool operator == (const TiXmlString & a, const TiXmlString & b) +{ + return ( a.length() == b.length() ) // optimization on some platforms + && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare +} +inline bool operator < (const TiXmlString & a, const TiXmlString & b) +{ + return strcmp(a.c_str(), b.c_str()) < 0; +} + +inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } +inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } +inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } +inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } + +inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } +inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } +inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } +inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } + +TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); +TiXmlString operator + (const TiXmlString & a, const char* b); +TiXmlString operator + (const char* a, const TiXmlString & b); + + +/* + TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. + Only the operators that we need for TinyXML have been developped. +*/ +class TiXmlOutStream : public TiXmlString +{ +public : + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const TiXmlString & in) + { + *this += in; + return *this; + } + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const char * in) + { + *this += in; + return *this; + } + +} ; + +#endif // TIXML_STRING_INCLUDED +#endif // TIXML_USE_STL Added: trunk/modules/sagguixml/include/tinyxml.h =================================================================== --- trunk/modules/sagguixml/include/tinyxml.h (rev 0) +++ trunk/modules/sagguixml/include/tinyxml.h 2007-08-24 21:23:12 UTC (rev 459) @@ -0,0 +1,1804 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#ifndef TINYXML_INCLUDED +#define TINYXML_INCLUDED + +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4530 ) +#pragma warning( disable : 4786 ) +#endif + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#define TIXML_USE_STL + +// Help out windows: +#if defined( _DEBUG ) && !defined( DEBUG ) +#define DEBUG +#endif + +#ifdef TIXML_USE_STL + #include <string> + #include <iostream> + #include <sstream> + #define TIXML_STRING std::string +#else + #include "tinystr.h" + #define TIXML_STRING TiXmlString +#endif + +// Deprecated library function hell. Compilers want to use the +// new safe versions. This probably doesn't fully address the problem, +// but it gets closer. There are too many compilers for me to fully +// test. If you get compilation troubles, undefine TIXML_SAFE +#define TIXML_SAFE + +#ifdef TIXML_SAFE + #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + // Microsoft visual studio, version 2005 and higher. + #define TIXML_SNPRINTF _snprintf_s + #define TIXML_SNSCANF _snscanf_s + #define TIXML_SSCANF sscanf_s + #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + //#pragma message( "Using _sn* functions." ) + #define TIXML_SNPRINTF _snprintf + #define TIXML_SNSCANF _snscanf + #define TIXML_SSCANF sscanf + #elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + //#warning( "Using sn* functions." ) + #define TIXML_SNPRINTF snprintf + #define TIXML_SNSCANF snscanf + #define TIXML_SSCANF sscanf + #else + #define TIXML_SSCANF sscanf + #endif +#endif + +class TiXmlDocument; +class TiXmlElement; +class TiXmlComment; +class TiXmlUnknown; +class TiXmlAttribute; +class TiXmlText; +class TiXmlDeclaration; +class TiXmlParsingData; + +const int TIXML_MAJOR_VERSION = 2; +const int TIXML_MINOR_VERSION = 5; +const int TIXML_PATCH_VERSION = 3; + +/* Internal structure for tracking location of items + in the XML file. +*/ +struct TiXmlCursor +{ + TiXmlCursor() { Clear(); } + void Clear() { row = col = -1; } + + int row; // 0 based. + int col; // 0 based. +}; + + +/** + If you call the Accept() method, it requires being passed a TiXmlVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves + are simple called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, <b>no children of this node or its sibilings</b> will be Visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. + + You should never change the document from a callback. + + @sa TiXmlNode::Accept() +*/ +class TiXmlVisitor +{ +public: + virtual ~TiXmlVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } + /// Visit a document. + virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } + + /// Visit an element. + virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } + /// Visit an element. + virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } + + /// Visit a declaration + virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } + /// Visit a text node + virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } + /// Visit a comment node + virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } + /// Visit an unknow node + virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } +}; + +// Only used by Attribute::Query functions +enum +{ + TIXML_SUCCESS, + TIXML_NO_ATTRIBUTE, + TIXML_WRONG_TYPE +}; + + +// Used by the parsing routines. +enum TiXmlEncoding +{ + TIXML_ENCODING_UNKNOWN, + TIXML_ENCODING_UTF8, + TIXML_ENCODING_LEGACY +}; + +const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; + +/** TiXmlBase is a base class for every class in TinyXml. + It does little except to establish that TinyXml classes + can be printed and provide some utility functions. + + In XML, the document and elements can contain + other elements and other types of nodes. + + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) + + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) + + A Decleration contains: Attributes (not on tree) + @endverbatim +*/ +class TiXmlBase +{ + friend class TiXmlNode; + friend class TiXmlElement; + friend class TiXmlDocument; + +public: + TiXmlBase() : userData(0) {} + virtual ~TiXmlBase() {} + + /** All TinyXml classes can print themselves to a filestream + or the string class (TiXmlString in non-STL mode, std::string + in STL mode.) Either or both cfile and str can be null. + + This is a formatted print, and will insert + tabs and newlines. + + (For an unformatted stream, use the << operator.) + */ + virtual void Print( FILE* cfile, int depth ) const = 0; + + /** The world does not agree on whether white space should be kept or + not. In order to make everyone happy, these global, static functions + are provided to set whether or not TinyXml will condense all white space + into a single space or not. The default is to condense. Note changing this + value is not thread safe. + */ + static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } + + /// Return the current white space setting. + static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } + + /** Return the position, in the original source file, of this node or attribute. + The row and column are 1-based. (That is the first row and first column is + 1,1). If the returns values are 0 or less, then the parser does not have + a row and column value. + + Generally, the row and column value will be set when the TiXmlDocument::Load(), + TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set + when the DOM was created from operator>>. + + The values reflect the initial load. Once the DOM is modified programmatically + (by adding or changing nodes and attributes) the new values will NOT update to + reflect changes in the document. + + There is a minor performance cost to computing the row and column. Computation + can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. + + @sa TiXmlDocument::SetTabSize() + */ + int Row() const { return location.row + 1; } + int Column() const { return location.col + 1; } ///< See Row() + + void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. + void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. + const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. + + // Table that returs, for a given lead byte, the total number of bytes + // in the UTF-8 sequence. + static const int utf8ByteTable[256]; + + virtual const char* Parse( const char* p, + TiXmlParsingData* data, + TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; + + /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, + or they will be transformed into entities! + */ + static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); + + enum + { + TIXML_NO_ERROR = 0, + TIXML_ERROR, + TIXML_ERROR_OPENING_FILE, + TIXML_ERROR_OUT_OF_MEMORY, + TIXML_ERROR_PARSING_ELEMENT, + TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, + TIXML_ERROR_READING_ELEMENT_VALUE, + TIXML_ERROR_READING_ATTRIBUTES, + TIXML_ERROR_PARSING_EMPTY, + TIXML_ERROR_READING_END_TAG, + TIXML_ERROR_PARSING_UNKNOWN, + TIXML_ERROR_PARSING_COMMENT, + TIXML_ERROR_PARSING_DECLARATION, + TIXML_ERROR_DOCUMENT_EMPTY, + TIXML_ERROR_EMBEDDED_NULL, + TIXML_ERROR_PARSING_CDATA, + TIXML_ERROR_DOCUMENT_TOP_ONLY, + + TIXML_ERROR_STRING_COUNT + }; + +protected: + + static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + } + inline static bool IsWhiteSpace( int c ) + { + if ( c < 256 ) + return IsWhiteSpace( (char) c ); + return false; // Again, only truly correct for English/Latin...but usually works. + } + + #ifdef TIXML_USE_STL + static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); + static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); + #endif + + /* Reads an XML name into the string provided. Returns + a pointer just past the last character of the name, + or 0 if the function has an error. + */ + static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); + + /* Reads text. Returns a pointer past the given end tag. + Wickedly complex options, but it keeps the (sensitive) code in one place. + */ + static const char* ReadText( const char* in, // where to start + TIXML_STRING* text, // the string read + bool ignoreWhiteSpace, // whether to keep the white space + const char* endTag, // what ends this text + bool ignoreCase, // whether to ignore case in the end tag + TiXmlEncoding encoding ); // the current encoding + + // If an entity has been found, transform it into a character. + static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); + + // Get a character, while interpreting entities. + // The length can be from 0 to 4 bytes. + inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) + { + assert( p ); + if ( encoding == TIXML_ENCODING_UTF8 ) + { + *length = utf8ByteTable[ *((const unsigned char*)p) ]; + assert( *length >= 0 && *length < 5 ); + } + else + { + *length = 1; + } + + if ( *length == 1 ) + { + if ( *p == '&' ) + return GetEntity( p, _value, length, encoding ); + *_value = *p; + return p+1; + } + else if ( *length ) + { + //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), + // and the null terminator isn't needed + for( int i=0; p[i] && i<*length; ++i ) { + _value[i] = p[i]; + } + return p + (*length); + } + else + { + // Not valid text. + return 0; + } + } + + // Return true if the next characters in the stream are any of the endTag sequences. + // Ignore case only works for english, and should only be relied on when comparing + // to English words: StringEqual( p, "version", true ) is fine. + static bool StringEqual( const char* p, + const char* endTag, + bool ignoreCase, + TiXmlEncoding encoding ); + + static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; + + TiXmlCursor location; + + /// Field containing a generic user pointer + void* userData; + + // None of these methods are reliable for any language except English. + // Good for approximation, not great for accuracy. + static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); + static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); + inline static int ToLower( int v, TiXmlEncoding encoding ) + { + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( v < 128 ) return tolower( v ); + return v; + } + else + { + return tolower( v ); + } + } + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + +private: + TiXmlBase( const TiXmlBase& ); // not implemented. + void operator=( const TiXmlBase& base ); // not allowed. + + struct Entity + { + const char* str; + unsigned int strLength; + char chr; + }; + enum + { + NUM_ENTITY = 5, + MAX_ENTITY_LENGTH = 6 + + }; + static Entity entity[ NUM_ENTITY ]; + static bool condenseWhiteSpace; +}; + + +/** The parent class for everything in the Document Object Model. + (Except for attributes). + Nodes have siblings, a parent, and children. A node can be + in a document, or stand on its own. The type of a TiXmlNode + can be queried, and it can be cast to its more defined type. +*/ +class TiXmlNode : public TiXmlBase +{ + friend class TiXmlDocument; + friend class TiXmlElement; + +public: + #ifdef TIXML_USE_STL + + /** An input stream operator, for every class. Tolerant of newlines and + formatting, but doesn't expect them. + */ + friend std::istream& operator >> (std::istream& in, TiXmlNode& base); + + /** An output stream operator, for every class. Note that this outputs + without any newlines or formatting, as opposed to Print(), which + includes tabs and new lines. + + The operator<< and operator>> are not completely symmetric. Writing + a node to a stream is very well defined. You'll get a nice stream + of output, without any extra whitespace or newlines. + + But reading is not as well defined. (As it always is.) If you create + a TiXmlElement (for example) and read that from an input stream, + the text needs to define an element or junk will result. This is + true of all input streams, but it's worth keeping in mind. + + A TiXmlDocument will read nodes until it reads a root element, and + all the children of that root element. + */ + friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); + + /// Appends the XML node or attribute to a std::string. + friend std::string& operator<< (std::string& out, const TiXmlNode& base ); + + #endif + + /** The types of XML nodes supported by TinyXml. (All the + unsupported types are picked up by UNKNOWN.) + */ + enum NodeType + { + DOCUMENT, + ELEMENT, + COMMENT, + UNKNOWN, + TEXT, + DECLARATION, + TYPECOUNT + }; + + virtual ~TiXmlNode(); + + /** The meaning of 'value' changes for the specific type of + TiXmlNode. + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + + The subclasses will wrap this function. + */ + const char *Value() const { return value.c_str (); } + + #ifdef TIXML_USE_STL + /** Return Value() as a std::string. If you only use STL, + this is more efficient than calling Value(). + Only available in STL mode. + */ + const std::string& ValueStr() const { return value; } + #endif + + const TIXML_STRING& ValueTStr() const { return value; } + + /** Changes the value of the node. Defined as: + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + void SetValue(const char * _value) { value = _value;} + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Delete all the children of this node. Does not affect 'this'. + void Clear(); + + /// One step up the DOM. + TiXmlNode* Parent() { return parent; } + const TiXmlNode* Parent() const { return parent; } + + const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. + TiXmlNode* FirstChild() { return firstChild; } + const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. + /// The first child of this node with the matching 'value'. Will be null if none found. + TiXmlNode* FirstChild( const char * _value ) { + // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) + // call the method, cast the return back to non-const. + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); + } + const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. + TiXmlNode* LastChild() { return lastChild; } + + const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. + TiXmlNode* LastChild( const char * _value ) { + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. + #endif + + /** An alternate way to walk the children of a node. + One way to iterate over nodes is: + @verbatim + for( child = parent->FirstChild(); child; child = child->NextSibling() ) + @endverbatim + + IterateChildren does the same thing with the syntax: + @verbatim + child = 0; + while( child = parent->IterateChildren( child ) ) + @endverbatim + + IterateChildren takes the previous child as input and finds + the next one. If the previous child is null, it returns the + first. IterateChildren will return null when done. + */ + const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); + } + + /// This flavor of IterateChildren searches for children with a particular 'value' + const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + #endif + + /** Add a new node related to this. Adds a child past the LastChild. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); + + + /** Add a new node related to this. Adds a child past the LastChild. + + NOTE: the node to be added is passed by pointer, and will be + henceforth owned (and deleted) by tinyXml. This method is efficient + and avoids an extra copy, but should be used with care as it + uses a different memory model than the other insert functions. + + @sa InsertEndChild + */ + TiXmlNode* LinkEndChild( TiXmlNode* addThis ); + + /** Add a new node related to this. Adds a child before the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); + + /** Add a new node related to this. Adds a child after the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); + + /** Replace a child of this node. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); + + /// Delete a child of this node. + bool RemoveChild( TiXmlNode* removeThis ); + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling() const { return prev; } + TiXmlNode* PreviousSibling() { return prev; } + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling( const char * ) const; + TiXmlNode* PreviousSibling( const char *_prev ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Navigate to a sibling node. + const TiXmlNode* NextSibling() const { return next; } + TiXmlNode* NextSibling() { return next; } + + /// Navigate to a sibling node with the given 'value'. + const TiXmlNode* NextSibling( const char * ) const; + TiXmlNode* NextSibling( const char* _next ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement() const; + TiXmlElement* NextSiblingElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement( const char * ) const; + TiXmlElement* NextSiblingElement( const char *_next ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement() const; + TiXmlElement* FirstChildElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); + } + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement( const char * _value ) const; + TiXmlElement* FirstChildElement( const char * _value ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /** Query the type (as an enumerated value, above) of this node. + The possible types are: DOCUMENT, ELEMENT, COMMENT, + UNKNOWN, TEXT, and DECLARATION. + */ + int Type() const { return type; } + + /** Return a pointer to the Document this node lives in. + Returns null if not in a document. + */ + const TiXmlDocument* GetDocument() const; + TiXmlDocument* GetDocument() { + return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); + } + + /// Returns true if this node has no children. + bool NoChildren() const { return !firstChild; } + + virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + /** Create an exact duplicate of this node and return it. The memory must be deleted + by the caller. + */ + virtual TiXmlNode* Clone() const = 0; + + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. + + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( TiXmlVisitor* visitor ) const = 0; + +protected: + TiXmlNode( NodeType _type ); + + // Copy to the allocated object. Shared functionality between Clone, Copy constructor, + // and the assignment operator. + void CopyTo( TiXmlNode* target ) const; + + #ifdef TIXML_USE_STL + // The real work of the input operator. + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; + #endif + + // Figure out what is at *p, and parse it. Returns null if it is not an xml node. + TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); + + TiXmlNode* parent; + NodeType type; + + TiXmlNode* firstChild; + TiXmlNode* lastChild; + + TIXML_STRING value; + + TiXmlNode* prev; + TiXmlNode* next; + +private: + TiXmlNode( const TiXmlNode& ); // not implemented. + void operator=( const TiXmlNode& base ); // not allowed. +}; + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not TiXmlNodes, since they are not + part of the tinyXML document object model. There are other + suggested ways to look at this problem. +*/ +class TiXmlAttribute : public TiXmlBase +{ + friend class TiXmlAttributeSet; + +public: + /// Construct an empty attribute. + TiXmlAttribute() : TiXmlBase() + { + document = 0; + prev = next = 0; + } + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlAttribute( const std::string& _name, const std::string& _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + #endif + + /// Construct an attribute with a name and value. + TiXmlAttribute( const char * _name, const char * _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + + const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. + const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. + #ifdef TIXML_USE_STL + const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. + #endif + int IntValue() const; ///< Return the value of this attribute, converted to an integer. + double DoubleValue() const; ///< Return the value of this attribute, converted to a double. + + // Get the tinyxml string representation + const TIXML_STRING& NameTStr() const { return name; } + + /** QueryIntValue examines the value string. It is an alternative to the + IntValue() method with richer error checking. + If the value is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. + + A specialized but useful call. Note that for success it returns 0, + which is the opposite of almost all other TinyXml calls. + */ + int QueryIntValue( int* _value ) const; + /// QueryDoubleValue examines the value string. See QueryIntValue(). + int QueryDoubleValue( double* _value ) const; + + void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. + void SetValue( const char* _value ) { value = _value; } ///< Set the value. + + void SetIntValue( int _value ); ///< Set the value from an integer. + void SetDoubleValue( double _value ); ///< Set the value from a double. + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetName( const std::string& _name ) { name = _name; } + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Get the next sibling attribute in the DOM. Returns null at end. + const TiXmlAttribute* Next() const; + TiXmlAttribute* Next() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + } + + /// Get the previous sibling attribute in the DOM. Returns null at beginning. + const TiXmlAttribute* Previous() const; + TiXmlAttribute* Previous() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + } + + bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } + bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } + bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + + /* Attribute parsing starts: first letter of the name + returns: the next char after the value end quote + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + // Prints this Attribute to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } + void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + + // [internal use] + // Set the document pointer so the attribute can report errors. + void SetDocument( TiXmlDocument* doc ) { document = doc; } + +private: + TiXmlAttribute( const TiXmlAttribute& ); // not implemented. + void operator=( const TiXmlAttribute& base ); // not allowed. + + TiXmlDocument* document; // A pointer back to a document, for error reporting. + TIXML_STRING name; + TIXML_STRING value; + TiXmlAttribute* prev; + TiXmlAttribute* next; +}; + + +/* A class used to manage a group of attributes. + It is only used internally, both by the ELEMENT and the DECLARATION. + + The set can be changed transparent to the Element and Declaration + classes that use it, but NOT transparent to the Attribute + which has to implement a next() and previous() method. Which makes + it a bit problematic and prevents the use of STL. + + This version is implemented with circular lists because: + - I like circular lists + - it demonstrates some independence from the (typical) doubly linked list. +*/ +class TiXmlAttributeSet +{ +public: + TiXmlAttributeSet(); + ~TiXmlAttributeSet(); + + void Add( TiXmlAttribute* attribute ); + void Remove( TiXmlAttribute* attribute ); + + const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + + const TiXmlAttribute* Find( const char* _name ) const; + TiXmlAttribute* Find( const char* _name ) { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) ); + } + #ifdef TIXML_USE_STL + const TiXmlAttribute* Find( const std::string& _name ) const; + TiXmlAttribute* Find( const std::string& _name ) { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) ); + } + + #endif + +private: + //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), + //*ME: this class must be also use a hidden/disabled copy-constructor !!! + TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed + void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) + + TiXmlAttribute sentinel; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class TiXmlElement : public TiXmlNode +{ +public: + /// Construct an element. + TiXmlElement (const char * in_value); + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlElement( const std::string& _value ); + #endif + + TiXmlElement( const TiXmlElement& ); + + void operator=( const TiXmlElement& base ); + + virtual ~TiXmlElement(); + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + */ + const char* Attribute( const char* name ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an integer, + the integer value will be put in the return 'i', if 'i' + is non-null. + */ + const char* Attribute( const char* name, int* i ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an double, + the double value will be put in the return 'd', if 'd' + is non-null. + */ + const char* Attribute( const char* name, double* d ) const; + + /** QueryIntAttribute examines the attribute - it is an alternative to the + Attribute() method with richer error checking. + If the attribute is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. If the attribute + does not exist, then TIXML_NO_ATTRIBUTE is returned. + */ + int QueryIntAttribute( const char* name, int* _value ) const; + /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). + int QueryDoubleAttribute( const char* name, double* _value ) const; + /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). + int QueryFloatAttribute( const char* name, float* _value ) const { + double d; + int result = QueryDoubleAttribute( name, &d ); + if ( result == TIXML_SUCCESS ) { + *_value = (float)d; + } + return result; + } + + #ifdef TIXML_USE_STL + /** Template form of the attribute query which will try to read the + attribute into the specified type. Very easy, very powerful, but + be careful to make sure to call this with the correct type. + + NOTE: This method doesn't work correctly for 'string' types. + + @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE + */ + template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + + std::stringstream sstream( node->ValueStr() ); + sstream >> *outValue; + if ( !sstream.fail() ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; + } + /* + This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string" + but template specialization is hard to get working cross-compiler. Leaving the bug for now. + + // The above will fail for std::string because the space character is used as a seperator. + // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string + template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + *outValue = node->ValueStr(); + return TIXML_SUCCESS; + } + */ + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, const char * _value ); + + #ifdef TIXML_USE_STL + const std::string* Attribute( const std::string& name ) const; + const std::string* Attribute( const std::string& name, int* i ) const; + const std::string* Attribute( const std::string& name, double* d ) const; + int QueryIntAttribute( const std::string& name, int* _value ) const; + int QueryDoubleAttribute( const std::string& name, double* _value ) const; + + /// STL std::string form. + void SetAttribute( const std::string& name, const std::string& _value ); + ///< STL std::string form. + void SetAttribute( const std::string& name, int _value ); + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char * name, int value ); + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetDoubleAttribute( const char * name, double value ); + + /** Deletes an attribute with the given name. + */ + void RemoveAttribute( const char * name ); + #ifdef TIXML_USE_STL + void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. + #endif + + const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. + TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } + const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. + TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the TiXmlText child + and accessing it directly. + + If the first child of 'this' is a TiXmlText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + <foo>This is text</foo> + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + <foo><b>This is text</b></foo> + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + <foo>This is <b>text</b></foo> + @endverbatim + GetText() will return "This is ". + + WARNING: GetText() accesses a child node - don't become confused with the + similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are + safe type casts on the referenced node. + */ + const char* GetText() const; + + /// Creates a new Element and returns it - the returned element is a copy. + virtual TiXmlNode* Clone() const; + // Print the Element to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: next char past '<' + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXml... [truncated message content] |
From: <sag...@li...> - 2007-08-20 20:52:58
|
Revision: 458 http://saggui.svn.sourceforge.net/saggui/?rev=458&view=rev Author: juvinious Date: 2007-08-20 13:52:54 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Modified doxyfile, fixed scrollbar and polished style a bit Modified Paths: -------------- trunk/docs/Doxyfile trunk/src/style.cpp trunk/src/widgets/scroll_bar.cpp Modified: trunk/docs/Doxyfile =================================================================== --- trunk/docs/Doxyfile 2007-08-19 10:01:33 UTC (rev 457) +++ trunk/docs/Doxyfile 2007-08-20 20:52:54 UTC (rev 458) @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = "Simplified All Gaming Graphical User Interface (SAGGUI)" -PROJECT_NUMBER = +PROJECT_NUMBER = 0.50 OUTPUT_DIRECTORY = docs CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English Modified: trunk/src/style.cpp =================================================================== --- trunk/src/style.cpp 2007-08-19 10:01:33 UTC (rev 457) +++ trunk/src/style.cpp 2007-08-20 20:52:54 UTC (rev 458) @@ -107,8 +107,8 @@ bmp->doLine(size.x+size.width,size.y,size.x+size.width,size.y+size.height,colors[S_StandardFg]); if((flags & AT_MouseOver) && (flags && AT_Raised)) { - bmp->doLine(size.x,size.y,size.x + size.width,size.y,rgba::WHITE); - bmp->doLine(size.x,size.y+size.height,size.x + size.width,size.y+size.height,rgba::WHITE); + bmp->doLine(size.x,size.y,size.x + size.width, size.y,rgba::GRAY); + bmp->doLine(size.x,size.y+size.height,size.x + size.width,size.y+size.height,rgba::GRAY); } else { Modified: trunk/src/widgets/scroll_bar.cpp =================================================================== --- trunk/src/widgets/scroll_bar.cpp 2007-08-19 10:01:33 UTC (rev 457) +++ trunk/src/widgets/scroll_bar.cpp 2007-08-20 20:52:54 UTC (rev 458) @@ -60,7 +60,7 @@ pauseTime = 500; buttonDir = NONE; mouseLocation = NONE; - buttonIncrement = scrollAreaIncrement = scrollWheelIncrement = 0; + //buttonIncrement = scrollAreaIncrement = scrollWheelIncrement = 0; setType(AT_Horizontal); setStyle(BUTTONORIG); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-19 10:01:36
|
Revision: 457 http://saggui.svn.sourceforge.net/saggui/?rev=457&view=rev Author: juvinious Date: 2007-08-19 03:01:33 -0700 (Sun, 19 Aug 2007) Log Message: ----------- Added several new members to system, resourcemanager, and guimanager to setup system externally without relying on saggui. Updated accordingly. Modified Paths: -------------- trunk/CHANGELOG trunk/include/saggui/gui_manager.h trunk/include/saggui/resource_manager.h trunk/include/saggui/system.h trunk/include/saggui/widgets/abstractbutton.h trunk/modules/agl/include/agl_system.h trunk/modules/agl/src/agl_system.cpp trunk/modules/allegro/include/al_system.h trunk/modules/allegro/src/al_system.cpp trunk/modules/openlayer/include/ol_system.h trunk/modules/openlayer/src/ol_system.cpp trunk/modules/palib/include/saggui/pa_system.h trunk/modules/palib/saggui/pa_system.cpp trunk/modules/profiler/include/profilesystem.h trunk/modules/profiler/src/profilesystem.cpp trunk/modules/sdl/include/sdl_system.h trunk/modules/sdl/src/sdl_system.cpp trunk/modules/sdlgl/include/sdlgl_system.h trunk/modules/sdlgl/src/sdlgl_system.cpp trunk/src/gui_manager.cpp trunk/src/resource_manager.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/CHANGELOG 2007-08-19 10:01:33 UTC (rev 457) @@ -1,4 +1,5 @@ 0.50 +- Added new member to system,resourceManager and guiManager to accomodate not having to use guiManagers setResolution - Made several commentary updates throughout the source - Added a profiler module to run tests and debug the library - Fixed compilation issues with PALib, updated to the most recent version of PALib as of 07/28/07 Modified: trunk/include/saggui/gui_manager.h =================================================================== --- trunk/include/saggui/gui_manager.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/include/saggui/gui_manager.h 2007-08-19 10:01:33 UTC (rev 457) @@ -58,8 +58,8 @@ class mouseManager; class resourceManager; class scheme; - class style; - class coord; + class style; + class coord; class keys; //! The Gui Manager Class @@ -71,69 +71,79 @@ */ class SAGGUI_EXPORT guiManager : public has_slots<> { - private: - //! ID number management - int WINDOW_ID; + public: + //! \name Public Members - //! This contains pointers to each created window (Every window must register with the Manager) - std::list<window *>windows; + //! Setup + static void setup(const std::string & sys, bool systemInitCalls=true); - //! Temp delete list - std::list< std::list<window *>::iterator >windowDelete; + //! Set system screen + static void setScreen(void *s, bool bitmapBuffers=true); - //! These are the main windows that are at the upper echelon (parents) - std::vector<window *>parents; + //! Resolution + static bool setupScreen(double width, double height, double depth=32, bool fullscreen=false, bool bitmapBuffers=true); - //! Temp delete queue - std::list< std::vector<window *>::iterator >parentDelete; + //! Add window + static void addWindow(window *w); - //! This points to the main bitmap buffer - graphic *dest; + //! Remove window + static void removeWindow(window *w); - //! Resource Manager - resourceManager *resources; + //! Fix window relationship + static void fixWindow(window *w); - //! Temp window holder to place currentWindowFocused in case the manager is disabled - window *tempWindowFocused; + //! Update + static void update(); - //! Current focused window - window *currentWindowFocused; + //! draw windows + static void renderWindows(); - //! Last focused window - window *lastWindowFocused; + //! Toggle if the system is active + static void toggleActive(); - //! Is guiManager initialized - bool initialized; + //! Get the current graphic bitmap + static graphic *getSystemBuffer(); + + //! Get the current set screen + static graphic *getScreen(); + + //! Set the current scheme + static void setScheme(scheme *s); + + //! Add a scheme + static void addScheme(scheme *s); + + //! Get the current default scheme + static scheme *getCurrentScheme(); - //! Is the system graphics loaded - bool systemGraphicsLoaded; + //! Get scheme list + static std::vector<scheme *> &getSchemes(); + + //! Set to use bitmap buffering if possible + static bool useBuffering(bool buffering=true); - //! window queue - bool newWindows; + //! Set the mouse clicking system ie left clicks or right clicks + static void setClickSystem(mouseButtons type= M_Left); - //! Is guiManager active - bool active; + //! Raises a window to the top + static void raiseWindowTop(window *w); - //! Viewport restriction - bool viewportRestrict; + //! Set window focused + static void setWindowFocused(window *w); - //! Prepare window for deletion - void addWindowForDeletion(window *w); - - //! Set window focus and trigger events - void setFocus(window *w); - - //! Raises window or its parent to the top of the vector - void raiseWindow(window *w); - - //! Recursive logic for windows and their children - void doWindowLogic(std::vector<window *>&winList); - - //! Recursive drawing for windows and their children - void doWindowRender(std::vector<window *>&winList, graphic *bmp); - - //! Assign style to a window - void assignWindowStyle(window *w); + //! Prevent windows from going outside viewport + static void restrictViewport(bool vp); + + // Remove later + static int getMouseOverWinIDWM(); + static std::string getMouseButtonInfoWM(); + + //! \name Signals + static signal0<> onResolutionChange; + static signal1<mouseButtons> switchClickSystem; + static signal0<> onUpdate; + static signal1<graphic *> drawUnderWindows; + static signal1<graphic *> drawOverWindows; protected: @@ -146,6 +156,9 @@ //! Destructor ~guiManager(); + //! Set screen + void setSystemScreen(void *s, bool bitmapBuffers); + //! Set resolution bool setResolution(double width, double height, double depth=32, bool fullscreen=false, bool bitmapBuffers=true); @@ -186,77 +199,69 @@ //! \name Keyboard Slots slot keyPress(const keys &k); slot keyRelease(const keys &k); + private: + //! ID number management + int WINDOW_ID; - public: - //! \name Public Members + //! This contains pointers to each created window (Every window must register with the Manager) + std::list<window *>windows; - //! Setup - static void setup(const std::string & sys, bool systemInitCalls=true); + //! Temp delete list + std::list< std::list<window *>::iterator >windowDelete; - //! Resolution - static bool setupScreen(double width, double height, double depth=32, bool fullscreen=false, bool bitmapBuffers=true); + //! These are the main windows that are at the upper echelon (parents) + std::vector<window *>parents; - //! Add window - static void addWindow(window *w); + //! Temp delete queue + std::list< std::vector<window *>::iterator >parentDelete; - //! Remove window - static void removeWindow(window *w); + //! This points to the main bitmap buffer + graphic *dest; - //! Fix window relationship - static void fixWindow(window *w); + //! Resource Manager + resourceManager *resources; - //! Update - static void update(); + //! Temp window holder to place currentWindowFocused in case the manager is disabled + window *tempWindowFocused; - //! draw windows - static void renderWindows(); + //! Current focused window + window *currentWindowFocused; - //! Toggle if the system is active - static void toggleActive(); + //! Last focused window + window *lastWindowFocused; - //! Get the current graphic bitmap - static graphic *getSystemBuffer(); - - //! Get the current set screen - static graphic *getScreen(); - - //! Set the current scheme - static void setScheme(scheme *s); - - //! Add a scheme - static void addScheme(scheme *s); - - //! Get the current default scheme - static scheme *getCurrentScheme(); + //! Is guiManager initialized + bool initialized; - //! Get scheme list - static std::vector<scheme *> &getSchemes(); - - //! Set to use bitmap buffering if possible - static bool useBuffering(bool buffering=true); + //! Is the system graphics loaded + bool systemGraphicsLoaded; - //! Set the mouse clicking system ie left clicks or right clicks - static void setClickSystem(mouseButtons type= M_Left); + //! window queue + bool newWindows; - //! Raises a window to the top - static void raiseWindowTop(window *w); + //! Is guiManager active + bool active; - //! Set window focused - static void setWindowFocused(window *w); + //! Viewport restriction + bool viewportRestrict; - //! Prevent windows from going outside viewport - static void restrictViewport(bool vp); - - // Remove later - static int getMouseOverWinIDWM(); - static std::string getMouseButtonInfoWM(); - - //! \name Signals - static signal0<> onResolutionChange; - static signal1<mouseButtons> switchClickSystem; - static signal0<> onUpdate; - static signal1<graphic *> drawUnderWindows; - static signal1<graphic *> drawOverWindows; + //! Prepare window for deletion + void addWindowForDeletion(window *w); + + //! Set window focus and trigger events + void setFocus(window *w); + + //! Raises window or its parent to the top of the vector + void raiseWindow(window *w); + + //! Recursive logic for windows and their children + void doWindowLogic(std::vector<window *>&winList); + + //! Recursive drawing for windows and their children + void doWindowRender(std::vector<window *>&winList, graphic *bmp); + + //! Assign style to a window + void assignWindowStyle(window *w); }; } Modified: trunk/include/saggui/resource_manager.h =================================================================== --- trunk/include/saggui/resource_manager.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/include/saggui/resource_manager.h 2007-08-19 10:01:33 UTC (rev 457) @@ -97,6 +97,9 @@ //! Setup the system bool setSystem(std::string sys, bool systemInitCalls=true); + //! Set system screen + void setSystemScreen(void *s); + //! Set screen resolution bool setScreen(double width, double height, double depth, bool fullscreen); Modified: trunk/include/saggui/system.h =================================================================== --- trunk/include/saggui/system.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/include/saggui/system.h 2007-08-19 10:01:33 UTC (rev 457) @@ -76,6 +76,10 @@ /*! Provides the means to which a library can set the Screen Resolution */ virtual bool setResolution(double width, double height, double depth=32, bool fullscreen=false)=0; + //! Set the screen of the actual system + /*! This is so that you can handle resolution calls yourself if you don't want saggui to do it for you */ + virtual void setSystemScreen(void *s)=0; + /*! Is this system capable of bitmap buffers? */ virtual bool canUseBitmapBuffers()=0; Modified: trunk/include/saggui/widgets/abstractbutton.h =================================================================== --- trunk/include/saggui/widgets/abstractbutton.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/include/saggui/widgets/abstractbutton.h 2007-08-19 10:01:33 UTC (rev 457) @@ -138,7 +138,7 @@ signal1<const coord &> pressed; signal1<const coord &> released; signal1<const coord &> clicked; - signal0<> toggled; + signal1<const bool> toggled; protected: //! Current set font Modified: trunk/modules/agl/include/agl_system.h =================================================================== --- trunk/modules/agl/include/agl_system.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/agl/include/agl_system.h 2007-08-19 10:01:33 UTC (rev 457) @@ -78,6 +78,8 @@ //! Can use bitmap buffers bool canUseBitmapBuffers(); + void setSystemScreen(void *s); + //! Return screen Buffer graphic *getScreen(); }; Modified: trunk/modules/agl/src/agl_system.cpp =================================================================== --- trunk/modules/agl/src/agl_system.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/agl/src/agl_system.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -109,6 +109,16 @@ return true; //return false; } + + + void aglSystem::setSystemScreen(void *s) + { + if(!aglScreen) + { + aglScreen = new allegroGraphic(); + } + setScreen(aglScreen,screen); + } //! Return screen Buffer graphic *aglSystem::getScreen() Modified: trunk/modules/allegro/include/al_system.h =================================================================== --- trunk/modules/allegro/include/al_system.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/allegro/include/al_system.h 2007-08-19 10:01:33 UTC (rev 457) @@ -65,7 +65,7 @@ //! Constructor allegroSystem(); //! Destructor - ~allegroSystem(); + virtual ~allegroSystem(); //! Initialize the system bool setup(); @@ -79,6 +79,8 @@ //! Can use bitmap buffers bool canUseBitmapBuffers(); + void setSystemScreen(void *s); + //! Return screen Buffer graphic *getScreen(); }; Modified: trunk/modules/allegro/src/al_system.cpp =================================================================== --- trunk/modules/allegro/src/al_system.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/allegro/src/al_system.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -99,6 +99,16 @@ return true; } + //! Set system screen + void allegroSystem::setSystemScreen(void *s) + { + if(!allegroScreen) + { + allegroScreen = new allegroGraphic(); + } + setScreen(allegroScreen,screen); + } + //! Can use bitmap buffers bool allegroSystem::canUseBitmapBuffers() { Modified: trunk/modules/openlayer/include/ol_system.h =================================================================== --- trunk/modules/openlayer/include/ol_system.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/openlayer/include/ol_system.h 2007-08-19 10:01:33 UTC (rev 457) @@ -79,6 +79,9 @@ //! Can use bitmap buffers bool canUseBitmapBuffers(); + + void setSystemScreen(void *s); + //! Return screen Buffer graphic *getScreen(); }; Modified: trunk/modules/openlayer/src/ol_system.cpp =================================================================== --- trunk/modules/openlayer/src/ol_system.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/openlayer/src/ol_system.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -100,6 +100,15 @@ return( true ); } + void olSystem::setSystemScreen(void *s) + { + if(!olScreen) + { + olScreen = new olGraphic(); + setScreen(olScreen,0); + } + } + //! Can use bitmap buffers bool olSystem::canUseBitmapBuffers() { Modified: trunk/modules/palib/include/saggui/pa_system.h =================================================================== --- trunk/modules/palib/include/saggui/pa_system.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/palib/include/saggui/pa_system.h 2007-08-19 10:01:33 UTC (rev 457) @@ -71,6 +71,8 @@ //! Set screen resolution and color depth bool setResolution(double width, double height, double depth=32, bool fullscreen=false); + void setSystemScreen(void *s); + //! Can use bitmap buffers bool canUseBitmapBuffers(); Modified: trunk/modules/palib/saggui/pa_system.cpp =================================================================== --- trunk/modules/palib/saggui/pa_system.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/palib/saggui/pa_system.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -101,6 +101,17 @@ return true; } + void paSystem::setSystemScreen(void *s) + { + if(!paScreen) + { + paScreen = new paGraphic(); + paScreen->width = 255; + paScreen->height = 191; + } + setScreen(paScreen,s); + } + //! Can use bitmap buffers bool paSystem::canUseBitmapBuffers() { Modified: trunk/modules/profiler/include/profilesystem.h =================================================================== --- trunk/modules/profiler/include/profilesystem.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/profiler/include/profilesystem.h 2007-08-19 10:01:33 UTC (rev 457) @@ -71,6 +71,8 @@ //! Set screen resolution and color depth bool setResolution(double width, double height, double depth=32, bool fullscreen=false); + void setSystemScreen(void *s); + //! Can use bitmap buffers bool canUseBitmapBuffers(); Modified: trunk/modules/profiler/src/profilesystem.cpp =================================================================== --- trunk/modules/profiler/src/profilesystem.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/profiler/src/profilesystem.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -74,6 +74,11 @@ { return true; } + + void profileSystem::setSystemScreen(void *s) + { + s = s; + } //! Can use bitmap buffers bool profileSystem::canUseBitmapBuffers() Modified: trunk/modules/sdl/include/sdl_system.h =================================================================== --- trunk/modules/sdl/include/sdl_system.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/sdl/include/sdl_system.h 2007-08-19 10:01:33 UTC (rev 457) @@ -72,6 +72,8 @@ //! Set screen resolution and color depth bool setResolution(double width, double height, double depth=32, bool fullscreen=false); + void setSystemScreen(void *s); + //! Can use bitmap buffers bool canUseBitmapBuffers(); Modified: trunk/modules/sdl/src/sdl_system.cpp =================================================================== --- trunk/modules/sdl/src/sdl_system.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/sdl/src/sdl_system.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -44,7 +44,7 @@ namespace saggui { static graphic *sdlScreen=0; - bool sdlSystem::isScreenSetup = false; + bool sdlSystem::isScreenSetup=false; //init sdlSystem::sdlSystem() @@ -96,6 +96,13 @@ return true; } + void sdlSystem::setSystemScreen(void *s) + { + if(!sdlScreen)sdlScreen = new sdlGraphic(); + setScreen(sdlScreen, s); + isScreenSetup = true; + } + //! Can use bitmap buffers bool sdlSystem::canUseBitmapBuffers() { Modified: trunk/modules/sdlgl/include/sdlgl_system.h =================================================================== --- trunk/modules/sdlgl/include/sdlgl_system.h 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/sdlgl/include/sdlgl_system.h 2007-08-19 10:01:33 UTC (rev 457) @@ -71,6 +71,8 @@ //! Set screen resolution and color depth bool setResolution(double width, double height, double depth=32, bool fullscreen=false); + void setSystemScreen(void *s); + //! Can use bitmap buffers bool canUseBitmapBuffers(); Modified: trunk/modules/sdlgl/src/sdlgl_system.cpp =================================================================== --- trunk/modules/sdlgl/src/sdlgl_system.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/modules/sdlgl/src/sdlgl_system.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -107,6 +107,13 @@ return true; } + + void sdlglSystem::setSystemScreen(void *s) + { + if(!sdlglScreen)sdlglScreen = new sdlglGraphic(); + setScreen(sdlglScreen,s); + } + //! Can use bitmap buffers bool sdlglSystem::canUseBitmapBuffers() { Modified: trunk/src/gui_manager.cpp =================================================================== --- trunk/src/gui_manager.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/src/gui_manager.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -305,6 +305,20 @@ } } + //! Set screen + void guiManager::setSystemScreen(void *s, bool bitmapBuffers) + { + resources->setSystemScreen(s); + + enableBuffering(bitmapBuffers); + + if(!systemGraphicsLoaded) + { + mouseManager::loadDefaultImages(); + systemGraphicsLoaded = true; + } + } + // Set resolution bool guiManager::setResolution(double width, double height, double depth, bool fullscreen, bool bitmapBuffers) { @@ -706,6 +720,13 @@ } } + // Set system screen + void guiManager::setScreen(void *s, bool bitmapBuffers) + { + if(!windowManager)return; + windowManager->setSystemScreen(s, bitmapBuffers); + } + // resolution bool guiManager::setupScreen(double width, double height, double depth, bool fullscreen, bool bitmapBuffers) { Modified: trunk/src/resource_manager.cpp =================================================================== --- trunk/src/resource_manager.cpp 2007-08-17 00:07:10 UTC (rev 456) +++ trunk/src/resource_manager.cpp 2007-08-19 10:01:33 UTC (rev 457) @@ -177,8 +177,20 @@ reInitGraphics(); initialized=true; + + // Load system font + registerFont<bmpFont>(); + return true; } + + void resourceManager::setSystemScreen(void *s) + { + systemManager->setSystemScreen(s); + screenWidth = systemManager->getScreen()->getBmpWidth(); + screenHeight = systemManager->getScreen()->getBmpHeight(); + reInitGraphics(); + } // Set resolution bool resourceManager::setScreen(double width, double height, double depth, bool fullscreen) @@ -190,11 +202,6 @@ reInitGraphics(); screenWidth = width; screenHeight = height; - if(temp) - { - // Load system font - registerFont<bmpFont>(); - } return temp; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |