saggui-svn Mailing List for Simplified All Gaming GUI (Page 2)
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...> - 2007-08-17 00:07:12
|
Revision: 456 http://saggui.svn.sourceforge.net/saggui/?rev=456&view=rev Author: juvinious Date: 2007-08-16 17:07:10 -0700 (Thu, 16 Aug 2007) Log Message: ----------- Fixed some memory leaks and optimized a tad bit Modified Paths: -------------- trunk/CMakeLists.txt trunk/include/saggui/widgets/listbox.h trunk/src/bitmap_font.cpp trunk/src/scheme.cpp trunk/src/widgets/listbox.cpp trunk/src/widgets/scroll_bar.cpp Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-08-16 22:20:24 UTC (rev 455) +++ trunk/CMakeLists.txt 2007-08-17 00:07:10 UTC (rev 456) @@ -76,12 +76,22 @@ # ------------------------------------------------------- option(CREATE_STATIC_LIB "Make the library static?" on) +option(HAVE_DEBUG "Make an unoptimized build of saggui?" off) + option(ENABLE_FREETYPE_FONTS "Enables freetype font support" on) if(NOT MSVC) - set(CXXFLAGS "-O2 -Wall -funroll-loops -fexpensive-optimizations -Woverloaded-virtual -Werror") + if(HAVE_DEBUG) + set(CXXFLAGS "-Wall") + else(HAVE_DEBUG) + set(CXXFLAGS "-O2 -Wall -funroll-loops -fexpensive-optimizations -Woverloaded-virtual -Werror") + endif(HAVE_DEBUG) else(NOT MSVC) - set(CXXFLAGS "-O2") + if(HAVE_DEBUG) + set(CXXFLAGS "") + else(HAVE_DEBUG) + set(CXXFLAGS "-O2") + endif(HAVE_DEBUG) endif(NOT MSVC) add_definitions(${CXXFLAGS}) Modified: trunk/include/saggui/widgets/listbox.h =================================================================== --- trunk/include/saggui/widgets/listbox.h 2007-08-16 22:20:24 UTC (rev 455) +++ trunk/include/saggui/widgets/listbox.h 2007-08-17 00:07:10 UTC (rev 456) @@ -115,7 +115,7 @@ //! Popup for selectable list box popUp; - scrollBar sideBar; + //scrollBar sideBar; }; } Modified: trunk/src/bitmap_font.cpp =================================================================== --- trunk/src/bitmap_font.cpp 2007-08-16 22:20:24 UTC (rev 455) +++ trunk/src/bitmap_font.cpp 2007-08-17 00:07:10 UTC (rev 456) @@ -129,6 +129,7 @@ if(instances>0)instances--; if(instances==0)resourceManager::destroyGraphic(unknownGlyph); if(loadedFromFile)resourceManager::destroyGraphic(currentFont); + glyphs.clear(); } //! Create glyph map Modified: trunk/src/scheme.cpp =================================================================== --- trunk/src/scheme.cpp 2007-08-16 22:20:24 UTC (rev 455) +++ trunk/src/scheme.cpp 2007-08-17 00:07:10 UTC (rev 456) @@ -89,7 +89,9 @@ } scheme::~scheme() { - + colors.clear(); + styles.clear(); + shapes.clear(); } //! Set translucency to the entire scheme Modified: trunk/src/widgets/listbox.cpp =================================================================== --- trunk/src/widgets/listbox.cpp 2007-08-16 22:20:24 UTC (rev 455) +++ trunk/src/widgets/listbox.cpp 2007-08-17 00:07:10 UTC (rev 456) @@ -60,12 +60,12 @@ showListButton.clicked.connect(this,&listBox::showPopUp); showListButton.onPaint.connect(this,&listBox::drawOnButton); - popUp.addChild(&sideBar); + //popUp.addChild(&sideBar); popUp.setAttribute(AT_Visible | AT_Enabled, false); popUp.onLostFocus.connect(this,&listBox::hidePopUp); popUp.onKeyPress.connect(this,&listBox::keyPress); - sideBar.setAttribute(AT_Visible | AT_Enabled, false); + //sideBar.setAttribute(AT_Visible | AT_Enabled, false); currentItem=-1; highlightedItem=0; Modified: trunk/src/widgets/scroll_bar.cpp =================================================================== --- trunk/src/widgets/scroll_bar.cpp 2007-08-16 22:20:24 UTC (rev 455) +++ trunk/src/widgets/scroll_bar.cpp 2007-08-17 00:07:10 UTC (rev 456) @@ -45,20 +45,26 @@ { scrollBar::scrollBar() : mouseEvents(this), keyEvents(this) { - setType(AT_Horizontal); - setStyle(BUTTONORIG); index = 0; + style = 0; buttonSize = 0; buttonIncrement = 1; + scrollArea = 0; + scrollAreaTop = 0; + scrollAreaBottom = 0; scrollAreaIncrement = 5; scrollWheelIncrement = 5; - setMaxSize(0); + maxSize = 0; mouseDown = false; clickPaused = false; pauseTime = 500; buttonDir = NONE; mouseLocation = NONE; + buttonIncrement = scrollAreaIncrement = scrollWheelIncrement = 0; + setType(AT_Horizontal); + setStyle(BUTTONORIG); + setAttribute(AT_Filled, true); onScrollWheelUp.connect(this,&scrollBar::scrollWheelUp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-08-16 22:20:30
|
Revision: 455 http://saggui.svn.sourceforge.net/saggui/?rev=455&view=rev Author: juvinious Date: 2007-08-16 15:20:24 -0700 (Thu, 16 Aug 2007) Log Message: ----------- Fixed profiler and added it to build with the example apps Modified Paths: -------------- trunk/CHANGELOG trunk/CMakeLists.txt trunk/examples/demo/CMakeLists.txt trunk/examples/demo/include/test_classes.h trunk/examples/demo/src/allegro.cpp trunk/examples/demo/src/allegrogl.cpp trunk/examples/demo/src/openlayer.cpp trunk/examples/demo/src/sdl.cpp trunk/examples/demo/src/sdlgl.cpp trunk/examples/demo/src/test_classes.cpp trunk/examples/gamedemo/CMakeLists.txt trunk/examples/gamedemo/include/gamedemo.h 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/sdl.cpp trunk/examples/gamedemo/src/sdlgl.cpp trunk/examples/widgets/CMakeLists.txt trunk/examples/widgets/include/widgets.h trunk/examples/widgets/src/allegro.cpp trunk/examples/widgets/src/allegrogl.cpp trunk/examples/widgets/src/openlayer.cpp trunk/examples/widgets/src/sdl.cpp trunk/examples/widgets/src/sdlgl.cpp trunk/examples/widgets/src/widgets.cpp trunk/include/saggui/animation.h trunk/include/saggui/bitmap_font.h trunk/include/saggui/common.h trunk/include/saggui/coord.h trunk/include/saggui/debug.h trunk/include/saggui/dllspec.h trunk/include/saggui/font.h trunk/include/saggui/font_base.h trunk/include/saggui/font_manager.h trunk/include/saggui/graphic_manager.h trunk/include/saggui/graphics.h trunk/include/saggui/gui_manager.h trunk/include/saggui/key_events.h trunk/include/saggui/keyinput.h trunk/include/saggui/keyinput_manager.h trunk/include/saggui/keys.h trunk/include/saggui/library_factory.h trunk/include/saggui/mouse.h trunk/include/saggui/mouse_events.h trunk/include/saggui/mouse_manager.h trunk/include/saggui/resource_manager.h trunk/include/saggui/rgba.h trunk/include/saggui/scheme.h trunk/include/saggui/schemes/defaultscheme.h trunk/include/saggui/sigslot.h trunk/include/saggui/sprite.h trunk/include/saggui/style.h trunk/include/saggui/system.h trunk/include/saggui/system_factory.h trunk/include/saggui/timer.h trunk/include/saggui/widgets/abstractbutton.h trunk/include/saggui/widgets/box.h trunk/include/saggui/widgets/button.h trunk/include/saggui/widgets/buttongroup.h trunk/include/saggui/widgets/checkbox.h trunk/include/saggui/widgets/dialog.h trunk/include/saggui/widgets/input_box.h trunk/include/saggui/widgets/label.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/include/saggui/window.h trunk/modules/agl/include/agl_factory.h trunk/modules/agl/include/agl_gfx.h trunk/modules/agl/include/agl_system.h trunk/modules/agl/saggui_agl.h trunk/modules/agl/src/agl_factory.cpp trunk/modules/agl/src/agl_gfx.cpp trunk/modules/agl/src/agl_system.cpp trunk/modules/allegro/include/al_factory.h trunk/modules/allegro/include/al_font.h trunk/modules/allegro/include/al_gfx.h trunk/modules/allegro/include/al_keyinput.h trunk/modules/allegro/include/al_mouse.h trunk/modules/allegro/include/al_system.h trunk/modules/allegro/saggui_alleg.h trunk/modules/allegro/src/al_factory.cpp trunk/modules/allegro/src/al_font.cpp trunk/modules/allegro/src/al_gfx.cpp trunk/modules/allegro/src/al_keyinput.cpp trunk/modules/allegro/src/al_mouse.cpp trunk/modules/allegro/src/al_system.cpp trunk/modules/freetype/include/ft_default.h trunk/modules/freetype/include/ft_font.h trunk/modules/freetype/saggui_freetype.h trunk/modules/freetype/src/ft_font.cpp trunk/modules/opengl/include/opengl_gfx.h trunk/modules/opengl/src/opengl_gfx.cpp trunk/modules/openlayer/include/ol_factory.h trunk/modules/openlayer/include/ol_font.h trunk/modules/openlayer/include/ol_gfx.h trunk/modules/openlayer/include/ol_system.h trunk/modules/openlayer/saggui_ol.h trunk/modules/openlayer/src/ol_factory.cpp trunk/modules/openlayer/src/ol_font.cpp trunk/modules/openlayer/src/ol_gfx.cpp trunk/modules/openlayer/src/ol_system.cpp trunk/modules/palib/include/saggui/custom_timer.h trunk/modules/palib/include/saggui/pa_factory.h trunk/modules/palib/include/saggui/pa_font.h trunk/modules/palib/include/saggui/pa_gfx.h trunk/modules/palib/include/saggui/pa_keyinput.h trunk/modules/palib/include/saggui/pa_mouse.h trunk/modules/palib/include/saggui/pa_system.h trunk/modules/palib/include/saggui/saggui.h trunk/modules/palib/saggui/pa_factory.cpp trunk/modules/palib/saggui/pa_font.cpp trunk/modules/palib/saggui/pa_gfx.cpp trunk/modules/palib/saggui/pa_keyinput.cpp trunk/modules/palib/saggui/pa_mouse.cpp trunk/modules/palib/saggui/pa_system.cpp trunk/modules/profiler/CMakeLists.txt trunk/modules/sdl/include/sdl_factory.h trunk/modules/sdl/include/sdl_gfx.h trunk/modules/sdl/include/sdl_keyinput.h trunk/modules/sdl/include/sdl_mouse.h trunk/modules/sdl/include/sdl_system.h trunk/modules/sdl/saggui_sdl.h trunk/modules/sdl/src/sdl_factory.cpp trunk/modules/sdl/src/sdl_gfx.cpp trunk/modules/sdl/src/sdl_keyinput.cpp trunk/modules/sdl/src/sdl_mouse.cpp trunk/modules/sdl/src/sdl_system.cpp trunk/modules/sdlgl/include/sdlgl_factory.h trunk/modules/sdlgl/include/sdlgl_gfx.h trunk/modules/sdlgl/include/sdlgl_system.h trunk/modules/sdlgl/saggui_sdlgl.h trunk/modules/sdlgl/src/sdlgl_factory.cpp trunk/modules/sdlgl/src/sdlgl_gfx.cpp trunk/modules/sdlgl/src/sdlgl_system.cpp trunk/src/animation.cpp trunk/src/bitmap_font.cpp trunk/src/coord.cpp trunk/src/font.cpp trunk/src/font_base.cpp trunk/src/font_manager.cpp trunk/src/graphic_manager.cpp trunk/src/graphics.cpp trunk/src/gui_manager.cpp trunk/src/key_events.cpp trunk/src/keyinput.cpp trunk/src/keyinput_manager.cpp trunk/src/keys.cpp trunk/src/library_factory.cpp trunk/src/mouse.cpp trunk/src/mouse_events.cpp trunk/src/mouse_manager.cpp trunk/src/resource_manager.cpp trunk/src/rgba.cpp trunk/src/scheme.cpp trunk/src/schemes/defaultscheme.cpp trunk/src/style.cpp trunk/src/system.cpp trunk/src/system_factory.cpp trunk/src/timer.cpp trunk/src/widgets/abstractbutton.cpp trunk/src/widgets/box.cpp trunk/src/widgets/button.cpp trunk/src/widgets/buttongroup.cpp trunk/src/widgets/checkbox.cpp trunk/src/widgets/dialog.cpp trunk/src/widgets/input_box.cpp trunk/src/widgets/label.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 trunk/src/window.cpp trunk/utils/bmpdump/bmpdump-alleg.cpp trunk/utils/bmpdump/bmpdump-sdl.cpp Added Paths: ----------- trunk/examples/demo/src/profiler.cpp trunk/examples/gamedemo/src/profiler.cpp trunk/examples/widgets/src/profiler.cpp trunk/modules/profiler/include/profilefactory.h trunk/modules/profiler/include/profilefont.h trunk/modules/profiler/include/profilegfx.h trunk/modules/profiler/include/profilekeyinput.h trunk/modules/profiler/include/profilemouse.h trunk/modules/profiler/include/profilesystem.h trunk/modules/profiler/saggui_profiler.h trunk/modules/profiler/src/profilefactory.cpp trunk/modules/profiler/src/profilefont.cpp trunk/modules/profiler/src/profilegfx.cpp trunk/modules/profiler/src/profilekeyinput.cpp trunk/modules/profiler/src/profilemouse.cpp trunk/modules/profiler/src/profilesystem.cpp Removed Paths: ------------- trunk/modules/profiler/include/al_factory.h trunk/modules/profiler/include/al_font.h trunk/modules/profiler/include/al_gfx.h trunk/modules/profiler/include/al_keyinput.h trunk/modules/profiler/include/al_mouse.h trunk/modules/profiler/include/al_system.h trunk/modules/profiler/saggui_alleg.h trunk/modules/profiler/src/al_factory.cpp trunk/modules/profiler/src/al_font.cpp trunk/modules/profiler/src/al_gfx.cpp trunk/modules/profiler/src/al_keyinput.cpp trunk/modules/profiler/src/al_mouse.cpp trunk/modules/profiler/src/al_system.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/CHANGELOG 2007-08-16 22:20:24 UTC (rev 455) @@ -1,4 +1,6 @@ -0.48 +0.50 +- 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 - Moved all dependent widgets and examples from button to pushButton - Deprecated button so that pushButton can be used in its place Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/CMakeLists.txt 2007-08-16 22:20:24 UTC (rev 455) @@ -250,6 +250,7 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/modules/sdlgl) endif(ENABLE_SDLGL) +add_subdirectory(${CMAKE_SOURCE_DIR}/modules/profiler) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/demo) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/gamedemo) add_subdirectory(${CMAKE_SOURCE_DIR}/examples/widgets) Modified: trunk/examples/demo/CMakeLists.txt =================================================================== --- trunk/examples/demo/CMakeLists.txt 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/demo/CMakeLists.txt 2007-08-16 22:20:24 UTC (rev 455) @@ -70,4 +70,9 @@ add_executable(demo-sdlgl src/sdlgl.cpp ${DEMO_SRC}) target_link_libraries(demo-sdlgl ${FONT_LIBS} saggui-sdlgl saggui-sdl saggui) add_dependencies(demo-sdlgl saggui-sdlgl saggui-sdl saggui ${FONT_LIBS}) -endif(ENABLE_SDLGL) \ No newline at end of file +endif(ENABLE_SDLGL) + +# Profiler +add_executable(demo-profiler src/profiler.cpp ${DEMO_SRC}) +target_link_libraries(demo-profiler ${FONT_LIBS} saggui-profiler saggui) +add_dependencies(demo-profiler saggui-profiler saggui ${FONT_LIBS}) \ No newline at end of file Modified: trunk/examples/demo/include/test_classes.h =================================================================== --- trunk/examples/demo/include/test_classes.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/demo/include/test_classes.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/demo/src/allegro.cpp =================================================================== --- trunk/examples/demo/src/allegro.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/demo/src/allegro.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/demo/src/allegrogl.cpp =================================================================== --- trunk/examples/demo/src/allegrogl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/demo/src/allegrogl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/demo/src/openlayer.cpp =================================================================== --- trunk/examples/demo/src/openlayer.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/demo/src/openlayer.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Copied: trunk/examples/demo/src/profiler.cpp (from rev 453, trunk/examples/demo/src/sdl.cpp) =================================================================== --- trunk/examples/demo/src/profiler.cpp (rev 0) +++ trunk/examples/demo/src/profiler.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -0,0 +1,399 @@ +/* +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 MAIN_CPP +#define MAIN_CPP + +#include <iostream> +#include <vector> +#include <string> +#include "saggui.h" +#include "saggui_profiler.h" +#ifdef INCLUDE_FREETYPE +#include "saggui_freetype.h" +#endif +#include "debug.h" +#include "test_classes.h" + +using namespace saggui; + +static keys currentKey; + +class signalFuncs : public has_slots<> +{ + public: + void getKey(const keys &k) + { + currentKey = k; + } + + void screenChanged() + { + std::cout << "Resolution Changed.\n"; + } +}; + +class newBox : public dialog +{ + public: + + textBox text; + void resize() + { + text.position.set(leftPadding,topPadding,position.width-(leftPadding+rightPadding),position.height-(topPadding+bottomPadding)); + } + + newBox() + { + addChild(&text); + onResize.connect(this,&newBox::resize); + } + ~newBox() + { + } +}; + +int main(int argc, char *argv[]) +{ + resourceManager::registerBackend<PROFILER_SAGGUI>(); +#ifdef INCLUDE_FREETYPE + resourceManager::registerFont<freetype>(); +#endif + // Sets up the SAGGUI with the specified library + guiManager::setup("profiler"); + + // Create a timer to regulate the logic loop + guiTimer timer, fpsTimer; + int fps=0,fpsCounter =0; + + testDecorator decor(200,200); + + // Some Variables + int reso_x = 640,reso_y = 480; + int fontSizeW = 18; + int fontSizeH = 12; + int opacity=255; + bool fullscreen = false; + bool buffered = true; + rgba blackCol(0,0,0,0); + rgba whiteCol(255,255,255,255); + bool quit = false; + + // Set the resolution of the demo + if(!guiManager::setupScreen(reso_x,reso_y,32,fullscreen, buffered)) + { + std::cout << "Couldn't create display\n"; + return 1; + } + + // Connect to the resolution change to exemplify the useage + signalFuncs f; + guiManager::onResolutionChange.connect(&f, &signalFuncs::screenChanged); + + // Create a test font as an example + bool fontLoaded = true; + saggui::font *testFont = new saggui::font("freetype"); + if(!testFont->load("data/comic.ttf")) + { + delete testFont; + testFont = resourceManager::getFont(); + fontLoaded = false; + } + + //Create some windows + win window1,window3;//, window3, window4; + + newBox tBox; + + inputBox test; + test.position.set(10,400,200,20); + test.setHorizontalAlign(inputBox::T_Left); + //test.setAutoResize(true); + test.setText("I'm an input box"); + + // Scroll bar + scrollBar sbar1, sbar2; + + sbar1.setType(AT_Horizontal); + sbar1.position.set(15,300,450,15); + sbar1.setStyle(scrollBar::BUTTONORIG); + sbar1.setMaxSize(150); + + sbar2.setType(AT_Vertical); + sbar2.position.set(450,50,15,250); + sbar2.setStyle(scrollBar::BUTTONORIG); + sbar2.setMaxSize(150); + + // Create background noise + lines bgLines[5] = {lines(reso_x,reso_y),lines(reso_x,reso_y),lines(reso_x,reso_y),lines(reso_x,reso_y),lines(reso_x,reso_y)}; + + for(int i=0;i<5;++i) + { + guiManager::onUpdate.connect(&bgLines[i],&lines::update); + guiManager::drawUnderWindows.connect(&bgLines[i],&lines::draw); + } + + // connect keyInput + keyInputManager::pressed.connect(&f,&signalFuncs::getKey); + + // Permanent windows + window1.position.set(20,20,250,250); + + tBox.position.set(100,80,250,250); + tBox.text.setText("\\#FF0000C\\end\\#0000FFo\\end\\#00C000l\\end\\#FFFF00o\\end\\#A0A0A0r\\end\\#C05800e\\end\\#00FFFFd\\end \\#FF0000Text\\end using tags! Everyone knows that dragons don't exist. But while this simplistic formulation may satisfy the layman, it does not suffice for the scientific mind. The School of Higher Neantical Nillity is in fact wholly unconcerned with what does exist. Indeed, the banality of existence has been so amply demonstrated, there is no need for us to discuss it any further here. The brilliant Cerebron, attacking the problem analytically, discovered three distinct kinds of dragon: the mythical, the chimerical, and the purely hypothetical. They were all, one might say, nonexistent, but each nonexisted in an entirely different way."); + //tBox.setWordWrap(false); + + // Button tester + pushButton myButton; + myButton.setText("Press me!"); + myButton.position.setPosition(400,400); + + radial myRadial; + myRadial.position.set(15,360,15,15); + + label radialLabel; + radialLabel.setAutoResize(true); + radialLabel.setText("<-Radial Button"); + radialLabel.position.setPosition(35,358); + + checkBox myCheckbox; + myCheckbox.position.set(15,380,15,15); + + label cbLabel; + cbLabel.setAutoResize(true); + cbLabel.setText("<-checkbox Button"); + cbLabel.position.setPosition(35,378); + + testProgress progress1; + testProgress progress2; + testProgress progress3; + testProgress progress4; + testProgress progress5; + testProgress progress6; + testProgress progress7; + progress1.position.set(10,150,100,20); + progress2.position.set(10,175,100,20); + progress3.position.set(100,10,20,100); + progress4.position.set(125,10,20,100); + progress5.position.set(10,200,100,20); + progress6.position.set(150,10,20,100); + progress7.position.set(10,430,200,20); + progress1.setProgress(75.0); + progress2.setProgress(75.0); + progress3.setProgress(75.0); + progress4.setProgress(75.0); + progress1.setStyle(progressBar::TOP); + progress2.setStyle(progressBar::BOTTOM); + progress3.setStyle(progressBar::TOP); + progress4.setStyle(progressBar::BOTTOM); + progress5.setStyle(progressBar::MIDDLE); + progress6.setStyle(progressBar::MIDDLE); + progress7.setStyle(progressBar::BOTTOM); + progress3.setType(progressBar::VERTICAL); + progress4.setType(progressBar::VERTICAL); + progress6.setType(progressBar::VERTICAL); + + progress1.setColor(rgba::GREEN); + progress2.setColor(rgba::YELLOW); + progress5.setColor(rgba::BLUE); + progress3.setColor(rgba::GREEN); + progress4.setColor(rgba::YELLOW); + progress6.setColor(rgba::BLUE); + progress7.setColor(rgba::RED); + + window1.addChild(&progress1); + window1.addChild(&progress2); + window1.addChild(&progress3); + window1.addChild(&progress4); + window1.addChild(&progress5); + window1.addChild(&progress6); + + window3.position.set(77,67,150,150); + window1.addChild(&window3); + window3.onMove.connect(&window3, &win::moving); + + dialog dialogTest; + dialogTest.position.set(200,200,200,200); + + //Temporary windows + std::vector<window *>windows; + + // 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)) + { + guiManager::toggleActive(); + } + if((keyInputManager::keyState(keys::ALT)&&keyInputManager::keyState(keys::ENTER))) + { + if(fullscreen)fullscreen=false; + else fullscreen = true; + guiManager::setupScreen(reso_x,reso_y,32,fullscreen); + } + + if(keyInputManager::keyState(keys::UP)) + { + if(opacity<255)++opacity; + //guiManager::getScheme().setTranslucency(opacity); + whiteCol.alpha = opacity; + } + if(keyInputManager::keyState(keys::DOWN)) + { + if(opacity>0)--opacity; + //guiManager::getScheme().setTranslucency(opacity); + whiteCol.alpha = opacity; + } + if(keyInputManager::keyState(keys::LEFT,true)) + { + if(fontSizeW>0) + { + --fontSizeW; + --fontSizeH; + } + if(fontLoaded)testFont->setSize(fontSizeW,fontSizeH); + resourceManager::getFont()->setSize(fontSizeW,fontSizeH); + } + if(keyInputManager::keyState(keys::RIGHT,true)) + { + if(fontSizeW<50) + { + ++fontSizeW; + ++fontSizeH; + } + if(fontLoaded)testFont->setSize(fontSizeW,fontSizeH); + resourceManager::getFont()->setSize(fontSizeW,fontSizeH); + } + if(keyInputManager::keyState(keys::NUM_2,true)) + { + window *temp = new win(); + temp->position.set(rand()%400,rand()%300,200,200); + windows.push_back(temp); + guiManager::addWindow(temp); + if(rand()%2)temp->setStyle(&decor); + } + if(keyInputManager::keyState(keys::NUM_3,true)) + { + if(windows.size()>0) + { + window *temp = windows.back(); + guiManager::removeWindow(temp); + windows.pop_back(); + delete temp; + } + } + if(keyInputManager::keyState(keys::NUM_4,true)) + { + buffered = guiManager::useBuffering(!buffered); + } + + guiManager::update(); + + //for(int i=0;i<5;++i){bgLines[i].update();} + + timer.reset(); + } + + if(draw) + { + if(fpsTimer.secs()<=1)fpsCounter++; + (guiManager::getSystemBuffer())->clearBmp(blackCol); + + //for(int i=0;i<5;++i){bgLines[i].draw(guiManager::getSystemBuffer());} + + 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,398,whiteCol,guiManager::getSystemBuffer(),1,"FPS:%d",fps); + testFont->render(320,412,whiteCol,guiManager::getSystemBuffer(),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(640,240,whiteCol,guiManager::getSystemBuffer(),2,"Testing right aligned"); + + guiManager::renderWindows(); + + + } + + if(fpsTimer.secs()>=1) + { + fpsTimer.reset(); + fps=fpsCounter; + fpsCounter=0; + } + while((timer.msecs())==0)timer.sleep(1); + + } + + // Remove temporary windows + for(std::vector<window *>::iterator i = windows.begin();i!=windows.end();++i) + { + window * loopWindow = (*i); + guiManager::removeWindow(loopWindow); + delete (loopWindow); + } + windows.clear(); + + if(fontLoaded)delete testFont; + + return 0; +} + +#endif Modified: trunk/examples/demo/src/sdl.cpp =================================================================== --- trunk/examples/demo/src/sdl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/demo/src/sdl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/demo/src/sdlgl.cpp =================================================================== --- trunk/examples/demo/src/sdlgl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/demo/src/sdlgl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/demo/src/test_classes.cpp =================================================================== --- trunk/examples/demo/src/test_classes.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/demo/src/test_classes.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/gamedemo/CMakeLists.txt =================================================================== --- trunk/examples/gamedemo/CMakeLists.txt 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/gamedemo/CMakeLists.txt 2007-08-16 22:20:24 UTC (rev 455) @@ -69,3 +69,7 @@ target_link_libraries(gamedemo-sdlgl ${FONT_LIBS} saggui-sdlgl saggui-sdl saggui) add_dependencies(gamedemo-sdlgl saggui-sdlgl saggui-sdl saggui) endif(ENABLE_SDLGL) + +add_executable(gamedemo-profiler src/profiler.cpp ${GAMEDEMO_SRC}) +target_link_libraries(gamedemo-profiler ${FONT_LIBS} saggui-profiler saggui) +add_dependencies(gamedemo-profiler saggui-profiler saggui) \ No newline at end of file Modified: trunk/examples/gamedemo/include/gamedemo.h =================================================================== --- trunk/examples/gamedemo/include/gamedemo.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/gamedemo/include/gamedemo.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/gamedemo/src/allegro.cpp =================================================================== --- trunk/examples/gamedemo/src/allegro.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/gamedemo/src/allegro.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/gamedemo/src/allegrogl.cpp =================================================================== --- trunk/examples/gamedemo/src/allegrogl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/gamedemo/src/allegrogl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/gamedemo/src/gamedemo.cpp =================================================================== --- trunk/examples/gamedemo/src/gamedemo.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/gamedemo/src/gamedemo.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/gamedemo/src/openlayer.cpp =================================================================== --- trunk/examples/gamedemo/src/openlayer.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/gamedemo/src/openlayer.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Copied: trunk/examples/gamedemo/src/profiler.cpp (from rev 453, trunk/examples/gamedemo/src/sdl.cpp) =================================================================== --- trunk/examples/gamedemo/src/profiler.cpp (rev 0) +++ trunk/examples/gamedemo/src/profiler.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -0,0 +1,190 @@ +/* +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 "gamedemo.h" +#include <saggui_profiler.h> +#include "gamedemo_gfx.h" + +int main(int argc, char *argv[]) +{ + // Register library + resourceManager::registerBackend<PROFILER_SAGGUI>(); + // Sets up the SAGGUI with the specified library + guiManager::setup("profiler"); + + // Create a timer to regulate the logic loop + guiTimer timer, fpsTimer; + int fps=0,fpsCounter =0; + + gameData data; + + if(!guiManager::setupScreen(data.screenWidth,data.screenHeight,32,data.fullscreen, data.buffered)) + { + std::cout << "Couldn't create display\n"; + return 1; + } + + basicDecor baseDecor; + //baseDecor.background = rgba(80,80,140,255); + basicDecor buttonDecor; + filledDecor fillDecor; + plainDecor colorOnly; + + /* + guiManager::getCurrentScheme()->base = &baseDecor; + guiManager::getCurrentScheme()->button = &buttonDecor; + guiManager::getCurrentScheme()->filler = &fillDecor; + guiManager::getCurrentScheme()->colorOnly = &colorOnly; + */ + guiManager::getCurrentScheme()->styles[W_Basic] = baseDecor; + guiManager::getCurrentScheme()->styles[W_PushButton] = buttonDecor; + //guiManager::getCurrentScheme()->styles[W_Filler] = fillDecor; + //guiManager::getCurrentScheme()->schemes[W_CcolorOnly = &colorOnly; + + graphic *panel = resourceManager::createGraphic(); + graphic *button1 = resourceManager::createGraphic(); + graphic *button2 = resourceManager::createGraphic(); + graphic *button3 = resourceManager::createGraphic(); + graphic *eButton = resourceManager::createGraphic(); + graphic *mButton = resourceManager::createGraphic(); + + /* + panel->loadBmp("control-panel.bmp"); + button1->loadBmp("button1.bmp"); + button2->loadBmp("button2.bmp"); + button3->loadBmp("button3.bmp"); + eButton->loadBmp("quit.bmp"); + mButton->loadBmp("menu.bmp"); + */ + + panel->loadBmp(ctrlPanel,ctrlPanel_W,ctrlPanel_H); + button1->loadBmp(btn1,btn1_W,btn1_H); + button2->loadBmp(btn2,btn2_W,btn2_H); + button3->loadBmp(btn3,btn3_W,btn3_H); + eButton->loadBmp(quitbtn,quitbtn_W,quitbtn_H); + mButton->loadBmp(menubtn,menubtn_W,menubtn_H); + + box controlPanel; + controlPanel.setStyle(&colorOnly); + controlPanel.setBitmap(panel); + controlPanel.position.setPosition(0,280); + + mainMenu mMenu; + + icon b1(&controlPanel,button1,420,20); + b1.text.setText("Let's do some lightning!"); + icon b2(&controlPanel,button2,460,20); + b2.text.setText("Block or someshit!"); + icon b3(&controlPanel,button3,500,20); + b3.text.setText("They set us up the bomb!"); + icon b4(&controlPanel,button1,540,20); + b4.text.setText("Light my fire."); + icon b5(&controlPanel,button2,580,20); + b5.text.setText("Somshit that's not needed"); + icon b6(&controlPanel,button3,420,60); + b6.text.setText("You bomb again?"); + icon b7(&controlPanel,button1,460,60); + b7.text.setText("I HATE LIFE!"); + icon b8(&controlPanel,button2,500,60); + icon b9(&controlPanel,button3,540,60); + b9.text.setText("One bomb, two bomb, three bomb, 4...."); + icon b10(&controlPanel,button3,580,60); + b10.text.setText("Sevalecan is teh bomb!"); + + icon exitButton(&controlPanel,eButton,155,90,64,16); + exitButton.text.setText("Quit Demo"); + exitButton.b1.onLeftClick.connect(&data,&gameData::endGame); + + icon menuButton(&controlPanel,mButton,225,90,64,16); + menuButton.text.setText("Menu"); + menuButton.b1.onLeftClick.connect(&mMenu, &mainMenu::toggleMenu); + + // Nice stars + stars background; + // Main loop + while(!data.quit){ + + bool draw=false; + while (timer.msecs() >= 1000/60) + { + draw = true; + if(keyInputManager::keyState(keys::NUM_1,true)) + { + guiManager::toggleActive(); + } + + guiManager::update(); + + timer.reset(); + } + + if(draw) + { + if(fpsTimer.secs()<=1)fpsCounter++; + (guiManager::getSystemBuffer())->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()); + + guiManager::renderWindows(); + + + + } + + if(fpsTimer.secs()>=1) + { + fpsTimer.reset(); + fps=fpsCounter; + fpsCounter=0; + } + while((timer.msecs())==0)timer.sleep(1); + + } + + resourceManager::destroyGraphic(panel); + resourceManager::destroyGraphic(button1); + resourceManager::destroyGraphic(button2); + resourceManager::destroyGraphic(button3); + resourceManager::destroyGraphic(eButton); + resourceManager::destroyGraphic(mButton); + + + return 0; +} + Modified: trunk/examples/gamedemo/src/sdl.cpp =================================================================== --- trunk/examples/gamedemo/src/sdl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/gamedemo/src/sdl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/gamedemo/src/sdlgl.cpp =================================================================== --- trunk/examples/gamedemo/src/sdlgl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/gamedemo/src/sdlgl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/widgets/CMakeLists.txt =================================================================== --- trunk/examples/widgets/CMakeLists.txt 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/widgets/CMakeLists.txt 2007-08-16 22:20:24 UTC (rev 455) @@ -55,4 +55,8 @@ add_executable(widgets-sdlgl src/sdlgl.cpp ${WIDGETS_SRC}) target_link_libraries(widgets-sdlgl saggui-sdlgl saggui-sdl saggui) add_dependencies(widgets-sdlgl saggui-sdlgl saggui-sdl saggui) -endif(ENABLE_SDLGL) \ No newline at end of file +endif(ENABLE_SDLGL) + +add_executable(widgets-profiler src/profiler.cpp ${WIDGETS_SRC}) +target_link_libraries(widgets-profiler saggui-profiler saggui) +add_dependencies(widgets-profiler saggui-profiler saggui) \ No newline at end of file Modified: trunk/examples/widgets/include/widgets.h =================================================================== --- trunk/examples/widgets/include/widgets.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/widgets/include/widgets.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/widgets/src/allegro.cpp =================================================================== --- trunk/examples/widgets/src/allegro.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/widgets/src/allegro.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005 - 2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/widgets/src/allegrogl.cpp =================================================================== --- trunk/examples/widgets/src/allegrogl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/widgets/src/allegrogl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005 - 2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/widgets/src/openlayer.cpp =================================================================== --- trunk/examples/widgets/src/openlayer.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/widgets/src/openlayer.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005 - 2007, Miguel A. Gavidia All rights reserved. Copied: trunk/examples/widgets/src/profiler.cpp (from rev 453, trunk/examples/widgets/src/sdl.cpp) =================================================================== --- trunk/examples/widgets/src/profiler.cpp (rev 0) +++ trunk/examples/widgets/src/profiler.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -0,0 +1,119 @@ +/* +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 MAIN_CPP +#define MAIN_CPP + +#include "saggui_profiler.h" +#include "widgets.h" + +using namespace saggui; + +int main(int argc, char *argv[]) +{ + //Adds the backend to SAGGUI + resourceManager::registerBackend<PROFILER_SAGGUI>(); + + // Sets up the SAGGUI with the specified library + guiManager::setup("profiler"); + + // 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; + } + + widgetContainer::setupWidgets(); + + // Main loop + while(!quit){ + + bool draw=false; + while (timer.msecs() >= 1000/60) + { + draw = true; + if(keyInputManager::keyState(keys::ESC)) + { + quit=true; + draw=false; + break; + } + + guiManager::update(); + + timer.reset(); + } + + if(draw) + { + if(fpsTimer.secs()<=1)fpsCounter++; + + resourceManager::getFont()->render(0,0,rgba::BLACK,guiManager::getSystemBuffer(),1,"FPS: %d",fps); + + guiManager::renderWindows(); + + + + } + + if(fpsTimer.secs()>=1) + { + fpsTimer.reset(); + fps=fpsCounter; + fpsCounter=0; + } + while((timer.msecs())==0)timer.sleep(1); + + } + + widgetContainer::killWidgets(); + + return 0; +} + +#endif Modified: trunk/examples/widgets/src/sdl.cpp =================================================================== --- trunk/examples/widgets/src/sdl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/widgets/src/sdl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005 - 2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/widgets/src/sdlgl.cpp =================================================================== --- trunk/examples/widgets/src/sdlgl.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/widgets/src/sdlgl.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005 - 2007, Miguel A. Gavidia All rights reserved. Modified: trunk/examples/widgets/src/widgets.cpp =================================================================== --- trunk/examples/widgets/src/widgets.cpp 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/examples/widgets/src/widgets.cpp 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/animation.h =================================================================== --- trunk/include/saggui/animation.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/animation.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/bitmap_font.h =================================================================== --- trunk/include/saggui/bitmap_font.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/bitmap_font.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -43,7 +43,7 @@ #include <map> #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/common.h =================================================================== --- trunk/include/saggui/common.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/common.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/coord.h =================================================================== --- trunk/include/saggui/coord.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/coord.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -43,7 +43,7 @@ #include "sigslot.h" #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/debug.h =================================================================== --- trunk/include/saggui/debug.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/debug.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/dllspec.h =================================================================== --- trunk/include/saggui/dllspec.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/dllspec.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/font.h =================================================================== --- trunk/include/saggui/font.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/font.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -46,7 +46,7 @@ #include "sigslot.h" #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/font_base.h =================================================================== --- trunk/include/saggui/font_base.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/font_base.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -44,7 +44,7 @@ #include <stdarg.h> #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/font_manager.h =================================================================== --- trunk/include/saggui/font_manager.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/font_manager.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/graphic_manager.h =================================================================== --- trunk/include/saggui/graphic_manager.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/graphic_manager.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/graphics.h =================================================================== --- trunk/include/saggui/graphics.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/graphics.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -45,7 +45,7 @@ #include "coord.h" #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/gui_manager.h =================================================================== --- trunk/include/saggui/gui_manager.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/gui_manager.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/key_events.h =================================================================== --- trunk/include/saggui/key_events.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/key_events.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -45,7 +45,7 @@ #include "sigslot.h" #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/keyinput.h =================================================================== --- trunk/include/saggui/keyinput.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/keyinput.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -46,7 +46,7 @@ #include <list> #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/keyinput_manager.h =================================================================== --- trunk/include/saggui/keyinput_manager.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/keyinput_manager.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -48,7 +48,7 @@ #include "sigslot.h" #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/keys.h =================================================================== --- trunk/include/saggui/keys.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/keys.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -41,7 +41,7 @@ #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/library_factory.h =================================================================== --- trunk/include/saggui/library_factory.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/library_factory.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/mouse.h =================================================================== --- trunk/include/saggui/mouse.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/mouse.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -43,7 +43,7 @@ #include "coord.h" #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/mouse_events.h =================================================================== --- trunk/include/saggui/mouse_events.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/mouse_events.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -45,7 +45,7 @@ #include "sigslot.h" #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/mouse_manager.h =================================================================== --- trunk/include/saggui/mouse_manager.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/mouse_manager.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -50,7 +50,7 @@ #include "sigslot.h" #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/resource_manager.h =================================================================== --- trunk/include/saggui/resource_manager.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/resource_manager.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/rgba.h =================================================================== --- trunk/include/saggui/rgba.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/rgba.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -42,7 +42,7 @@ #include <string> #include "dllspec.h" -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface /*! This is the naming convention for this SAGGUI lib. */ Modified: trunk/include/saggui/scheme.h =================================================================== --- trunk/include/saggui/scheme.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/scheme.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005 - 2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/schemes/defaultscheme.h =================================================================== --- trunk/include/saggui/schemes/defaultscheme.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/schemes/defaultscheme.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005 - 2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/sigslot.h =================================================================== --- trunk/include/saggui/sigslot.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/sigslot.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2007 Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/sprite.h =================================================================== --- trunk/include/saggui/sprite.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/sprite.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. Modified: trunk/include/saggui/style.h =================================================================== --- trunk/include/saggui/style.h 2007-08-16 20:22:59 UTC (rev 454) +++ trunk/include/saggui/style.h 2007-08-16 22:20:24 UTC (rev 455) @@ -1,5 +1,5 @@ /* -SAGGUI (Simplified Allegro Gaming Graphical User Interface) +SAGGUI (Simplified All Gaming Graphical User Interface) Copyright (c) 2005-2007, Miguel A. Gavidia All rights reserved. @@ -44,7 +44,7 @@ #include "dllspec.h" #include <vector> -//! Simplified Allegro Gaming Graphical User Interface +//! Simplified All Gaming Graphical User Interface... [truncated message content] |
From: <sag...@li...> - 2007-08-16 20:23:01
|
Revision: 454 http://saggui.svn.sourceforge.net/saggui/?rev=454&view=rev Author: juvinious Date: 2007-08-16 13:22:59 -0700 (Thu, 16 Aug 2007) Log Message: ----------- Added profiler module to work as a dummy module in order to debug and profile the library Added Paths: ----------- trunk/modules/profiler/ Copied: trunk/modules/profiler (from rev 453, trunk/modules/allegro) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-07-28 19:42:25
|
Revision: 453 http://saggui.svn.sourceforge.net/saggui/?rev=453&view=rev Author: juvinious Date: 2007-07-28 12:42:23 -0700 (Sat, 28 Jul 2007) Log Message: ----------- Added deprecated macro. Deprecated button so that pushButton can be used instead. Fixed PALib compilation problems and updated to latest PALib. 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/sdl.cpp trunk/examples/demo/src/sdlgl.cpp trunk/examples/gamedemo/include/gamedemo.h trunk/examples/gamedemo/src/gamedemo.cpp trunk/examples/widgets/include/widgets.h trunk/examples/widgets/src/widgets.cpp trunk/include/saggui/dllspec.h trunk/include/saggui/widgets/button.h trunk/include/saggui/widgets/listbox.h trunk/include/saggui/widgets/scroll_bar.h trunk/modules/palib/include/saggui/pa_gfx.h trunk/modules/palib/include/saggui/pa_mouse.h trunk/modules/palib/include/saggui/saggui.h trunk/modules/palib/saggui/pa_gfx.cpp trunk/modules/palib/saggui/pa_keyinput.cpp trunk/modules/palib/saggui/pa_mouse.cpp trunk/modules/palib/source/main.cpp trunk/src/widgets/listbox.cpp trunk/src/widgets/scroll_bar.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/CHANGELOG 2007-07-28 19:42:23 UTC (rev 453) @@ -1,4 +1,8 @@ -0.46 +0.48 +- Fixed compilation issues with PALib, updated to the most recent version of PALib as of 07/28/07 +- Moved all dependent widgets and examples from button to pushButton +- Deprecated button so that pushButton can be used in its place +- Added deprecated macro to dllspec to facilitate deprecation - Implemented a new push button which will eventually replace the current button implementation - Made additional fixes for abstractButton Modified: trunk/examples/demo/src/allegro.cpp =================================================================== --- trunk/examples/demo/src/allegro.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/demo/src/allegro.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -183,7 +183,7 @@ //tBox.setWordWrap(false); // Button tester - button myButton; + pushButton myButton; myButton.setText("Press me!"); myButton.position.setPosition(400,400); Modified: trunk/examples/demo/src/allegrogl.cpp =================================================================== --- trunk/examples/demo/src/allegrogl.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/demo/src/allegrogl.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -180,7 +180,7 @@ //tBox.setWordWrap(false); // Button tester - button myButton; + pushButton myButton; myButton.setText("Press me!"); myButton.position.setPosition(400,400); Modified: trunk/examples/demo/src/openlayer.cpp =================================================================== --- trunk/examples/demo/src/openlayer.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/demo/src/openlayer.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -180,7 +180,7 @@ //tBox.setWordWrap(false); // Button tester - button myButton; + pushButton myButton; myButton.setText("Press me!"); myButton.position.setPosition(400,400); Modified: trunk/examples/demo/src/sdl.cpp =================================================================== --- trunk/examples/demo/src/sdl.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/demo/src/sdl.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -179,7 +179,7 @@ //tBox.setWordWrap(false); // Button tester - button myButton; + pushButton myButton; myButton.setText("Press me!"); myButton.position.setPosition(400,400); Modified: trunk/examples/demo/src/sdlgl.cpp =================================================================== --- trunk/examples/demo/src/sdlgl.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/demo/src/sdlgl.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -248,7 +248,7 @@ //tBox.setWordWrap(false); // Button tester - button myButton; + pushButton myButton; myButton.setText("Press me!"); myButton.position.setPosition(400,400); Modified: trunk/examples/gamedemo/include/gamedemo.h =================================================================== --- trunk/examples/gamedemo/include/gamedemo.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/gamedemo/include/gamedemo.h 2007-07-28 19:42:23 UTC (rev 453) @@ -85,8 +85,8 @@ void toggleScreen2(const coord &c); box menu; - button opt1; - button opt2; + pushButton opt1; + pushButton opt2; checkBox check1; label checkLabel; }; @@ -143,7 +143,7 @@ public: icon(window *parent, graphic *bmp, double x, double y, double width=32, double height=32); ~icon(); - button b1; + pushButton b1; label text; blankDecor dec; }; Modified: trunk/examples/gamedemo/src/gamedemo.cpp =================================================================== --- trunk/examples/gamedemo/src/gamedemo.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/gamedemo/src/gamedemo.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -307,7 +307,7 @@ icon::icon(window *parent, graphic *bmp, double x, double y, double width, double height) { parent->addChild(&b1); - b1.setBitmap(bmp); + b1.setIcon(bmp); b1.position.set(x,y,width,height); b1.onHover.connect(this,&icon::showText); b1.onHoverOut.connect(this,&icon::hideText); Modified: trunk/examples/widgets/include/widgets.h =================================================================== --- trunk/examples/widgets/include/widgets.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/widgets/include/widgets.h 2007-07-28 19:42:23 UTC (rev 453) @@ -67,9 +67,7 @@ void onEnter(const keys &k); - void onButton1(); - - void onButton2(const coord &pos); + void onButton1(const coord &pos); }; #endif /* WIDGETS_H */ Modified: trunk/examples/widgets/src/widgets.cpp =================================================================== --- trunk/examples/widgets/src/widgets.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/examples/widgets/src/widgets.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -138,10 +138,8 @@ static inputBox *input1 = 0; -static button *pushButton1 = 0; +static pushButton *pushButton1 = 0; -static pushButton *pushButton2 = 0; - static textBox *textArea = 0; static listBox *lb = 0; @@ -201,17 +199,11 @@ input1->setHorizontalAlign(inputBox::T_Left); input1->setText("Input text"); - pushButton1 = new button(); + pushButton1 = new pushButton(); pushButton1->position.setPosition(140,220); pushButton1->setText("Clear text!"); - pushButton1->onButtonClick.connect(container,&widgetContainer::onButton1); + pushButton1->clicked.connect(container,&widgetContainer::onButton1); - pushButton2 = new pushButton(); - pushButton2->position.setPosition(240,220); - //pushButton2->setIcon(logo); - pushButton2->setText("Clear text!"); - pushButton2->clicked.connect(container,&widgetContainer::onButton2); - cb1 = new checkBox(); cb1->position.set(10,340,resourceManager::getFont()->getWidth()+4,resourceManager::getFont()->getWidth()+4); cb1->onEnable.connect(container,&widgetContainer::fullscreen); @@ -241,7 +233,6 @@ mainBox->addChild(text2); mainBox->addChild(input1); mainBox->addChild(pushButton1); - mainBox->addChild(pushButton2); mainBox->addChild(cb1); mainBox->addChild(text3); mainBox->addChild(lb); @@ -264,7 +255,6 @@ delete text2; delete input1; delete pushButton1; - delete pushButton2; delete cb1; delete text3; @@ -312,15 +302,10 @@ } } -void widgetContainer::onButton1() +void widgetContainer::onButton1(const coord &pos) { textArea->clearText(); } -void widgetContainer::onButton2(const coord &pos) -{ - textArea->clearText(); -} - #endif /* WIDGETS_CPP */ Modified: trunk/include/saggui/dllspec.h =================================================================== --- trunk/include/saggui/dllspec.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/include/saggui/dllspec.h 2007-07-28 19:42:23 UTC (rev 453) @@ -42,12 +42,15 @@ #if defined (_WIN32) && defined (SAGGUI_LIB_BUILD) && defined (SAGGUI_SHARED) #define SAGGUI_EXPORT __declspec(dllexport) #define SAGGUI_EXT_EXPORT __declspec(dllexport) +#define SAGGUI_EXPORT_METHOD dllexport #elif defined (_WIN32) && defined (SAGGUI_SHARED) #define SAGGUI_EXPORT __declspec(dllimport) #define SAGGUI_EXT_EXPORT __declspec(dllimport) +#define SAGGUI_EXPORT_METHOD dllexport #else #define SAGGUI_EXPORT #define SAGGUI_EXT_EXPORT +#define SAGGUI_EXPORT_METHOD #endif #ifdef _MSC_VER @@ -56,4 +59,11 @@ #endif #endif +#ifdef __GNUC__ +//#define SAGGUI_DEPRECATED __attribute__((deprecated, SAGGUI_EXPORT_METHOD)) +#define SAGGUI_DEPRECATED __attribute__ ((deprecated)) +#else +#define SAGGUI_DEPRECATED #endif + +#endif Modified: trunk/include/saggui/widgets/button.h =================================================================== --- trunk/include/saggui/widgets/button.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/include/saggui/widgets/button.h 2007-07-28 19:42:23 UTC (rev 453) @@ -54,6 +54,9 @@ * It can just be used to show off your clicks, make your interfaces neater. \n * Just connect events to it, slap a graphic on it and/or add some text.\n * It will autoresize if the text is larger than the width and height of the widget. \n + * + * + * \note This function has been deprecated please take a look at pushButton */ class SAGGUI_EXPORT button : public window, public mouseEvents, public keyEvents @@ -96,7 +99,7 @@ void setClickSystem(mouseButtons type); public: //! Constructor - button(); + SAGGUI_DEPRECATED button(); //! Destructor ~button(); Modified: trunk/include/saggui/widgets/listbox.h =================================================================== --- trunk/include/saggui/widgets/listbox.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/include/saggui/widgets/listbox.h 2007-07-28 19:42:23 UTC (rev 453) @@ -42,7 +42,7 @@ #include "saggui/window.h" #include "saggui/mouse_events.h" #include "saggui/key_events.h" -#include "saggui/widgets/button.h" +#include "saggui/widgets/pushbutton.h" #include "saggui/widgets/label.h" #include "saggui/widgets/scroll_bar.h" @@ -75,11 +75,11 @@ slot resized(); slot drawOnButton(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); - + slot showPopUp(); - slot showPopUp(const coord &c); - + slot showPopUp(const coord &pos); + slot hidePopUp(); slot onHoverItem(const coord &pos); @@ -111,7 +111,7 @@ //! Label to contain our chosen item label chosen; //! Button for drop down - button showListButton; + pushButton showListButton; //! Popup for selectable list box popUp; Modified: trunk/include/saggui/widgets/scroll_bar.h =================================================================== --- trunk/include/saggui/widgets/scroll_bar.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/include/saggui/widgets/scroll_bar.h 2007-07-28 19:42:23 UTC (rev 453) @@ -46,7 +46,7 @@ #include "saggui/key_events.h" #include "saggui/timer.h" #include "saggui/widgets/box.h" -#include "saggui/widgets/button.h" +#include "saggui/widgets/pushbutton.h" namespace saggui { @@ -86,10 +86,10 @@ double buttonSize; //! The topmost button (Top horizontal | left vertical) - button topButton; + pushButton topButton; //! The bottommost button (bottom horizontal | right vertical) - button bottomButton; + pushButton bottomButton; //! The centered button (crawls the index) box middleButton; @@ -151,10 +151,10 @@ virtual void onUp(const coord &c); virtual void scrollWheelUp(const coord &c); virtual void scrollWheelDown(const coord &c); - virtual void topButtonDown(); - virtual void topButtonUp(); - virtual void bottomButtonDown(); - virtual void bottomButtonUp(); + virtual slot topButtonDown(const coord &pos); + virtual slot topButtonUp(const coord &pos); + virtual slot bottomButtonDown(const coord &pos); + virtual slot bottomButtonUp(const coord &pos); virtual void middleButtonMove(); virtual void middleButtonUp(const coord &c); virtual void resizeButtons(); Modified: trunk/modules/palib/include/saggui/pa_gfx.h =================================================================== --- trunk/modules/palib/include/saggui/pa_gfx.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/modules/palib/include/saggui/pa_gfx.h 2007-07-28 19:42:23 UTC (rev 453) @@ -91,6 +91,11 @@ //! Draw Filled Circle to bitmap or passed bitmap void doCirclefill(double x, double y, double radius,const rgba & color, graphic *bmp=0); + + //! Draw a filled triangle between three points to bitmap or passed bitmap + void doTriangle(double x1, double y1, double x2, double y2, double x3, double y3, const rgba & color, graphic *bmp=0); + + // Bitmap Routines @@ -121,15 +126,9 @@ //! Clear to color void clearBmp(const rgba & color); - - //! Blit bitmap - void renderBmp(double x,double y,const rgba & color=rgba::NOCOLOR, graphic *b=0); - - //! Stretch Blit bitmap - void renderStretchedBmp(double x, double y, double width, double height,const rgba & color=rgba::NOCOLOR,graphic *b=0); - //! Render a portion of the bitmap to the given bitmap - void renderBmpArea(double x1, double y1, double x2, double y2, double width, double height, graphic *b); + //! Render a certain area of a bitmap + void renderBmp(double x1, double y1, double x2, double y2, double width, double height, const rgba &color, graphic *b=0); }; } Modified: trunk/modules/palib/include/saggui/pa_mouse.h =================================================================== --- trunk/modules/palib/include/saggui/pa_mouse.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/modules/palib/include/saggui/pa_mouse.h 2007-07-28 19:42:23 UTC (rev 453) @@ -65,6 +65,8 @@ ~paMouse(); //! Updates the mouse ie polling and setting keys void update(); + //! Sets the mouse pointer to specific location + void setPosition(int x, int y); }; } Modified: trunk/modules/palib/include/saggui/saggui.h =================================================================== --- trunk/modules/palib/include/saggui/saggui.h 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/modules/palib/include/saggui/saggui.h 2007-07-28 19:42:23 UTC (rev 453) @@ -52,9 +52,10 @@ //! These are the base GUI headers #include "saggui/animation.h" #include "saggui/bitmap_font.h" +#include "saggui/common.h" #include "saggui/coord.h" #include "saggui/debug.h" -#include "saggui/decorator.h" +#include "saggui/style.h" #include "saggui/dllspec.h" #include "saggui/font.h" #include "saggui/font_base.h" @@ -72,27 +73,33 @@ #include "saggui/mouse_manager.h" #include "saggui/resource_manager.h" #include "saggui/rgba.h" +#include "saggui/scheme.h" #include "saggui/sigslot.h" #include "saggui/sprite.h" #include "saggui/system_factory.h" -/* #include "saggui/system_graphics.h" */ #include "saggui/system.h" #include "saggui/timer.h" #include "saggui/window.h" - //! Headers for included widgets +#include "saggui/widgets/abstractbutton.h" #include "saggui/widgets/box.h" #include "saggui/widgets/button.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" +//! Headers for included schemes +#include "saggui/schemes/defaultscheme.h" + //! Headers for module #include "pa_factory.h" #include "pa_font.h" Modified: trunk/modules/palib/saggui/pa_gfx.cpp =================================================================== --- trunk/modules/palib/saggui/pa_gfx.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/modules/palib/saggui/pa_gfx.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -46,13 +46,13 @@ { static void fixX(double &x) { - if(x<0)x=0; - if(x>255)x=255; + if(x<=1)x=1; + if(x>=254)x=254; } static void fixY(double &y) { - if(y<0)y=0; - if(y>191)y=191; + if(y<=1)y=1; + if(y>=190)y=190; } @@ -110,8 +110,8 @@ //!FIXME fixX(x); fixY(y); - if((x+width) > 255)width = 255 - x; - if((y+height) > 191)height = 191 - y; + width = ((x + width) > 254) ? 254 - x : width; + height = ((y + height) > 190) ? 190 - y : height; PA_Draw16bitLine (0, u16(x), u16(y), u16(x + width), u16(y), PA_RGB((u16)color.red >> 3,(u16)color.green >> 3,(u16)color.red >> 3)); PA_Draw16bitLine (0, u16(x), u16(y), u16(x), u16(y + height), PA_RGB((u16)color.red >> 3,(u16)color.green >> 3,(u16)color.red >> 3)); PA_Draw16bitLine (0, u16(x + width), u16(y), u16(x + width), u16(y + height), PA_RGB((u16)color.red >> 3,(u16)color.green >> 3,(u16)color.red >> 3)); @@ -125,8 +125,8 @@ //!FIXME fixX(x); fixY(y); - if((x+width) > 255)width = 255 - x; - if((y+height) > 191)height = 191 - y; + width = ((x + width) > 254) ? 254 - x : width; + height = ((y + height) > 190) ? 190 - y : height; PA_Draw16bitRect (0, s16(x), s16(y), s16(x+width), s16(y+height), PA_RGB((u16)color.red >> 3,(u16)color.green >> 3,(u16)color.red >> 3)); } @@ -142,6 +142,11 @@ { //!FIXME } + + void paGraphic::doTriangle(double x1, double y1, double x2, double y2, double x3, double y3, const rgba & color, graphic *bmp) + { + //!FIXME + } //! Load bitmap from file (and save filename) void paGraphic::loadBmp(const std::string & filename, const rgba & color) @@ -197,24 +202,11 @@ if(isScreenBmp())PA_Clear16bitBg(0); } - //! Blit - void paGraphic::renderBmp(double x,double y,const rgba & color, graphic *b) + //! render bmp + void paGraphic::renderBmp(double x1, double y1, double x2, double y2, double width, double height, const rgba &color, graphic *b) { //!FIXME - //PA_8bitDraw(0,0); } - //! Stretch Blit - void paGraphic::renderStretchedBmp(double x, double y, double width, double height,const rgba & color,graphic *b) - { - //!FIXME - //PA_8bitDraw(0,0); - } - - - void paGraphic::renderBmpArea(double x1, double y1, double x2, double y2, double width, double height, graphic *b) - { - //!FIXME - } } #endif Modified: trunk/modules/palib/saggui/pa_keyinput.cpp =================================================================== --- trunk/modules/palib/saggui/pa_keyinput.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/modules/palib/saggui/pa_keyinput.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -58,6 +58,8 @@ keys paKeyInput::convertKey(int unicode, int scancode) { //!FIXME + + return keys(); } //init Modified: trunk/modules/palib/saggui/pa_mouse.cpp =================================================================== --- trunk/modules/palib/saggui/pa_mouse.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/modules/palib/saggui/pa_mouse.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -68,6 +68,14 @@ else buttonState[LEFTBUTTON] = false; } + + + //! Sets the mouse pointer to specific location + void paMouse::setPosition(int x, int y) + { + Stylus.X = x; + Stylus.Y = y; + } } #endif Modified: trunk/modules/palib/source/main.cpp =================================================================== --- trunk/modules/palib/source/main.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/modules/palib/source/main.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -10,10 +10,10 @@ public: line() { - x1 = PA_RandMinMax(0,255); - x2 = PA_RandMinMax(0,255); - y1 = PA_RandMinMax(0,191); - y2 = PA_RandMinMax(0,191); + x1 = PA_RandMinMax(0,254); + x2 = PA_RandMinMax(0,254); + y1 = PA_RandMinMax(0,190); + y2 = PA_RandMinMax(0,190); if(PA_RandMinMax(0,100)<50)x1dir = -1; else x1dir = 1; if(PA_RandMinMax(0,100)<50)x2dir = -1; @@ -34,9 +34,9 @@ x1=0; x1dir=1; } - if(x1>=255) + if(x1>=254) { - x1=255; + x1=254; x1dir=-1; } if(x2<=0) @@ -44,10 +44,10 @@ x2dir=1; x2=0; } - if(x2>=255) + if(x2>=254) { x2dir=-1; - x2=255; + x2=254; } if(y1<=0) { @@ -57,17 +57,17 @@ if(y1>=191) { y1dir=-1; - y1=191; + y1=190; } if(y2<=0) { y2dir=1; y2=0; } - if(y2>=191) + if(y2>=190) { y2dir=-1; - y2=191; + y2=190; } x1+=x1dir; y1+=y1dir; @@ -110,7 +110,7 @@ int duration; }; -class touch : public sigslot::has_slots<> +class touch : public has_slots<> { public: touch() @@ -119,13 +119,13 @@ ~touch() { } - void info(coord c) + void info(const coord &c) { PA_OutputText(1,0,4,"x: %03d | y: %03d", s16(c.x), s16(c.y)); PA_OutputText(1,0,8,"Focused widget: %03d", s16(guiManager::getMouseOverWinIDWM())); } - void addPixel(coord c) + void addPixel(const coord &c) { pixels.push_back(pix(c.x,c.y)); } @@ -160,7 +160,7 @@ box b; b.position.set(50,50,50,50); - b.setDrag(window::ALLDRAG); + b.setDrag(M_AllDrag); checkBox c; c.position.set(100,100,25,25); @@ -194,9 +194,7 @@ bs.render(); guiManager::renderWindows(); - guiManager::renderToScreen(); - PA_WaitForVBL(); } Modified: trunk/src/widgets/listbox.cpp =================================================================== --- trunk/src/widgets/listbox.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/src/widgets/listbox.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -57,7 +57,7 @@ chosen.onKeyPress.connect(this,&listBox::mainKeyPress); addChild(&showListButton); - showListButton.onButtonClick.connect(this,&listBox::showPopUp); + showListButton.clicked.connect(this,&listBox::showPopUp); showListButton.onPaint.connect(this,&listBox::drawOnButton); popUp.addChild(&sideBar); @@ -167,7 +167,7 @@ mouseManager::setPosition(int(itemList[highlightedItem]->getRelativePosition().getX2() - (itemList[highlightedItem]->position.width/2)),int(itemList[highlightedItem]->getRelativePosition().getY2() - (itemList[highlightedItem]->position.height/2))); } - slot listBox::showPopUp(const coord &c) + slot listBox::showPopUp(const coord &pos) { showPopUp(); } Modified: trunk/src/widgets/scroll_bar.cpp =================================================================== --- trunk/src/widgets/scroll_bar.cpp 2007-07-27 17:38:34 UTC (rev 452) +++ trunk/src/widgets/scroll_bar.cpp 2007-07-28 19:42:23 UTC (rev 453) @@ -67,14 +67,14 @@ topButton.onScrollWheelUp.connect(this,&scrollBar::scrollWheelUp); topButton.onScrollWheelDown.connect(this,&scrollBar::scrollWheelDown); topButton.onPaint.connect(this,&scrollBar::drawButtonTop); - topButton.onButtonDown.connect(this,&scrollBar::topButtonDown); - topButton.onButtonRelease.connect(this,&scrollBar::topButtonUp); + topButton.pressed.connect(this,&scrollBar::topButtonDown); + topButton.released.connect(this,&scrollBar::topButtonUp); bottomButton.onScrollWheelUp.connect(this,&scrollBar::scrollWheelUp); bottomButton.onScrollWheelDown.connect(this,&scrollBar::scrollWheelDown); bottomButton.onPaint.connect(this,&scrollBar::drawButtonBottom); - bottomButton.onButtonDown.connect(this,&scrollBar::bottomButtonDown); - bottomButton.onButtonRelease.connect(this,&scrollBar::bottomButtonUp); + bottomButton.pressed.connect(this,&scrollBar::bottomButtonDown); + bottomButton.released.connect(this,&scrollBar::bottomButtonUp); middleButton.setDrag(M_NoDrag); middleButton.onMove.connect(this,&scrollBar::middleButtonMove); @@ -168,24 +168,24 @@ { scrollDown(scrollWheelIncrement); } - void scrollBar::topButtonDown() + slot scrollBar::topButtonDown(const coord &pos) { if(!mouseDown)clickTimer.reset(); mouseDown=true; buttonDir = BUTTONUP; } - void scrollBar::topButtonUp() + slot scrollBar::topButtonUp(const coord &pos) { mouseDown= clickPaused =false; buttonDir = NONE; } - void scrollBar::bottomButtonDown() + slot scrollBar::bottomButtonDown(const coord &pos) { if(!mouseDown)clickTimer.reset(); mouseDown=true; buttonDir = BUTTONDOWN; } - void scrollBar::bottomButtonUp() + slot scrollBar::bottomButtonUp(const coord &pos) { mouseDown= clickPaused =false; buttonDir = NONE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-07-27 17:38:39
|
Revision: 452 http://saggui.svn.sourceforge.net/saggui/?rev=452&view=rev Author: juvinious Date: 2007-07-27 10:38:34 -0700 (Fri, 27 Jul 2007) Log Message: ----------- New push button is completely useable and recommended to be used instead of the old button implementation Modified Paths: -------------- trunk/examples/widgets/include/widgets.h trunk/examples/widgets/src/widgets.cpp trunk/include/saggui/widgets/abstractbutton.h trunk/include/saggui/widgets/pushbutton.h trunk/src/widgets/abstractbutton.cpp trunk/src/widgets/pushbutton.cpp Modified: trunk/examples/widgets/include/widgets.h =================================================================== --- trunk/examples/widgets/include/widgets.h 2007-07-27 04:17:08 UTC (rev 451) +++ trunk/examples/widgets/include/widgets.h 2007-07-27 17:38:34 UTC (rev 452) @@ -68,6 +68,8 @@ void onEnter(const keys &k); void onButton1(); + + void onButton2(const coord &pos); }; #endif /* WIDGETS_H */ Modified: trunk/examples/widgets/src/widgets.cpp =================================================================== --- trunk/examples/widgets/src/widgets.cpp 2007-07-27 04:17:08 UTC (rev 451) +++ trunk/examples/widgets/src/widgets.cpp 2007-07-27 17:38:34 UTC (rev 452) @@ -210,6 +210,7 @@ pushButton2->position.setPosition(240,220); //pushButton2->setIcon(logo); pushButton2->setText("Clear text!"); + pushButton2->clicked.connect(container,&widgetContainer::onButton2); cb1 = new checkBox(); cb1->position.set(10,340,resourceManager::getFont()->getWidth()+4,resourceManager::getFont()->getWidth()+4); @@ -316,5 +317,10 @@ textArea->clearText(); } +void widgetContainer::onButton2(const coord &pos) +{ + textArea->clearText(); +} + #endif /* WIDGETS_CPP */ Modified: trunk/include/saggui/widgets/abstractbutton.h =================================================================== --- trunk/include/saggui/widgets/abstractbutton.h 2007-07-27 04:17:08 UTC (rev 451) +++ trunk/include/saggui/widgets/abstractbutton.h 2007-07-27 17:38:34 UTC (rev 452) @@ -54,7 +54,7 @@ /*! * An abstract button representing different types of buttons, radials, etc */ - class SAGGUI_EXPORT abstractButton : public window, mouseEvents, keyEvents + class SAGGUI_EXPORT abstractButton : public window, public mouseEvents, public keyEvents { public: //! Constructor @@ -129,15 +129,15 @@ void setFontColor(const rgba &color); //! \name PUBLIC SLOTS - slot animateClick(int msec = 100); - slot click(const coord &pos); - slot toggle(); - slot setChecked(bool); + virtual slot animateClick(int msec = 100); + virtual slot click(const coord &pos); + virtual slot toggle(); + virtual slot setChecked(bool); - //! \name SIGNALS - signal0<> pressed; - signal0<> released; - signal0<> clicked; + //! \name PUBLIC SIGNALS + signal1<const coord &> pressed; + signal1<const coord &> released; + signal1<const coord &> clicked; signal0<> toggled; protected: @@ -167,6 +167,8 @@ std::string text; buttonGroup *bGroup; + + //! \name PRIVATE SLOTS slot onClicked(const coord &pos); slot onPressed(const coord &pos); slot onReleased(const coord &pos); Modified: trunk/include/saggui/widgets/pushbutton.h =================================================================== --- trunk/include/saggui/widgets/pushbutton.h 2007-07-27 04:17:08 UTC (rev 451) +++ trunk/include/saggui/widgets/pushbutton.h 2007-07-27 17:38:34 UTC (rev 452) @@ -78,6 +78,8 @@ //! \name PRIVATE SLOTS slot onTextChanged(); slot onIconChanged(); + slot depress(const coord &pos); + slot release(const coord &pos); }; } Modified: trunk/src/widgets/abstractbutton.cpp =================================================================== --- trunk/src/widgets/abstractbutton.cpp 2007-07-27 04:17:08 UTC (rev 451) +++ trunk/src/widgets/abstractbutton.cpp 2007-07-27 17:38:34 UTC (rev 452) @@ -189,6 +189,7 @@ slot abstractButton::click(const coord &pos) { + } slot abstractButton::toggle() @@ -196,9 +197,9 @@ } - slot abstractButton::setChecked(bool checkable) + slot abstractButton::setChecked(bool checked) { - this->checkable = checkable; + this->checked = checked; } // Set click system @@ -208,11 +209,6 @@ { case M_Left: { - onRightClick.disconnect_slot(this,&abstractButton::click); - onMiddleClick.disconnect_slot(this,&abstractButton::click); - - onLeftClick.connect(this,&abstractButton::click); - onRightDown.disconnect_slot(this,&abstractButton::onPressed); onRightUp.disconnect_slot(this,&abstractButton::onReleased); onRightClick.disconnect_slot(this,&abstractButton::onClicked); @@ -227,11 +223,6 @@ } case M_Right: { - onLeftClick.disconnect_slot(this,&abstractButton::click); - onMiddleClick.disconnect_slot(this,&abstractButton::click); - - onRightClick.connect(this,&abstractButton::click); - onLeftDown.disconnect_slot(this,&abstractButton::onPressed); onLeftUp.disconnect_slot(this,&abstractButton::onReleased); onLeftClick.disconnect_slot(this,&abstractButton::onClicked); @@ -273,6 +264,8 @@ bGroup->buttonClickedObj.emit(this); bGroup->buttonClickedID.emit(getID()); } + + clicked.emit(pos); } slot abstractButton::onPressed(const coord &pos) @@ -282,6 +275,8 @@ bGroup->buttonPressedObj.emit(this); bGroup->buttonPressedID.emit(getID()); } + + pressed.emit(pos); } slot abstractButton::onReleased(const coord &pos) @@ -291,6 +286,8 @@ bGroup->buttonReleasedObj.emit(this); bGroup->buttonReleasedID.emit(getID()); } + + released.emit(pos); } } Modified: trunk/src/widgets/pushbutton.cpp =================================================================== --- trunk/src/widgets/pushbutton.cpp 2007-07-27 04:17:08 UTC (rev 451) +++ trunk/src/widgets/pushbutton.cpp 2007-07-27 17:38:34 UTC (rev 452) @@ -49,6 +49,9 @@ onPaint.connect(this, &pushButton::paintEvent); textChanged.connect(this,&pushButton::onTextChanged); iconChanged.connect(this,&pushButton::onIconChanged); + pressed.connect(this,&pushButton::depress); + released.connect(this,&pushButton::release); + setAttribute(AT_Raised | AT_Off,true); } pushButton::pushButton(const std::string &text) @@ -76,14 +79,11 @@ slot pushButton::paintEvent(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) { - - const bool hasText = !this->getText().empty(); - const bool hasIcon = (this->getIcon() ? true : false); - if(hasText) + if(!this->getText().empty()) { buttonFont->render(pos.x + textPosition.x,pos.y + textPosition.y,fontColor,bmp,0,getText()); } - if(hasIcon) + if(this->getIcon()) { this->getIcon()->renderBmp(0, 0, pos.x + iconPosition.x, pos.y + iconPosition.y, iconPosition.width, iconPosition.height, rgba::NOCOLOR, bmp); } @@ -150,6 +150,28 @@ // This is to ensure that the text actually fixes itself onTextChanged(); } + + slot pushButton::depress(const coord &pos) + { + setAttribute(AT_Raised,false); + setAttribute(AT_Sunken | AT_Pressed,true); + + textPosition.x++; + textPosition.y++; + iconPosition.x++; + iconPosition.y++; + } + + slot pushButton::release(const coord &pos) + { + setAttribute(AT_Raised,true); + setAttribute(AT_Sunken | AT_Pressed,false); + + textPosition.x--; + textPosition.y--; + iconPosition.x--; + iconPosition.y--; + } } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-07-27 04:17:11
|
Revision: 451 http://saggui.svn.sourceforge.net/saggui/?rev=451&view=rev Author: juvinious Date: 2007-07-26 21:17:08 -0700 (Thu, 26 Jul 2007) Log Message: ----------- Updated changelog Modified Paths: -------------- trunk/CHANGELOG Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-07-27 04:11:49 UTC (rev 450) +++ trunk/CHANGELOG 2007-07-27 04:17:08 UTC (rev 451) @@ -1,3 +1,7 @@ +0.46 +- Implemented a new push button which will eventually replace the current button implementation +- Made additional fixes for abstractButton + 0.45 07-13-07 - Added new member to window doParentConnectActions - Fixed up listBox to work more like a real combo box This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-07-27 04:11:52
|
Revision: 450 http://saggui.svn.sourceforge.net/saggui/?rev=450&view=rev Author: juvinious Date: 2007-07-26 21:11:49 -0700 (Thu, 26 Jul 2007) Log Message: ----------- Updated abstractbutton and implemented a new pushbutton (incomplete) to evetually replace the current button implementation. Modified Paths: -------------- trunk/cmake/saggui.h.in trunk/examples/widgets/src/widgets.cpp trunk/include/saggui/widgets/abstractbutton.h trunk/src/widgets/abstractbutton.cpp Added Paths: ----------- trunk/include/saggui/widgets/pushbutton.h trunk/src/widgets/pushbutton.cpp Modified: trunk/cmake/saggui.h.in =================================================================== --- trunk/cmake/saggui.h.in 2007-07-24 02:08:31 UTC (rev 449) +++ trunk/cmake/saggui.h.in 2007-07-27 04:11:49 UTC (rev 450) @@ -92,6 +92,7 @@ #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" Modified: trunk/examples/widgets/src/widgets.cpp =================================================================== --- trunk/examples/widgets/src/widgets.cpp 2007-07-24 02:08:31 UTC (rev 449) +++ trunk/examples/widgets/src/widgets.cpp 2007-07-27 04:11:49 UTC (rev 450) @@ -140,6 +140,8 @@ static button *pushButton1 = 0; +static pushButton *pushButton2 = 0; + static textBox *textArea = 0; static listBox *lb = 0; @@ -204,6 +206,11 @@ pushButton1->setText("Clear text!"); pushButton1->onButtonClick.connect(container,&widgetContainer::onButton1); + pushButton2 = new pushButton(); + pushButton2->position.setPosition(240,220); + //pushButton2->setIcon(logo); + pushButton2->setText("Clear text!"); + cb1 = new checkBox(); cb1->position.set(10,340,resourceManager::getFont()->getWidth()+4,resourceManager::getFont()->getWidth()+4); cb1->onEnable.connect(container,&widgetContainer::fullscreen); @@ -233,6 +240,7 @@ mainBox->addChild(text2); mainBox->addChild(input1); mainBox->addChild(pushButton1); + mainBox->addChild(pushButton2); mainBox->addChild(cb1); mainBox->addChild(text3); mainBox->addChild(lb); @@ -255,6 +263,7 @@ delete text2; delete input1; delete pushButton1; + delete pushButton2; delete cb1; delete text3; Modified: trunk/include/saggui/widgets/abstractbutton.h =================================================================== --- trunk/include/saggui/widgets/abstractbutton.h 2007-07-24 02:08:31 UTC (rev 449) +++ trunk/include/saggui/widgets/abstractbutton.h 2007-07-27 04:11:49 UTC (rev 450) @@ -48,6 +48,7 @@ { //! Forward declaration class buttonGroup; + class font; //! abstractButton /*! @@ -56,7 +57,7 @@ class SAGGUI_EXPORT abstractButton : public window, mouseEvents, keyEvents { public: - //! Constructor + //! Constructor explicit abstractButton(); //! Destructor virtual ~abstractButton(); @@ -87,6 +88,7 @@ //! Set button state down void setDown(bool); + //! Is button state down? bool isDown() const; @@ -120,6 +122,12 @@ //! Get button group of button buttonGroup *getGroup() const; + //! Set current font + void setFont(font *font); + + //! Set font color + void setFontColor(const rgba &color); + //! \name PUBLIC SLOTS slot animateClick(int msec = 100); slot click(const coord &pos); @@ -133,9 +141,20 @@ signal0<> toggled; protected: - //! \name PROTECTED SLOTS + //! Current set font + font *buttonFont; + + //! Font color + 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 setClickSystem(mouseButtons type); + + //! \name PROTECTED SIGNALS + signal0<> textChanged; + signal0<> iconChanged; + signal0<> fontChanged; private: bool autoExclusive; bool autoRepeat; Copied: trunk/include/saggui/widgets/pushbutton.h (from rev 449, trunk/include/saggui/widgets/abstractbutton.h) =================================================================== --- trunk/include/saggui/widgets/pushbutton.h (rev 0) +++ trunk/include/saggui/widgets/pushbutton.h 2007-07-27 04:11:49 UTC (rev 450) @@ -0,0 +1,84 @@ +/* +SAGGUI (Simplified Allegro 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 PUSHBUTTON_H +#define PUSHBUTTON_H + +#include "saggui/widgets/abstractbutton.h" + +namespace saggui +{ + //! pushButton + /*! + * A pushable button + */ + class SAGGUI_EXPORT pushButton : public abstractButton + { + public: + //! Default Constructor + explicit pushButton(); + + //! Constructor with text + explicit pushButton(const std::string &text); + + //! Constructor with text and icon + explicit pushButton(const std::string &text, graphic *icon); + + //! Constructor with icon + explicit pushButton(graphic *icon); + + //! Destructor + virtual ~pushButton(); + + protected: + //! \name PROTECTED SLOTS + virtual slot paintEvent(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + private: + //! Text location + coord textPosition; + + //! Icon location + coord iconPosition; + + //! \name PRIVATE SLOTS + slot onTextChanged(); + slot onIconChanged(); + }; +} + +#endif // PUSHBUTTON_H Modified: trunk/src/widgets/abstractbutton.cpp =================================================================== --- trunk/src/widgets/abstractbutton.cpp 2007-07-24 02:08:31 UTC (rev 449) +++ trunk/src/widgets/abstractbutton.cpp 2007-07-27 04:11:49 UTC (rev 450) @@ -39,14 +39,18 @@ #ifndef ABSTRACTBUTTON_CPP #define ABSTRACTBUTTON_CPP +#include "saggui/resource_manager.h" #include "saggui/widgets/abstractbutton.h" #include "saggui/widgets/buttongroup.h" +#include "saggui/font.h" namespace saggui { - abstractButton::abstractButton() : window(W_Basic), mouseEvents(this), keyEvents(this) + abstractButton::abstractButton() : window(W_PushButton), mouseEvents(this), keyEvents(this) { setAttribute(AT_Raised,true); + setFont(resourceManager::getFont()); + setFontColor(rgba::BLACK); autoExclusive=false; autoRepeat=false; autoRepeatDelay=0; @@ -65,6 +69,7 @@ void abstractButton::setText(const std::string &text) { this->text = text; + textChanged.emit(); } std::string abstractButton::getText() const { @@ -74,6 +79,7 @@ void abstractButton::setIcon(graphic *icon) { this->icon = icon; + iconChanged.emit(); } graphic *abstractButton::getIcon() const @@ -165,6 +171,18 @@ else return 0; } + void abstractButton::setFont(font *font) + { + if(!font)return; + this->buttonFont = font; + fontChanged.emit(); + } + + void abstractButton::setFontColor(const rgba &color) + { + fontColor = color; + } + slot abstractButton::animateClick(int msec) { } Copied: trunk/src/widgets/pushbutton.cpp (from rev 449, trunk/src/widgets/abstractbutton.cpp) =================================================================== --- trunk/src/widgets/pushbutton.cpp (rev 0) +++ trunk/src/widgets/pushbutton.cpp 2007-07-27 04:11:49 UTC (rev 450) @@ -0,0 +1,155 @@ +/* +SAGGUI (Simplified Allegro 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 PUSHBUTTON_CPP +#define PUSHBUTTON_CPP + +#include "saggui/widgets/pushbutton.h" +#include "saggui/font.h" + +namespace saggui +{ + pushButton::pushButton() + { + onPaint.connect(this, &pushButton::paintEvent); + textChanged.connect(this,&pushButton::onTextChanged); + iconChanged.connect(this,&pushButton::onIconChanged); + } + + pushButton::pushButton(const std::string &text) + { + onPaint.connect(this, &pushButton::paintEvent); + setText(text); + } + + pushButton::pushButton(const std::string &text, graphic *icon) + { + onPaint.connect(this, &pushButton::paintEvent); + setText(text); + setIcon(icon); + } + + pushButton::pushButton(graphic *icon) + { + onPaint.connect(this, &pushButton::paintEvent); + setIcon(icon); + } + + pushButton::~pushButton() + { + } + + slot pushButton::paintEvent(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + { + + const bool hasText = !this->getText().empty(); + const bool hasIcon = (this->getIcon() ? true : false); + if(hasText) + { + buttonFont->render(pos.x + textPosition.x,pos.y + textPosition.y,fontColor,bmp,0,getText()); + } + if(hasIcon) + { + this->getIcon()->renderBmp(0, 0, pos.x + iconPosition.x, pos.y + iconPosition.y, iconPosition.width, iconPosition.height, rgba::NOCOLOR, bmp); + } + } + + slot pushButton::onTextChanged() + { + if(this->getText().empty()) + { + textPosition.set(0,0,0,0); + return; + } + + textPosition.setWidth(buttonFont->getLength(this->getText())); + textPosition.setHeight(buttonFont->getHeight()); + + const double totalWidth = iconPosition.width + textPosition.width + 2; + + position.setWidth(leftPadding + rightPadding + totalWidth); + + if(iconPosition.height <= textPosition.height) + { + position.setHeight(topPadding + bottomPadding + textPosition.height + 2); + textPosition.setY(topPadding + 1); + } + else + { + position.setHeight(topPadding + bottomPadding + iconPosition.height + 2); + textPosition.setY((position.height/2) - (textPosition.height/2)); + } + + textPosition.setX(leftPadding + iconPosition.width + 1); + } + + slot pushButton::onIconChanged() + { + if(!this->getIcon()) + { + iconPosition.set(0,0,0,0); + return; + } + + iconPosition.setWidth(this->getIcon()->getBmpWidth()); + iconPosition.setHeight(this->getIcon()->getBmpHeight()); + + const double totalWidth = iconPosition.width + textPosition.width + 2; + + position.setWidth(leftPadding + rightPadding + totalWidth); + + if(iconPosition.height <= textPosition.height) + { + position.setHeight(topPadding + bottomPadding + textPosition.height + 2); + iconPosition.setY((position.height/2) - (iconPosition.height/2)); + } + else + { + position.setHeight(topPadding + bottomPadding + iconPosition.height + 2); + iconPosition.setY(topPadding + 1); + } + + iconPosition.setX(leftPadding + 1); + iconPosition.setY(topPadding + 1); + + // This is to ensure that the text actually fixes itself + onTextChanged(); + } +} + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-07-24 02:08:33
|
Revision: 449 http://saggui.svn.sourceforge.net/saggui/?rev=449&view=rev Author: juvinious Date: 2007-07-23 19:08:31 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Removed unecessary connections and automations between buttonGroup and abstractButton Modified Paths: -------------- trunk/include/saggui/widgets/abstractbutton.h trunk/include/saggui/widgets/buttongroup.h trunk/src/widgets/abstractbutton.cpp trunk/src/widgets/buttongroup.cpp Modified: trunk/include/saggui/widgets/abstractbutton.h =================================================================== --- trunk/include/saggui/widgets/abstractbutton.h 2007-07-21 23:32:36 UTC (rev 448) +++ trunk/include/saggui/widgets/abstractbutton.h 2007-07-24 02:08:31 UTC (rev 449) @@ -115,9 +115,9 @@ bool isAutoExclusive() const; //! Assign button to certain button group - void setGroup(buttonGroup *group); - - //! Get button group of button + void setGroup(buttonGroup *group); + + //! Get button group of button buttonGroup *getGroup() const; //! \name PUBLIC SLOTS @@ -136,9 +136,6 @@ //! \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 setClickSystem(mouseButtons type); - - //! Performs specific actions when this window is connected to a parent - virtual void doParentConnectActions(); private: bool autoExclusive; bool autoRepeat; @@ -148,8 +145,6 @@ bool checked; bool down; graphic *icon; - /* coord iconSize; */ - /* shortcut : QKeySequence */ std::string text; buttonGroup *bGroup; Modified: trunk/include/saggui/widgets/buttongroup.h =================================================================== --- trunk/include/saggui/widgets/buttongroup.h 2007-07-21 23:32:36 UTC (rev 448) +++ trunk/include/saggui/widgets/buttongroup.h 2007-07-24 02:08:31 UTC (rev 449) @@ -67,7 +67,6 @@ //! Add a button to this button group void addButton(abstractButton *); - /*void addButton(abstractButton *, int id);*/ //! Remove button from this button group void removeButton(abstractButton *); @@ -77,11 +76,9 @@ //! Return currently checked button (if exclusive) abstractButton * checkedButton() const; - // no setter on purpose! //! Returns a button according to its ID abstractButton *button(int id) const; - /*void setId(abstractButton *button, int id);*/ //! returns the ID of the given button int id(abstractButton *button) const; Modified: trunk/src/widgets/abstractbutton.cpp =================================================================== --- trunk/src/widgets/abstractbutton.cpp 2007-07-21 23:32:36 UTC (rev 448) +++ trunk/src/widgets/abstractbutton.cpp 2007-07-24 02:08:31 UTC (rev 449) @@ -156,12 +156,7 @@ void abstractButton::setGroup(buttonGroup *group) { // need to setup groups - if(this->bGroup) - { - delete this->bGroup; - this->bGroup = group; - } - else this->bGroup = group; + this->bGroup = group; } buttonGroup *abstractButton::getGroup() const @@ -253,76 +248,12 @@ } } - // Performs specific actions when this window is connected to a parent - void abstractButton::doParentConnectActions() - { - bool otherBtnGroup = false; - std::vector<window *> temp1 = this->getAbsoluteParent()->getChildren(); - std::vector<window *>::iterator pBegin = temp1.begin(); - std::vector<window *>::iterator pEnd = temp1.end(); - for(std::vector<window *>::iterator i = pBegin;i!=pEnd;++i) - { - std::vector<window *> temp2 = (*i)->getChildren(); - std::vector<window *>::iterator cBegin = temp2.begin(); - std::vector<window *>::iterator cEnd = temp2.end(); - for(std::vector<window *>::iterator j = cBegin;j!=cEnd;++j) - { - abstractButton *btn = dynamic_cast<abstractButton *>((*j)); - if(btn) - { - if(btn->bGroup) - { - this->setGroup(btn->bGroup); - otherBtnGroup = true; - break; - } - } - } - if(!otherBtnGroup) - { - abstractButton *btn = dynamic_cast<abstractButton *>((*i)); - if(btn) - { - if(btn->bGroup) - { - this->setGroup(btn->bGroup); - otherBtnGroup = true; - break; - } - } - } - } - if(!otherBtnGroup) - { - this->setGroup(new buttonGroup()); - for(std::vector<window *>::iterator i = pBegin;i!=pEnd;++i) - { - std::vector<window *> temp2 = (*i)->getChildren(); - std::vector<window *>::iterator cBegin = temp2.begin(); - std::vector<window *>::iterator cEnd = temp2.end(); - for(std::vector<window *>::iterator j = cBegin;j!=cEnd;++j) - { - abstractButton *btn = dynamic_cast<abstractButton *>((*j)); - if(btn) - { - btn->setGroup(this->bGroup); - } - } - abstractButton *btn = dynamic_cast<abstractButton *>((*i)); - if(btn) - { - btn->setGroup(this->bGroup); - } - } - } - } - slot abstractButton::onClicked(const coord &pos) { if(bGroup) { - bGroup->buttonClickedObj(this); - bGroup->buttonClickedID(getID()); + bGroup->buttonClickedObj.emit(this); + bGroup->buttonClickedID.emit(getID()); } } @@ -330,8 +261,8 @@ { if(bGroup) { - bGroup->buttonPressedObj(this); - bGroup->buttonPressedID(getID()); + bGroup->buttonPressedObj.emit(this); + bGroup->buttonPressedID.emit(getID()); } } @@ -339,8 +270,8 @@ { if(bGroup) { - bGroup->buttonReleasedObj(this); - bGroup->buttonReleasedID(getID()); + bGroup->buttonReleasedObj.emit(this); + bGroup->buttonReleasedID.emit(getID()); } } } Modified: trunk/src/widgets/buttongroup.cpp =================================================================== --- trunk/src/widgets/buttongroup.cpp 2007-07-21 23:32:36 UTC (rev 448) +++ trunk/src/widgets/buttongroup.cpp 2007-07-24 02:08:31 UTC (rev 449) @@ -66,7 +66,6 @@ this->group.push_back(button); } - /*void addButton(abstractButton *, int id);*/ void buttonGroup::removeButton(abstractButton *button) { this->group.remove(button); @@ -106,7 +105,7 @@ return 0; } - /*void setId(abstractButton *button, int id);*/ + int buttonGroup::id(abstractButton *button) const { if(button)return button->getID(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-07-21 23:32:39
|
Revision: 448 http://saggui.svn.sourceforge.net/saggui/?rev=448&view=rev Author: juvinious Date: 2007-07-21 16:32:36 -0700 (Sat, 21 Jul 2007) Log Message: ----------- Fixed winMain@16 error due to the order of the libs in the SDL module as well as bmpdump-sdl Modified Paths: -------------- trunk/modules/sdl/CMakeLists.txt trunk/utils/bmpdump/CMakeLists.txt Modified: trunk/modules/sdl/CMakeLists.txt =================================================================== --- trunk/modules/sdl/CMakeLists.txt 2007-07-13 12:11:01 UTC (rev 447) +++ trunk/modules/sdl/CMakeLists.txt 2007-07-21 23:32:36 UTC (rev 448) @@ -12,7 +12,11 @@ src/sdl_gfx.cpp src/sdl_keyinput.cpp src/sdl_mouse.cpp src/sdl_system.cpp) add_library(saggui-sdl ${CREATE_STATIC_LIB} ${SDL_SRC}) -target_link_libraries(saggui-sdl ${SDL_LIBRARY}) +if(MINGW) + target_link_libraries(saggui-sdl ${SDL_LIBRARY} -lSDLmain) +else(MINGW) + target_link_libraries(saggui-sdl ${SDL_LIBRARY}) +endif(MINGW) file(GLOB HEADERS ${CMAKE_SOURCE_DIR}/modules/sdl/include/*.h) foreach(f ${HEADERS}) Modified: trunk/utils/bmpdump/CMakeLists.txt =================================================================== --- trunk/utils/bmpdump/CMakeLists.txt 2007-07-13 12:11:01 UTC (rev 447) +++ trunk/utils/bmpdump/CMakeLists.txt 2007-07-21 23:32:36 UTC (rev 448) @@ -28,7 +28,11 @@ if(ENABLE_SDL) add_executable(bmpdump-sdl bmpdump-sdl.cpp) - target_link_libraries(bmpdump-sdl ${SDL_LIBRARY}) + if(MINGW) + target_link_libraries(bmpdump-sdl ${SDL_LIBRARY} -lSDLmain) + else(MINGW) + target_link_libraries(bmpdump-sdl ${SDL_LIBRARY}) + endif(MINGW) install(TARGETS bmpdump-sdl DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) endif(ENABLE_SDL) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-07-13 12:11:04
|
Revision: 447 http://saggui.svn.sourceforge.net/saggui/?rev=447&view=rev Author: juvinious Date: 2007-07-13 05:11:01 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Moddified changelog to ready for another release Modified Paths: -------------- trunk/CHANGELOG Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-07-03 23:46:37 UTC (rev 446) +++ trunk/CHANGELOG 2007-07-13 12:11:01 UTC (rev 447) @@ -1,4 +1,4 @@ -0.45 +0.45 07-13-07 - Added new member to window doParentConnectActions - Fixed up listBox to work more like a real combo box - Added setPosition to mouse and mouseManager to move the mouse This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-07-03 23:46:40
|
Revision: 446 http://saggui.svn.sourceforge.net/saggui/?rev=446&view=rev Author: juvinious Date: 2007-07-03 16:46:37 -0700 (Tue, 03 Jul 2007) Log Message: ----------- Added some fixes to abstractbutton and buttongroup as well as window Modified Paths: -------------- trunk/README trunk/include/saggui/widgets/abstractbutton.h trunk/include/saggui/widgets/buttongroup.h trunk/include/saggui/window.h trunk/src/widgets/abstractbutton.cpp trunk/src/window.cpp Modified: trunk/README =================================================================== --- trunk/README 2007-05-15 21:51:43 UTC (rev 445) +++ trunk/README 2007-07-03 23:46:37 UTC (rev 446) @@ -1,3 +1,9 @@ + ______ ______ ______ ______ __ __ __ +/\ ___\ /\ __ \ /\ ___\ /\ ___\ /\ \/\ \ /\ \ +\ \___ \\ \ __ \\ \ \__ \\ \ \__ \\ \ \_\ \\ \ \ + \/\_____\\ \_\ \_\\ \_____\\ \_____\\ \_____\\ \_\ + \/_____/ \/_/\/_/ \/_____/ \/_____/ \/_____/ \/_/ + Introduction This is a project aimed towards making a simplified GUI Library originally intended to be used Modified: trunk/include/saggui/widgets/abstractbutton.h =================================================================== --- trunk/include/saggui/widgets/abstractbutton.h 2007-05-15 21:51:43 UTC (rev 445) +++ trunk/include/saggui/widgets/abstractbutton.h 2007-07-03 23:46:37 UTC (rev 446) @@ -70,7 +70,7 @@ //! Set icon if button makes use of icons void setIcon(graphic *icon); - //! Get current set icon + //! Get current set icon graphic *getIcon() const; //! Returns the size of the icon @@ -78,6 +78,7 @@ //! Set whether button is checkable void setCheckable(bool); + //! Is button checkable? bool isCheckable() const; @@ -91,6 +92,7 @@ //! Set whether button auto repeats void setAutoRepeat(bool); + //! Is button auto repeatable? bool getAutoRepeat() const; @@ -102,6 +104,7 @@ //! Set auto repeat interval (milliseconds) void setAutoRepeatInterval(int); + //! Get auto repeat interval (milliseconds) int getAutoRepeatInterval() const; @@ -135,7 +138,7 @@ virtual slot setClickSystem(mouseButtons type); //! Performs specific actions when this window is connected to a parent - virtual void doParentConnectActions(); + virtual void doParentConnectActions(); private: bool autoExclusive; bool autoRepeat; Modified: trunk/include/saggui/widgets/buttongroup.h =================================================================== --- trunk/include/saggui/widgets/buttongroup.h 2007-05-15 21:51:43 UTC (rev 445) +++ trunk/include/saggui/widgets/buttongroup.h 2007-07-03 23:46:37 UTC (rev 446) @@ -62,7 +62,7 @@ //! Set exclusive property for buttons in group void setExclusive(bool); - //! Set is button group exclusive? + //! Set is button group exclusive? bool isExclusive() const; //! Add a button to this button group @@ -70,7 +70,7 @@ /*void addButton(abstractButton *, int id);*/ //! Remove button from this button group - void removeButton(abstractButton *); + void removeButton(abstractButton *); //! Get a list of existing buttons std::list<abstractButton*> buttons() const; @@ -84,10 +84,10 @@ /*void setId(abstractButton *button, int id);*/ //! returns the ID of the given button - int id(abstractButton *button) const; + int id(abstractButton *button) const; //! Returns the ID of the current checked button (if exclusive) - int checkedId() const; + int checkedId() const; //! \name SIGNALS signal1<abstractButton *> buttonClickedObj; Modified: trunk/include/saggui/window.h =================================================================== --- trunk/include/saggui/window.h 2007-05-15 21:51:43 UTC (rev 445) +++ trunk/include/saggui/window.h 2007-07-03 23:46:37 UTC (rev 446) @@ -125,6 +125,9 @@ //! Return this instances parent window *getParent(); + + //! Get top most parent + window *getAbsoluteParent(); //! Add child void addChild(window *c); @@ -214,9 +217,6 @@ //! Get parent position if not return this->position coord getParentClipped(coord c); - //! Get top most parent - window *getAbsoluteParent(); - //! click system type static mouseButtons clickType; Modified: trunk/src/widgets/abstractbutton.cpp =================================================================== --- trunk/src/widgets/abstractbutton.cpp 2007-05-15 21:51:43 UTC (rev 445) +++ trunk/src/widgets/abstractbutton.cpp 2007-07-03 23:46:37 UTC (rev 446) @@ -104,9 +104,9 @@ return this->checked; } - void abstractButton::setDown(bool) + void abstractButton::setDown(bool down) { - + this->down = down; } bool abstractButton::isDown() const @@ -114,8 +114,9 @@ return this->down; } - void abstractButton::setAutoRepeat(bool) + void abstractButton::setAutoRepeat(bool autoRepeat) { + this->autoRepeat = autoRepeat; } bool abstractButton::getAutoRepeat() const @@ -123,8 +124,9 @@ return this->autoRepeat; } - void abstractButton::setAutoRepeatDelay(int) + void abstractButton::setAutoRepeatDelay(int autoRepeatDelay) { + this->autoRepeatDelay = autoRepeatDelay; } int abstractButton::getAutoRepeatDelay() const @@ -132,16 +134,18 @@ return this->autoRepeatDelay; } - void abstractButton::setAutoRepeatInterval(int) + void abstractButton::setAutoRepeatInterval(int autoRepeatInterval) { + this->autoRepeatInterval = autoRepeatInterval; } int abstractButton::getAutoRepeatInterval() const { return this->autoRepeatInterval; } - void abstractButton::setAutoExclusive(bool) + void abstractButton::setAutoExclusive(bool autoExclusive) { + this->autoExclusive = autoExclusive; } bool abstractButton::isAutoExclusive() const @@ -151,6 +155,13 @@ void abstractButton::setGroup(buttonGroup *group) { + // need to setup groups + if(this->bGroup) + { + delete this->bGroup; + this->bGroup = group; + } + else this->bGroup = group; } buttonGroup *abstractButton::getGroup() const @@ -172,9 +183,9 @@ } - slot abstractButton::setChecked(bool) + slot abstractButton::setChecked(bool checkable) { - + this->checkable = checkable; } // Set click system @@ -245,7 +256,65 @@ // Performs specific actions when this window is connected to a parent void abstractButton::doParentConnectActions() { - + bool otherBtnGroup = false; + std::vector<window *> temp1 = this->getAbsoluteParent()->getChildren(); + std::vector<window *>::iterator pBegin = temp1.begin(); + std::vector<window *>::iterator pEnd = temp1.end(); + for(std::vector<window *>::iterator i = pBegin;i!=pEnd;++i) + { + std::vector<window *> temp2 = (*i)->getChildren(); + std::vector<window *>::iterator cBegin = temp2.begin(); + std::vector<window *>::iterator cEnd = temp2.end(); + for(std::vector<window *>::iterator j = cBegin;j!=cEnd;++j) + { + abstractButton *btn = dynamic_cast<abstractButton *>((*j)); + if(btn) + { + if(btn->bGroup) + { + this->setGroup(btn->bGroup); + otherBtnGroup = true; + break; + } + } + } + if(!otherBtnGroup) + { + abstractButton *btn = dynamic_cast<abstractButton *>((*i)); + if(btn) + { + if(btn->bGroup) + { + this->setGroup(btn->bGroup); + otherBtnGroup = true; + break; + } + } + } + } + if(!otherBtnGroup) + { + this->setGroup(new buttonGroup()); + for(std::vector<window *>::iterator i = pBegin;i!=pEnd;++i) + { + std::vector<window *> temp2 = (*i)->getChildren(); + std::vector<window *>::iterator cBegin = temp2.begin(); + std::vector<window *>::iterator cEnd = temp2.end(); + for(std::vector<window *>::iterator j = cBegin;j!=cEnd;++j) + { + abstractButton *btn = dynamic_cast<abstractButton *>((*j)); + if(btn) + { + btn->setGroup(this->bGroup); + } + } + abstractButton *btn = dynamic_cast<abstractButton *>((*i)); + if(btn) + { + btn->setGroup(this->bGroup); + } + } + } } slot abstractButton::onClicked(const coord &pos) Modified: trunk/src/window.cpp =================================================================== --- trunk/src/window.cpp 2007-05-15 21:51:43 UTC (rev 445) +++ trunk/src/window.cpp 2007-07-03 23:46:37 UTC (rev 446) @@ -153,7 +153,7 @@ void window::doParentConnectActions() { // Nothing we are not connected to a parent - } + } window *window::getParent() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-15 21:51:55
|
Revision: 445 http://saggui.svn.sourceforge.net/saggui/?rev=445&view=rev Author: juvinious Date: 2007-05-15 14:51:43 -0700 (Tue, 15 May 2007) Log Message: ----------- Added member to window, worked on abstractButton and buttonGroup Modified Paths: -------------- trunk/CHANGELOG trunk/include/saggui/widgets/abstractbutton.h trunk/include/saggui/widgets/buttongroup.h trunk/include/saggui/window.h trunk/src/widgets/abstractbutton.cpp trunk/src/window.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-05-10 21:11:01 UTC (rev 444) +++ trunk/CHANGELOG 2007-05-15 21:51:43 UTC (rev 445) @@ -1,4 +1,5 @@ -0.44 +0.45 +- Added new member to window doParentConnectActions - Fixed up listBox to work more like a real combo box - Added setPosition to mouse and mouseManager to move the mouse - Added new widget listbox @@ -100,4 +101,4 @@ - Deprecated and removed cbuild build system 0.01 11-28-2006 -Initial official release of library \ No newline at end of file +Initial official release of library Modified: trunk/include/saggui/widgets/abstractbutton.h =================================================================== --- trunk/include/saggui/widgets/abstractbutton.h 2007-05-10 21:11:01 UTC (rev 444) +++ trunk/include/saggui/widgets/abstractbutton.h 2007-05-15 21:51:43 UTC (rev 445) @@ -46,67 +46,96 @@ namespace saggui { + //! Forward declaration + class buttonGroup; + //! abstractButton /*! * An abstract button representing different types of buttons, radials, etc */ - - - class buttonGroup; - class SAGGUI_EXPORT abstractButton : public window, mouseEvents, keyEvents { public: + //! Constructor explicit abstractButton(); + //! Destructor virtual ~abstractButton(); + //! Set current text of button void setText(const std::string &text); + + //! Get current text of button std::string getText() const; + //! Set icon if button makes use of icons void setIcon(graphic *icon); + + //! Get current set icon graphic *getIcon() const; + //! Returns the size of the icon coord iconSize() const; - + + //! Set whether button is checkable void setCheckable(bool); + //! Is button checkable? bool isCheckable() const; + //! Is button checked? bool isChecked() const; + //! Set button state down void setDown(bool); + //! Is button state down? bool isDown() const; + //! Set whether button auto repeats void setAutoRepeat(bool); + //! Is button auto repeatable? bool getAutoRepeat() const; + //! Set auto repeat delay (milliseconds) void setAutoRepeatDelay(int); + + //! Get auto repeat delay (milliseconds) int getAutoRepeatDelay() const; + //! Set auto repeat interval (milliseconds) void setAutoRepeatInterval(int); + //! Get auto repeat interval (milliseconds) int getAutoRepeatInterval() const; + //! Set whether button is auto exclusive void setAutoExclusive(bool); + + //! Is button auto exclusive bool isAutoExclusive() const; - void setGroup(buttonGroup *group); + //! Assign button to certain button group + void setGroup(buttonGroup *group); + + //! Get button group of button buttonGroup *getGroup() const; - //public Q_SLOTS: + //! \name PUBLIC SLOTS slot animateClick(int msec = 100); slot click(const coord &pos); slot toggle(); slot setChecked(bool); - //Q_SIGNALS: + //! \name SIGNALS signal0<> pressed; signal0<> released; signal0<> clicked; signal0<> toggled; protected: + //! \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 setClickSystem(mouseButtons type); + + //! Performs specific actions when this window is connected to a parent + virtual void doParentConnectActions(); private: bool autoExclusive; bool autoRepeat; Modified: trunk/include/saggui/widgets/buttongroup.h =================================================================== --- trunk/include/saggui/widgets/buttongroup.h 2007-05-10 21:11:01 UTC (rev 444) +++ trunk/include/saggui/widgets/buttongroup.h 2007-05-15 21:51:43 UTC (rev 445) @@ -44,30 +44,52 @@ namespace saggui { + + //! Button Group + /*! + * A button group houses a collection of buttons for + * relating and processing interactions between them + */ + class SAGGUI_EXPORT buttonGroup { public: + //! Constructor explicit buttonGroup(); + //! Destructor ~buttonGroup(); + //! Set exclusive property for buttons in group void setExclusive(bool); + + //! Set is button group exclusive? bool isExclusive() const; + //! Add a button to this button group void addButton(abstractButton *); /*void addButton(abstractButton *, int id);*/ - void removeButton(abstractButton *); + //! Remove button from this button group + void removeButton(abstractButton *); + + //! Get a list of existing buttons std::list<abstractButton*> buttons() const; + //! Return currently checked button (if exclusive) abstractButton * checkedButton() const; // no setter on purpose! + //! Returns a button according to its ID abstractButton *button(int id) const; /*void setId(abstractButton *button, int id);*/ - int id(abstractButton *button) const; - int checkedId() const; - //Q_SIGNALS: + //! returns the ID of the given button + int id(abstractButton *button) const; + + //! Returns the ID of the current checked button (if exclusive) + int checkedId() const; + + //! \name SIGNALS signal1<abstractButton *> buttonClickedObj; signal1<int> buttonClickedID; signal1<abstractButton *> buttonPressedObj; Modified: trunk/include/saggui/window.h =================================================================== --- trunk/include/saggui/window.h 2007-05-10 21:11:01 UTC (rev 444) +++ trunk/include/saggui/window.h 2007-05-15 21:51:43 UTC (rev 445) @@ -184,6 +184,9 @@ //! Set clickable system virtual slot setClickSystem(mouseButtons type); + //! Performs specific actions when this window is connected to a parent + virtual void doParentConnectActions(); + //! Signal emitted when connected to a parent signal1<window *>onParentConnect; Modified: trunk/src/widgets/abstractbutton.cpp =================================================================== --- trunk/src/widgets/abstractbutton.cpp 2007-05-10 21:11:01 UTC (rev 444) +++ trunk/src/widgets/abstractbutton.cpp 2007-05-15 21:51:43 UTC (rev 445) @@ -174,7 +174,7 @@ slot abstractButton::setChecked(bool) { - + } // Set click system @@ -242,6 +242,12 @@ } } + // Performs specific actions when this window is connected to a parent + void abstractButton::doParentConnectActions() + { + + } + slot abstractButton::onClicked(const coord &pos) { if(bGroup) Modified: trunk/src/window.cpp =================================================================== --- trunk/src/window.cpp 2007-05-10 21:11:01 UTC (rev 444) +++ trunk/src/window.cpp 2007-05-15 21:51:43 UTC (rev 445) @@ -149,6 +149,12 @@ //nothing we don't have mouse events } + // Performs specific actions when this window is connected to a parent + void window::doParentConnectActions() + { + // Nothing we are not connected to a parent + } + window *window::getParent() { return parent; @@ -173,6 +179,7 @@ { parent = p; parent->children.push_back(this); + doParentConnectActions(); onParentConnect.emit(p); } @@ -180,6 +187,7 @@ { children.push_back(c); c->parent = this; + c->doParentConnectActions(); c->onParentConnect.emit(this); guiManager::fixWindow(c); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-10 21:11:11
|
Revision: 444 http://saggui.svn.sourceforge.net/saggui/?rev=444&view=rev Author: juvinious Date: 2007-05-10 14:11:01 -0700 (Thu, 10 May 2007) Log Message: ----------- fixed warning in textBox under windows Modified Paths: -------------- trunk/src/widgets/text_box.cpp Modified: trunk/src/widgets/text_box.cpp =================================================================== --- trunk/src/widgets/text_box.cpp 2007-05-09 20:56:24 UTC (rev 443) +++ trunk/src/widgets/text_box.cpp 2007-05-10 21:11:01 UTC (rev 444) @@ -96,7 +96,7 @@ colors.push(originalColor); std::map<int, rgba>colTemp; - for(unsigned int i = 0; i<textWork.length();++i) + for(int i = 0; i<int(textWork.length());++i) { // Check our text for color codes before giving it over to the parser if(textWork[i]=='\\') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-09 20:56:32
|
Revision: 443 http://saggui.svn.sourceforge.net/saggui/?rev=443&view=rev Author: juvinious Date: 2007-05-09 13:56:24 -0700 (Wed, 09 May 2007) Log Message: ----------- Fixed up listbox to be useable. Added new members to mouse, mouseManager and window classes Modified Paths: -------------- trunk/CHANGELOG trunk/examples/widgets/src/widgets.cpp trunk/include/saggui/mouse.h trunk/include/saggui/mouse_manager.h trunk/include/saggui/widgets/listbox.h trunk/include/saggui/window.h trunk/modules/allegro/include/al_mouse.h trunk/modules/allegro/src/al_mouse.cpp trunk/modules/sdl/include/sdl_mouse.h trunk/modules/sdl/src/sdl_mouse.cpp trunk/src/mouse_manager.cpp trunk/src/scheme.cpp trunk/src/style.cpp trunk/src/widgets/listbox.cpp trunk/src/window.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/CHANGELOG 2007-05-09 20:56:24 UTC (rev 443) @@ -1,4 +1,6 @@ -0.43 +0.44 +- Fixed up listBox to work more like a real combo box +- Added setPosition to mouse and mouseManager to move the mouse - Added new widget listbox - Added in two new button type (buttonGroup & abstractButton) classes to improve the existing button and radial widgets and accomodate newer ones (juvinious) - Added in scons build SConstruct file (kazzmir) Modified: trunk/examples/widgets/src/widgets.cpp =================================================================== --- trunk/examples/widgets/src/widgets.cpp 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/examples/widgets/src/widgets.cpp 2007-05-09 20:56:24 UTC (rev 443) @@ -142,6 +142,8 @@ static textBox *textArea = 0; +static listBox *lb = 0; + widgetContainer::widgetContainer() { // Nothing @@ -214,6 +216,15 @@ text3->setText("Fullscreen"); text3->onLeftClick.connect(container,&widgetContainer::onLabel3Click); + lb = new listBox(); + lb->position.set(10,290,100,20); + lb->addItem("One"); + lb->addItem("Two"); + lb->addItem("Three"); + lb->addItem("Four"); + lb->addItem("Five"); + lb->addItem("Six"); + mainBox->addChild(logoBox); mainBox->addChild(textArea); mainBox->addChild(radial1); @@ -224,6 +235,7 @@ mainBox->addChild(pushButton1); mainBox->addChild(cb1); mainBox->addChild(text3); + mainBox->addChild(lb); } @@ -246,6 +258,8 @@ delete cb1; delete text3; + + delete lb; } void widgetContainer::textChange() Modified: trunk/include/saggui/mouse.h =================================================================== --- trunk/include/saggui/mouse.h 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/include/saggui/mouse.h 2007-05-09 20:56:24 UTC (rev 443) @@ -109,6 +109,9 @@ //! Updates the mouse ie polling and setting keys virtual void update()=0; + + //! Sets the mouse pointer to specific location + virtual void setPosition(int x, int y)=0; }; } #endif Modified: trunk/include/saggui/mouse_manager.h =================================================================== --- trunk/include/saggui/mouse_manager.h 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/include/saggui/mouse_manager.h 2007-05-09 20:56:24 UTC (rev 443) @@ -244,6 +244,9 @@ //! Get currentMousePosition static coord getPosition(); + //! Set currentMousePosition + static void setPosition(int x, int y); + //! \name Signals static signal1<const coord &> move; Modified: trunk/include/saggui/widgets/listbox.h =================================================================== --- trunk/include/saggui/widgets/listbox.h 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/include/saggui/widgets/listbox.h 2007-05-09 20:56:24 UTC (rev 443) @@ -69,7 +69,7 @@ void clearItems(); //! \name SIGNALS - signal1<int> itemSelected; + signal1<unsigned int> itemSelected; protected: slot resized(); @@ -77,6 +77,8 @@ slot drawOnButton(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); slot showPopUp(); + + slot showPopUp(const coord &c); slot hidePopUp(); Modified: trunk/include/saggui/window.h =================================================================== --- trunk/include/saggui/window.h 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/include/saggui/window.h 2007-05-09 20:56:24 UTC (rev 443) @@ -144,6 +144,9 @@ //! Add style void setStyle(style *d); + //! Set winType + void setWinType(winType wt); + //! Is the mouse over it? bool mouseOver(); Modified: trunk/modules/allegro/include/al_mouse.h =================================================================== --- trunk/modules/allegro/include/al_mouse.h 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/modules/allegro/include/al_mouse.h 2007-05-09 20:56:24 UTC (rev 443) @@ -69,6 +69,8 @@ ~allegroMouse(); //! Updates the mouse ie polling and setting keys void update(); + //! Sets the mouse Position + void setPosition(int x, int y); }; } Modified: trunk/modules/allegro/src/al_mouse.cpp =================================================================== --- trunk/modules/allegro/src/al_mouse.cpp 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/modules/allegro/src/al_mouse.cpp 2007-05-09 20:56:24 UTC (rev 443) @@ -95,6 +95,13 @@ lastScroll = mouse_z; } } + + + //! Sets mouse position + void allegroMouse::setPosition(int x, int y) + { + position_mouse(x,y); + } } #endif Modified: trunk/modules/sdl/include/sdl_mouse.h =================================================================== --- trunk/modules/sdl/include/sdl_mouse.h 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/modules/sdl/include/sdl_mouse.h 2007-05-09 20:56:24 UTC (rev 443) @@ -63,6 +63,8 @@ ~sdlMouse(); //! Updates the mouse ie polling and setting keys void update(); + //! Sets the mouse Position + void setPosition(int x, int y); }; } Modified: trunk/modules/sdl/src/sdl_mouse.cpp =================================================================== --- trunk/modules/sdl/src/sdl_mouse.cpp 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/modules/sdl/src/sdl_mouse.cpp 2007-05-09 20:56:24 UTC (rev 443) @@ -107,6 +107,12 @@ } } } + + //! Sets the mouse Position + void sdlMouse::setPosition(int x, int y) + { + SDL_WarpMouse(x,y); + } } #endif Modified: trunk/src/mouse_manager.cpp =================================================================== --- trunk/src/mouse_manager.cpp 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/src/mouse_manager.cpp 2007-05-09 20:56:24 UTC (rev 443) @@ -1059,6 +1059,15 @@ return coord(0,0,0,0); } + + //! Sets the mouse Position + void mouseManager::setPosition(int x, int y) + { + if((getInstance())->mousePointer) + { + (getInstance())->mousePointer->setPosition(x,y); + } + } } #endif /* MOUSE_MANAGER_CPP */ Modified: trunk/src/scheme.cpp =================================================================== --- trunk/src/scheme.cpp 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/src/scheme.cpp 2007-05-09 20:56:24 UTC (rev 443) @@ -66,10 +66,10 @@ colors[S_StandardFg] = rgba(85,85,85,255); colors[S_StandardFgBlend] = rgba(225,225,225,255); colors[S_StandardText] = rgba(0,0,0,255); - colors[S_WindowBg] = rgba(255,255,255,255); - colors[S_WindowBgBlend] = rgba(200,200,200,255); - colors[S_WindowFg] = rgba(128,128,128,255); - colors[S_WindowFgBlend] = rgba(100,100,100,255); + colors[S_WindowBg] = rgba(150,150,150,255); + colors[S_WindowBgBlend] = rgba(110,110,110,255); + colors[S_WindowFg] = rgba(85,85,85,255); + colors[S_WindowFgBlend] = rgba(255,255,255,255); colors[S_WindowText] = rgba(0,0,0,255); colors[S_ActiveTitleBg] = rgba(255,255,255,255); colors[S_ActiveTitleBgBlend] = rgba(255,255,255,255); Modified: trunk/src/style.cpp =================================================================== --- trunk/src/style.cpp 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/src/style.cpp 2007-05-09 20:56:24 UTC (rev 443) @@ -78,7 +78,7 @@ { 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,rgba(150,150,150,255)); + 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); } @@ -108,7 +108,7 @@ 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::BLACK); + bmp->doLine(size.x,size.y+size.height,size.x + size.width,size.y+size.height,rgba::WHITE); } else { @@ -139,7 +139,7 @@ slot defaultDialogStyle::drawBackground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) { - bmp->doRectfill(size.x,size.y,size.width,size.height,colors[S_WindowBg]); + bmp->doRectfill(size.x,size.y,size.width,size.height,rgba::WHITE); } slot defaultDialogStyle::drawForeground(const coord &size, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) Modified: trunk/src/widgets/listbox.cpp =================================================================== --- trunk/src/widgets/listbox.cpp 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/src/widgets/listbox.cpp 2007-05-09 20:56:24 UTC (rev 443) @@ -40,11 +40,15 @@ #define LISTBOX_CPP #include "saggui/widgets/listbox.h" +#include "saggui/mouse_manager.h" namespace saggui { - listBox::listBox() : mouseEvents(this), keyEvents(this) + listBox::listBox() : window(W_ComboBox), mouseEvents(this), keyEvents(this) { + chosen.setWinType(W_ComboBox); + chosen.wColors[S_WindowBg] = rgba::WHITE; + chosen.wColors[S_WindowBgBlend] = rgba::WHITE; chosen.setHorizontalAlign(0); addChild(&chosen); @@ -75,6 +79,9 @@ label *temp = new label(); temp->setHorizontalAlign(0); temp->setText(text); + temp->setWinType(W_ComboBox); + temp->wColors[S_WindowBg] = rgba::WHITE; + temp->wColors[S_WindowBgBlend] = rgba::WHITE; if(itemList.empty()) { chosen.setText(text); @@ -149,61 +156,78 @@ listSize+=position.height; popUp.addChild((*i)); (*i)->onHover.connect(this,&listBox::onHoverItem); - switch(currentType) - { - case M_Left: - { - (*i)->onLeftDown.connect(this,&listBox::onSelectItem); - break; - } - case M_Right: - { - (*i)->onRightDown.connect(this,&listBox::onSelectItem); - break; - } - case M_Middle: - { - (*i)->onRightDown.connect(this,&listBox::onSelectItem); - break; - } - } } popUp.position.setHeight(listSize); + if(popUp.getRelativePosition().getY2() > guiManager::getScreen()->getBmpHeight()) + { + popUp.position.setY((position.y - listSize) - 1); + } + highlightedItem = currentItem; + itemList[currentItem]->setAttribute(AT_On,true); + mouseManager::setPosition(int(itemList[highlightedItem]->getRelativePosition().getX2() - (itemList[highlightedItem]->position.width/2)),int(itemList[highlightedItem]->getRelativePosition().getY2() - (itemList[highlightedItem]->position.height/2))); } + + slot listBox::showPopUp(const coord &c) + { + showPopUp(); + } slot listBox::hidePopUp() { popUp.setAttribute(AT_Visible | AT_Enabled, false); popUp.setAlwaysOnTop(false); popUp.position.set(0,0,0,0); + int location = 0; std::vector<label *>::iterator ibegin = itemList.begin(); std::vector<label *>::iterator iend = itemList.end(); for(std::vector<label *>::iterator i = ibegin;i!=iend;++i) { popUp.removeChild((*i)); + (*i)->onHover.disconnect(this); + (*i)->onPaint.disconnect(this); + if(((*i)->attributes & AT_Selected) && ((*i)->attributes & AT_On)) + { + (*i)->onPaint.disconnect(this); + (*i)->setAttribute(AT_Selected,false); + chosen.setText((*i)->getText()); + itemSelected.emit(location); + highlightedItem = currentItem = location; + guiManager::setWindowFocused(&chosen); + } + else if(((*i)->attributes & AT_Selected) && ((*i)->attributes & AT_MouseOver)) + { + (*i)->onPaint.disconnect(this); + (*i)->setAttribute(AT_Selected,false); + chosen.setText((*i)->getText()); + itemSelected.emit(location); + highlightedItem = currentItem = location; + } + ++location; } } slot listBox::onHoverItem(const coord &pos) { - int location = 0; - std::vector<label *>::const_iterator ibegin = itemList.begin(); - std::vector<label *>::const_iterator iend = itemList.end(); - for(std::vector<label *>::const_iterator i = ibegin;i!=iend;++i) + for(unsigned int i = 0;i<itemList.size();++i) { - if((*i)->attributes & AT_Selected) + if(itemList[i]->attributes & AT_Selected) { - (*i)->onPaint.disconnect(this); - (*i)->setAttribute(AT_Selected,false); + itemList[i]->onPaint.disconnect(this); + itemList[i]->setAttribute(AT_Selected,false); } - if(((*i)->attributes & AT_MouseOver) || ((*i)->attributes & AT_On)) + if((itemList[i]->attributes & AT_On)) { - (*i)->onPaint.connect(this,&listBox::onHoverDraw); - (*i)->setAttribute(AT_Selected,true); - (*i)->setAttribute(AT_On,false); - highlightedItem = location; + itemList[i]->onPaint.connect(this,&listBox::onHoverDraw); + itemList[i]->setAttribute(AT_Selected,true); + itemList[i]->setAttribute(AT_On,false); + highlightedItem = i; } - ++location; + else if((itemList[i]->attributes & AT_MouseOver)) + { + itemList[i]->onPaint.connect(this,&listBox::onHoverDraw); + itemList[i]->setAttribute(AT_Selected,true); + highlightedItem = i; + } } } @@ -214,21 +238,19 @@ slot listBox::onSelectItem(const coord &pos) { - int location = 0; - std::vector<label *>::const_iterator ibegin = itemList.begin(); - std::vector<label *>::const_iterator iend = itemList.end(); - for(std::vector<label *>::const_iterator i = ibegin;i!=iend;++i) + for(unsigned int i = 0;i<itemList.size();++i) { - if((*i)->attributes & AT_Selected) + if(itemList[i]->attributes & AT_Selected) { - (*i)->onPaint.disconnect(this); - (*i)->setAttribute(AT_Selected,false); - chosen.setText((*i)->getText()); - itemSelected.emit(location); - currentItem = location; + itemList[i]->onPaint.disconnect(this); + itemList[i]->setAttribute(AT_Selected,false); + chosen.setText(itemList[i]->getText()); + itemSelected.emit(i); + highlightedItem = currentItem = i; + guiManager::setWindowFocused(&chosen); + mouseManager::setPosition(int(chosen.getRelativePosition().getX2() - (chosen.position.width/2)),int(chosen.getRelativePosition().getY2() - (chosen.position.height/2))); break; } - ++location; } } @@ -238,19 +260,9 @@ { case keys::UP: showPopUp(); - if(!itemList.empty()) - { - itemList[currentItem]->setAttribute(AT_On,true); - itemList[currentItem]->onHover.emit(coord()); - } break; case keys::DOWN: showPopUp(); - if(!itemList.empty()) - { - itemList[currentItem]->setAttribute(AT_On,true); - itemList[currentItem]->onHover.emit(coord()); - } break; } } @@ -263,31 +275,28 @@ if(highlightedItem>0)highlightedItem--; else highlightedItem=itemList.size()-1; itemList[highlightedItem]->setAttribute(AT_On,true); - itemList[highlightedItem]->onHover.emit(coord()); + //itemList[highlightedItem]->onHover.emit(coord()); + mouseManager::setPosition(int(itemList[highlightedItem]->getRelativePosition().getX2() - (itemList[highlightedItem]->position.width/2)),int(itemList[highlightedItem]->getRelativePosition().getY2() - (itemList[highlightedItem]->position.height/2))); break; case keys::DOWN: if(highlightedItem<itemList.size()-1)highlightedItem++; else highlightedItem=0; itemList[highlightedItem]->setAttribute(AT_On,true); - itemList[highlightedItem]->onHover.emit(coord()); + //itemList[highlightedItem]->onHover.emit(coord()); + mouseManager::setPosition(int(itemList[highlightedItem]->getRelativePosition().getX2() - (itemList[highlightedItem]->position.width/2)),int(itemList[highlightedItem]->getRelativePosition().getY2() - (itemList[highlightedItem]->position.height/2))); break; case keys::ENTER: { - int location = 0; - std::vector<label *>::const_iterator ibegin = itemList.begin(); - std::vector<label *>::const_iterator iend = itemList.end(); - for(std::vector<label *>::const_iterator i = ibegin;i!=iend;++i) + onSelectItem(coord()); + hidePopUp(); + break; + } + case keys::ESC: + { + for(unsigned int i = 0;i<itemList.size();++i) { - if((*i)->attributes & AT_Selected) - { - (*i)->onPaint.disconnect(this); - (*i)->setAttribute(AT_Selected,false); - chosen.setText((*i)->getText()); - itemSelected.emit(location); - currentItem = location; - break; - } - ++location; + itemList[i]->onPaint.disconnect(this); + itemList[i]->setAttribute(AT_Selected,false); } hidePopUp(); break; @@ -299,6 +308,31 @@ slot listBox::setClickSystem(mouseButtons type) { currentType = type; + + switch(type) + { + case M_Left: + { + chosen.onMiddleClick.disconnect(this); + chosen.onRightClick.disconnect(this); + chosen.onLeftClick.connect(this,&listBox::showPopUp); + break; + } + case M_Right: + { + chosen.onMiddleClick.disconnect(this); + chosen.onLeftClick.disconnect(this); + chosen.onRightClick.connect(this,&listBox::showPopUp); + break; + } + case M_Middle: + { + chosen.onLeftClick.disconnect(this); + chosen.onRightClick.disconnect(this); + chosen.onMiddleClick.connect(this,&listBox::showPopUp); + break; + } + } } } Modified: trunk/src/window.cpp =================================================================== --- trunk/src/window.cpp 2007-05-09 06:18:54 UTC (rev 442) +++ trunk/src/window.cpp 2007-05-09 20:56:24 UTC (rev 443) @@ -207,6 +207,12 @@ onResize.emit(); } + + //! Set winType + void window::setWinType(winType wt) + { + windowType = wt; + } // bool window::mouseOver() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-09 06:18:56
|
Revision: 442 http://saggui.svn.sourceforge.net/saggui/?rev=442&view=rev Author: juvinious Date: 2007-05-08 23:18:54 -0700 (Tue, 08 May 2007) Log Message: ----------- Modified listbox to work a lot better. Modified Paths: -------------- trunk/include/saggui/widgets/listbox.h trunk/src/widgets/listbox.cpp Modified: trunk/include/saggui/widgets/listbox.h =================================================================== --- trunk/include/saggui/widgets/listbox.h 2007-05-09 03:27:25 UTC (rev 441) +++ trunk/include/saggui/widgets/listbox.h 2007-05-09 06:18:54 UTC (rev 442) @@ -41,6 +41,7 @@ #include "saggui/window.h" #include "saggui/mouse_events.h" +#include "saggui/key_events.h" #include "saggui/widgets/button.h" #include "saggui/widgets/label.h" #include "saggui/widgets/scroll_bar.h" @@ -52,17 +53,23 @@ * List Box is user selectable combo box. \n */ - class listBox : public window, public mouseEvents + class listBox : public window, public mouseEvents, public keyEvents { public: listBox(); ~listBox(); - // Add item + //! Add item void addItem(const std::string &text); + + //! Selected item + int selectedItem(); - // Clear items + //! Clear items void clearItems(); + + //! \name SIGNALS + signal1<int> itemSelected; protected: slot resized(); @@ -72,18 +79,39 @@ slot showPopUp(); slot hidePopUp(); + + 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 onSelectItem(const coord &pos); + + slot mainKeyPress(const keys &k); + + slot keyPress(const keys &k); + + slot setClickSystem(mouseButtons type); private: // Items //std::vector<std::string>itemList; std::vector<label *>itemList; + + //! Selected item if negative -1 no selection + int currentItem; + + //! Highlighted item + unsigned int highlightedItem; + + //! Current click system + mouseButtons currentType; - // Label to contain our chosen item + //! Label to contain our chosen item label chosen; - // Button for drop down + //! Button for drop down button showListButton; - // Popup for selectable list + //! Popup for selectable list box popUp; scrollBar sideBar; }; Modified: trunk/src/widgets/listbox.cpp =================================================================== --- trunk/src/widgets/listbox.cpp 2007-05-09 03:27:25 UTC (rev 441) +++ trunk/src/widgets/listbox.cpp 2007-05-09 06:18:54 UTC (rev 442) @@ -43,22 +43,28 @@ namespace saggui { - listBox::listBox() : mouseEvents(this) { + listBox::listBox() : mouseEvents(this), keyEvents(this) + { chosen.setHorizontalAlign(0); addChild(&chosen); onResize.connect(this,&listBox::resized); + + chosen.onKeyPress.connect(this,&listBox::mainKeyPress); addChild(&showListButton); showListButton.onButtonClick.connect(this,&listBox::showPopUp); showListButton.onPaint.connect(this,&listBox::drawOnButton); - //showListButton.onButtonClick.connect(this,&listBox::showPopUp); - + popUp.addChild(&sideBar); popUp.setAttribute(AT_Visible | AT_Enabled, false); popUp.onLostFocus.connect(this,&listBox::hidePopUp); + popUp.onKeyPress.connect(this,&listBox::keyPress); sideBar.setAttribute(AT_Visible | AT_Enabled, false); + + currentItem=-1; + highlightedItem=0; } listBox::~listBox() { } @@ -72,9 +78,16 @@ if(itemList.empty()) { chosen.setText(text); + currentItem = 0; } itemList.push_back(temp); } + + // Selected Item + int listBox::selectedItem() + { + return currentItem; + } // Clear items void listBox::clearItems() @@ -88,6 +101,7 @@ } itemList.clear(); chosen.setText(""); + currentItem = -1; } slot listBox::resized() @@ -117,6 +131,7 @@ slot listBox::showPopUp() { + if(itemList.empty())return; guiManager::setWindowFocused(&popUp); popUp.setAttribute(AT_Visible | AT_Enabled, true); popUp.setAlwaysOnTop(true); @@ -133,6 +148,25 @@ (*i)->position.set(0,listSize,position.width,position.height); listSize+=position.height; popUp.addChild((*i)); + (*i)->onHover.connect(this,&listBox::onHoverItem); + switch(currentType) + { + case M_Left: + { + (*i)->onLeftDown.connect(this,&listBox::onSelectItem); + break; + } + case M_Right: + { + (*i)->onRightDown.connect(this,&listBox::onSelectItem); + break; + } + case M_Middle: + { + (*i)->onRightDown.connect(this,&listBox::onSelectItem); + break; + } + } } popUp.position.setHeight(listSize); } @@ -149,6 +183,123 @@ popUp.removeChild((*i)); } } + + slot listBox::onHoverItem(const coord &pos) + { + int location = 0; + std::vector<label *>::const_iterator ibegin = itemList.begin(); + std::vector<label *>::const_iterator iend = itemList.end(); + for(std::vector<label *>::const_iterator i = ibegin;i!=iend;++i) + { + if((*i)->attributes & AT_Selected) + { + (*i)->onPaint.disconnect(this); + (*i)->setAttribute(AT_Selected,false); + } + if(((*i)->attributes & AT_MouseOver) || ((*i)->attributes & AT_On)) + { + (*i)->onPaint.connect(this,&listBox::onHoverDraw); + (*i)->setAttribute(AT_Selected,true); + (*i)->setAttribute(AT_On,false); + highlightedItem = location; + } + ++location; + } + } + + slot listBox::onHoverDraw(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape) + { + bmp->doRectfill(0,0,pos.width,pos.height,rgba(50,50,50,100)); + } + + slot listBox::onSelectItem(const coord &pos) + { + int location = 0; + std::vector<label *>::const_iterator ibegin = itemList.begin(); + std::vector<label *>::const_iterator iend = itemList.end(); + for(std::vector<label *>::const_iterator i = ibegin;i!=iend;++i) + { + if((*i)->attributes & AT_Selected) + { + (*i)->onPaint.disconnect(this); + (*i)->setAttribute(AT_Selected,false); + chosen.setText((*i)->getText()); + itemSelected.emit(location); + currentItem = location; + break; + } + ++location; + } + } + + slot listBox::mainKeyPress(const keys &k) + { + switch(k.getValue()) + { + case keys::UP: + showPopUp(); + if(!itemList.empty()) + { + itemList[currentItem]->setAttribute(AT_On,true); + itemList[currentItem]->onHover.emit(coord()); + } + break; + case keys::DOWN: + showPopUp(); + if(!itemList.empty()) + { + itemList[currentItem]->setAttribute(AT_On,true); + itemList[currentItem]->onHover.emit(coord()); + } + break; + } + } + + slot listBox::keyPress(const keys &k) + { + switch(k.getValue()) + { + case keys::UP: + if(highlightedItem>0)highlightedItem--; + else highlightedItem=itemList.size()-1; + itemList[highlightedItem]->setAttribute(AT_On,true); + itemList[highlightedItem]->onHover.emit(coord()); + break; + case keys::DOWN: + if(highlightedItem<itemList.size()-1)highlightedItem++; + else highlightedItem=0; + itemList[highlightedItem]->setAttribute(AT_On,true); + itemList[highlightedItem]->onHover.emit(coord()); + break; + case keys::ENTER: + { + int location = 0; + std::vector<label *>::const_iterator ibegin = itemList.begin(); + std::vector<label *>::const_iterator iend = itemList.end(); + for(std::vector<label *>::const_iterator i = ibegin;i!=iend;++i) + { + if((*i)->attributes & AT_Selected) + { + (*i)->onPaint.disconnect(this); + (*i)->setAttribute(AT_Selected,false); + chosen.setText((*i)->getText()); + itemSelected.emit(location); + currentItem = location; + break; + } + ++location; + } + hidePopUp(); + break; + } + } + } + + // Set click system + slot listBox::setClickSystem(mouseButtons type) + { + currentType = type; + } } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-09 03:27:30
|
Revision: 441 http://saggui.svn.sourceforge.net/saggui/?rev=441&view=rev Author: juvinious Date: 2007-05-08 20:27:25 -0700 (Tue, 08 May 2007) Log Message: ----------- Added new widget listbox - WIP Modified Paths: -------------- trunk/CHANGELOG trunk/cmake/saggui.h.in Added Paths: ----------- trunk/include/saggui/widgets/listbox.h trunk/src/widgets/listbox.cpp Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-05-07 00:54:11 UTC (rev 440) +++ trunk/CHANGELOG 2007-05-09 03:27:25 UTC (rev 441) @@ -1,4 +1,5 @@ -0.42 +0.43 +- Added new widget listbox - Added in two new button type (buttonGroup & abstractButton) classes to improve the existing button and radial widgets and accomodate newer ones (juvinious) - Added in scons build SConstruct file (kazzmir) - Added doDottedLine and doDottedRectfill for graphics class Modified: trunk/cmake/saggui.h.in =================================================================== --- trunk/cmake/saggui.h.in 2007-05-07 00:54:11 UTC (rev 440) +++ trunk/cmake/saggui.h.in 2007-05-09 03:27:25 UTC (rev 441) @@ -90,6 +90,7 @@ #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/radial.h" #include "saggui/widgets/scroll_bar.h" Copied: trunk/include/saggui/widgets/listbox.h (from rev 440, trunk/include/saggui/widgets/box.h) =================================================================== --- trunk/include/saggui/widgets/listbox.h (rev 0) +++ trunk/include/saggui/widgets/listbox.h 2007-05-09 03:27:25 UTC (rev 441) @@ -0,0 +1,92 @@ +/* +SAGGUI (Simplified Allegro 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 LISTBOX_H +#define LISTBOX_H + +#include "saggui/window.h" +#include "saggui/mouse_events.h" +#include "saggui/widgets/button.h" +#include "saggui/widgets/label.h" +#include "saggui/widgets/scroll_bar.h" + +namespace saggui +{ + //! List Box + /*! + * List Box is user selectable combo box. \n + */ + + class listBox : public window, public mouseEvents + { + public: + listBox(); + ~listBox(); + + // Add item + void addItem(const std::string &text); + + // Clear items + void clearItems(); + + protected: + slot resized(); + + slot drawOnButton(const coord &pos, graphic *bmp, const std::vector<rgba> &colors, const uint32_t &flags, const shapeType &shape); + + slot showPopUp(); + + slot hidePopUp(); + + private: + // Items + //std::vector<std::string>itemList; + std::vector<label *>itemList; + + // Label to contain our chosen item + label chosen; + // Button for drop down + button showListButton; + + // Popup for selectable list + box popUp; + scrollBar sideBar; + }; +} + +#endif Copied: trunk/src/widgets/listbox.cpp (from rev 440, trunk/src/widgets/box.cpp) =================================================================== --- trunk/src/widgets/listbox.cpp (rev 0) +++ trunk/src/widgets/listbox.cpp 2007-05-09 03:27:25 UTC (rev 441) @@ -0,0 +1,154 @@ +/* +SAGGUI (Simplified Allegro 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 LISTBOX_CPP +#define LISTBOX_CPP + +#include "saggui/widgets/listbox.h" + +namespace saggui +{ + listBox::listBox() : mouseEvents(this) { + chosen.setHorizontalAlign(0); + addChild(&chosen); + + onResize.connect(this,&listBox::resized); + + addChild(&showListButton); + showListButton.onButtonClick.connect(this,&listBox::showPopUp); + showListButton.onPaint.connect(this,&listBox::drawOnButton); + //showListButton.onButtonClick.connect(this,&listBox::showPopUp); + + popUp.addChild(&sideBar); + popUp.setAttribute(AT_Visible | AT_Enabled, false); + popUp.onLostFocus.connect(this,&listBox::hidePopUp); + + sideBar.setAttribute(AT_Visible | AT_Enabled, false); + } + + listBox::~listBox() { } + +// Add item + void listBox::addItem(const std::string &text) + { + label *temp = new label(); + temp->setHorizontalAlign(0); + temp->setText(text); + if(itemList.empty()) + { + chosen.setText(text); + } + itemList.push_back(temp); + } + +// Clear items + void listBox::clearItems() + { + std::vector<label *>::iterator ibegin = itemList.begin(); + std::vector<label *>::iterator iend = itemList.end(); + for(std::vector<label *>::iterator i = ibegin;i!=iend;++i) + { + popUp.removeChild((*i)); + if((*i))delete (*i); + } + itemList.clear(); + chosen.setText(""); + } + + slot listBox::resized() + { + chosen.position.set(0,0,(position.width*.80)-1,position.height-1); + 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) + { + double movex = 0; + double movey = 0; + + if(flags & AT_Sunken) + { + movex = 1;//pos.width * 0.10; + movey = 1;//pos.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)), + rgba::BLACK); + } + + slot listBox::showPopUp() + { + guiManager::setWindowFocused(&popUp); + popUp.setAttribute(AT_Visible | AT_Enabled, true); + popUp.setAlwaysOnTop(true); + coord temp = getRelativePosition(); + temp.y += position.height; + temp.setWidth(position.width); + popUp.position = temp; + + std::vector<label *>::iterator ibegin = itemList.begin(); + std::vector<label *>::iterator iend = itemList.end(); + double listSize = 0; + for(std::vector<label *>::iterator i = ibegin;i!=iend;++i) + { + (*i)->position.set(0,listSize,position.width,position.height); + listSize+=position.height; + popUp.addChild((*i)); + } + popUp.position.setHeight(listSize); + } + + slot listBox::hidePopUp() + { + popUp.setAttribute(AT_Visible | AT_Enabled, false); + popUp.setAlwaysOnTop(false); + popUp.position.set(0,0,0,0); + std::vector<label *>::iterator ibegin = itemList.begin(); + std::vector<label *>::iterator iend = itemList.end(); + for(std::vector<label *>::iterator i = ibegin;i!=iend;++i) + { + popUp.removeChild((*i)); + } + } +} + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-07 00:54:16
|
Revision: 440 http://saggui.svn.sourceforge.net/saggui/?rev=440&view=rev Author: kazzmir Date: 2007-05-06 17:54:11 -0700 (Sun, 06 May 2007) Log Message: ----------- add getters for coord x/y/width/height Modified Paths: -------------- trunk/include/saggui/coord.h trunk/src/coord.cpp Modified: trunk/include/saggui/coord.h =================================================================== --- trunk/include/saggui/coord.h 2007-05-06 02:30:11 UTC (rev 439) +++ trunk/include/saggui/coord.h 2007-05-07 00:54:11 UTC (rev 440) @@ -68,6 +68,7 @@ //! Destructor ~coord(); + /* member variables should be private */ //! X position in coordinate system double x; @@ -119,13 +120,38 @@ //! Set height void setHeight(double h); + //! Get width + inline const double getWidth() const + { + return width; + } + + //! Get height + inline const double getHeight() const + { + return height; + } + + //! Returns x + /*! \return x */ + inline const double getX() const + { + return x; + } + + //! Returns y + /*! \return y */ + inline const double getY() const { + return y; + } + //! Returns x + width /*! \return x + width */ - double getX2() const; + const double getX2() const; //! Returns y + height /*! \return y + height */ - double getY2() const; + const double getY2() const; //! Is the given coord.x and coord.y inside this coord bool pointInside(const coord & c, shapeType type = S_Rectangle) const; Modified: trunk/src/coord.cpp =================================================================== --- trunk/src/coord.cpp 2007-05-06 02:30:11 UTC (rev 439) +++ trunk/src/coord.cpp 2007-05-07 00:54:11 UTC (rev 440) @@ -185,14 +185,14 @@ if(runResize)onResize.emit(); } - double coord::getX2() const + const double coord::getX2() const { - return (x+width); + return (getX()+getWidth()); } - double coord::getY2() const + const double coord::getY2() const { - return (y+height); + return (getY()+getHeight()); } bool coord::pointInside(const coord & c, shapeType type) const This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-06 02:30:13
|
Revision: 439 http://saggui.svn.sourceforge.net/saggui/?rev=439&view=rev Author: kazzmir Date: 2007-05-05 19:30:11 -0700 (Sat, 05 May 2007) Log Message: ----------- only use -Woverloaded-virtual for c++ files. fix some include paths Modified Paths: -------------- trunk/SConstruct trunk/modules/sdlgl/src/sdlgl_factory.cpp trunk/modules/sdlgl/src/sdlgl_gfx.cpp Modified: trunk/SConstruct =================================================================== --- trunk/SConstruct 2007-05-05 21:13:58 UTC (rev 438) +++ trunk/SConstruct 2007-05-06 02:30:11 UTC (rev 439) @@ -57,19 +57,23 @@ env.StaticLibrary('lib/saggui', map(replacer, findFiles( 'src', isCpp ) )) env.ParseHeader('include/saggui/saggui.h', 'cmake/saggui.h.in') -def buildModule(directory, name, menv = Environment(ENV = os.environ)): +def newEnv(): + return Environment( ENV = os.environ ) + +def buildModule(directory, name, menv ): # moduleEnv = Environment( ENV = os.environ ) menv.Append( CPPPATH = ['modules/%s/include' % directory,'include'] ) - menv.Append( CCFLAGS = ['-Wall', '-Woverloaded-virtual','-Werror'] ) + menv.Append( CCFLAGS = ['-Wall','-Werror'] ) + menv.Append( CXXFLAGS = ['-Woverloaded-virtual'] ) menv.StaticLibrary('lib/%s' % name, map(replacer, findFiles('modules/%s' % directory,isCpp))) for i in findFiles('modules/%s/' % directory, isH): menv.Install('include/saggui/%s' % dirname(i.replace('modules/%s' % directory,'').replace('include','%s' % directory)),i) -buildModule('allegro','saggui-alleg') -buildModule('agl','saggui-agl') -buildModule('sdl','saggui-sdl') -buildModule('sdlgl','saggui-sdlgl') -buildModule('opengl','saggui-opengl') +buildModule('allegro','saggui-alleg',newEnv()) +buildModule('agl','saggui-agl', newEnv()) +buildModule('sdl','saggui-sdl', newEnv()) +buildModule('sdlgl','saggui-sdlgl', newEnv()) +buildModule('opengl','saggui-opengl', newEnv()) freeTypeEnv = Environment( ENV = os.environ ) freeTypeEnv.ParseConfig('freetype-config --cflags') @@ -78,21 +82,3 @@ if hasNintendoDS: buildModule('palib','saggui-palib') - -if False: - ## probably put the below into a function if its generic enough - allegroEnv = Environment( ENV = os.environ ) - allegroEnv.Append( CPPPATH = ['modules/allegro/include','include'] ) - allegroEnv.Append( CCFLAGS = ['-Wall', '-Woverloaded-virtual'] ) - allegroEnv.StaticLibrary('lib/saggui-alleg', map(replacer, findFiles('modules/allegro',isCpp))) - for i in findFiles('modules/allegro/', isH): - allegroEnv.Install('include/saggui/%s' % dirname(i.replace('modules/allegro','').replace('include','allegro')),i) - - sdlEnv = Environment( ENV = os.environ ) - sdlEnv.Append( CPPPATH = ['modules/sdl/include','include'] ) - sdlEnv.Append( CCFLAGS = ['-Wall', '-Woverloaded-virtual'] ) - sdlEnv.StaticLibrary('lib/saggui-sdl', map(replacer, findFiles('modules/sdl',isCpp))) - for i in findFiles('modules/sdl/', isH): - sdlEnv.Install('include/saggui/%s' % dirname(i.replace('modules/sdl','').replace('include','sdl')),i) - - Modified: trunk/modules/sdlgl/src/sdlgl_factory.cpp =================================================================== --- trunk/modules/sdlgl/src/sdlgl_factory.cpp 2007-05-05 21:13:58 UTC (rev 438) +++ trunk/modules/sdlgl/src/sdlgl_factory.cpp 2007-05-06 02:30:11 UTC (rev 439) @@ -42,8 +42,8 @@ #include "sdlgl_system.h" #include "sdlgl_factory.h" #include "sdlgl_gfx.h" -#include "sdl_mouse.h" -#include "sdl_keyinput.h" +#include "saggui/sdl/sdl_mouse.h" +#include "saggui/sdl/sdl_keyinput.h" namespace saggui { Modified: trunk/modules/sdlgl/src/sdlgl_gfx.cpp =================================================================== --- trunk/modules/sdlgl/src/sdlgl_gfx.cpp 2007-05-05 21:13:58 UTC (rev 438) +++ trunk/modules/sdlgl/src/sdlgl_gfx.cpp 2007-05-06 02:30:11 UTC (rev 439) @@ -38,7 +38,7 @@ #include "sdlgl_gfx.h" #include <SDL/SDL.h> -#include "sdl_gfx_primitives.h" +#include "saggui/sdl/sdl_gfx_primitives.h" //! Simplified Allegro Gaming Graphical User Interface /*! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-05 21:13:59
|
Revision: 438 http://saggui.svn.sourceforge.net/saggui/?rev=438&view=rev Author: juvinious Date: 2007-05-05 14:13:58 -0700 (Sat, 05 May 2007) Log Message: ----------- Squashr3d warnings Modified Paths: -------------- trunk/modules/openlayer/src/ol_font.cpp Modified: trunk/modules/openlayer/src/ol_font.cpp =================================================================== --- trunk/modules/openlayer/src/ol_font.cpp 2007-05-05 20:00:18 UTC (rev 437) +++ trunk/modules/openlayer/src/ol_font.cpp 2007-05-05 21:13:58 UTC (rev 438) @@ -46,11 +46,13 @@ namespace saggui { + /* static ol::Rgba convertRgba(const rgba & color) { if(color == rgba::PINK)return( ol::Rgba::INVISIBLE ); return( ol::Rgba( (int)color.red, (int)color.green, (int)color.blue, (int)color.alpha ) ); } + */ olFont::olFont() : fontBase(false) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-05 20:00:20
|
Revision: 437 http://saggui.svn.sourceforge.net/saggui/?rev=437&view=rev Author: juvinious Date: 2007-05-05 13:00:18 -0700 (Sat, 05 May 2007) Log Message: ----------- Added -Werror to catch all errors and correct problems Modified Paths: -------------- trunk/CMakeLists.txt trunk/utils/bmpdump/bmpdump-alleg.cpp trunk/utils/bmpdump/bmpdump-sdl.cpp Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-05-05 16:31:15 UTC (rev 436) +++ trunk/CMakeLists.txt 2007-05-05 20:00:18 UTC (rev 437) @@ -79,7 +79,7 @@ option(ENABLE_FREETYPE_FONTS "Enables freetype font support" on) if(NOT MSVC) - set(CXXFLAGS "-O2 -Wall -funroll-loops -fexpensive-optimizations -Woverloaded-virtual") + set(CXXFLAGS "-O2 -Wall -funroll-loops -fexpensive-optimizations -Woverloaded-virtual -Werror") else(NOT MSVC) set(CXXFLAGS "-O2") endif(NOT MSVC) Modified: trunk/utils/bmpdump/bmpdump-alleg.cpp =================================================================== --- trunk/utils/bmpdump/bmpdump-alleg.cpp 2007-05-05 16:31:15 UTC (rev 436) +++ trunk/utils/bmpdump/bmpdump-alleg.cpp 2007-05-05 20:00:18 UTC (rev 437) @@ -99,7 +99,7 @@ char workStr[256]; sprintf(workStr,"\"#%2x%2x%2x\"",getr(pixel),getg(pixel),getb(pixel)); string workStrTmp = workStr; - for(int i = 0; i < workStrTmp.length();++i) + for(unsigned int i = 0; i < workStrTmp.length();++i) { if(workStrTmp[i]==' ')workStrTmp[i]='0'; } Modified: trunk/utils/bmpdump/bmpdump-sdl.cpp =================================================================== --- trunk/utils/bmpdump/bmpdump-sdl.cpp 2007-05-05 16:31:15 UTC (rev 436) +++ trunk/utils/bmpdump/bmpdump-sdl.cpp 2007-05-05 20:00:18 UTC (rev 437) @@ -127,7 +127,7 @@ char workStr[256]; sprintf(workStr,"\"#%2x%2x%2x\"",red,green,blue); string workStrTmp = workStr; - for(int i = 0; i < workStrTmp.length();++i) + for(unsigned int i = 0; i < workStrTmp.length();++i) { if(workStrTmp[i]==' ')workStrTmp[i]='0'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-05 16:31:17
|
Revision: 436 http://saggui.svn.sourceforge.net/saggui/?rev=436&view=rev Author: kazzmir Date: 2007-05-05 09:31:15 -0700 (Sat, 05 May 2007) Log Message: ----------- treat warnings as errors Modified Paths: -------------- trunk/SConstruct Modified: trunk/SConstruct =================================================================== --- trunk/SConstruct 2007-05-05 16:17:34 UTC (rev 435) +++ trunk/SConstruct 2007-05-05 16:31:15 UTC (rev 436) @@ -29,7 +29,7 @@ env.BuildDir('build','src') env.Append( CPPPATH = 'include' ) -env.Append( CCFLAGS = ['-Wall', '-Woverloaded-virtual'] ) +env.Append( CCFLAGS = ['-Wall', '-Woverloaded-virtual','-Werror'] ) def parseHeader(target, source, env): import re @@ -60,7 +60,7 @@ def buildModule(directory, name, menv = Environment(ENV = os.environ)): # moduleEnv = Environment( ENV = os.environ ) menv.Append( CPPPATH = ['modules/%s/include' % directory,'include'] ) - menv.Append( CCFLAGS = ['-Wall', '-Woverloaded-virtual'] ) + menv.Append( CCFLAGS = ['-Wall', '-Woverloaded-virtual','-Werror'] ) menv.StaticLibrary('lib/%s' % name, map(replacer, findFiles('modules/%s' % directory,isCpp))) for i in findFiles('modules/%s/' % directory, isH): menv.Install('include/saggui/%s' % dirname(i.replace('modules/%s' % directory,'').replace('include','%s' % directory)),i) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-05 16:17:38
|
Revision: 435 http://saggui.svn.sourceforge.net/saggui/?rev=435&view=rev Author: juvinious Date: 2007-05-05 09:17:34 -0700 (Sat, 05 May 2007) Log Message: ----------- Fixed all warnings Modified Paths: -------------- trunk/examples/demo/include/test_classes.h trunk/examples/demo/src/test_classes.cpp trunk/modules/agl/include/agl_gfx.h trunk/modules/openlayer/include/ol_gfx.h trunk/modules/sdl/include/sdl_gfx.h trunk/modules/sdlgl/include/sdlgl_gfx.h Modified: trunk/examples/demo/include/test_classes.h =================================================================== --- trunk/examples/demo/include/test_classes.h 2007-05-05 15:46:06 UTC (rev 434) +++ trunk/examples/demo/include/test_classes.h 2007-05-05 16:17:34 UTC (rev 435) @@ -112,7 +112,7 @@ void out(const saggui::coord &c); void moving(); // Set clickable system - void setClickSystem(int type); + void setClickSystem(saggui::mouseButtons type); }; class testProgress : public saggui::progressBar Modified: trunk/examples/demo/src/test_classes.cpp =================================================================== --- trunk/examples/demo/src/test_classes.cpp 2007-05-05 15:46:06 UTC (rev 434) +++ trunk/examples/demo/src/test_classes.cpp 2007-05-05 16:17:34 UTC (rev 435) @@ -288,22 +288,24 @@ } // Set click system - void win::setClickSystem(int type) + void win::setClickSystem(saggui::mouseButtons type) { switch(type) { - case 0: + case saggui::M_Left: { break; } - case 1: + case saggui::M_Right: { break; } - case 2: + case saggui::M_Middle: { break; } + default: + break; } } Modified: trunk/modules/agl/include/agl_gfx.h =================================================================== --- trunk/modules/agl/include/agl_gfx.h 2007-05-05 15:46:06 UTC (rev 434) +++ trunk/modules/agl/include/agl_gfx.h 2007-05-05 16:17:34 UTC (rev 435) @@ -99,6 +99,8 @@ // Bitmap Routines + // make the compiler happy about overloaded functions + using graphic::loadBmp; //! Load bitmap from from memory void loadBmp(char *data[], int width, int height); Modified: trunk/modules/openlayer/include/ol_gfx.h =================================================================== --- trunk/modules/openlayer/include/ol_gfx.h 2007-05-05 15:46:06 UTC (rev 434) +++ trunk/modules/openlayer/include/ol_gfx.h 2007-05-05 16:17:34 UTC (rev 435) @@ -105,6 +105,9 @@ // Bitmap Routines + // make the compiler happy about overloaded functions + using graphic::loadBmp; + //! Load bitmap from from memory void loadBmp(char *data[], int width, int height); Modified: trunk/modules/sdl/include/sdl_gfx.h =================================================================== --- trunk/modules/sdl/include/sdl_gfx.h 2007-05-05 15:46:06 UTC (rev 434) +++ trunk/modules/sdl/include/sdl_gfx.h 2007-05-05 16:17:34 UTC (rev 435) @@ -94,6 +94,8 @@ // Bitmap Routines + // make the compiler happy about overloaded functions + using graphic::loadBmp; //! Load bitmap from file (and save filename) void loadBmp(const std::string & filename, const rgba &color=0); Modified: trunk/modules/sdlgl/include/sdlgl_gfx.h =================================================================== --- trunk/modules/sdlgl/include/sdlgl_gfx.h 2007-05-05 15:46:06 UTC (rev 434) +++ trunk/modules/sdlgl/include/sdlgl_gfx.h 2007-05-05 16:17:34 UTC (rev 435) @@ -102,6 +102,8 @@ // Bitmap Routines + // make the compiler happy about overloaded functions + using graphic::loadBmp; //! Load bitmap from from memory void loadBmp(char *data[], int width, int height); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-05 15:46:10
|
Revision: 434 http://saggui.svn.sourceforge.net/saggui/?rev=434&view=rev Author: kazzmir Date: 2007-05-05 08:46:06 -0700 (Sat, 05 May 2007) Log Message: ----------- make compiler happy about virtual functions Modified Paths: -------------- trunk/SConstruct trunk/modules/allegro/include/al_gfx.h Modified: trunk/SConstruct =================================================================== --- trunk/SConstruct 2007-05-05 15:23:38 UTC (rev 433) +++ trunk/SConstruct 2007-05-05 15:46:06 UTC (rev 434) @@ -70,10 +70,12 @@ buildModule('sdl','saggui-sdl') buildModule('sdlgl','saggui-sdlgl') buildModule('opengl','saggui-opengl') + freeTypeEnv = Environment( ENV = os.environ ) freeTypeEnv.ParseConfig('freetype-config --cflags') buildModule('freetype','saggui-freetype', freeTypeEnv) buildModule('openlayer','saggui-openlayer', freeTypeEnv) + if hasNintendoDS: buildModule('palib','saggui-palib') Modified: trunk/modules/allegro/include/al_gfx.h =================================================================== --- trunk/modules/allegro/include/al_gfx.h 2007-05-05 15:23:38 UTC (rev 433) +++ trunk/modules/allegro/include/al_gfx.h 2007-05-05 15:46:06 UTC (rev 434) @@ -99,10 +99,12 @@ // Bitmap Routines - + // make the compiler happy about overloaded functions + using graphic::loadBmp; + //! Load bitmap from file (and save filename) - void loadBmp(const std::string & filename, const rgba & color=rgba::NOCOLOR); - + virtual void loadBmp(const std::string & filename, const rgba & color=rgba::NOCOLOR); + //! Create bitmap void createBmp(double width, double height, double depth=32); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@li...> - 2007-05-05 15:23:42
|
Revision: 433 http://saggui.svn.sourceforge.net/saggui/?rev=433&view=rev Author: kazzmir Date: 2007-05-05 08:23:38 -0700 (Sat, 05 May 2007) Log Message: ----------- compile freetype and openlayer Modified Paths: -------------- trunk/SConstruct trunk/modules/openlayer/src/ol_factory.cpp Modified: trunk/SConstruct =================================================================== --- trunk/SConstruct 2007-05-05 15:21:37 UTC (rev 432) +++ trunk/SConstruct 2007-05-05 15:23:38 UTC (rev 433) @@ -70,8 +70,10 @@ buildModule('sdl','saggui-sdl') buildModule('sdlgl','saggui-sdlgl') buildModule('opengl','saggui-opengl') -# buildModule('freetype','saggui-freetype') -# buildModule('openlayer','saggui-openlayer') +freeTypeEnv = Environment( ENV = os.environ ) +freeTypeEnv.ParseConfig('freetype-config --cflags') +buildModule('freetype','saggui-freetype', freeTypeEnv) +buildModule('openlayer','saggui-openlayer', freeTypeEnv) if hasNintendoDS: buildModule('palib','saggui-palib') Modified: trunk/modules/openlayer/src/ol_factory.cpp =================================================================== --- trunk/modules/openlayer/src/ol_factory.cpp 2007-05-05 15:21:37 UTC (rev 432) +++ trunk/modules/openlayer/src/ol_factory.cpp 2007-05-05 15:23:38 UTC (rev 433) @@ -40,8 +40,8 @@ #include <winalleg.h> #endif #include "ol_factory.h" -#include "al_mouse.h" -#include "al_keyinput.h" +#include "saggui/allegro/al_mouse.h" +#include "saggui/allegro/al_keyinput.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-05-05 15:21:42
|
Revision: 432 http://saggui.svn.sourceforge.net/saggui/?rev=432&view=rev Author: kazzmir Date: 2007-05-05 08:21:37 -0700 (Sat, 05 May 2007) Log Message: ----------- build sdlgl too Modified Paths: -------------- trunk/SConstruct Modified: trunk/SConstruct =================================================================== --- trunk/SConstruct 2007-05-05 15:18:32 UTC (rev 431) +++ trunk/SConstruct 2007-05-05 15:21:37 UTC (rev 432) @@ -21,6 +21,9 @@ replacer = replace('^src','build') +## maybe in the future +hasNintendoDS = False + env = Environment( ENV = os.environ ) env.BuildDir('build','src') @@ -63,11 +66,14 @@ menv.Install('include/saggui/%s' % dirname(i.replace('modules/%s' % directory,'').replace('include','%s' % directory)),i) buildModule('allegro','saggui-alleg') -aglEnv = Environment(ENV = os.environ ) -# aglEnv.Append( CPPPATH = ['modules/opengl','modules/allegro/include'] ) -buildModule('agl','saggui-agl', aglEnv) +buildModule('agl','saggui-agl') buildModule('sdl','saggui-sdl') +buildModule('sdlgl','saggui-sdlgl') buildModule('opengl','saggui-opengl') +# buildModule('freetype','saggui-freetype') +# buildModule('openlayer','saggui-openlayer') +if hasNintendoDS: + buildModule('palib','saggui-palib') if False: ## probably put the below into a function if its generic enough This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |