aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-08-15 11:31:21 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-08-15 11:31:21 +0800
commitbfe4f5ac512493bd9a359a06875288fbfaea6ff8 (patch)
treef3792da663b88b0db48376bf493d9dbe1ceba248 /include
parent65408f92d1728d06094cb81eac3c81e1dae34a65 (diff)
downloadbullet-lab-remix-bfe4f5ac512493bd9a359a06875288fbfaea6ff8.tar.xz
Bump SMELT to apilevel 2, adding several functions.
Diffstat (limited to 'include')
-rw-r--r--include/smanim.hpp1
-rw-r--r--include/smbmfont.hpp1
-rw-r--r--include/smcolor.hpp1
-rw-r--r--include/smdatapack.hpp1
-rw-r--r--include/smelt.hpp6
-rw-r--r--include/smentity.hpp1
-rw-r--r--include/smgrid.hpp1
-rw-r--r--include/smindicator.hpp52
-rw-r--r--include/smmath.hpp11
-rw-r--r--include/smprogresser.hpp1
-rw-r--r--include/smrandom.hpp1
-rw-r--r--include/smttfont.hpp1
12 files changed, 59 insertions, 19 deletions
diff --git a/include/smanim.hpp b/include/smanim.hpp
index b206d5e..8cc4eef 100644
--- a/include/smanim.hpp
+++ b/include/smanim.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Animation header
*
* WARNING: This library is in development and interfaces would be very
diff --git a/include/smbmfont.hpp b/include/smbmfont.hpp
index 8dffc1f..6a0f1c1 100644
--- a/include/smbmfont.hpp
+++ b/include/smbmfont.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Bitmap font support header
*
* WARNING: This library is in development and interfaces would be very
diff --git a/include/smcolor.hpp b/include/smcolor.hpp
index 9d901de..94ff4f3 100644
--- a/include/smcolor.hpp
+++ b/include/smcolor.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Color system header & implementation
*
* WARNING: This library is in development and interfaces would be very
diff --git a/include/smdatapack.hpp b/include/smdatapack.hpp
index ace7c81..8431b58 100644
--- a/include/smdatapack.hpp
+++ b/include/smdatapack.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* DaTaPack format support header
*
* WARNING: This library is in development and interfaces would be very
diff --git a/include/smelt.hpp b/include/smelt.hpp
index 105da2a..b5c324e 100644
--- a/include/smelt.hpp
+++ b/include/smelt.hpp
@@ -2,7 +2,7 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
+ * api level 2
* Public header
*
* WARNING: This library is in development and interfaces would be very
@@ -31,7 +31,7 @@
#include <stddef.h>
#include <stdint.h>
-#define SMELT_APILEVEL 1
+#define SMELT_APILEVEL 2
typedef uint32_t DWORD;
typedef uint16_t WORD;
@@ -141,6 +141,7 @@ public:
virtual SMCHN smSFXPlay(SMSFX fx,int vol=100,int pan=0,float pitch=1.,bool loop=0)=0;
virtual float smSFXGetLengthf(SMSFX fx)=0;
virtual DWORD smSFXGetLengthd(SMSFX fx)=0;
+ virtual void smSFXSetLoopPoint(SMSFX fx,DWORD l,DWORD r)=0;
virtual void smSFXFree(SMSFX fx)=0;
virtual void smChannelVol(SMCHN chn,int vol)=0;
@@ -170,6 +171,7 @@ public:
virtual bool smRenderEnd()=0;
virtual void sm3DCamera6f2v(float *pos,float *rot)=0;
virtual void sm2DCamera5f3v(float *pos,float *dpos,float *rot)=0;
+ virtual void smMultViewMatrix(float *mat)=0;
virtual void smClrscr(DWORD color)=0;
virtual void smRenderLinefd(float x1,float y1,float z1,float x2,float y2,float z2,DWORD color)=0;
virtual void smRenderLinefvd(float *p1,float *p2,DWORD color)=0;
diff --git a/include/smentity.hpp b/include/smentity.hpp
index 7ecb8ee..54fb3fb 100644
--- a/include/smentity.hpp
+++ b/include/smentity.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Entity header
*
* WARNING: This library is in development and interfaces would be very
diff --git a/include/smgrid.hpp b/include/smgrid.hpp
index acd808c..ce1aabb 100644
--- a/include/smgrid.hpp
+++ b/include/smgrid.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Distortion grid header
*
* WARNING: This library is in development and interfaces would be very
diff --git a/include/smindicator.hpp b/include/smindicator.hpp
index 5237a3b..0595dc8 100644
--- a/include/smindicator.hpp
+++ b/include/smindicator.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Indicator header & implementation
*
* WARNING: This library is in development and interfaces would be very
@@ -14,16 +13,17 @@
#include "smelt.hpp"
#include "smmath.hpp"
#include "smcolor.hpp"
+#include "smentity.hpp"
#include "smgrid.hpp"
class indicatorCircular
{
private:
smGrid *circle;
- double value,radius,thickness;
+ float value,radius,thickness;
DWORD color;
BYTE alpha;
public:
- void init(double r,double thkns,BYTE a,SMTEX tex,smTexRect tr)
+ void init(float r,float thkns,BYTE a,SMTEX tex,smTexRect tr)
{
circle=new smGrid(1025,3);
circle->setTexture(tex);
@@ -31,8 +31,8 @@ public:
radius=r;thickness=thkns;alpha=a;color=0;
for(int i=0;i<=1024;++i)
{
- double tang,tx,ty;
- tang=(double)i/1024.*PI*2-PI/2;
+ float tang,tx,ty;
+ tang=(float)i/1024.*PI*2-PI/2;
tx=-cos(tang)*radius;ty=sin(tang)*radius;
circle->setPos(i,2,tx,ty,0.5,GRID_REFTOPLEFT);
tx=-cos(tang)*(radius-thickness);ty=sin(tang)*(radius-thickness);
@@ -43,7 +43,7 @@ public:
}
void overrideColor(DWORD col){color=col;}
void setAlpha(BYTE a){alpha=a;}
- void setValue(double v)
+ void setValue(float v)
{
value=v;
for(int i=0;i<=1024;++i)
@@ -55,7 +55,7 @@ public:
if(tc->v<0.85)tc->v=0.85;
tcolor=color?SETA(color,alpha):SETA(tc->getHWColor(),alpha);
delete tc;
- if((double)i/1024.<=value)
+ if((float)i/1024.<=value)
{
circle->setColor(i,2,tcolor);
circle->setColor(i,1,SETA(0x00FFFFFF,alpha));
@@ -72,4 +72,42 @@ public:
void render(float x,float y){circle->render(x,y);}
void deinit(){delete circle;circle=NULL;}
};
+class indicatorLinear
+{
+private:
+ smEntity2D *upper,*lower;
+ float value,maxlength,thickness;
+ DWORD color;smTexRect trect;
+ BYTE alpha;
+public:
+ void init(float ml,float thkns,BYTE a,SMTEX tex,smTexRect tr)
+ {
+ upper=new smEntity2D(tex,tr.x,tr.y,tr.w,tr.h/2);
+ lower=new smEntity2D(tex,tr.x,tr.y+tr.h/2,tr.w,tr.h/2);
+ maxlength=ml;thickness=thkns;alpha=a;color=0;trect=tr;
+ }
+ void overrideColor(DWORD col){color=col;}
+ void setAlpha(BYTE a){alpha=a;}
+ void setValue(float v)
+ {
+ value=v;
+ int tr=(int)((1.0f-value)*255);
+ int tg=(int)(value*255);
+ DWORD tcolor=ARGB(alpha,tr,tg,0);
+ smColorHSVA *tc=new smColorHSVA(tcolor);
+ if(tc->v<0.85)tc->v=0.85;
+ tcolor=color?SETA(color,alpha):SETA(tc->getHWColor(),alpha);
+ delete tc;
+ upper->setColor(tcolor,0);upper->setColor(tcolor,1);
+ upper->setColor(0,2);upper->setColor(0,3);
+ lower->setColor(0,0);lower->setColor(0,1);
+ lower->setColor(tcolor,2);lower->setColor(tcolor,3);
+ }
+ void render(float x,float y)
+ {
+ upper->render(x,y,0,value*maxlength/trect.w,thickness/trect.h/2);
+ lower->render(x,y+thickness/2,0,value*maxlength/trect.w,thickness/trect.h/2);
+ }
+ void deinit(){delete upper;delete lower;upper=lower=NULL;}
+};
#endif
diff --git a/include/smmath.hpp b/include/smmath.hpp
index 805df50..5172772 100644
--- a/include/smmath.hpp
+++ b/include/smmath.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Math header & implementation
*
* WARNING: This library is in development and interfaces would be very
@@ -105,6 +104,16 @@ public:
tmp[3][3]=1;
*this=*this*tmp;
}
+ void lookat(double *eye,double *at,double *up)
+ {
+ smvec3d f=smvec3d(at[0],at[1],at[2])-smvec3d(eye[0],eye[1],eye[2]);f.normalize();
+ smvec3d UP=smvec3d(up[0],up[1],up[2]);UP.normalize();
+ smvec3d s=f*UP;smvec3d u=s.getNormalized()*f;
+ *this[0][0]= s.x;*this[1][0]= s.y;*this[2][0]= s.z;*this[3][0]=0;
+ *this[0][1]= u.x;*this[1][1]= u.y;*this[2][1]= u.z;*this[3][1]=0;
+ *this[0][2]=-f.x;*this[1][2]=-f.y;*this[2][2]=-f.z;*this[3][2]=0;
+ *this[0][3]= 0;*this[1][3]= 0;*this[2][3]= 0;*this[3][3]=1;
+ }
friend smMatrix operator *(smMatrix a,smMatrix b)
{
smMatrix ret;
diff --git a/include/smprogresser.hpp b/include/smprogresser.hpp
index ca81e62..50edd2d 100644
--- a/include/smprogresser.hpp
+++ b/include/smprogresser.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Progresser header & implementation
*
* WARNING: This library is in development and interfaces would be very
diff --git a/include/smrandom.hpp b/include/smrandom.hpp
index 9c47941..ed560e0 100644
--- a/include/smrandom.hpp
+++ b/include/smrandom.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Random engine header & implementation
*
* WARNING: This library is in development and interfaces would be very
diff --git a/include/smttfont.hpp b/include/smttfont.hpp
index 2fd96d5..777d8ed 100644
--- a/include/smttfont.hpp
+++ b/include/smttfont.hpp
@@ -2,7 +2,6 @@
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
- * api level 1
* Truetype font support header
*
* WARNING: This library is in development and interfaces would be very