Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12285 for code


Ignore:
Timestamp:
Apr 4, 2019, 5:46:25 PM (6 years ago)
Author:
mkarpf
Message:

Example Level with scaling

Location:
code/branches/MouseAPI_FS19
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/MouseAPI_FS19/data/levels/MouseAPIExample.oxw

    r12276 r12285  
    3535    </collisionShapes>
    3636</MouseAPIExample>
    37 
    38 <MouseAPIExample position="100,0,100" direction="0,0,0">
    39     <attached>
    40         <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
    41     </attached>
    42     <collisionShapes>
    43         <BoxCollisionShape position="0,0,0" halfExtents="10,10,10" />
    44     </collisionShapes>
    45 </MouseAPIExample>
    46 
    47 <MouseAPIExample position="100,0,-100" direction="0,0,0">
    48     <attached>
    49         <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
    50     </attached>
    51     <collisionShapes>
    52         <BoxCollisionShape position="0,0,0" halfExtents="10,10,10" />
    53     </collisionShapes>
    54 </MouseAPIExample>
    5537 
    5638  </Scene>
  • code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapiexample.cc

    r12271 r12285  
    99{
    1010    RegisterObject(MouseAPIExample);
    11     //mouseapi = MouseAPI::getInstance();
    1211
    1312}
     
    1918}
    2019
    21 void MouseAPIExample::tick(float dt)
    22 {
    23     ControllableEntity::tick(dt);
    24 
    25 }
    26 
    2720void MouseAPIExample::testfunction(MouseButtonCode::ByEnum mouse)
    2821{
    29     orxout() << "MouseAPIExample: Object Clicked\n";
     22    float randomnumber = (rand()%100 + 1)/100.0;
     23    this->setScale(randomnumber);
     24    orxout() << "Blah\n";
     25
    3026}
    3127
     
    3531    MouseAPI::getInstance().activate();
    3632    MouseAPI::getInstance().addClickableObject(this->getWorldPosition(),10,std::list<MouseButtonCode::ByEnum>{MouseButtonCode::Left},[this](MouseButtonCode::ByEnum mouse){this->testfunction(mouse);});
    37 
    3833}
    3934}
  • code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapiexample.h

    r12271 r12285  
    99#include "worldentities/ControllableEntity.h"
    1010#include "core/CoreIncludes.h"
     11#include <list>
     12#include <stdlib.h>
    1113
    1214namespace orxonox
     
    1921    virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    2022    void testfunction(MouseButtonCode::ByEnum mouse);
    21     virtual void tick(float dt) override;
     23    static std::list<MouseAPIExample> blocks;
    2224};
    2325}
Note: See TracChangeset for help on using the changeset viewer.