Browse Source

Skeleton for the particle emitter class.

legacy
Sam Hocevar sam 14 years ago
parent
commit
b7e01a1f90
8 changed files with 119 additions and 0 deletions
  1. +1
    -0
      src/Makefile.am
  2. +1
    -0
      src/core.h
  3. +63
    -0
      src/emitter.cpp
  4. +38
    -0
      src/emitter.h
  5. +2
    -0
      win32/deushax.vcxproj
  6. +6
    -0
      win32/deushax.vcxproj.filters
  7. +2
    -0
      win32/monsterz.vcxproj
  8. +6
    -0
      win32/monsterz.vcxproj.filters

+ 1
- 0
src/Makefile.am View File

@@ -8,6 +8,7 @@ liblol_a_SOURCES = \
forge.cpp forge.h video.cpp video.h timer.cpp timer.h bitfield.h \
profiler.cpp profiler.h input.h input.cpp world.cpp world.h \
sample.cpp sample.h sampler.cpp sampler.h text.cpp text.h \
emitter.cpp emitter.h \
\
sdlinput.cpp sdlinput.h \
\


+ 1
- 0
src/core.h View File

@@ -29,6 +29,7 @@

// Entities
#include "entity.h"
#include "emitter.h"
#include "font.h"
#include "sample.h"
#include "text.h"


+ 63
- 0
src/emitter.cpp View File

@@ -0,0 +1,63 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

#if defined HAVE_CONFIG_H
# include "config.h"
#endif

#include <cstdio>
#include <cmath>

#include "core.h"

/*
* Emitter implementation class
*/

class EmitterData
{
friend class Emitter;

private:
int tiler;
Float3 gravity;
int particles[100];
Float3 positions[100];
Float3 velocities[100];
int nparticles;
};

/*
* Public Emitter class
*/

Emitter::Emitter(int tiler, Float3 gravity)
: data(new EmitterData())
{
data->tiler = tiler;
data->gravity = gravity;
data->nparticles = 0;
}

void Emitter::TickGame(float deltams)
{
Entity::TickGame(deltams);
}

void Emitter::TickDraw(float deltams)
{
Entity::TickDraw(deltams);
}

Emitter::~Emitter()
{
delete data;
}


+ 38
- 0
src/emitter.h View File

@@ -0,0 +1,38 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

//
// The Emitter class
// -----------------
//

#if !defined __DH_EMITTER_H__
#define __DH_EMITTER_H__

#include "entity.h"

class EmitterData;

class Emitter : public Entity
{
public:
Emitter(int tiler, Float3 gravity);
virtual ~Emitter();

protected:
virtual void TickGame(float deltams);
virtual void TickDraw(float deltams);

private:
EmitterData *data;
};

#endif // __DH_EMITTER_H__


+ 2
- 0
win32/deushax.vcxproj View File

@@ -21,6 +21,7 @@
<ClInclude Include="..\src\debugsphere.h" />
<ClInclude Include="..\src\debugstats.h" />
<ClInclude Include="..\src\dict.h" />
<ClInclude Include="..\src\emitter.h" />
<ClInclude Include="..\src\entity.h" />
<ClInclude Include="..\src\font.h" />
<ClInclude Include="..\src\forge.h" />
@@ -51,6 +52,7 @@
<ClCompile Include="..\src\debugsphere.cpp" />
<ClCompile Include="..\src\debugstats.cpp" />
<ClCompile Include="..\src\dict.cpp" />
<ClCompile Include="..\src\emitter.cpp" />
<ClCompile Include="..\src\entity.cpp" />
<ClCompile Include="..\src\font.cpp" />
<ClCompile Include="..\src\forge.cpp" />


+ 6
- 0
win32/deushax.vcxproj.filters View File

@@ -27,6 +27,9 @@
<ClInclude Include="..\src\dict.h">
<Filter>lolengine</Filter>
</ClInclude>
<ClInclude Include="..\src\emitter.h">
<Filter>lolengine</Filter>
</ClInclude>
<ClInclude Include="..\src\entity.h">
<Filter>lolengine</Filter>
</ClInclude>
@@ -106,6 +109,9 @@
<ClCompile Include="..\src\dict.cpp">
<Filter>lolengine</Filter>
</ClCompile>
<ClCompile Include="..\src\emitter.cpp">
<Filter>lolengine</Filter>
</ClCompile>
<ClCompile Include="..\src\entity.cpp">
<Filter>lolengine</Filter>
</ClCompile>


+ 2
- 0
win32/monsterz.vcxproj View File

@@ -24,6 +24,7 @@
<ClInclude Include="..\src\debugsphere.h" />
<ClInclude Include="..\src\debugstats.h" />
<ClInclude Include="..\src\dict.h" />
<ClInclude Include="..\src\emitter.h" />
<ClInclude Include="..\src\entity.h" />
<ClInclude Include="..\src\font.h" />
<ClInclude Include="..\src\forge.h" />
@@ -56,6 +57,7 @@
<ClCompile Include="..\src\debugsphere.cpp" />
<ClCompile Include="..\src\debugstats.cpp" />
<ClCompile Include="..\src\dict.cpp" />
<ClCompile Include="..\src\emitter.cpp" />
<ClCompile Include="..\src\entity.cpp" />
<ClCompile Include="..\src\font.cpp" />
<ClCompile Include="..\src\forge.cpp" />


+ 6
- 0
win32/monsterz.vcxproj.filters View File

@@ -27,6 +27,9 @@
<ClInclude Include="..\src\dict.h">
<Filter>lolengine</Filter>
</ClInclude>
<ClInclude Include="..\src\emitter.h">
<Filter>lolengine</Filter>
</ClInclude>
<ClInclude Include="..\src\entity.h">
<Filter>lolengine</Filter>
</ClInclude>
@@ -109,6 +112,9 @@
<ClCompile Include="..\src\dict.cpp">
<Filter>lolengine</Filter>
</ClCompile>
<ClCompile Include="..\src\emitter.cpp">
<Filter>lolengine</Filter>
</ClCompile>
<ClCompile Include="..\src\entity.cpp">
<Filter>lolengine</Filter>
</ClCompile>


Loading…
Cancel
Save