aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2018-02-03 00:55:26 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2018-02-03 00:55:26 +0800
commit1eb88d4f5d5cb05d62be1d4a0c88c7399f7c0de0 (patch)
tree4daf8fa3f4e8fff38a61b8e2da752df8b519f232 /examples
parent6f955e10a71e364f527ea654156ea83785e9ada8 (diff)
downloadSMELT-1eb88d4f5d5cb05d62be1d4a0c88c7399f7c0de0.tar.xz
Added the GL 3.2+ port.
Fixed poor performance of the truetype renderer. (Partially) Fixed texture locking. Minor addition and fixes to the math library.
Diffstat (limited to 'examples')
-rw-r--r--examples/makefile9
-rw-r--r--examples/smelt_test.cpp9
2 files changed, 13 insertions, 5 deletions
diff --git a/examples/makefile b/examples/makefile
index 6654d03..d25e638 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -1,13 +1,18 @@
CC= g++
-CXXFLAGS= -I/usr/include/freetype2 -I../include -D_LINUX
+CXXFLAGS= -I/usr/include/freetype2 -I../include -D_LINUX -g
LINK= -lSDL2 -lvorbis -lvorbisfile -lopenal -ljpeg -lpng -lfreetype -lz -lsmeltext -lsmelt -lCxImage
LINK_GLFW= -lglfw -lGLEW -lGL -lvorbis -lvorbisfile -lopenal -ljpeg -lpng -lfreetype -lz -lsmeltext -lsmelt -lCxImage
LINK_FOLDER= -L../smelt/sdl -L../extensions
LINK_GLFW_FOLDER= -L../smelt/glfw -L../extensions
+LINK_GLFW_M_FOLDER= -L../smelt/glfw_m -L../extensions
-all:
+all: sdl glfw glfw_m
+
+sdl:
$(CC) smelt_test.cpp $(CXXFLAGS) $(LINK_FOLDER) $(LINK) -o smelt_test
clean:
rm smelt_test
glfw:
$(CC) smelt_test.cpp $(CXXFLAGS) $(LINK_GLFW_FOLDER) $(LINK_GLFW) -o smelt_test_glfw
+glfw_m:
+ $(CC) smelt_test.cpp $(CXXFLAGS) $(LINK_GLFW_M_FOLDER) $(LINK_GLFW) -o smelt_test_glfw_m
diff --git a/examples/smelt_test.cpp b/examples/smelt_test.cpp
index 879a507..8d0e41b 100644
--- a/examples/smelt_test.cpp
+++ b/examples/smelt_test.cpp
@@ -71,7 +71,7 @@ bool doingNothing()
sm->smClrscr(0xFF000000);
//render the 3d entity.
e3d->render9f(0,0,0,theta,0,1,0,1);
-#define pp printf("(%.0f,%.0f,%.0f) (%.0f,%.0f,%.0f)\n",pos[0],pos[1],pos[2],rot[0],rot[1],rot[2]);
+#define pp printf("(%.0f,%.0f,%.0f) (%.0f,%.0f,%.0f)\n",pos[0],pos[1],pos[2],rot[0],rot[1],rot[2])
//camera manipulation key bindings.
if(sm->smGetKeyState(SMK_W)==SMKST_HIT)pos[1]+=10,pp;
if(sm->smGetKeyState(SMK_S)==SMKST_HIT)pos[1]-=10,pp;
@@ -147,13 +147,16 @@ int main()
fonttest.setScale(1.);
//load the truetype font.
- if(!ttftest.loadTTF("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc",18))if(!ttftest.loadTTF("/usr/share/fonts/wenquanyi/wqy-microhei/wqy-microhei.ttc",18))sm->smLog("ttf load error!");
+ if(!ttftest.loadTTF("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc",18))
+ if(!ttftest.loadTTF("/usr/share/fonts/wenquanyi/wqy-microhei/wqy-microhei.ttc",18))
+ if(!ttftest.loadTTF("/usr/share/fonts/wqy-microhei/wqy-microhei.ttc",18))
+ sm->smLog("ttf load error!");
//load the texture.
tex=sm->smTextureLoad("SpriteSheet.png");
//load the sound files.
sfx=sm->smSFXLoad("tap.ogg");
- bgm=sm->smSFXLoad("稲田姫樣に叱られるから.ogg");
+ bgm=sm->smSFXLoad("稲田姫様に叱られるから.ogg");
//set loop points of the bgm.
sm->smSFXSetLoopPoint(bgm,0xED80,0x1E0400);
//create the rendering target for the 3d scene.