diff options
author | Chris Xiong <chirs241097@gmail.com> | 2019-05-25 22:40:15 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2019-05-25 22:40:15 +0800 |
commit | 3f72121ac41741d53e4916f1275cbd4f93259c4d (patch) | |
tree | 15bba079c86de0e241812cd657ad190eb0c2c41a /visualization/extrasmeltutils.cpp | |
parent | eba45fdf11a98113b439db0510b55f14845db8fb (diff) | |
download | QMidiPlayer-3f72121ac41741d53e4916f1275cbd4f93259c4d.tar.xz |
Massive code refactor en cours!
Less complain from compilers:
- use nullptr instead of NULL
- use types for event fields
- explicit type casting added
Stop saving parameters of meta events in p1/p2 fields of SEvent.
callback_t now uses std::function, deprecating ICallback.
Not recommended for daily usage, or even testing: the code refactor
is still a work in progress.
Diffstat (limited to 'visualization/extrasmeltutils.cpp')
-rw-r--r-- | visualization/extrasmeltutils.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/visualization/extrasmeltutils.cpp b/visualization/extrasmeltutils.cpp index 6c8dd93..7e766f4 100644 --- a/visualization/extrasmeltutils.cpp +++ b/visualization/extrasmeltutils.cpp @@ -3,9 +3,9 @@ #include <algorithm> #include <smcolor.hpp> #include "extrasmeltutils.hpp" -SMELT* smEntity3DBuffer::sm=NULL; -SMELT* smParticle::sm=NULL; -SMELT* smParticleSystem::sm=NULL; +SMELT* smEntity3DBuffer::sm=nullptr; +SMELT* smParticle::sm=nullptr; +SMELT* smParticleSystem::sm=nullptr; smVertex makeVertex(float x,float y,float z,DWORD color,float tx,float ty) {smVertex v;v.x=x;v.y=y;v.z=z;v.col=color;v.tx=tx;v.ty=ty;return v;} void smEntity3D::addVerices(int n,...) @@ -93,7 +93,7 @@ void smParticle::update() q.v[3].x=v3.x+pos.x;q.v[3].y=v3.y+pos.y;q.v[3].z=v3.z+pos.z; } smParticleSystem::smParticleSystem() -{sm=smGetInterface(SMELT_APILEVEL);particles.clear();posGenerator=NULL;active=false;} +{sm=smGetInterface(SMELT_APILEVEL);particles.clear();posGenerator=nullptr;active=false;} smParticleSystem::~smParticleSystem() {for(unsigned i=0;i<particles.size();++i)delete particles[i];particles.clear();} void smParticleSystem::setParticleSystemInfo(smParticleSystemInfo _psinfo) @@ -104,7 +104,7 @@ void smParticleSystem::setPSEmissionPosGen(smPSEmissionPositionGenerator *_gen) void smParticleSystem::setPSLookAt(smvec3d at){lookat=true;lookatpos=at;} void smParticleSystem::unsetPSLookAt(){lookat=false;} void smParticleSystem::startPS() -{active=true;nemdelay=0;re.setSeed(time(NULL));} +{active=true;nemdelay=0;re.setSeed(time(nullptr));} void smParticleSystem::stopPS() {active=false;} void smParticleSystem::updatePS() @@ -166,7 +166,7 @@ void smParticleSystem::updatePS() } } while(!particles.empty()&&particles.back()->dead) - {delete particles.back();particles.back()=NULL;particles.pop_back();} + {delete particles.back();particles.back()=nullptr;particles.pop_back();} } void smParticleSystem::renderPS() {for(unsigned i=0;i<particles.size();++i)particles[i]->render();} |