Apply LF line endings as an SVN property, this time on the JGE source files.
This commit is contained in:
@@ -1,81 +1,81 @@
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeColor*** helper classes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGECOLOR_H
|
||||
#define HGECOLOR_H
|
||||
|
||||
|
||||
//#include "hge.h"
|
||||
|
||||
#include "../JTypes.h"
|
||||
|
||||
#define hgeColor hgeColorRGB
|
||||
|
||||
inline void ColorClamp(float &x) { if(x<0.0f) x=0.0f; if(x>1.0f) x=1.0f; }
|
||||
|
||||
|
||||
class hgeColorRGB
|
||||
{
|
||||
public:
|
||||
float r,g,b,a;
|
||||
|
||||
hgeColorRGB(float _r, float _g, float _b, float _a) { r=_r; g=_g; b=_b; a=_a; }
|
||||
hgeColorRGB(DWORD col) { SetHWColor(col); }
|
||||
hgeColorRGB() { r=g=b=a=0; }
|
||||
|
||||
hgeColorRGB operator- (const hgeColorRGB &c) const { return hgeColorRGB(r-c.r, g-c.g, b-c.b, a-c.a); }
|
||||
hgeColorRGB operator+ (const hgeColorRGB &c) const { return hgeColorRGB(r+c.r, g+c.g, b+c.b, a+c.a); }
|
||||
hgeColorRGB operator* (const hgeColorRGB &c) const { return hgeColorRGB(r*c.r, g*c.g, b*c.b, a*c.a); }
|
||||
hgeColorRGB& operator-= (const hgeColorRGB &c) { r-=c.r; g-=c.g; b-=c.b; a-=c.a; return *this; }
|
||||
hgeColorRGB& operator+= (const hgeColorRGB &c) { r+=c.r; g+=c.g; b+=c.b; a+=c.a; return *this; }
|
||||
bool operator== (const hgeColorRGB &c) const { return (r==c.r && g==c.g && b==c.b && a==c.a); }
|
||||
bool operator!= (const hgeColorRGB &c) const { return (r!=c.r || g!=c.g || b!=c.b || a!=c.a); }
|
||||
|
||||
hgeColorRGB operator/ (const float scalar) const { return hgeColorRGB(r/scalar, g/scalar, b/scalar, a/scalar); }
|
||||
hgeColorRGB operator* (const float scalar) const { return hgeColorRGB(r*scalar, g*scalar, b*scalar, a*scalar); }
|
||||
hgeColorRGB& operator*= (const float scalar) { r*=scalar; g*=scalar; b*=scalar; a*=scalar; return *this; }
|
||||
|
||||
void Clamp() { ColorClamp(r); ColorClamp(g); ColorClamp(b); ColorClamp(a); }
|
||||
void SetHWColor(DWORD col) { a = (col>>24)/255.0f; r = ((col>>16) & 0xFF)/255.0f; g = ((col>>8) & 0xFF)/255.0f; b = (col & 0xFF)/255.0f; }
|
||||
DWORD GetHWColor() const { return ARGB(((int)(a*255.0f)), ((int)(r*255.0f)), ((int)(g*255.0f)), ((int)(b*255.0f))); }
|
||||
};
|
||||
|
||||
inline hgeColorRGB operator* (const float sc, const hgeColorRGB &c) { return c*sc; }
|
||||
|
||||
|
||||
class hgeColorHSV
|
||||
{
|
||||
public:
|
||||
float h,s,v,a;
|
||||
|
||||
hgeColorHSV(float _h, float _s, float _v, float _a) { h=_h; s=_s; v=_v; a=_a; }
|
||||
hgeColorHSV(DWORD col) { SetHWColor(col); }
|
||||
hgeColorHSV() { h=s=v=a=0; }
|
||||
|
||||
hgeColorHSV operator- (const hgeColorHSV &c) const { return hgeColorHSV(h-c.h, s-c.s, v-c.v, a-c.a); }
|
||||
hgeColorHSV operator+ (const hgeColorHSV &c) const { return hgeColorHSV(h+c.h, s+c.s, v+c.v, a+c.a); }
|
||||
hgeColorHSV operator* (const hgeColorHSV &c) const { return hgeColorHSV(h*c.h, s*c.s, v*c.v, a*c.a); }
|
||||
hgeColorHSV& operator-= (const hgeColorHSV &c) { h-=c.h; s-=c.s; v-=c.v; a-=c.a; return *this; }
|
||||
hgeColorHSV& operator+= (const hgeColorHSV &c) { h+=c.h; s+=c.s; v+=c.v; a+=c.a; return *this; }
|
||||
bool operator== (const hgeColorHSV &c) const { return (h==c.h && s==c.s && v==c.v && a==c.a); }
|
||||
bool operator!= (const hgeColorHSV &c) const { return (h!=c.h || s!=c.s || v!=c.v || a!=c.a); }
|
||||
|
||||
hgeColorHSV operator/ (const float scalar) const { return hgeColorHSV(h/scalar, s/scalar, v/scalar, a/scalar); }
|
||||
hgeColorHSV operator* (const float scalar) const { return hgeColorHSV(h*scalar, s*scalar, v*scalar, a*scalar); }
|
||||
hgeColorHSV& operator*= (const float scalar) { h*=scalar; s*=scalar; v*=scalar; a*=scalar; return *this; }
|
||||
|
||||
void Clamp() { ColorClamp(h); ColorClamp(s); ColorClamp(v); ColorClamp(a); }
|
||||
void SetHWColor(DWORD col);
|
||||
DWORD GetHWColor() const;
|
||||
};
|
||||
|
||||
inline hgeColorHSV operator* (const float sc, const hgeColorHSV &c) { return c*sc; }
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeColor*** helper classes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGECOLOR_H
|
||||
#define HGECOLOR_H
|
||||
|
||||
|
||||
//#include "hge.h"
|
||||
|
||||
#include "../JTypes.h"
|
||||
|
||||
#define hgeColor hgeColorRGB
|
||||
|
||||
inline void ColorClamp(float &x) { if(x<0.0f) x=0.0f; if(x>1.0f) x=1.0f; }
|
||||
|
||||
|
||||
class hgeColorRGB
|
||||
{
|
||||
public:
|
||||
float r,g,b,a;
|
||||
|
||||
hgeColorRGB(float _r, float _g, float _b, float _a) { r=_r; g=_g; b=_b; a=_a; }
|
||||
hgeColorRGB(DWORD col) { SetHWColor(col); }
|
||||
hgeColorRGB() { r=g=b=a=0; }
|
||||
|
||||
hgeColorRGB operator- (const hgeColorRGB &c) const { return hgeColorRGB(r-c.r, g-c.g, b-c.b, a-c.a); }
|
||||
hgeColorRGB operator+ (const hgeColorRGB &c) const { return hgeColorRGB(r+c.r, g+c.g, b+c.b, a+c.a); }
|
||||
hgeColorRGB operator* (const hgeColorRGB &c) const { return hgeColorRGB(r*c.r, g*c.g, b*c.b, a*c.a); }
|
||||
hgeColorRGB& operator-= (const hgeColorRGB &c) { r-=c.r; g-=c.g; b-=c.b; a-=c.a; return *this; }
|
||||
hgeColorRGB& operator+= (const hgeColorRGB &c) { r+=c.r; g+=c.g; b+=c.b; a+=c.a; return *this; }
|
||||
bool operator== (const hgeColorRGB &c) const { return (r==c.r && g==c.g && b==c.b && a==c.a); }
|
||||
bool operator!= (const hgeColorRGB &c) const { return (r!=c.r || g!=c.g || b!=c.b || a!=c.a); }
|
||||
|
||||
hgeColorRGB operator/ (const float scalar) const { return hgeColorRGB(r/scalar, g/scalar, b/scalar, a/scalar); }
|
||||
hgeColorRGB operator* (const float scalar) const { return hgeColorRGB(r*scalar, g*scalar, b*scalar, a*scalar); }
|
||||
hgeColorRGB& operator*= (const float scalar) { r*=scalar; g*=scalar; b*=scalar; a*=scalar; return *this; }
|
||||
|
||||
void Clamp() { ColorClamp(r); ColorClamp(g); ColorClamp(b); ColorClamp(a); }
|
||||
void SetHWColor(DWORD col) { a = (col>>24)/255.0f; r = ((col>>16) & 0xFF)/255.0f; g = ((col>>8) & 0xFF)/255.0f; b = (col & 0xFF)/255.0f; }
|
||||
DWORD GetHWColor() const { return ARGB(((int)(a*255.0f)), ((int)(r*255.0f)), ((int)(g*255.0f)), ((int)(b*255.0f))); }
|
||||
};
|
||||
|
||||
inline hgeColorRGB operator* (const float sc, const hgeColorRGB &c) { return c*sc; }
|
||||
|
||||
|
||||
class hgeColorHSV
|
||||
{
|
||||
public:
|
||||
float h,s,v,a;
|
||||
|
||||
hgeColorHSV(float _h, float _s, float _v, float _a) { h=_h; s=_s; v=_v; a=_a; }
|
||||
hgeColorHSV(DWORD col) { SetHWColor(col); }
|
||||
hgeColorHSV() { h=s=v=a=0; }
|
||||
|
||||
hgeColorHSV operator- (const hgeColorHSV &c) const { return hgeColorHSV(h-c.h, s-c.s, v-c.v, a-c.a); }
|
||||
hgeColorHSV operator+ (const hgeColorHSV &c) const { return hgeColorHSV(h+c.h, s+c.s, v+c.v, a+c.a); }
|
||||
hgeColorHSV operator* (const hgeColorHSV &c) const { return hgeColorHSV(h*c.h, s*c.s, v*c.v, a*c.a); }
|
||||
hgeColorHSV& operator-= (const hgeColorHSV &c) { h-=c.h; s-=c.s; v-=c.v; a-=c.a; return *this; }
|
||||
hgeColorHSV& operator+= (const hgeColorHSV &c) { h+=c.h; s+=c.s; v+=c.v; a+=c.a; return *this; }
|
||||
bool operator== (const hgeColorHSV &c) const { return (h==c.h && s==c.s && v==c.v && a==c.a); }
|
||||
bool operator!= (const hgeColorHSV &c) const { return (h!=c.h || s!=c.s || v!=c.v || a!=c.a); }
|
||||
|
||||
hgeColorHSV operator/ (const float scalar) const { return hgeColorHSV(h/scalar, s/scalar, v/scalar, a/scalar); }
|
||||
hgeColorHSV operator* (const float scalar) const { return hgeColorHSV(h*scalar, s*scalar, v*scalar, a*scalar); }
|
||||
hgeColorHSV& operator*= (const float scalar) { h*=scalar; s*=scalar; v*=scalar; a*=scalar; return *this; }
|
||||
|
||||
void Clamp() { ColorClamp(h); ColorClamp(s); ColorClamp(v); ColorClamp(a); }
|
||||
void SetHWColor(DWORD col);
|
||||
DWORD GetHWColor() const;
|
||||
};
|
||||
|
||||
inline hgeColorHSV operator* (const float sc, const hgeColorHSV &c) { return c*sc; }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,70 +1,70 @@
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeDistortionMesh helper class header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGEDISTORT_H
|
||||
#define HGEDISTORT_H
|
||||
|
||||
|
||||
//#include "hge.h"
|
||||
#include "../JTypes.h"
|
||||
|
||||
|
||||
#define HGEDISP_NODE 0
|
||||
#define HGEDISP_TOPLEFT 1
|
||||
#define HGEDISP_CENTER 2
|
||||
|
||||
class JTexture;
|
||||
class JQuad;
|
||||
|
||||
/*
|
||||
** HGE Distortion mesh class
|
||||
*/
|
||||
class hgeDistortionMesh
|
||||
{
|
||||
public:
|
||||
hgeDistortionMesh(int cols, int rows);
|
||||
hgeDistortionMesh(const hgeDistortionMesh &dm);
|
||||
~hgeDistortionMesh();
|
||||
|
||||
hgeDistortionMesh& operator= (const hgeDistortionMesh &dm);
|
||||
|
||||
void Render(float x, float y);
|
||||
void Clear(PIXEL_TYPE col=ARGB(0xFF,0xFF,0xFF,0xFF), float z=0.5f);
|
||||
|
||||
void SetTexture(JTexture* tex);
|
||||
void SetTextureRect(float x, float y, float w, float h);
|
||||
void SetBlendMode(int blend);
|
||||
void SetZ(int col, int row, float z);
|
||||
void SetColor(int col, int row, PIXEL_TYPE color);
|
||||
void SetDisplacement(int col, int row, float dx, float dy, int ref);
|
||||
|
||||
JTexture* GetTexture() const {return quad->mTex;}
|
||||
void GetTextureRect(float *x, float *y, float *w, float *h) const { *x=tx; *y=ty; *w=width; *h=height; }
|
||||
int GetBlendMode() const { return 0; }
|
||||
float GetZ(int col, int row) const;
|
||||
PIXEL_TYPE GetColor(int col, int row) const;
|
||||
void GetDisplacement(int col, int row, float *dx, float *dy, int ref) const;
|
||||
|
||||
int GetRows() { return nRows; }
|
||||
int GetCols() { return nCols; }
|
||||
|
||||
private:
|
||||
hgeDistortionMesh();
|
||||
|
||||
//static HGE *hge;
|
||||
|
||||
Vertex *disp_array;
|
||||
int nRows, nCols;
|
||||
float cellw,cellh;
|
||||
float tx,ty,width,height;
|
||||
JQuad* quad;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeDistortionMesh helper class header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGEDISTORT_H
|
||||
#define HGEDISTORT_H
|
||||
|
||||
|
||||
//#include "hge.h"
|
||||
#include "../JTypes.h"
|
||||
|
||||
|
||||
#define HGEDISP_NODE 0
|
||||
#define HGEDISP_TOPLEFT 1
|
||||
#define HGEDISP_CENTER 2
|
||||
|
||||
class JTexture;
|
||||
class JQuad;
|
||||
|
||||
/*
|
||||
** HGE Distortion mesh class
|
||||
*/
|
||||
class hgeDistortionMesh
|
||||
{
|
||||
public:
|
||||
hgeDistortionMesh(int cols, int rows);
|
||||
hgeDistortionMesh(const hgeDistortionMesh &dm);
|
||||
~hgeDistortionMesh();
|
||||
|
||||
hgeDistortionMesh& operator= (const hgeDistortionMesh &dm);
|
||||
|
||||
void Render(float x, float y);
|
||||
void Clear(PIXEL_TYPE col=ARGB(0xFF,0xFF,0xFF,0xFF), float z=0.5f);
|
||||
|
||||
void SetTexture(JTexture* tex);
|
||||
void SetTextureRect(float x, float y, float w, float h);
|
||||
void SetBlendMode(int blend);
|
||||
void SetZ(int col, int row, float z);
|
||||
void SetColor(int col, int row, PIXEL_TYPE color);
|
||||
void SetDisplacement(int col, int row, float dx, float dy, int ref);
|
||||
|
||||
JTexture* GetTexture() const {return quad->mTex;}
|
||||
void GetTextureRect(float *x, float *y, float *w, float *h) const { *x=tx; *y=ty; *w=width; *h=height; }
|
||||
int GetBlendMode() const { return 0; }
|
||||
float GetZ(int col, int row) const;
|
||||
PIXEL_TYPE GetColor(int col, int row) const;
|
||||
void GetDisplacement(int col, int row, float *dx, float *dy, int ref) const;
|
||||
|
||||
int GetRows() { return nRows; }
|
||||
int GetCols() { return nCols; }
|
||||
|
||||
private:
|
||||
hgeDistortionMesh();
|
||||
|
||||
//static HGE *hge;
|
||||
|
||||
Vertex *disp_array;
|
||||
int nRows, nCols;
|
||||
float cellw,cellh;
|
||||
float tx,ty,width,height;
|
||||
JQuad* quad;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,93 +1,93 @@
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeFont helper class header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGEFONT_H
|
||||
#define HGEFONT_H
|
||||
|
||||
#include "../JTypes.h"
|
||||
//#include "hge.h"
|
||||
//#include "hgesprite.h"
|
||||
|
||||
|
||||
#define HGETEXT_LEFT 0
|
||||
#define HGETEXT_RIGHT 1
|
||||
#define HGETEXT_CENTER 2
|
||||
#define HGETEXT_HORZMASK 0x03
|
||||
|
||||
#define HGETEXT_TOP 0
|
||||
#define HGETEXT_BOTTOM 4
|
||||
#define HGETEXT_MIDDLE 8
|
||||
#define HGETEXT_VERTMASK 0x0C
|
||||
|
||||
class JTexture;
|
||||
class JQuad;
|
||||
/*
|
||||
** HGE Font class
|
||||
*/
|
||||
class hgeFont
|
||||
{
|
||||
public:
|
||||
hgeFont(const char *filename, bool bMipmap=false);
|
||||
~hgeFont();
|
||||
|
||||
void Render(float x, float y, int align, const char *string);
|
||||
void printf(float x, float y, int align, const char *format, ...);
|
||||
void printfb(float x, float y, float w, float h, int align, const char *format, ...);
|
||||
|
||||
void SetColor(PIXEL_TYPE col);
|
||||
void SetZ(float z);
|
||||
void SetBlendMode(int blend);
|
||||
void SetScale(float scale) {fScale=scale;}
|
||||
void SetProportion(float prop) { fProportion=prop; }
|
||||
void SetRotation(float rot) {fRot=rot;}
|
||||
void SetTracking(float tracking) {fTracking=tracking;}
|
||||
void SetSpacing(float spacing) {fSpacing=spacing;}
|
||||
|
||||
PIXEL_TYPE GetColor() const {return dwCol;}
|
||||
float GetZ() const {return fZ;}
|
||||
int GetBlendMode() const {return nBlend;}
|
||||
float GetScale() const {return fScale;}
|
||||
float GetProportion() const { return fProportion; }
|
||||
float GetRotation() const {return fRot;}
|
||||
float GetTracking() const {return fTracking;}
|
||||
float GetSpacing() const {return fSpacing;}
|
||||
|
||||
JQuad* GetSprite(char chr) const { return letters[(unsigned char)chr]; }
|
||||
float GetHeight() const { return fHeight; }
|
||||
float GetStringWidth(const char *string) const;
|
||||
|
||||
private:
|
||||
hgeFont();
|
||||
hgeFont(const hgeFont &fnt);
|
||||
hgeFont& operator= (const hgeFont &fnt);
|
||||
|
||||
char* _get_line(char *file, char *line);
|
||||
|
||||
//static HGE *hge;
|
||||
|
||||
static char buffer[256];
|
||||
|
||||
JTexture* hTexture;
|
||||
JQuad* letters[256];
|
||||
float pre[256];
|
||||
float post[256];
|
||||
float fHeight;
|
||||
float fScale;
|
||||
float fProportion;
|
||||
float fRot;
|
||||
float fTracking;
|
||||
float fSpacing;
|
||||
|
||||
PIXEL_TYPE dwCol;
|
||||
float fZ;
|
||||
int nBlend;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeFont helper class header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGEFONT_H
|
||||
#define HGEFONT_H
|
||||
|
||||
#include "../JTypes.h"
|
||||
//#include "hge.h"
|
||||
//#include "hgesprite.h"
|
||||
|
||||
|
||||
#define HGETEXT_LEFT 0
|
||||
#define HGETEXT_RIGHT 1
|
||||
#define HGETEXT_CENTER 2
|
||||
#define HGETEXT_HORZMASK 0x03
|
||||
|
||||
#define HGETEXT_TOP 0
|
||||
#define HGETEXT_BOTTOM 4
|
||||
#define HGETEXT_MIDDLE 8
|
||||
#define HGETEXT_VERTMASK 0x0C
|
||||
|
||||
class JTexture;
|
||||
class JQuad;
|
||||
/*
|
||||
** HGE Font class
|
||||
*/
|
||||
class hgeFont
|
||||
{
|
||||
public:
|
||||
hgeFont(const char *filename, bool bMipmap=false);
|
||||
~hgeFont();
|
||||
|
||||
void Render(float x, float y, int align, const char *string);
|
||||
void printf(float x, float y, int align, const char *format, ...);
|
||||
void printfb(float x, float y, float w, float h, int align, const char *format, ...);
|
||||
|
||||
void SetColor(PIXEL_TYPE col);
|
||||
void SetZ(float z);
|
||||
void SetBlendMode(int blend);
|
||||
void SetScale(float scale) {fScale=scale;}
|
||||
void SetProportion(float prop) { fProportion=prop; }
|
||||
void SetRotation(float rot) {fRot=rot;}
|
||||
void SetTracking(float tracking) {fTracking=tracking;}
|
||||
void SetSpacing(float spacing) {fSpacing=spacing;}
|
||||
|
||||
PIXEL_TYPE GetColor() const {return dwCol;}
|
||||
float GetZ() const {return fZ;}
|
||||
int GetBlendMode() const {return nBlend;}
|
||||
float GetScale() const {return fScale;}
|
||||
float GetProportion() const { return fProportion; }
|
||||
float GetRotation() const {return fRot;}
|
||||
float GetTracking() const {return fTracking;}
|
||||
float GetSpacing() const {return fSpacing;}
|
||||
|
||||
JQuad* GetSprite(char chr) const { return letters[(unsigned char)chr]; }
|
||||
float GetHeight() const { return fHeight; }
|
||||
float GetStringWidth(const char *string) const;
|
||||
|
||||
private:
|
||||
hgeFont();
|
||||
hgeFont(const hgeFont &fnt);
|
||||
hgeFont& operator= (const hgeFont &fnt);
|
||||
|
||||
char* _get_line(char *file, char *line);
|
||||
|
||||
//static HGE *hge;
|
||||
|
||||
static char buffer[256];
|
||||
|
||||
JTexture* hTexture;
|
||||
JQuad* letters[256];
|
||||
float pre[256];
|
||||
float post[256];
|
||||
float fHeight;
|
||||
float fScale;
|
||||
float fProportion;
|
||||
float fRot;
|
||||
float fTracking;
|
||||
float fSpacing;
|
||||
|
||||
PIXEL_TYPE dwCol;
|
||||
float fZ;
|
||||
int nBlend;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,165 +1,165 @@
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeParticleSystem helper class header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGEPARTICLE_H
|
||||
#define HGEPARTICLE_H
|
||||
|
||||
|
||||
//#include "hge.h"
|
||||
//#include "hgesprite.h"
|
||||
#include "hgevector.h"
|
||||
#include "hgecolor.h"
|
||||
#include "hgerect.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
class JQuad;
|
||||
|
||||
#define MAX_PARTICLES 500
|
||||
#define MAX_PSYSTEMS 100
|
||||
|
||||
struct hgeParticle
|
||||
{
|
||||
hgeVector vecLocation;
|
||||
hgeVector vecVelocity;
|
||||
|
||||
float fGravity;
|
||||
float fRadialAccel;
|
||||
float fTangentialAccel;
|
||||
|
||||
float fSpin;
|
||||
float fSpinDelta;
|
||||
|
||||
float fSize;
|
||||
float fSizeDelta;
|
||||
|
||||
hgeColor colColor; // + alpha
|
||||
hgeColor colColorDelta;
|
||||
|
||||
float fAge;
|
||||
float fTerminalAge;
|
||||
};
|
||||
|
||||
struct hgeParticleSystemInfo
|
||||
{
|
||||
JQuad* sprite; // texture + blend mode
|
||||
int nEmission; // particles per sec
|
||||
float fLifetime;
|
||||
|
||||
float fParticleLifeMin;
|
||||
float fParticleLifeMax;
|
||||
|
||||
float fDirection;
|
||||
float fSpread;
|
||||
bool bRelative;
|
||||
|
||||
float fSpeedMin;
|
||||
float fSpeedMax;
|
||||
|
||||
float fGravityMin;
|
||||
float fGravityMax;
|
||||
|
||||
float fRadialAccelMin;
|
||||
float fRadialAccelMax;
|
||||
|
||||
float fTangentialAccelMin;
|
||||
float fTangentialAccelMax;
|
||||
|
||||
float fSizeStart;
|
||||
float fSizeEnd;
|
||||
float fSizeVar;
|
||||
|
||||
float fSpinStart;
|
||||
float fSpinEnd;
|
||||
float fSpinVar;
|
||||
|
||||
hgeColor colColorStart; // + alpha
|
||||
hgeColor colColorEnd;
|
||||
float fColorVar;
|
||||
float fAlphaVar;
|
||||
};
|
||||
|
||||
class hgeParticleSystem
|
||||
{
|
||||
public:
|
||||
hgeParticleSystemInfo info;
|
||||
|
||||
hgeParticleSystem(const char *filename, JQuad *sprite);
|
||||
hgeParticleSystem(hgeParticleSystemInfo *psi);
|
||||
hgeParticleSystem(const hgeParticleSystem &ps);
|
||||
~hgeParticleSystem() { }
|
||||
|
||||
hgeParticleSystem& operator= (const hgeParticleSystem &ps);
|
||||
|
||||
|
||||
void Render();
|
||||
void FireAt(float x, float y);
|
||||
void Fire();
|
||||
void Stop(bool bKillParticles=false);
|
||||
void Update(float fDeltaTime);
|
||||
void MoveTo(float x, float y, bool bMoveParticles=false);
|
||||
void Transpose(float x, float y) { fTx=x; fTy=y; }
|
||||
void TrackBoundingBox(bool bTrack) { bUpdateBoundingBox=bTrack; }
|
||||
|
||||
int GetParticlesAlive() const { return nParticlesAlive; }
|
||||
float GetAge() const { return fAge; }
|
||||
void GetPosition(float *x, float *y) const { *x=vecLocation.x; *y=vecLocation.y; }
|
||||
void GetTransposition(float *x, float *y) const { *x=fTx; *y=fTy; }
|
||||
hgeRect* GetBoundingBox(hgeRect *rect) const { memcpy(rect, &rectBoundingBox, sizeof(hgeRect)); return rect; }
|
||||
|
||||
private:
|
||||
hgeParticleSystem();
|
||||
|
||||
//static HGE *hge;
|
||||
|
||||
float fAge;
|
||||
float fEmissionResidue;
|
||||
|
||||
hgeVector vecPrevLocation;
|
||||
hgeVector vecLocation;
|
||||
float fTx, fTy;
|
||||
|
||||
int nParticlesAlive;
|
||||
hgeRect rectBoundingBox;
|
||||
bool bUpdateBoundingBox;
|
||||
|
||||
typedef std::list<hgeParticle> ParticleBuffer;
|
||||
ParticleBuffer mParticleBuffer;
|
||||
|
||||
float mTimer;
|
||||
};
|
||||
|
||||
class hgeParticleManager
|
||||
{
|
||||
public:
|
||||
hgeParticleManager();
|
||||
~hgeParticleManager();
|
||||
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
|
||||
hgeParticleSystem* SpawnPS(hgeParticleSystemInfo *psi, float x, float y);
|
||||
bool IsPSAlive(hgeParticleSystem *ps) const;
|
||||
void Transpose(float x, float y);
|
||||
void GetTransposition(float *dx, float *dy) const {*dx=tX; *dy=tY;}
|
||||
void KillPS(hgeParticleSystem *ps);
|
||||
void KillAll();
|
||||
|
||||
private:
|
||||
hgeParticleManager(const hgeParticleManager &);
|
||||
hgeParticleManager& operator= (const hgeParticleManager &);
|
||||
|
||||
int nPS;
|
||||
float tX;
|
||||
float tY;
|
||||
hgeParticleSystem* psList[MAX_PSYSTEMS];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeParticleSystem helper class header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGEPARTICLE_H
|
||||
#define HGEPARTICLE_H
|
||||
|
||||
|
||||
//#include "hge.h"
|
||||
//#include "hgesprite.h"
|
||||
#include "hgevector.h"
|
||||
#include "hgecolor.h"
|
||||
#include "hgerect.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
class JQuad;
|
||||
|
||||
#define MAX_PARTICLES 500
|
||||
#define MAX_PSYSTEMS 100
|
||||
|
||||
struct hgeParticle
|
||||
{
|
||||
hgeVector vecLocation;
|
||||
hgeVector vecVelocity;
|
||||
|
||||
float fGravity;
|
||||
float fRadialAccel;
|
||||
float fTangentialAccel;
|
||||
|
||||
float fSpin;
|
||||
float fSpinDelta;
|
||||
|
||||
float fSize;
|
||||
float fSizeDelta;
|
||||
|
||||
hgeColor colColor; // + alpha
|
||||
hgeColor colColorDelta;
|
||||
|
||||
float fAge;
|
||||
float fTerminalAge;
|
||||
};
|
||||
|
||||
struct hgeParticleSystemInfo
|
||||
{
|
||||
JQuad* sprite; // texture + blend mode
|
||||
int nEmission; // particles per sec
|
||||
float fLifetime;
|
||||
|
||||
float fParticleLifeMin;
|
||||
float fParticleLifeMax;
|
||||
|
||||
float fDirection;
|
||||
float fSpread;
|
||||
bool bRelative;
|
||||
|
||||
float fSpeedMin;
|
||||
float fSpeedMax;
|
||||
|
||||
float fGravityMin;
|
||||
float fGravityMax;
|
||||
|
||||
float fRadialAccelMin;
|
||||
float fRadialAccelMax;
|
||||
|
||||
float fTangentialAccelMin;
|
||||
float fTangentialAccelMax;
|
||||
|
||||
float fSizeStart;
|
||||
float fSizeEnd;
|
||||
float fSizeVar;
|
||||
|
||||
float fSpinStart;
|
||||
float fSpinEnd;
|
||||
float fSpinVar;
|
||||
|
||||
hgeColor colColorStart; // + alpha
|
||||
hgeColor colColorEnd;
|
||||
float fColorVar;
|
||||
float fAlphaVar;
|
||||
};
|
||||
|
||||
class hgeParticleSystem
|
||||
{
|
||||
public:
|
||||
hgeParticleSystemInfo info;
|
||||
|
||||
hgeParticleSystem(const char *filename, JQuad *sprite);
|
||||
hgeParticleSystem(hgeParticleSystemInfo *psi);
|
||||
hgeParticleSystem(const hgeParticleSystem &ps);
|
||||
~hgeParticleSystem() { }
|
||||
|
||||
hgeParticleSystem& operator= (const hgeParticleSystem &ps);
|
||||
|
||||
|
||||
void Render();
|
||||
void FireAt(float x, float y);
|
||||
void Fire();
|
||||
void Stop(bool bKillParticles=false);
|
||||
void Update(float fDeltaTime);
|
||||
void MoveTo(float x, float y, bool bMoveParticles=false);
|
||||
void Transpose(float x, float y) { fTx=x; fTy=y; }
|
||||
void TrackBoundingBox(bool bTrack) { bUpdateBoundingBox=bTrack; }
|
||||
|
||||
int GetParticlesAlive() const { return nParticlesAlive; }
|
||||
float GetAge() const { return fAge; }
|
||||
void GetPosition(float *x, float *y) const { *x=vecLocation.x; *y=vecLocation.y; }
|
||||
void GetTransposition(float *x, float *y) const { *x=fTx; *y=fTy; }
|
||||
hgeRect* GetBoundingBox(hgeRect *rect) const { memcpy(rect, &rectBoundingBox, sizeof(hgeRect)); return rect; }
|
||||
|
||||
private:
|
||||
hgeParticleSystem();
|
||||
|
||||
//static HGE *hge;
|
||||
|
||||
float fAge;
|
||||
float fEmissionResidue;
|
||||
|
||||
hgeVector vecPrevLocation;
|
||||
hgeVector vecLocation;
|
||||
float fTx, fTy;
|
||||
|
||||
int nParticlesAlive;
|
||||
hgeRect rectBoundingBox;
|
||||
bool bUpdateBoundingBox;
|
||||
|
||||
typedef std::list<hgeParticle> ParticleBuffer;
|
||||
ParticleBuffer mParticleBuffer;
|
||||
|
||||
float mTimer;
|
||||
};
|
||||
|
||||
class hgeParticleManager
|
||||
{
|
||||
public:
|
||||
hgeParticleManager();
|
||||
~hgeParticleManager();
|
||||
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
|
||||
hgeParticleSystem* SpawnPS(hgeParticleSystemInfo *psi, float x, float y);
|
||||
bool IsPSAlive(hgeParticleSystem *ps) const;
|
||||
void Transpose(float x, float y);
|
||||
void GetTransposition(float *dx, float *dy) const {*dx=tX; *dy=tY;}
|
||||
void KillPS(hgeParticleSystem *ps);
|
||||
void KillAll();
|
||||
|
||||
private:
|
||||
hgeParticleManager(const hgeParticleManager &);
|
||||
hgeParticleManager& operator= (const hgeParticleManager &);
|
||||
|
||||
int nPS;
|
||||
float tX;
|
||||
float tY;
|
||||
hgeParticleSystem* psList[MAX_PSYSTEMS];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeRect helper class
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGERECT_H
|
||||
#define HGERECT_H
|
||||
|
||||
|
||||
class hgeRect
|
||||
{
|
||||
public:
|
||||
float x1, y1, x2, y2;
|
||||
|
||||
hgeRect(float _x1, float _y1, float _x2, float _y2) {x1=_x1; y1=_y1; x2=_x2; y2=_y2; bClean=false; }
|
||||
hgeRect() {bClean=true;}
|
||||
|
||||
void Clear() {bClean=true;}
|
||||
bool IsClean() const {return bClean;}
|
||||
void Set(float _x1, float _y1, float _x2, float _y2) { x1=_x1; x2=_x2; y1=_y1; y2=_y2; bClean=false; }
|
||||
void SetRadius(float x, float y, float r) { x1=x-r; x2=x+r; y1=y-r; y2=y+r; bClean=false; }
|
||||
void Encapsulate(float x, float y);
|
||||
bool TestPoint(float x, float y) const;
|
||||
bool Intersect(const hgeRect *rect) const;
|
||||
|
||||
private:
|
||||
bool bClean;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeRect helper class
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGERECT_H
|
||||
#define HGERECT_H
|
||||
|
||||
|
||||
class hgeRect
|
||||
{
|
||||
public:
|
||||
float x1, y1, x2, y2;
|
||||
|
||||
hgeRect(float _x1, float _y1, float _x2, float _y2) {x1=_x1; y1=_y1; x2=_x2; y2=_y2; bClean=false; }
|
||||
hgeRect() {bClean=true;}
|
||||
|
||||
void Clear() {bClean=true;}
|
||||
bool IsClean() const {return bClean;}
|
||||
void Set(float _x1, float _y1, float _x2, float _y2) { x1=_x1; x2=_x2; y1=_y1; y2=_y2; bClean=false; }
|
||||
void SetRadius(float x, float y, float r) { x1=x-r; x2=x+r; y1=y-r; y2=y+r; bClean=false; }
|
||||
void Encapsulate(float x, float y);
|
||||
bool TestPoint(float x, float y) const;
|
||||
bool Intersect(const hgeRect *rect) const;
|
||||
|
||||
private:
|
||||
bool bClean;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeVector helper class
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGEVECTOR_H
|
||||
#define HGEVECTOR_H
|
||||
|
||||
|
||||
//#include "hge.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*
|
||||
** Fast 1.0/sqrtf(float) routine
|
||||
*/
|
||||
float InvSqrt(float x);
|
||||
|
||||
class hgeVector
|
||||
{
|
||||
public:
|
||||
float x,y;
|
||||
|
||||
hgeVector(float _x, float _y) { x=_x; y=_y; }
|
||||
hgeVector() { x=0; y=0; }
|
||||
|
||||
hgeVector operator- () const { return hgeVector(-x, -y); }
|
||||
hgeVector operator- (const hgeVector &v) const { return hgeVector(x-v.x, y-v.y); }
|
||||
hgeVector operator+ (const hgeVector &v) const { return hgeVector(x+v.x, y+v.y); }
|
||||
hgeVector& operator-= (const hgeVector &v) { x-=v.x; y-=v.y; return *this; }
|
||||
hgeVector& operator+= (const hgeVector &v) { x+=v.x; y+=v.y; return *this; }
|
||||
bool operator== (const hgeVector &v) const { return (x==v.x && y==v.y); }
|
||||
bool operator!= (const hgeVector &v) const { return (x!=v.x || y!=v.y); }
|
||||
|
||||
hgeVector operator/ (const float scalar) const { return hgeVector(x/scalar, y/scalar); }
|
||||
hgeVector operator* (const float scalar) const { return hgeVector(x*scalar, y*scalar); }
|
||||
hgeVector& operator*= (const float scalar) { x*=scalar; y*=scalar; return *this; }
|
||||
|
||||
float Dot(const hgeVector *v) const { return x*v->x + y*v->y; }
|
||||
float Length() const { return sqrtf(Dot(this)); }
|
||||
float Angle(const hgeVector *v = 0) const;
|
||||
|
||||
void Clamp(const float max) { if(Length() > max) { Normalize(); x *= max; y *= max; } }
|
||||
hgeVector* Normalize() { float rc=InvSqrt(Dot(this)); x*=rc; y*=rc; return this; }
|
||||
hgeVector* Rotate(float a);
|
||||
};
|
||||
|
||||
inline hgeVector operator* (const float s, const hgeVector &v) { return v*s; }
|
||||
inline float operator^ (const hgeVector &v, const hgeVector &u) { return v.Angle(&u); }
|
||||
inline float operator% (const hgeVector &v, const hgeVector &u) { return v.Dot(&u); }
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
** Haaf's Game Engine 1.7
|
||||
** Copyright (C) 2003-2007, Relish Games
|
||||
** hge.relishgames.com
|
||||
**
|
||||
** hgeVector helper class
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HGEVECTOR_H
|
||||
#define HGEVECTOR_H
|
||||
|
||||
|
||||
//#include "hge.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*
|
||||
** Fast 1.0/sqrtf(float) routine
|
||||
*/
|
||||
float InvSqrt(float x);
|
||||
|
||||
class hgeVector
|
||||
{
|
||||
public:
|
||||
float x,y;
|
||||
|
||||
hgeVector(float _x, float _y) { x=_x; y=_y; }
|
||||
hgeVector() { x=0; y=0; }
|
||||
|
||||
hgeVector operator- () const { return hgeVector(-x, -y); }
|
||||
hgeVector operator- (const hgeVector &v) const { return hgeVector(x-v.x, y-v.y); }
|
||||
hgeVector operator+ (const hgeVector &v) const { return hgeVector(x+v.x, y+v.y); }
|
||||
hgeVector& operator-= (const hgeVector &v) { x-=v.x; y-=v.y; return *this; }
|
||||
hgeVector& operator+= (const hgeVector &v) { x+=v.x; y+=v.y; return *this; }
|
||||
bool operator== (const hgeVector &v) const { return (x==v.x && y==v.y); }
|
||||
bool operator!= (const hgeVector &v) const { return (x!=v.x || y!=v.y); }
|
||||
|
||||
hgeVector operator/ (const float scalar) const { return hgeVector(x/scalar, y/scalar); }
|
||||
hgeVector operator* (const float scalar) const { return hgeVector(x*scalar, y*scalar); }
|
||||
hgeVector& operator*= (const float scalar) { x*=scalar; y*=scalar; return *this; }
|
||||
|
||||
float Dot(const hgeVector *v) const { return x*v->x + y*v->y; }
|
||||
float Length() const { return sqrtf(Dot(this)); }
|
||||
float Angle(const hgeVector *v = 0) const;
|
||||
|
||||
void Clamp(const float max) { if(Length() > max) { Normalize(); x *= max; y *= max; } }
|
||||
hgeVector* Normalize() { float rc=InvSqrt(Dot(this)); x*=rc; y*=rc; return this; }
|
||||
hgeVector* Rotate(float a);
|
||||
};
|
||||
|
||||
inline hgeVector operator* (const float s, const hgeVector &v) { return v*s; }
|
||||
inline float operator^ (const hgeVector &v, const hgeVector &u) { return v.Angle(&u); }
|
||||
inline float operator% (const hgeVector &v, const hgeVector &u) { return v.Dot(&u); }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user