diff options
-rw-r--r-- | extensions/smbmfont.cpp | 2 | ||||
-rw-r--r-- | include/smelt.hpp | 22 | ||||
-rw-r--r-- | smelt/sdl/gfx_sdl.cpp | 5 | ||||
-rw-r--r-- | smelt/sdl/inp_sdl.cpp | 6 | ||||
-rw-r--r-- | smelt/sdl/smelt_internal.hpp | 6 | ||||
-rw-r--r-- | smelt/sdl/sys_sdl.cpp | 3 |
6 files changed, 26 insertions, 18 deletions
diff --git a/extensions/smbmfont.cpp b/extensions/smbmfont.cpp index 292c2b7..22f9280 100644 --- a/extensions/smbmfont.cpp +++ b/extensions/smbmfont.cpp @@ -53,6 +53,8 @@ bool smBMFont::loadAnmFromMemory(const char* ptr,DWORD size) DWORD msez=anm.getFileSize("content.meta"); parseMeta(mptr,msez); anm.releaseFilePtr("content.meta"); + setBlend(BLEND_ALPHABLEND); + setColor(0xFFFFFFFF); } void smBMFont::close() { diff --git a/include/smelt.hpp b/include/smelt.hpp index 95b3934..79e49e9 100644 --- a/include/smelt.hpp +++ b/include/smelt.hpp @@ -2,7 +2,7 @@ /* * Simple MultimEdia LiTerator(SMELT) * by Chris Xiong 2015 - * api level 2 + * api level 3 * 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 2 +#define SMELT_APILEVEL 3 typedef uint32_t DWORD; typedef uint16_t WORD; @@ -58,13 +58,13 @@ typedef size_t SMCHN;//Channel Handle #define SETB(col,b) (((col)&0xFFFFFF00)+DWORD(b)) //Blend Modes -#define BLEND_COLORADD 0x1 -#define BLEND_COLORMUL 0x0 -#define BLEND_COLORINV 0x8 -#define BLEND_ALPHABLEND 0x2 -#define BLEND_ALPHAADD 0x0 -#define BLEND_ZWRITE 0x4 -#define BLEND_NOZWRITE 0x0 +#define BLEND_COLORADD 0x1 +#define BLEND_COLORMUL 0x0 +#define BLEND_COLORINV 0x8 +#define BLEND_ALPHABLEND 0x2 +#define BLEND_ALPHAADD 0x0 +#define BLEND_ZWRITE 0x4 +#define BLEND_NOZWRITE 0x0 typedef bool (*smHook)(); @@ -115,7 +115,7 @@ class SMELT { public: SMELT(){} - virtual ~SMELT(){}; + virtual ~SMELT(){} virtual void smRelease()=0; virtual bool smInit()=0; virtual void smFinale()=0; @@ -135,6 +135,7 @@ public: virtual void smSetFPS(int fps)=0; virtual float smGetFPS()=0; virtual float smGetDelta()=0; + virtual float smGetTime()=0; virtual SMSFX smSFXLoad(const char *path)=0; virtual SMSFX smSFXLoadFromMemory(const char *ptr,DWORD size)=0; @@ -164,6 +165,7 @@ public: virtual int smGetWheel()=0; virtual bool smIsMouseOver()=0; virtual int smGetKeyState(int key)=0; + virtual int smGetKey()=0; virtual bool smGetInpEvent(smInpEvent *e)=0; virtual bool smRenderBegin2D(bool ztest=0,SMTRG trg=0)=0; diff --git a/smelt/sdl/gfx_sdl.cpp b/smelt/sdl/gfx_sdl.cpp index c0e9305..8c028ca 100644 --- a/smelt/sdl/gfx_sdl.cpp +++ b/smelt/sdl/gfx_sdl.cpp @@ -699,7 +699,7 @@ bool SMELT_IMPL::loadGLEntryPoints() pOpenGLDevice->have_GL_ARB_texture_rectangle=true; pOpenGLDevice->have_GL_ARB_texture_non_power_of_two=true; pOpenGLDevice->have_GL_EXT_framebuffer_object=true; - pOpenGLDevice->have_GL_EXT_texture_compression_s3tc=true; + pOpenGLDevice->have_GL_EXT_texture_compression_s3tc=false; pOpenGLDevice->have_GL_ARB_vertex_buffer_object=true; #define GL_PROC(ext,fn,call,ret,params) \ if(pOpenGLDevice->have_##ext) \ @@ -766,8 +766,7 @@ bool SMELT_IMPL::loadGLEntryPoints() smLog("%s:"SLINE": OpenGL: Using GL_EXT_texture_compression_s3tc.\n",GFX_SDL_SRCFN); else if (true) { - smLog("%s:"SLINE": OpenGL: WARNING: no texture compression support or it's disabled.\n",GFX_SDL_SRCFN); - smLog("%s:"SLINE": OpenGL: Performance may suffer in a low-memory system!\n",GFX_SDL_SRCFN); + smLog("%s:"SLINE": OpenGL: Texture compression disabled!\n",GFX_SDL_SRCFN); } if(pOpenGLDevice->have_GL_ARB_vertex_buffer_object) { diff --git a/smelt/sdl/inp_sdl.cpp b/smelt/sdl/inp_sdl.cpp index b9f99db..a18baa9 100644 --- a/smelt/sdl/inp_sdl.cpp +++ b/smelt/sdl/inp_sdl.cpp @@ -2,7 +2,6 @@ /* * Simple MultimEdia LiTerator(SMELT) * by Chris Xiong 2015 - * api level 1 * Input manager implementation * * WARNING: This library is in development and interfaces would be very @@ -25,6 +24,7 @@ void SMELT_IMPL::smGetMouse2f(float *x,float *y){*x=posx,*y=posy;} void SMELT_IMPL::smSetMouse2f(float x,float y){SDL_WarpMouseInWindow((SDL_Window*)hwnd,x,y);} int SMELT_IMPL::smGetWheel(){return posz;} bool SMELT_IMPL::smIsMouseOver(){return mouseOver;} +int SMELT_IMPL::smGetKey(){return lkey;} int SMELT_IMPL::smGetKeyState(int key) { if(!(keyz[key]&4)&&keylst[key])return SMKST_RELEASE; @@ -79,6 +79,8 @@ void SMELT_IMPL::buildEvent(int type,int k,int scan,int flags,int x,int y) while(last->next)last=last->next; last->next=eptr; } + if(eptr->e.type==INPUT_KEYDOWN||eptr->e.type==INPUT_MBUTTONDOWN) + lkey=eptr->e.sccode; if(eptr->e.type==INPUT_MOUSEMOVE)posx=eptr->e.x,posy=eptr->e.y; if(eptr->e.type==INPUT_MOUSEWHEEL)posz=eptr->e.wheel; } @@ -88,7 +90,7 @@ void SMELT_IMPL::clearQueue() TInputEventList *nxt,*eptr=inpQueue; for(unsigned i=0;i<sizeof(keyz)/sizeof(keyz[0]);++i)keyz[i]&=~3; while(eptr){nxt=eptr->next;delete eptr;eptr=nxt;} - inpQueue=NULL;posz=0; + inpQueue=NULL;posz=0;lkey=0; } int SMELT_IMPL::SDLKeyToSMKey(int sdlkey) { diff --git a/smelt/sdl/smelt_internal.hpp b/smelt/sdl/smelt_internal.hpp index 73960a7..2d75e9a 100644 --- a/smelt/sdl/smelt_internal.hpp +++ b/smelt/sdl/smelt_internal.hpp @@ -106,6 +106,7 @@ public: virtual void smSetFPS(int fps); virtual float smGetFPS(); virtual float smGetDelta(); + virtual float smGetTime(); virtual SMSFX smSFXLoad(const char *path); virtual SMSFX smSFXLoadFromMemory(const char *ptr,DWORD size); @@ -135,6 +136,7 @@ public: virtual int smGetWheel(); virtual bool smIsMouseOver(); virtual int smGetKeyState(int key); + virtual int smGetKey(); virtual bool smGetInpEvent(smInpEvent *e); virtual bool smRenderBegin2D(bool ztest=0,SMTRG trg=0); @@ -223,7 +225,7 @@ public: ALuint src[SRC_MAX]; ALuint getSource(); - int posz; + int posz,lkey; float posx,posy; SDL_Keymod keymods; bool mouseOver,captured; @@ -236,7 +238,7 @@ public: bool procSDLEvent(const SDL_Event &e); int SDLKeyToSMKey(int sdlkey); - float timeDelta,updateFPSDelay,fps; + float timeDelta,updateFPSDelay,fps,timeS; DWORD fixDelta,t0; int fcnt; DWORD dt; diff --git a/smelt/sdl/sys_sdl.cpp b/smelt/sdl/sys_sdl.cpp index 8ae3da1..190f3bb 100644 --- a/smelt/sdl/sys_sdl.cpp +++ b/smelt/sdl/sys_sdl.cpp @@ -166,7 +166,7 @@ void SMELT_IMPL::smMainLoop() { timeDelta=dt/1000.; if(timeDelta>0.2)timeDelta=fixDelta?fixDelta/1000.:.01; - ++fcnt;updateFPSDelay+=timeDelta;t0=sdlticks; + ++fcnt;updateFPSDelay+=timeDelta;t0=sdlticks;timeS+=timeDelta; if(updateFPSDelay>1){fps=fcnt/updateFPSDelay;updateFPSDelay=.0;fcnt=0;} if(pUpdateFunc())break; for(int i=1;i<=255;++i)keylst[i]=((keyz[i]&4)!=0); @@ -243,6 +243,7 @@ void SMELT_IMPL::smSetFPS(int fps) } float SMELT_IMPL::smGetFPS(){return fps;} float SMELT_IMPL::smGetDelta(){return timeDelta;} +float SMELT_IMPL::smGetTime(){return timeS;} SMELT_IMPL::SMELT_IMPL() { |