aboutsummaryrefslogtreecommitdiff
path: root/smelt/sdl
diff options
context:
space:
mode:
Diffstat (limited to 'smelt/sdl')
-rw-r--r--smelt/sdl/gfx_sdl.cpp5
-rw-r--r--smelt/sdl/inp_sdl.cpp6
-rw-r--r--smelt/sdl/smelt_internal.hpp6
-rw-r--r--smelt/sdl/sys_sdl.cpp3
4 files changed, 12 insertions, 8 deletions
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()
{