Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4834 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Jul 11, 2005, 5:47:23 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: crosshair in WeaponManager (instead of World) and implemented easy Cyling for LoadParam

Location:
orxonox/trunk/src/lib
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/event/event_handler.h

    r4780 r4834  
    1212#include "event_def.h"
    1313
     14// FORWARD DECLARATION
    1415class EventListener;
    15 
     16template <class T> class tList;
    1617
    1718//! The one Event Handler from Orxonox
  • orxonox/trunk/src/lib/event/key_mapper.cc

    r4833 r4834  
    5757//! this is the mapping array from names to ids: enter all orxonox.conf keys here
    5858/** @todo use globals.h for this.... everything is done there for those Options,
    59  * and you do not have to care about The namings
     59 * and you do not have to care about The namings, as they might change
    6060 */
    6161orxKeyMapping map[] = {
    62   {&KeyMapper::PEV_UP,                   "Up"},
    63   {&KeyMapper::PEV_DOWN,                 "Down"},
    64   {&KeyMapper::PEV_LEFT,                 "Left"},
    65   {&KeyMapper::PEV_RIGHT,                "Right"},
     62  {&KeyMapper::PEV_UP,                   CONFIG_NAME_PLAYER_UP},
     63  {&KeyMapper::PEV_DOWN,                 CONFIG_NAME_PLAYER_DOWN},
     64  {&KeyMapper::PEV_LEFT,                 CONFIG_NAME_PLAYER_LEFT},
     65  {&KeyMapper::PEV_RIGHT,                CONFIG_NAME_PLAYER_RIGHT},
    6666  {&KeyMapper::PEV_STRAFE_LEFT,          "StrafeLeft"},
    6767  {&KeyMapper::PEV_STRAFE_RIGHT,         "StrafeRight"},
    6868
    69   {&KeyMapper::PEV_FIRE1,                "Fire"},
     69  {&KeyMapper::PEV_FIRE1,                CONFIG_NAME_PLAYER_FIRE},
    7070  {&KeyMapper::PEV_FIRE1,                "Fire1"},
    7171  {&KeyMapper::PEV_FIRE2,                "Fire2"},
     
    7474
    7575
    76   {&KeyMapper::PEV_VIEW0,                "view0"},
    77   {&KeyMapper::PEV_VIEW1,                "view1"},
    78   {&KeyMapper::PEV_VIEW2,                "view2"},
    79   {&KeyMapper::PEV_VIEW3,                "view3"},
    80   {&KeyMapper::PEV_VIEW4,                "view4"},
    81   {&KeyMapper::PEV_VIEW5,                "view5"},
    82 
    83   {&KeyMapper::PEV_NEXT_WORLD,           "Next-World"},
    84   {&KeyMapper::PEV_PREVIOUS_WORLD,       "Prev-World"},
    85 
    86   {&KeyMapper::PEV_PAUSE,                "Pause"},
    87   {&KeyMapper::PEV_QUIT,                 "Quit"},
     76  {&KeyMapper::PEV_VIEW0,                CONFIG_NAME_VIEW0},
     77  {&KeyMapper::PEV_VIEW1,                CONFIG_NAME_VIEW1},
     78  {&KeyMapper::PEV_VIEW2,                CONFIG_NAME_VIEW2},
     79  {&KeyMapper::PEV_VIEW3,                CONFIG_NAME_VIEW3},
     80  {&KeyMapper::PEV_VIEW4,                CONFIG_NAME_VIEW4},
     81  {&KeyMapper::PEV_VIEW5,                CONFIG_NAME_VIEW5},
     82
     83  {&KeyMapper::PEV_NEXT_WORLD,           CONFIG_NAME_NEXT_WORLD},
     84  {&KeyMapper::PEV_PREVIOUS_WORLD,       CONFIG_NAME_PREV_WORLD},
     85
     86  {&KeyMapper::PEV_PAUSE,                CONFIG_NAME_PAUSE},
     87  {&KeyMapper::PEV_QUIT,                 CONFIG_NAME_QUIT},
    8888  {NULL, NULL}
    8989};
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4833 r4834  
    325325  glDisable(GL_CULL_FACE);
    326326  glDisable(GL_LIGHTING);  // will be set back when leaving 2D-mode
    327   glEnable(GL_TEXTURE_2D);
    328 
    329   /* This allows alpha blending of 2D textures with the scene */
    330   glEnable(GL_BLEND);
    331   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    332327
    333328  glViewport(0, 0, screen->w, screen->h);
     
    351346void GraphicsEngine::leave2DMode()
    352347{
     348  glMatrixMode(GL_PROJECTION);
     349  glPopMatrix();
     350
    353351  glMatrixMode(GL_MODELVIEW);
    354   glPopMatrix();
    355 
    356   glMatrixMode(GL_PROJECTION);
    357352  glPopMatrix();
    358353
     
    444439      this->geTextCFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_DYNAMIC, 0, 255, 0);
    445440      this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
    446       this->geTextCFPS->setPosition(5, 500);
     441      this->geTextCFPS->setPosition(5, 5);
    447442      this->geTextMaxFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_DYNAMIC, 0, 255, 0);
    448443      this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
    449       this->geTextMaxFPS->setPosition(5, 530);
     444      this->geTextMaxFPS->setPosition(5, 35);
    450445      this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
    451446      this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
    452       this->geTextMinFPS->setPosition(5, 560);
     447      this->geTextMinFPS->setPosition(5, 65);
    453448#endif /* NO_TEXT */
    454449    }
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4833 r4834  
    6868
    6969    /** \brief swaps the GL_BUFFERS */
    70     static void swapBuffers() { SDL_GL_SwapBuffers(); };
     70    inline static void swapBuffers() { SDL_GL_SwapBuffers(); };
    7171
    7272    void process(const Event  &event);
  • orxonox/trunk/src/lib/graphics/importer/material.cc

    r4746 r4834  
    5757{
    5858  PRINTF(4)("delete Material %s.\n", this->getName());
     59
    5960  if (this->diffuseTexture)
    6061    ResourceManager::getInstance()->unload(this->diffuseTexture);
     62  if (this->ambientTexture)
     63    ResourceManager::getInstance()->unload(this->ambientTexture);
     64  if (this->specularTexture)
     65    ResourceManager::getInstance()->unload(this->specularTexture);
    6166}
    6267
     
    267272    ResourceManager::getInstance()->unload(this->diffuseTexture);
    268273
    269   //! \todo check if RESOURCE MANAGER is availiable
    270   //! \todo Textures from .mtl-file need special care.
    271   this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE);
     274  //! @todo check if RESOURCE MANAGER is availiable
     275  //! @todo Textures from .mtl-file need special care.
     276  if (dMap!= NULL)
     277    this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE);
     278  else
     279    this->diffuseTexture = NULL;
    272280}
    273281
  • orxonox/trunk/src/lib/graphics/importer/model.cc

    r4822 r4834  
    159159
    160160  this->materialList = new tList<Material>;
     161  this->materialsExtern = false;
    161162
    162163  if (this->type == MODEL_VERTEX_ARRAY)
     
    186187
    187188  // deleting the MaterialList
    188   PRINTF(5)("Deleting Materials.\n");
    189   tIterator<Material>* tmpIt = this->materialList->getIterator();
    190   Material* material = tmpIt->nextElement();
    191 
    192   //! \todo do we really have to delete this material??
    193   while(material)
     189  if (!this->materialsExtern)
     190  {
     191    PRINTF(5)("Deleting Materials.\n");
     192
     193    tIterator<Material>* tmpIt = this->materialList->getIterator();
     194    Material* material = tmpIt->nextElement();
     195  //! @todo do we really have to delete this material??
     196    while(material)
    194197    {
    195198      delete material;
    196199      material = tmpIt->nextElement();
    197200    }
    198   delete tmpIt;
     201    delete tmpIt;
     202  }
    199203  delete materialList;
    200204  delete this->pModelInfo;
     
    356360/**
    357361   \brief finalizes an Model.
    358    This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process.
     362 * This funcion is needed, to delete all the Lists, and arrays that are no more
     363 * needed because they are already imported into openGL.
     364 * This will be applied at the end of the importing Process.
    359365*/
    360366bool Model::cleanup()
     
    372378   \param material the Material to add
    373379   \returns the added material
    374 
    375    !! beware the Material will be deleted when the Model gets deleted
     380 *
     381 * this also tells this Model, that all the Materials are handled externally
     382 * with this option set the Materials will not be deleted with the Model.
     383 * !! -> NO MATERIALS GET DELETED WITH ONE CALL TO THIS FUNCTION !!
    376384*/
    377385Material* Model::addMaterial(Material* material)
    378386{
    379387  this->materialList->add(material);
     388  this->materialsExtern = true;
    380389  return material;
    381390}
  • orxonox/trunk/src/lib/graphics/importer/model.h

    r4830 r4834  
    190190
    191191  tList<Material>* materialList;    //!< A list for all the Materials in this Model
     192  bool             materialsExtern; //!< If the materials given to this Object are extern.
    192193};
    193194
  • orxonox/trunk/src/lib/graphics/text_engine.cc

    r4830 r4834  
    919919  // entering 3D-mode
    920920  GraphicsEngine::enter2DMode();
     921  glEnable(GL_TEXTURE_2D);
     922  glEnable(GL_BLEND);
     923  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     924
    921925  // drawing all the texts
    922926  tIterator<Text>* textIterator = textList->getIterator();
  • orxonox/trunk/src/lib/particles/particle_engine.cc

    r4746 r4834  
    9696  }
    9797}
    98 
    99 
    10098
    10199/**
Note: See TracChangeset for help on using the changeset viewer.