Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4374 in orxonox.OLD for orxonox


Ignore:
Timestamp:
May 29, 2005, 11:24:12 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: ability to change background color

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4320 r4374  
    170170  this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel);
    171171}
     172
     173void GraphicsEngine::setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
     174{
     175  glClearColor(red, green, blue, alpha);
     176}
     177
    172178
    173179/**
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4245 r4374  
    2727  int setResolution(int width, int height, int bpp);
    2828  void setFullscreen(bool fullscreen = false);
     29  static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0);
     30
    2931  /** \returns the x resolution */
    3032  inline int getResolutionX(void) {return this->resolutionX;}
  • orxonox/trunk/src/subprojects/framework.cc

    r4360 r4374  
    184184            this->printHelp();
    185185            break;
     186          case SDLK_2:
     187            for (int i = 0; i < 3; i++)
     188              {
     189                backgroundColor[i] += .1;
     190                if (backgroundColor[i] > 1.0)
     191                  backgroundColor[i] = 1.0;
     192                GraphicsEngine::setBackgroundColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]);
     193              }
     194            break;
     195          case SDLK_1:
     196            for (int i = 0; i < 3; i++)
     197              {
     198                backgroundColor[i] -= .1;
     199                if (backgroundColor[i] < 0.0)
     200                  backgroundColor[i] = 0.0;
     201                GraphicsEngine::setBackgroundColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]);
     202              }
     203            break;
    186204          }
    187205        break;
     
    241259  SDL_ShowCursor(2);
    242260
    243   for (int i = 0; i <MOUSE_BUTTON_COUNT; i++)
     261  for (int i = 0; i < MOUSE_BUTTON_COUNT; i++)
    244262    mouseDown[i] = false;
     263  for (int i = 0; i < 4; i++)
     264    backgroundColor[i] = 0;
    245265
    246266  ResourceManager::getInstance()->setDataDir(DATA_DIRECTORY);
     
    251271
    252272  camera->setAbsCoor(Vector(10, 10, 10));
     273
    253274}
    254275
     
    265286  PRINT(0)(" Help for the frameWork\n");
    266287  PRINT(0)("========================\n");
    267   PRINT(0)("h - print thisHelp\n");
     288  PRINT(0)("h - print this Help\n");
    268289  PRINT(0)("a - zoom in\n");
    269290  PRINT(0)("z - zoom out\n");
    270291  PRINT(0)("r - reset camera position\n");
     292  PRINT(0)("1 - background color darker\n");
     293  PRINT(0)("2 - background color brighter\n");
     294
    271295
    272296  PRINT(0)("\n");
  • orxonox/trunk/src/subprojects/framework.h

    r4349 r4374  
    2626
    2727  int movement [4];
    28  
     28  float backgroundColor[4];
     29
    2930  Uint32 lastFrame;
    3031  Uint32 currFrame;
Note: See TracChangeset for help on using the changeset viewer.