Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2009, 2:24:34 PM (15 years ago)
Author:
erwin
Message:

added config ability to sound, few other changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound/src/orxonox/objects/items/Engine.cc

    r2662 r2980  
    3636#include "objects/worldentities/pawns/SpaceShip.h"
    3737#include "tools/Shader.h"
     38#include "sound/SoundBase.h"
    3839
    3940namespace orxonox
     
    9596        XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode);
    9697        XMLPortParam(Engine, "accelerationupdown",    setAccelerationUpDown,    setAccelerationUpDown,    xmlelement, mode);
     98
     99        XMLPortParamLoadOnly(Engine, "sound", loadSound, xmlelement, mode);
    97100    }
    98101
     
    219222    {
    220223        this->ship_ = ship;
     224        this->sound_->attachToEntity(ship);
     225
    221226        if (ship)
    222227        {
     
    240245            return Vector3::ZERO;
    241246    }
     247
     248    void Engine::loadSound(const std::string filename)
     249    {
     250        if(filename == "") return;
     251        else
     252        {
     253            if(this->sound_ == NULL)
     254            {
     255                this->sound_ = new SoundBase(this->ship_);
     256            }
     257
     258            this->sound_->loadFile(filename);
     259            this->sound_->play(true);
     260        }
     261    }
    242262}
Note: See TracChangeset for help on using the changeset viewer.