Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4666 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 23, 2005, 4:34:44 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: particle-demo now also shows models from the model-directory

Location:
orxonox/trunk/src/subprojects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/subprojects/particles/particle_fun.cc

    r4649 r4666  
    2323#include "stdlibincl.h"
    2424#include "graphics_engine.h"
     25
     26#include <dirent.h>
    2527
    2628#define PINIT_EMISSION_RATE          50
     
    3638#define PINIT_INHERIT_SPEED          0.0
    3739#define PINIT_PARTICLE_MASS          1.0
     40#define PINIT_MODEL_DIRECTORY        "models/"
    3841
    3942
     
    217220          PRINT(4)("ParticleType set to %s\n", value);
    218221        }
    219 
     222        else if(!strcmp(name, "ParticleModel"))
     223        {
     224          char* modelName = new char[strlen(PINIT_MODEL_DIRECTORY) + strlen(value)+1];
     225          sprintf(modelName, "%s%s", PINIT_MODEL_DIRECTORY, value);
     226          tmpSys->setModel(ResourceManager::getFullName(modelName));
     227          delete modelName;
     228        }
    220229      else if (!strcmp(name, "RandomColor"))
    221230        {
     
    370379          systemBox->fill(ParticleType);
    371380
     381          systemBox->fill(new Label("ParticleModel"));
     382          Menu* ParticleModel = new Menu("ParticleModel");
     383          {
     384            DIR* directory;
     385            directory = opendir(ResourceManager::getFullName(PINIT_MODEL_DIRECTORY));
     386            dirent* file;
     387            while(file = readdir(directory))
     388            {
     389              printf("%s\n", file->d_name);
     390              if(strstr(file->d_name, ".obj"))
     391                 ParticleModel->addItem(file->d_name);
     392            }
     393          }
     394          ParticleModel->connectSignal("changed", (void*)ParticleModel, systemChange );
     395          systemBox->fill(ParticleModel);
     396
     397
    372398          Button* RandomColor = new Button("RandomColor");
    373399          RandomColor->connectSignal("released", (void*)RandomColor, systemChange);
  • orxonox/trunk/src/subprojects/testmain/testmain.cc

    r3572 r4666  
     1#include <dirent.h>
     2#include <stdio.h>
     3
    14int main(int argc, char** argv)
    25{
     6  DIR* directory;
     7  directory = opendir("/");
     8  dirent* test;
     9
     10  while(test = readdir(directory))
     11  {
     12    printf("%s\n", test->d_name);
     13  }
     14
    315
    416}
Note: See TracChangeset for help on using the changeset viewer.