From bfe4f5ac512493bd9a359a06875288fbfaea6ff8 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sat, 15 Aug 2015 11:31:21 +0800 Subject: Bump SMELT to apilevel 2, adding several functions. --- smelt/sdl/gfx_sdl.cpp | 6 +++++- smelt/sdl/sfx_sdl.cpp | 12 +++++++++++- smelt/sdl/smelt_internal.hpp | 5 +++-- smelt/sdl/sys_sdl.cpp | 1 - 4 files changed, 19 insertions(+), 5 deletions(-) (limited to 'smelt') diff --git a/smelt/sdl/gfx_sdl.cpp b/smelt/sdl/gfx_sdl.cpp index 4ad7404..3fd3b46 100644 --- a/smelt/sdl/gfx_sdl.cpp +++ b/smelt/sdl/gfx_sdl.cpp @@ -2,7 +2,6 @@ /* * Simple MultimEdia LiTerator(SMELT) * by Chris Xiong 2015 - * api level 1 * GFX implementation based on SDL2/OpenGL and hge-unix * * WARNING: This library is in development and interfaces would be very @@ -116,6 +115,11 @@ void SMELT_IMPL::sm3DCamera6f2v(float *pos,float *rot) pOpenGLDevice->glRotatef((GLfloat)-rot[2],0,0,1); pOpenGLDevice->glTranslatef((GLfloat)-pos[0],(GLfloat)-pos[1],(GLfloat)-pos[2]); } +void SMELT_IMPL::smMultViewMatrix(float *mat) +{ + pOpenGLDevice->glMatrixMode(GL_MODELVIEW); + pOpenGLDevice->glMultMatrixf(mat); +} void SMELT_IMPL::sm2DCamera5f3v(float *pos,float *dpos,float *rot) { batchOGL(); diff --git a/smelt/sdl/sfx_sdl.cpp b/smelt/sdl/sfx_sdl.cpp index afc8f68..10a207c 100644 --- a/smelt/sdl/sfx_sdl.cpp +++ b/smelt/sdl/sfx_sdl.cpp @@ -2,7 +2,6 @@ /* * Simple MultimEdia LiTerator(SMELT) * by Chris Xiong 2015 - * api level 1 * GFX implementation based on OpenAL * * WARNING: This library is in development and interfaces would be very @@ -90,6 +89,14 @@ DWORD SMELT_IMPL::smSFXGetLengthd(SMSFX fx) } return -1; } +void SMELT_IMPL::smSFXSetLoopPoint(SMSFX fx,DWORD l,DWORD r) +{ + if(pOpenALDevice) + { + ALint pt[2];pt[0]=l;pt[1]=r; + alBufferiv((ALuint)fx,AL_LOOP_POINTS_SOFT,pt); + } +} void SMELT_IMPL::smSFXFree(SMSFX fx) { if(pOpenALDevice) @@ -299,6 +306,9 @@ bool SMELT_IMPL::initOAL() smLog("%s:"SLINE": AL_VENDOR: %s\n",SFX_SDL_SRCFN,(char*)alGetString(AL_VENDOR)); smLog("%s:"SLINE": AL_RENDERER: %s\n",SFX_SDL_SRCFN,(char*)alGetString(AL_RENDERER)); smLog("%s:"SLINE": AL_VERSION: %s\n",SFX_SDL_SRCFN,(char*)alGetString(AL_VERSION)); + const char* ext=(const char*)alGetString(AL_EXTENSIONS); + lpp=strstr(ext,"AL_SOFT_loop_points")!=NULL; + if(!lpp)smLog("%s:"SLINE": Warning: loop points not supported. Please recompile with OpenAL Soft.\n",SFX_SDL_SRCFN); pOpenALDevice=(void*)dev; return true; } diff --git a/smelt/sdl/smelt_internal.hpp b/smelt/sdl/smelt_internal.hpp index a84050f..8b36ebf 100644 --- a/smelt/sdl/smelt_internal.hpp +++ b/smelt/sdl/smelt_internal.hpp @@ -2,7 +2,6 @@ /* * Simple MultimEdia LiTerator(SMELT) * by Chris Xiong 2015 - * api level 1 * Internal header for SDL version * * WARNING: This library is in development and interfaces would be very @@ -113,6 +112,7 @@ public: virtual SMCHN smSFXPlay(SMSFX fx,int vol=100,int pan=0,float pitch=1.,bool loop=0); virtual float smSFXGetLengthf(SMSFX fx); virtual DWORD smSFXGetLengthd(SMSFX fx); + virtual void smSFXSetLoopPoint(SMSFX fx,DWORD l,DWORD r); virtual void smSFXFree(SMSFX fx); virtual void smChannelVol(SMCHN chn,int vol); @@ -142,6 +142,7 @@ public: virtual bool smRenderEnd(); virtual void sm3DCamera6f2v(float *pos,float *rot); virtual void sm2DCamera5f3v(float *pos,float *dpos,float *rot); + virtual void smMultViewMatrix(float *mat); virtual void smClrscr(DWORD color); virtual void smRenderLinefd(float x1,float y1,float z1,float x2,float y2,float z2,DWORD color); virtual void smRenderLinefvd(float *p1,float *p2,DWORD color); @@ -217,7 +218,7 @@ public: void *pOpenALDevice; bool initOAL(); void finiOAL(); - bool mute; + bool mute,lpp; int scnt; ALuint src[SRC_MAX]; ALuint getSource(); diff --git a/smelt/sdl/sys_sdl.cpp b/smelt/sdl/sys_sdl.cpp index f489c9d..1892069 100644 --- a/smelt/sdl/sys_sdl.cpp +++ b/smelt/sdl/sys_sdl.cpp @@ -2,7 +2,6 @@ /* * Simple MultimEdia LiTerator(SMELT) * by Chris Xiong 2015 - * api level 1 * SMELT system implementation * * WARNING: This library is in development and interfaces would be very -- cgit v1.2.3