aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-06 23:28:21 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-06 23:28:21 +0800
commitc93d16b6eb05984dc2c8ef474fe94d2136f6c0e2 (patch)
tree8e97181a5d07ffc525014875af12e83f9b16a409
parent038b31f0158a0018dbf2eceb71026cc4e665faa9 (diff)
downloadSMELT-c93d16b6eb05984dc2c8ef474fe94d2136f6c0e2.tar.xz
Add makefile and an example app.
Furthermore, make the compiler happier with my stupid code.
-rwxr-xr-xexamples/SpriteSheet.pngbin0 -> 17442 bytes
-rw-r--r--examples/lcdfont.anmbin0 -> 7811 bytes
-rw-r--r--examples/makefile9
-rw-r--r--examples/smelt_test.cpp147
-rw-r--r--extensions/makefile13
-rw-r--r--extensions/smdatapack.cpp2
-rw-r--r--smelt/sdl/CxImage/makefile12
-rw-r--r--smelt/sdl/gfx_sdl.cpp40
-rw-r--r--smelt/sdl/inp_sdl.cpp2
-rw-r--r--smelt/sdl/makefile13
-rw-r--r--smelt/sdl/sfx_sdl.cpp16
-rw-r--r--smelt/sdl/sys_sdl.cpp34
-rw-r--r--tools/dtputil/makefile10
13 files changed, 251 insertions, 47 deletions
diff --git a/examples/SpriteSheet.png b/examples/SpriteSheet.png
new file mode 100755
index 0000000..e34abbb
--- /dev/null
+++ b/examples/SpriteSheet.png
Binary files differ
diff --git a/examples/lcdfont.anm b/examples/lcdfont.anm
new file mode 100644
index 0000000..e8913da
--- /dev/null
+++ b/examples/lcdfont.anm
Binary files differ
diff --git a/examples/makefile b/examples/makefile
new file mode 100644
index 0000000..b4844d9
--- /dev/null
+++ b/examples/makefile
@@ -0,0 +1,9 @@
+CC= g++
+CXXFLAGS= -I/usr/include/freetype2 -I../include -D_LINUX
+LINK= -lSDL2 -lvorbis -lvorbisfile -lopenal -ljpeg -lpng -lfreetype -lz -lsmeltext -lsmelt -lCxImage
+LINK_FOLDER= -L../smelt/sdl -L../extensions
+
+all:
+ $(CC) smelt_test.cpp $(CXXFLAGS) $(LINK_FOLDER) $(LINK) -o smelt_test
+clean:
+ rm smelt_test \ No newline at end of file
diff --git a/examples/smelt_test.cpp b/examples/smelt_test.cpp
new file mode 100644
index 0000000..915321a
--- /dev/null
+++ b/examples/smelt_test.cpp
@@ -0,0 +1,147 @@
+#include "smelt.hpp"
+#include "smentity.hpp"
+#include "smindicator.hpp"
+#include "smbmfont.hpp"
+#include "smttfont.hpp"
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <csignal>
+#if defined(__GNUC__) && !defined(MINGW_BUILD)
+#include <execinfo.h>
+#endif
+SMELT *sm;
+smEntity2D *e2d;
+smEntity3D *e3d;
+smQuad quad;
+float theta,d;
+indicatorCircular ictest;
+SMTEX tex;
+SMTRG testtrg;
+smBMFont fonttest;
+smTTFont ttftest;
+SMSFX sfx,bgm;
+void sigHandler(int pm)
+{
+ sm->smLog("Oops, the application ate a piece of DEAD BEEF!\n");
+#if defined(__GNUC__) && !defined(MINGW_BUILD)
+ void *strs[64];unsigned cnt;
+ char **str;cnt=backtrace(strs,64);
+ str=backtrace_symbols(strs,cnt);
+ for(unsigned i=0;i<cnt;++i)
+ sm->smLog("%s\n",str[i]);
+#endif
+ sm->smFinale();
+ exit(1);
+}
+bool doingNothing()
+{
+ d+=sm->smGetDelta();
+ if(d>0.37){sm->smSFXPlay(sfx);d=0;}
+ sm->smRenderBegin3D(60,testtrg);
+ static float pos[3]={0,0,600};
+ static float rot[3]={0,0,-30};
+ sm->sm3DCamera6f2v(pos,rot);
+ sm->smClrscr(0xFF000000);
+ e3d->render9f(0,0,0,theta,0,1,0,1);
+ //printf("%.2f\n",sm->smGetFPS());
+#define pp printf("(%.0f,%.0f,%.0f) (%.0f,%.0f,%.0f)\n",pos[0],pos[1],pos[2],rot[0],rot[1],rot[2]);
+ if(sm->smGetKeyState(SMK_W)==SMKST_HIT)pos[1]+=10,pp;
+ if(sm->smGetKeyState(SMK_S)==SMKST_HIT)pos[1]-=10,pp;
+ if(sm->smGetKeyState(SMK_D)==SMKST_HIT)pos[0]+=10,pp;
+ if(sm->smGetKeyState(SMK_A)==SMKST_HIT)pos[0]-=10,pp;
+ if(sm->smGetKeyState(SMK_Q)==SMKST_HIT)pos[2]+=10,pp;
+ if(sm->smGetKeyState(SMK_E)==SMKST_HIT)pos[2]-=10,pp;
+ if(sm->smGetKeyState(SMK_I)==SMKST_HIT)rot[1]+=5,pp;
+ if(sm->smGetKeyState(SMK_K)==SMKST_HIT)rot[1]-=5,pp;
+ if(sm->smGetKeyState(SMK_L)==SMKST_HIT)rot[0]+=5,pp;
+ if(sm->smGetKeyState(SMK_J)==SMKST_HIT)rot[0]-=5,pp;
+ if(sm->smGetKeyState(SMK_U)==SMKST_HIT)rot[2]+=5,pp;
+ if(sm->smGetKeyState(SMK_O)==SMKST_HIT)rot[2]-=5,pp;
+ sm->smRenderEnd();
+ sm->smRenderBegin2D();
+ sm->smClrscr(0xFF000000);
+ fonttest.render(0,0,0,ALIGN_LEFT,NULL,"bitmap font test");
+ ttftest.render(0,500,0xFFFFFFFF,ALIGN_LEFT);
+ quad.tex=sm->smTargetTexture(testtrg);
+ sm->smRenderQuad(&quad);
+ e2d->render(400,300,theta);
+ double t;
+ ictest.setValue(modf(theta,&t));
+ ictest.render(400,300);
+ theta+=0.02;
+ quad.tex=tex;
+ sm->smRenderQuad(&quad);
+ sm->smRenderEnd();
+ if(sm->smGetKeyState(SMK_Y)==SMKST_HIT)sm->smScreenShot("wtf.bmp");
+ return false;
+}
+int main()
+{
+ signal(SIGSEGV,sigHandler);
+ sm=smGetInterface(SMELT_APILEVEL);
+ sm->smVidMode(800,600,true);
+ sm->smUpdateFunc(doingNothing);
+ sm->smWinTitle("SMELT Example App");
+ sm->smSetFPS(FPS_VSYNC);
+ sm->smInit();
+
+ FILE *pFile;DWORD size,rsize;char *buff;
+ pFile=fopen("lcdfont.anm","rb");
+ if(!pFile)return 0;
+ fseek(pFile,0,SEEK_END);size=ftell(pFile);rewind(pFile);
+ buff=(char*)malloc(sizeof(char)*size);
+ if(!buff)return 0;
+ rsize=fread(buff,1,size,pFile);
+ if(rsize!=size)return 0;
+ fonttest.loadAnmFromMemory(buff,size);
+ fonttest.setColor(0xFFFFFFFF);
+ fonttest.setBlend(BLEND_ALPHABLEND);
+ fonttest.setScale(1.);
+
+ if(!ttftest.loadTTF("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc",18))sm->smLog("ttf load error!");
+
+ tex=sm->smTextureLoad("SpriteSheet.png");
+ sfx=sm->smSFXLoad("tap.ogg");
+ bgm=sm->smSFXLoad("稲田姫樣に叱られるから.ogg");
+ sm->smSFXSetLoopPoint(bgm,0xED80,0x1E0400);
+ //sm->smTextureLock(tex,0,0,64,320,false);
+ //sm->smTexutreUnlock(tex);
+ testtrg=sm->smTargetCreate(256,320);
+ e2d=new smEntity2D(tex,0,0,101,101);
+ e2d->setCentre(50,50);
+ e2d->setColor(0xFFFFFFFF,0);
+ e2d->setColor(0xFFFF0000,1);
+ e2d->setColor(0xFF00FF00,2);
+ e2d->setColor(0xFF0000FF,3);
+ e3d=new smEntity3D(tex,0,0,256,320);
+ e3d->setCentre(128,160);
+ quad.v[0].x=128;quad.v[0].y=128;
+ quad.v[1].x=384;quad.v[1].y=128;
+ quad.v[2].x=384;quad.v[2].y=448;
+ quad.v[3].x=128;quad.v[3].y=448;
+ quad.v[0].tx=.0;quad.v[0].ty=.0;
+ quad.v[1].tx=1.;quad.v[1].ty=.0;
+ quad.v[2].tx=1.;quad.v[2].ty=1.;
+ quad.v[3].tx=.0;quad.v[3].ty=1.;
+ for(int i=0;i<4;++i)quad.v[i].col=0xFFFFFFFF;
+ quad.blend=BLEND_ALPHABLEND;
+ quad.tex=tex;
+ ictest.init(100,5,0x80,tex,smTexRect(151,264,2,8));
+ ttftest.updateString(L"truetype font test\nNow Playing: 稲田姫樣に叱られるから by ZUN");
+ sm->smSFXPlay(bgm,100,0,1.,true);
+ sm->smMainLoop();
+ sm->smFinale();
+ delete e2d;
+ ictest.deinit();
+ fonttest.close();
+ free(buff);
+ fclose(pFile);
+ ttftest.releaseTTF();
+ sm->smTextureFree(tex);
+ sm->smTargetFree(testtrg);
+ sm->smSFXFree(sfx);
+ sm->smSFXFree(bgm);
+ sm->smRelease();
+ return 0;
+}
diff --git a/extensions/makefile b/extensions/makefile
new file mode 100644
index 0000000..4c6b3fe
--- /dev/null
+++ b/extensions/makefile
@@ -0,0 +1,13 @@
+CC= g++
+CXXFLAGS= -c -std=c++11 -Wall -I../include -I/usr/include/freetype2
+
+all: objects archive clean
+
+objects:
+ $(CC) *.cpp $(CXXFLAGS)
+archive:
+ $(AR) rcs libsmeltext.a *.o
+clean:
+ if ( test smanim.o ); then rm *.o; fi
+clean-all: clean
+ rm *.a \ No newline at end of file
diff --git a/extensions/smdatapack.cpp b/extensions/smdatapack.cpp
index 2e77324..3138ccd 100644
--- a/extensions/smdatapack.cpp
+++ b/extensions/smdatapack.cpp
@@ -11,7 +11,7 @@
#include "smdatapack.hpp"
#include <cstdio>
#include <cstring>
-#define gzgetDWORD(f) ((gzgetc(f)<<24)|(gzgetc(f)<<16)|(gzgetc(f)<<8)|(gzgetc(f)))&0xFFFFFFFF
+#define gzgetDWORD(f) (((gzgetc(f))<<24)|((gzgetc(f))<<16)|((gzgetc(f))<<8)|(gzgetc(f)))&0xFFFFFFFF
#define gch ((*(cp++))&0xFF)
#define mmgetDWORD ((gch<<24)|(gch<<16)|(gch<<8)|(gch))&0xFFFFFFFF
#define gzputDWORD(f,a) gzputc(f,a>>24);gzputc(f,(a>>16)&0xFF);gzputc(f,(a>>8)&0xFF);gzputc(f,a&0xFF);
diff --git a/smelt/sdl/CxImage/makefile b/smelt/sdl/CxImage/makefile
new file mode 100644
index 0000000..6dcb28b
--- /dev/null
+++ b/smelt/sdl/CxImage/makefile
@@ -0,0 +1,12 @@
+CC= g++
+CXXFLAGS= -c -Os -D_LINUX
+AR= ar
+
+all: objects archive clean
+
+objects:
+ $(CC) *.cpp $(CXXFLAGS)
+archive:
+ $(AR) rcs libCxImage.a *.o
+clean:
+ rm *.o && mv libCxImage.a ../
diff --git a/smelt/sdl/gfx_sdl.cpp b/smelt/sdl/gfx_sdl.cpp
index 8c028ca..47b6999 100644
--- a/smelt/sdl/gfx_sdl.cpp
+++ b/smelt/sdl/gfx_sdl.cpp
@@ -24,7 +24,7 @@ bool SMELT_IMPL::smRenderBegin2D(bool ztest,SMTRG trg)
{
TRenderTargetList *targ=(TRenderTargetList*)trg;
if(vertexArray)
- {smLog("%s:"SLINE": Last frame not closed.\n",GFX_SDL_SRCFN);return false;}
+ {smLog("%s:" SLINE ": Last frame not closed.\n",GFX_SDL_SRCFN);return false;}
if(pOpenGLDevice->have_GL_EXT_framebuffer_object)
pOpenGLDevice->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,(targ)?targ->frame:0);
pOpenGLDevice->glDepthFunc(GL_GEQUAL);
@@ -51,7 +51,7 @@ bool SMELT_IMPL::smRenderBegin3D(float fov,SMTRG trg)
{
TRenderTargetList *targ=(TRenderTargetList*)trg;
if(vertexArray)
- {smLog("%s:"SLINE": Last frame not closed.\n",GFX_SDL_SRCFN);return false;}
+ {smLog("%s:" SLINE ": Last frame not closed.\n",GFX_SDL_SRCFN);return false;}
if(pOpenGLDevice->have_GL_EXT_framebuffer_object)
pOpenGLDevice->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,(targ)?targ->frame:0);
pOpenGLDevice->glDepthFunc(GL_LESS);
@@ -230,7 +230,7 @@ SMTRG SMELT_IMPL::smTargetCreate(int w,int h)
ok=buildTarget(pTarget,gltex->name,w,h);
if(!ok)
{
- smLog("%s:"SLINE": Failed to create render target.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": Failed to create render target.\n",GFX_SDL_SRCFN);
smTextureFree(pTarget->tex);
delete pTarget;
return 0;
@@ -642,7 +642,7 @@ void SMELT_IMPL::batchOGL(bool endScene)
{
printf("idxbuf:%d\n",indexBuf[i]);
printf("QUAD'S TRIANGLE:\n");
-#define printVertex(a) printf("(%.2f,%.2f,%.2f),0x%lX,(%.2f,%.2f)\n",a.x,a.y,a.z,a.col,a.tx,a.ty);
+#define printVertex(a) printf("(%.2f,%.2f,%.2f),0x%X,(%.2f,%.2f)\n",a.x,a.y,a.z,a.col,a.tx,a.ty);
printf("#%d: ",indexBuf[i+0]);printVertex(vertexBuf[indexBuf[i+0]]);
printf("#%d: ",indexBuf[i+1]);printVertex(vertexBuf[indexBuf[i+1]]);
printf("#%d: ",indexBuf[i+2]);printVertex(vertexBuf[indexBuf[i+2]]);
@@ -694,7 +694,7 @@ bool SMELT_IMPL::checkGLExtension(const char *extlist,const char *ext)
}
bool SMELT_IMPL::loadGLEntryPoints()
{
- smLog("%s:"SLINE": OpenGL: loading entry points and examining extensions...\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: loading entry points and examining extensions...\n",GFX_SDL_SRCFN);
pOpenGLDevice->have_base_opengl=true;
pOpenGLDevice->have_GL_ARB_texture_rectangle=true;
pOpenGLDevice->have_GL_ARB_texture_non_power_of_two=true;
@@ -717,15 +717,15 @@ bool SMELT_IMPL::loadGLEntryPoints()
unloadGLEntryPoints();
return false;
}
- smLog("%s:"SLINE": GL_RENDERER: %s\n",GFX_SDL_SRCFN,(const char *)pOpenGLDevice->glGetString(GL_RENDERER));
- smLog("%s:"SLINE": GL_VENDOR: %s\n",GFX_SDL_SRCFN,(const char *)pOpenGLDevice->glGetString(GL_VENDOR));
- smLog("%s:"SLINE": GL_VERSION: %s\n",GFX_SDL_SRCFN,(const char *)pOpenGLDevice->glGetString(GL_VERSION));
+ smLog("%s:" SLINE ": GL_RENDERER: %s\n",GFX_SDL_SRCFN,(const char *)pOpenGLDevice->glGetString(GL_RENDERER));
+ smLog("%s:" SLINE ": GL_VENDOR: %s\n",GFX_SDL_SRCFN,(const char *)pOpenGLDevice->glGetString(GL_VENDOR));
+ smLog("%s:" SLINE ": GL_VERSION: %s\n",GFX_SDL_SRCFN,(const char *)pOpenGLDevice->glGetString(GL_VERSION));
const char *verstr=(const char*)pOpenGLDevice->glGetString(GL_VERSION);
int maj=0,min=0;
sscanf(verstr,"%d.%d",&maj,&min);
if((maj<1)||((maj==1)&&(min<2)))
{
- smLog("%s:"SLINE": OpenGL implementation must be at least version 1.2.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL implementation must be at least version 1.2.\n",GFX_SDL_SRCFN);
unloadGLEntryPoints();
return false;
}
@@ -738,35 +738,35 @@ bool SMELT_IMPL::loadGLEntryPoints()
maj>=2||checkGLExtension(exts,"GL_ARB_texture_non_power_of_two");
if(pOpenGLDevice->have_GL_ARB_texture_rectangle)
{
- smLog("%s:"SLINE": OpenGL: Using GL_ARB_texture_rectangle.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: Using GL_ARB_texture_rectangle.\n",GFX_SDL_SRCFN);
pOpenGLDevice->TextureTarget=GL_TEXTURE_RECTANGLE_ARB;
}
else if(pOpenGLDevice->have_GL_ARB_texture_non_power_of_two)
{
- smLog("%s:"SLINE": OpenGL: Using GL_ARB_texture_non_power_of_two.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: Using GL_ARB_texture_non_power_of_two.\n",GFX_SDL_SRCFN);
pOpenGLDevice->TextureTarget=GL_TEXTURE_2D;
}
else
{
- smLog("%s:"SLINE": OpenGL: Using power-of-two textures. This costs more memory!\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: Using power-of-two textures. This costs more memory!\n",GFX_SDL_SRCFN);
pOpenGLDevice->TextureTarget=GL_TEXTURE_2D;
}
if(pOpenGLDevice->have_GL_EXT_framebuffer_object)
pOpenGLDevice->have_GL_EXT_framebuffer_object=
checkGLExtension(exts, "GL_EXT_framebuffer_object");
if(pOpenGLDevice->have_GL_EXT_framebuffer_object)
- smLog("%s:"SLINE": OpenGL: Using GL_EXT_framebuffer_object.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: Using GL_EXT_framebuffer_object.\n",GFX_SDL_SRCFN);
else
- smLog("%s:"SLINE": OpenGL: WARNING! No render-to-texture support. Things may render badly.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: WARNING! No render-to-texture support. Things may render badly.\n",GFX_SDL_SRCFN);
if(pOpenGLDevice->have_GL_EXT_texture_compression_s3tc)
pOpenGLDevice->have_GL_EXT_texture_compression_s3tc=
checkGLExtension(exts,"GL_ARB_texture_compression")&&
checkGLExtension(exts,"GL_EXT_texture_compression_s3tc");
if(pOpenGLDevice->have_GL_EXT_texture_compression_s3tc)
- smLog("%s:"SLINE": OpenGL: Using GL_EXT_texture_compression_s3tc.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: Using GL_EXT_texture_compression_s3tc.\n",GFX_SDL_SRCFN);
else if (true)
{
- smLog("%s:"SLINE": OpenGL: Texture compression disabled!\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: Texture compression disabled!\n",GFX_SDL_SRCFN);
}
if(pOpenGLDevice->have_GL_ARB_vertex_buffer_object)
{
@@ -774,18 +774,18 @@ bool SMELT_IMPL::loadGLEntryPoints()
checkGLExtension(exts,"GL_ARB_vertex_buffer_object");
}
if(pOpenGLDevice->have_GL_ARB_vertex_buffer_object)
- smLog("%s:"SLINE": OpenGL: Using GL_ARB_vertex_buffer_object.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: Using GL_ARB_vertex_buffer_object.\n",GFX_SDL_SRCFN);
else
- smLog("%s:"SLINE": OpenGL: WARNING! No VBO support; performance may suffer.\n",GFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": OpenGL: WARNING! No VBO support; performance may suffer.\n",GFX_SDL_SRCFN);
return true;
}
bool SMELT_IMPL::initOGL()
{
primTex=0;
- if(pOpenGLDevice){smLog("%s:"SLINE": Multiple initialization!\n",GFX_SDL_SRCFN);return false;}
+ if(pOpenGLDevice){smLog("%s:" SLINE ": Multiple initialization!\n",GFX_SDL_SRCFN);return false;}
pOpenGLDevice=new TOpenGLDevice;
if(!loadGLEntryPoints())return false;
- smLog("%s:"SLINE": Mode: %d x %d\n",GFX_SDL_SRCFN,scrw,scrh);
+ smLog("%s:" SLINE ": Mode: %d x %d\n",GFX_SDL_SRCFN,scrw,scrh);
vertexArray=NULL;textures=NULL;IndexBufferObject=0;
if(!confOGL())return false;
pOpenGLDevice->glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
diff --git a/smelt/sdl/inp_sdl.cpp b/smelt/sdl/inp_sdl.cpp
index a18baa9..c1e05de 100644
--- a/smelt/sdl/inp_sdl.cpp
+++ b/smelt/sdl/inp_sdl.cpp
@@ -9,7 +9,7 @@
*
*/
#include "smelt_internal.hpp"
-static const char* INP_SDL_SRCFN="smelt/sdl/inp_sdl.cpp";
+//static const char* INP_SDL_SRCFN="smelt/sdl/inp_sdl.cpp";
bool SMELT_IMPL::smGetInpEvent(smInpEvent *e)
{
TInputEventList *eptr;
diff --git a/smelt/sdl/makefile b/smelt/sdl/makefile
new file mode 100644
index 0000000..aa9acb8
--- /dev/null
+++ b/smelt/sdl/makefile
@@ -0,0 +1,13 @@
+CC= g++
+CXXFLAGS= -c -std=c++11 -Wall -I/usr/include/SDL/ -I../include -D_LINUX
+
+all: objects archive clean
+
+objects:
+ $(CC) *.cpp $(CXXFLAGS)
+archive:
+ $(AR) rcs libsmelt.a *.o
+clean:
+ if ( test gfx_sdl.o ); then rm *.o; fi
+clean-all: clean
+ rm *.a \ No newline at end of file
diff --git a/smelt/sdl/sfx_sdl.cpp b/smelt/sdl/sfx_sdl.cpp
index 10a207c..b61a8a0 100644
--- a/smelt/sdl/sfx_sdl.cpp
+++ b/smelt/sdl/sfx_sdl.cpp
@@ -287,28 +287,28 @@ bool SMELT_IMPL::initOAL()
{
if(pOpenALDevice)return true;
scnt=0;memset(src,0,sizeof(src));
- smLog("%s:"SLINE": Initializing OpenAL...\n",SFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": Initializing OpenAL...\n",SFX_SDL_SRCFN);
ALCdevice *dev=alcOpenDevice(NULL);
if(!dev)
{
- smLog("%s:"SLINE": alcOpenDevice() failed.\n",SFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": alcOpenDevice() failed.\n",SFX_SDL_SRCFN);
return mute=true;
}
ALint caps[]={ALC_FREQUENCY,44100,0};
ALCcontext *ctx=alcCreateContext(dev,caps);
if(!ctx)
{
- smLog("%s:"SLINE": alcCreateContext() failed.\n",SFX_SDL_SRCFN);
+ smLog("%s:" SLINE ": alcCreateContext() failed.\n",SFX_SDL_SRCFN);
return mute=true;
}
alcMakeContextCurrent(ctx);alcProcessContext(ctx);
- smLog("%s:"SLINE": Done OpenAL initialization\n",SFX_SDL_SRCFN);
- 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));
+ smLog("%s:" SLINE ": Done OpenAL initialization\n",SFX_SDL_SRCFN);
+ 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);
+ 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/sys_sdl.cpp b/smelt/sdl/sys_sdl.cpp
index 190f3bb..27a9e7b 100644
--- a/smelt/sdl/sys_sdl.cpp
+++ b/smelt/sdl/sys_sdl.cpp
@@ -38,15 +38,15 @@ void SMELT_IMPL::smRelease()
bool SMELT_IMPL::smInit()
{
- smLog("%s:"SLINE": Initalizing SMELT...\n",SYS_SDL_SRCFN);
- smLog("%s:"SLINE": SMELT api version %d\n",SYS_SDL_SRCFN,SMELT_APILEVEL);
+ smLog("%s:" SLINE ": Initalizing SMELT...\n",SYS_SDL_SRCFN);
+ smLog("%s:" SLINE ": SMELT api version %d\n",SYS_SDL_SRCFN,SMELT_APILEVEL);
time_t t=time(NULL);
- smLog("%s:"SLINE": Date %s",SYS_SDL_SRCFN,asctime(localtime(&t)));
+ smLog("%s:" SLINE ": Date %s",SYS_SDL_SRCFN,asctime(localtime(&t)));
#ifdef WIN32
OSVERSIONINFO os_ver; MEMORYSTATUS mem_st;
os_ver.dwOSVersionInfoSize=sizeof(os_ver);
GetVersionEx(&os_ver);
- smLog("%s:"SLINE": OS: Windows %ld.%ld.%ld\n", SYS_SDL_SRCFN,os_ver.dwMajorVersion,os_ver.dwMinorVersion,os_ver.dwBuildNumber);
+ smLog("%s:" SLINE ": OS: Windows %ld.%ld.%ld\n", SYS_SDL_SRCFN,os_ver.dwMajorVersion,os_ver.dwMinorVersion,os_ver.dwBuildNumber);
int CPUInfo[4]={-1};
__cpuid(CPUInfo,0x80000000);
@@ -63,50 +63,50 @@ bool SMELT_IMPL::smInit()
memcpy(cpuName+32, CPUInfo, sizeof(CPUInfo));
}
while(*cpuName=' ')++cpuName;
- smLog("%s:"SLINE": CPU: %s\n", SYS_SDL_SRCFN,cpuName);
+ smLog("%s:" SLINE ": CPU: %s\n", SYS_SDL_SRCFN,cpuName);
free(loced);
GlobalMemoryStatus(&mem_st);
- smLog("%s:"SLINE": Memory: %ldK total, %ldK free\n", SYS_SDL_SRCFN,mem_st.dwTotalPhys/1024L,mem_st.dwAvailPhys/1024L);
+ smLog("%s:" SLINE ": Memory: %ldK total, %ldK free\n", SYS_SDL_SRCFN,mem_st.dwTotalPhys/1024L,mem_st.dwAvailPhys/1024L);
#else
system("uname -svm > os.out");
char osv[100];FILE* a=fopen("os.out","r");fgets(osv,100,a);fclose(a);
osv[strlen(osv)-1]='\0';
- smLog("%s:"SLINE": OS: %s\n",SYS_SDL_SRCFN,osv);
+ smLog("%s:" SLINE ": OS: %s\n",SYS_SDL_SRCFN,osv);
system("rm os.out");
system("cat /proc/cpuinfo | grep name -m 1 > cpu.out");
a=fopen("cpu.out","r");fgets(osv,100,a);fclose(a);
osv[strlen(osv)-1]='\0';char *ptr=osv;while(*ptr!=':')++ptr;ptr+=2;
- smLog("%s:"SLINE": CPU: %s\n",SYS_SDL_SRCFN,osv);
+ smLog("%s:" SLINE ": CPU: %s\n",SYS_SDL_SRCFN,osv);
system("rm cpu.out");
a=fopen("/proc/meminfo","r");
unsigned totalm,freem;
fscanf(a,"MemTotal: %u kB\n",&totalm);
fscanf(a,"MemFree: %u kB\n",&freem);
- smLog("%s:"SLINE": RAM: %ukB installed, %ukB free\n",SYS_SDL_SRCFN,totalm,freem);
+ smLog("%s:" SLINE ": RAM: %ukB installed, %ukB free\n",SYS_SDL_SRCFN,totalm,freem);
fclose(a);
#endif
if(SDL_Init(SDL_INIT_VIDEO)==-1)
{
- smLog("%s:"SLINE": SDL_Init() failed with error %s\n",SYS_SDL_SRCFN,SDL_GetError());
+ smLog("%s:" SLINE ": SDL_Init() failed with error %s\n",SYS_SDL_SRCFN,SDL_GetError());
return false;
}
if(SDL_GL_LoadLibrary(NULL)==-1)
{
- smLog("%s:"SLINE": SDL_GL_LoadLibrary() failed with error %s\n",SYS_SDL_SRCFN,SDL_GetError());
+ smLog("%s:" SLINE ": SDL_GL_LoadLibrary() failed with error %s\n",SYS_SDL_SRCFN,SDL_GetError());
return false;
}
SDL_DisplayMode vidinfo;
if(SDL_GetDesktopDisplayMode(0,&vidinfo))
{
- smLog("%s:"SLINE": SDL_GetDesktopDisplayMode() failed with error %s\n",SYS_SDL_SRCFN,SDL_GetError());
+ smLog("%s:" SLINE ": SDL_GetDesktopDisplayMode() failed with error %s\n",SYS_SDL_SRCFN,SDL_GetError());
SDL_Quit();
return false;
}
dispw=vidinfo.w;disph=vidinfo.h;
- smLog("%s:"SLINE": Screen: %d x %d\n",SYS_SDL_SRCFN,dispw,disph);
+ smLog("%s:" SLINE ": Screen: %d x %d\n",SYS_SDL_SRCFN,dispw,disph);
Uint32 flags=SDL_WINDOW_OPENGL;
if(!windowed)flags|=SDL_WINDOW_FULLSCREEN;
SDL_Window *screen=SDL_CreateWindow(winTitle,SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,scrw,scrh,flags);
@@ -122,7 +122,7 @@ bool SMELT_IMPL::smInit()
SDL_GL_SetSwapInterval(vsync?1:0);
if(!hwnd)
{
- smLog("%s:"SLINE": SDL_CreateWindow() failed with error %s\n",SYS_SDL_SRCFN,SDL_GetError());
+ smLog("%s:" SLINE ": SDL_CreateWindow() failed with error %s\n",SYS_SDL_SRCFN,SDL_GetError());
SDL_Quit();
return false;
}
@@ -142,15 +142,15 @@ bool SMELT_IMPL::smInit()
void SMELT_IMPL::smFinale()
{
- smLog("%s:"SLINE": Cleaning up...\n",SYS_SDL_SRCFN);
+ smLog("%s:" SLINE ": Cleaning up...\n",SYS_SDL_SRCFN);
clearQueue();finiOAL();finiOGL();
SDL_Quit();hwnd=0;
}
void SMELT_IMPL::smMainLoop()
{
- if(!hwnd)return smLog("%s:"SLINE": Error: SMELT is not initialized.\n",SYS_SDL_SRCFN);
- if(!pUpdateFunc) return smLog("%s:"SLINE": UpdateFunc is not defined.\n",SYS_SDL_SRCFN);
+ if(!hwnd)return smLog("%s:" SLINE ": Error: SMELT is not initialized.\n",SYS_SDL_SRCFN);
+ if(!pUpdateFunc) return smLog("%s:" SLINE ": UpdateFunc is not defined.\n",SYS_SDL_SRCFN);
Active=true;
for(;;)
{
diff --git a/tools/dtputil/makefile b/tools/dtputil/makefile
new file mode 100644
index 0000000..cb0ed0a
--- /dev/null
+++ b/tools/dtputil/makefile
@@ -0,0 +1,10 @@
+CC= g++
+CXXFLAGS= -Wall
+LINK= -lz -lsmeltext
+LINK_FOLDER= -L../../extensions/
+
+all: anmutil dtputil
+anmutil:
+ $(CC) anmutil.cpp -o anmutil $(CXXFLAGS) $(LINK_FOLDER) $(LINK)
+dtputil:
+ $(CC) dtputil.cpp -o dtputil $(CXXFLAGS) $(LINK_FOLDER) $(LINK) \ No newline at end of file