Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5366 in orxonox.OLD for trunk


Ignore:
Timestamp:
Oct 12, 2005, 1:23:08 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more definitions of GLGui.
also a patch to the resource-manager

Location:
trunk/src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r5364 r5366  
    111111  CL_NULL_ELEMENT_2D            =    0x00000f22,
    112112  CL_SHELL_BUFFER               =    0x00000f32,
     113  CL_GLGUI_HANDLER              =    0x00000f40,
    113114
    114115
  • trunk/src/defs/sdlincl.h

    r4662 r5366  
    11/*!
    2   \file sdlincl.h
    3   \brief This file includes sdl Headers.
    4 
    5   no Class is defined here, but the SDL Headers
     2 * @file sdlincl.h
     3 * This file includes sdl Headers.
     4 *
     5 * no Class is defined here, but the SDL Headers
    66*/
    77
     
    99#define _SDLINCL_H
    1010
     11#include "confincl.h"
     12
     13#ifdef HAVE_SDL_H
     14#include <SDL.h>
     15#else
    1116#include <SDL/SDL.h>
     17#endif
    1218
    1319#endif /* _SDLINCL_H */
  • trunk/src/lib/event/event.h

    r5239 r5366  
    22 * @file event.h
    33 * an abstract event
    4  *
    5  * @todo remove HUGE class-overhead. This could also be a struct
    6 */
     4 */
    75
    86#ifndef _EVENT_H
    97#define _EVENT_H
    108
    11 
    12 //#include "base_object.h"
    139#include "sdlincl.h"
    1410
  • trunk/src/lib/graphics/graphics_engine.h

    r5346 r5366  
    7171    bool hwSupportsEXT(const char* extension);
    7272
    73     /** \brief swaps the GL_BUFFERS */
     73    /** @brief swaps the GL_BUFFERS */
    7474    inline static void swapBuffers() { SDL_GL_SwapBuffers(); };
    7575
  • trunk/src/lib/gui/gl_gui/Makefile.am

    r5364 r5366  
    1010
    1111libORXglgui_a_SOURCES = glmenu/glmenu_imagescreen.cc \
     12                        glgui_handler.cc \
    1213                        glgui_widget.cc \
    1314                        glgui_button.cc \
  • trunk/src/lib/gui/gl_gui/Makefile.in

    r5364 r5366  
    5555libORXglgui_a_LIBADD =
    5656am_libORXglgui_a_OBJECTS = libORXglgui_a-glmenu_imagescreen.$(OBJEXT) \
     57        libORXglgui_a-glgui_handler.$(OBJEXT) \
    5758        libORXglgui_a-glgui_widget.$(OBJEXT) \
    5859        libORXglgui_a-glgui_button.$(OBJEXT) \
     
    7071@AMDEP_TRUE@    ./$(DEPDIR)/libORXglgui_a-glgui_container.Po \
    7172@AMDEP_TRUE@    ./$(DEPDIR)/libORXglgui_a-glgui_frame.Po \
     73@AMDEP_TRUE@    ./$(DEPDIR)/libORXglgui_a-glgui_handler.Po \
    7274@AMDEP_TRUE@    ./$(DEPDIR)/libORXglgui_a-glgui_pushbutton.Po \
    7375@AMDEP_TRUE@    ./$(DEPDIR)/libORXglgui_a-glgui_widget.Po \
     
    198200libORXglgui_a_CPPFLAGS = -DBUILD_ORXONOX
    199201libORXglgui_a_SOURCES = glmenu/glmenu_imagescreen.cc \
     202                        glgui_handler.cc \
    200203                        glgui_widget.cc \
    201204                        glgui_button.cc \
     
    268271@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libORXglgui_a-glgui_container.Po@am__quote@
    269272@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libORXglgui_a-glgui_frame.Po@am__quote@
     273@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libORXglgui_a-glgui_handler.Po@am__quote@
    270274@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libORXglgui_a-glgui_pushbutton.Po@am__quote@
    271275@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libORXglgui_a-glgui_widget.Po@am__quote@
     
    304308@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    305309@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libORXglgui_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libORXglgui_a-glmenu_imagescreen.obj `if test -f 'glmenu/glmenu_imagescreen.cc'; then $(CYGPATH_W) 'glmenu/glmenu_imagescreen.cc'; else $(CYGPATH_W) '$(srcdir)/glmenu/glmenu_imagescreen.cc'; fi`
     310
     311libORXglgui_a-glgui_handler.o: glgui_handler.cc
     312@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libORXglgui_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libORXglgui_a-glgui_handler.o -MD -MP -MF "$(DEPDIR)/libORXglgui_a-glgui_handler.Tpo" -c -o libORXglgui_a-glgui_handler.o `test -f 'glgui_handler.cc' || echo '$(srcdir)/'`glgui_handler.cc; \
     313@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/libORXglgui_a-glgui_handler.Tpo" "$(DEPDIR)/libORXglgui_a-glgui_handler.Po"; else rm -f "$(DEPDIR)/libORXglgui_a-glgui_handler.Tpo"; exit 1; fi
     314@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='glgui_handler.cc' object='libORXglgui_a-glgui_handler.o' libtool=no @AMDEPBACKSLASH@
     315@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/libORXglgui_a-glgui_handler.Po' tmpdepfile='$(DEPDIR)/libORXglgui_a-glgui_handler.TPo' @AMDEPBACKSLASH@
     316@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     317@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libORXglgui_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libORXglgui_a-glgui_handler.o `test -f 'glgui_handler.cc' || echo '$(srcdir)/'`glgui_handler.cc
     318
     319libORXglgui_a-glgui_handler.obj: glgui_handler.cc
     320@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libORXglgui_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libORXglgui_a-glgui_handler.obj -MD -MP -MF "$(DEPDIR)/libORXglgui_a-glgui_handler.Tpo" -c -o libORXglgui_a-glgui_handler.obj `if test -f 'glgui_handler.cc'; then $(CYGPATH_W) 'glgui_handler.cc'; else $(CYGPATH_W) '$(srcdir)/glgui_handler.cc'; fi`; \
     321@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/libORXglgui_a-glgui_handler.Tpo" "$(DEPDIR)/libORXglgui_a-glgui_handler.Po"; else rm -f "$(DEPDIR)/libORXglgui_a-glgui_handler.Tpo"; exit 1; fi
     322@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='glgui_handler.cc' object='libORXglgui_a-glgui_handler.obj' libtool=no @AMDEPBACKSLASH@
     323@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/libORXglgui_a-glgui_handler.Po' tmpdepfile='$(DEPDIR)/libORXglgui_a-glgui_handler.TPo' @AMDEPBACKSLASH@
     324@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     325@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libORXglgui_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libORXglgui_a-glgui_handler.obj `if test -f 'glgui_handler.cc'; then $(CYGPATH_W) 'glgui_handler.cc'; else $(CYGPATH_W) '$(srcdir)/glgui_handler.cc'; fi`
    306326
    307327libORXglgui_a-glgui_widget.o: glgui_widget.cc
  • trunk/src/lib/gui/gl_gui/glgui_checkbutton.cc

    r5360 r5366  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
    1717
    18 #include "glgui_.h"
     18#include "glgui_checkbutton.h"
    1919
    2020using namespace std;
     
    2323 * standard constructor
    2424*/
    25 GLGui::GLGui ()
     25GLGuiCheckButton::GLGuiCheckButton ()
    2626{
    2727  this->init();
     
    3333 * standard deconstructor
    3434*/
    35 GLGui::~GLGui()
     35GLGuiCheckButton::~GLGuiCheckButton()
    3636{
    3737
     
    4141 * initializes the GUI-element
    4242 */
    43 GLGui::init()
     43GLGuiCheckButton::init()
    4444{
    45   this->setClassID(CL_GLGUI_, "GLGui");
     45  this->setClassID(CL_GLGUI_CHECKBUTTON, "GLGuiCheckButton");
    4646
    4747}
    4848
    4949/**
    50  * draws the GLGui
     50 * draws the GLGuiCheckButton
    5151 */
    52 void GLGui::draw()
     52void GLGuiCheckButton::draw()
    5353{
    5454
  • trunk/src/lib/gui/gl_gui/glgui_checkbutton.h

    r5360 r5366  
    11/*!
    2  * @file glgui_.h
     2 * @file glgui_checkbutton.h
    33 * The gl_ widget of th openglGUI
    44 *
    55 */
    66
    7 #ifndef _GLGUI__H
     7#ifndef _GLGUI_CHECKBUTTON_H
    88#define _GLGUI__H
    99
    10 #include "base_object.h"
     10#include "glgui_button.h"
    1111
    1212// FORWARD DECLARATION
     
    1616 *
    1717 */
    18 class GLGui : public GLGui {
     18class GLGuiCheckButton : public GLGuiButton {
    1919
    2020 public:
    21   GLGui();
    22   virtual ~GLGui();
     21  GLGuiCheckButton();
     22  virtual ~GLGuiCheckButton();
    2323
    2424  void init();
     
    3030};
    3131
    32 #endif /* _GLGUI__H */
     32#endif /* _GLGUI_CHECKBUTTON_H */
  • trunk/src/lib/gui/gl_gui/glgui_handler.cc

    r5316 r5366  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
     
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
    1717
    18 #include "proto_singleton.h"
     18#include "glgui_handler.h"
    1919
    2020using namespace std;
    21 
    2221
    2322/**
    2423 * standard constructor
    2524 */
    26 ProtoSingleton::ProtoSingleton ()
     25GLGuiHandler::GLGuiHandler ()
    2726{
    28    this->setClassID(CL_PROTO_ID, "ProtoSingleton");
    29    this->setName("ProtoSingleton");
     27   this->setClassID(CL_GLGUI_HANDLER, "GLGuiHandler");
     28   this->setName("GLGuiHandler");
    3029
    3130   /* If you make a new class, what is most probably the case when you write this file
     
    4645 *  the singleton reference to this class
    4746 */
    48 ProtoSingleton* ProtoSingleton::singletonRef = NULL;
     47GLGuiHandler* GLGuiHandler::singletonRef = NULL;
    4948
    5049/**
    5150   @brief standard deconstructor
    5251 */
    53 ProtoSingleton::~ProtoSingleton ()
     52GLGuiHandler::~GLGuiHandler ()
    5453{
    55   ProtoSingleton::singletonRef = NULL;
     54  GLGuiHandler::singletonRef = NULL;
    5655}
  • trunk/src/lib/gui/gl_gui/glgui_handler.h

    r5316 r5366  
    44*/
    55
    6 #ifndef _PROTO_SINGLETON_H
    7 #define _PROTO_SINGLETON_H
     6#ifndef _GLGUI_HANDLER_H
     7#define _GLGUI_HANDLER_H
    88
    99#include "base_object.h"
     
    1212
    1313//! A default singleton class.
    14 class ProtoSingleton : public BaseObject {
     14class GLGuiHandler : public BaseObject {
    1515
    1616 public:
    17   virtual ~ProtoSingleton(void);
     17  virtual ~GLGuiHandler(void);
    1818  /** @returns a Pointer to the only object of this Class */
    19   inline static ProtoSingleton* getInstance(void) { if (!singletonRef) singletonRef = new ProtoSingleton();  return singletonRef; };
     19  inline static GLGuiHandler* getInstance(void) { if (!singletonRef) singletonRef = new GLGuiHandler();  return singletonRef; };
    2020
    2121 private:
    22   ProtoSingleton(void);
    23   static ProtoSingleton* singletonRef;
     22  GLGuiHandler(void);
     23  static GLGuiHandler* singletonRef;
    2424};
    2525
    26 #endif /* _PROTO_SINGLETON_H */
     26#endif /* _GLGUI_HANDLER_H */
  • trunk/src/lib/gui/gl_gui/glgui_image.cc

    r5360 r5366  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
    1717
    18 #include "glgui_.h"
     18#include "glgui_image.h"
    1919
    2020using namespace std;
     
    2323 * standard constructor
    2424*/
    25 GLGui::GLGui ()
     25GLGuiImage::GLGuiImage ()
    2626{
    2727  this->init();
     
    3333 * standard deconstructor
    3434*/
    35 GLGui::~GLGui()
     35GLGuiImage::~GLGuiImage()
    3636{
    3737
     
    4141 * initializes the GUI-element
    4242 */
    43 GLGui::init()
     43void GLGuiImage::init()
    4444{
    45   this->setClassID(CL_GLGUI_, "GLGui");
     45  this->setClassID(CL_GLGUI_, "GLGuiImage");
    4646
    4747}
    4848
    4949/**
    50  * draws the GLGui
     50 * draws the GLGuiImage
    5151 */
    52 void GLGui::draw()
     52void GLGuiImage::draw()
    5353{
    5454
  • trunk/src/lib/gui/gl_gui/glgui_image.h

    r5360 r5366  
    11/*!
    2  * @file glgui_.h
    3  * The gl_ widget of th openglGUI
     2 * @file glgui_image.h
     3 * The gl_Image widget of th openglGUI
    44 *
    55 */
    66
    7 #ifndef _GLGUI__H
    8 #define _GLGUI__H
     7#ifndef _GLGUI_IMAGE_H
     8#define _GLGUI_IMAGE_H
    99
    1010#include "base_object.h"
     
    1212// FORWARD DECLARATION
    1313
    14 //! This is part of the openglGUI class
     14//! This is Image part of the openglGUI class
    1515/**
    1616 *
    1717 */
    18 class GLGui : public GLGui {
     18class GLGuiImage : public GLGuiWidget {
    1919
    2020 public:
    21   GLGui();
    22   virtual ~GLGui();
     21  GLGuiImage();
     22  virtual ~GLGuiImage();
    2323
    2424  void init();
     
    3030};
    3131
    32 #endif /* _GLGUI__H */
     32#endif /* _GLGUI_IMAGE_H */
  • trunk/src/lib/gui/gl_gui/glgui_menu.cc

    r5360 r5366  
    2323 * standard constructor
    2424*/
    25 GLGui::GLGui ()
     25GLGuiMenu::GLGuiMenu ()
    2626{
    2727  this->init();
     
    3333 * standard deconstructor
    3434*/
    35 GLGui::~GLGui()
     35GLGuiMenu::~GLGuiMenu()
    3636{
    3737
     
    4141 * initializes the GUI-element
    4242 */
    43 GLGui::init()
     43void GLGuiMenu::init()
    4444{
    45   this->setClassID(CL_GLGUI_, "GLGui");
     45  this->setClassID(CL_GLGUI_MENU, "GLGuiMenu");
    4646
    4747}
    4848
    4949/**
    50  * draws the GLGui
     50 * draws the GLGuiMenu
    5151 */
    52 void GLGui::draw()
     52void GLGuiMenu::draw()
    5353{
    5454
  • trunk/src/lib/gui/gl_gui/glgui_menu.h

    r5360 r5366  
    11/*!
    2  * @file glgui_.h
    3  * The gl_ widget of th openglGUI
     2 * @file glgui_menu.h
     3 * The gl_Menu widget of th openglGUI
    44 *
    55 */
    66
    7 #ifndef _GLGUI__H
    8 #define _GLGUI__H
     7#ifndef _GLGUI_MENU_H
     8#define _GLGUI_MENU_H
    99
    1010#include "base_object.h"
     
    1212// FORWARD DECLARATION
    1313
    14 //! This is part of the openglGUI class
     14//! This is Menu part of the openglGUI class
    1515/**
    1616 *
    1717 */
    18 class GLGui : public GLGui {
     18class GLGuiMenu : public GLGuiMenu {
    1919
    2020 public:
    21   GLGui();
    22   virtual ~GLGui();
     21  GLGuiMenu();
     22  virtual ~GLGuiMenu();
    2323
    2424  void init();
     
    3030};
    3131
    32 #endif /* _GLGUI__H */
     32#endif /* _GLGUI_MENU_H */
  • trunk/src/lib/gui/gl_gui/glgui_widget.cc

    r5364 r5366  
    4646  this->setClassID(CL_GLGUI_WIDGET, "GLGuiWidget");
    4747
     48  this->managed = false;
     49  this->focusable = true;
     50  this->clickable = true;
     51
     52  this->backGround = NULL;
     53  this->renderModel = 0;
    4854}
  • trunk/src/lib/gui/gl_gui/glgui_widget.h

    r5365 r5366  
    11/*!
    2  * @file glgui_widget.h
    3  * The gl_widget of the openglGUI
    4  */
     2* @file glgui_widget.h
     3* The gl_widget of the openglGUI
     4*/
    55
    66#ifndef _GLGUI_WIDGET_H
     
    1515//! This is part of the openglGUI class
    1616/**
    17  * A widget is the main class of all the elements of th GUI.
    18  */
     17* A widget is the main class of all the elements of th GUI.
     18*/
    1919class GLGuiWidget : public Element2D {
    20  public:
    21   GLGuiWidget();
    22   virtual ~GLGuiWidget();
     20  public:
     21    GLGuiWidget();
     22    virtual ~GLGuiWidget();
    2323
    24   void init();
     24    void init();
    2525
    26   void show();
    27   void hide();
     26    void show();
     27    void hide();
    2828
    2929
    30   virtual void draw() = 0;
    31   virtual void update() = 0;
     30    virtual void draw() = 0;
     31    virtual void update() = 0;
    3232
    33  private:
    34   bool                  managed;          //!< if this GUI-element should be managed. true means it gets deleted with the deletion of it's parent.
    35   bool                  focusable;        //!< If it can receive focus.
    36   bool                  clickable;        //!< if it can be clicked upon.
     33  protected:
     34    Material*             backGround;
     35    GLuint                renderModel;
    3736
    38   Material*             backGround;
    39   GLuint                renderModel;
     37  private:
     38    bool                  managed;          //!< if this GUI-element should be managed. true means it gets deleted with the deletion of it's parent.
     39    bool                  focusable;        //!< If it can receive focus.
     40    bool                  clickable;        //!< if it can be clicked upon.
     41
    4042
    4143
  • trunk/src/util/resource_manager.cc

    r5346 r5366  
    217217BaseObject* ResourceManager::load(const char* fileName, ResourcePriority prio, void* param1, void* param2, void* param3)
    218218{
     219  if (fileName == NULL)
     220    return NULL;
    219221  ResourceType tmpType;
    220222#ifndef NO_MODEL
     
    284286                            void* param1, void* param2, void* param3)
    285287{
     288  if (fileName == NULL)
     289    return NULL;
     290
    286291  // searching if the resource was loaded before.
    287292  Resource* tmpResource = this->locateResourceByInfo(fileName, type, param1, param2, param3);
     
    320325          else
    321326            {
    322               PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", fullName);
     327              PRINTF(2)("File %s in %s does not exist. Loading a cube-Model instead\n", fileName, dataDir);
    323328              tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, &tmpResource->modelSize);
    324329            }
     
    461466bool ResourceManager::unload(void* pointer, ResourcePriority prio)
    462467{
     468  if (pointer == NULL)
     469    return false;
    463470  // if pointer is existent. and only one resource of this type exists.
    464471  Resource* tmpResource = this->locateResourceByPointer(pointer);
    465   if (tmpResource == NULL)
    466     {
    467       PRINTF(2)("Resource not Found %p\n", pointer);
    468       return false;
    469     }
    470   else
     472  if (tmpResource != NULL)
    471473    return unload(tmpResource, prio);
     474  else
     475  {
     476    PRINTF(2)("Resource not Found %p\n", pointer);
     477    return false;
     478  }
    472479}
    473480
Note: See TracChangeset for help on using the changeset viewer.