aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2017-06-17 22:43:07 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2017-06-17 22:43:07 +0800
commit123771f6b50550d35ba3f6d7c87e240686c23703 (patch)
treecfaac5cc5195eb10f9e8a246e589f0e498a0475a
parent16a560a5e723c27e61f5bba945a089b7b926f4ae (diff)
downloadSMELT-123771f6b50550d35ba3f6d7c87e240686c23703.tar.xz
Fixed example application.
Fixed compile errors in Windows.
-rw-r--r--README.md7
-rw-r--r--examples/makefile6
-rw-r--r--examples/smelt_test.cpp2
-rw-r--r--smelt/glfw/makefile2
-rw-r--r--smelt/glfw/sys_glfw.cpp5
-rw-r--r--smelt/sdl/makefile2
-rw-r--r--smelt/sdl/sys_sdl.cpp2
7 files changed, 17 insertions, 9 deletions
diff --git a/README.md b/README.md
index bf89666..3cc038b 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ A ~~totally useless~~ reference is now in the doc folder.
A D3D version will be put into construction _soon_.
## Building
-Building the SDL version of SMELT is now officially tested
+Building the SDL/GLFW version of SMELT is now officially tested
on debian sid, debian jessie and Arch Linux.
Theoretically the SDL version should work on Windows
@@ -19,7 +19,7 @@ Building dependencies on debian-based systems:
>libfreetype6-dev libopenal-dev libsdl2-dev libpng-dev
>libjpeg62-turbo-dev libvorbis-dev libogg-dev
-Now there's also an experimental port that uses GLFW instead of SDL2.
+Now there's also an port that uses GLFW instead of SDL2.
Minor behavior differences exist between the two versions.
Additional building dependencies for the GLFW version on a debian-base system:
@@ -27,6 +27,7 @@ Additional building dependencies for the GLFW version on a debian-base system:
>libglfw3-dev libglew-dev
To build a module, just run make in the corresponding folder.
+Please note that CxImage is also a module.
The example must be built last.
@@ -58,5 +59,7 @@ comments in the file for details.
## TODOs:
* Example code.
* Better documentation.
+* Sane way to build.
+* OpenGL 3+/OpenGL ES version.
* D3D version.
* Better tools?
diff --git a/examples/makefile b/examples/makefile
index b4844d9..6654d03 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -1,9 +1,13 @@
CC= g++
CXXFLAGS= -I/usr/include/freetype2 -I../include -D_LINUX
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
all:
$(CC) smelt_test.cpp $(CXXFLAGS) $(LINK_FOLDER) $(LINK) -o smelt_test
clean:
- rm smelt_test \ No newline at end of file
+ rm smelt_test
+glfw:
+ $(CC) smelt_test.cpp $(CXXFLAGS) $(LINK_GLFW_FOLDER) $(LINK_GLFW) -o smelt_test_glfw
diff --git a/examples/smelt_test.cpp b/examples/smelt_test.cpp
index 6bad6a6..879a507 100644
--- a/examples/smelt_test.cpp
+++ b/examples/smelt_test.cpp
@@ -61,7 +61,7 @@ bool doingNothing()
if(d>0.37){sm->smSFXPlay(sfx);d=0;}
//We render the 3D scene to a render target.
- sm->smRenderBegin3D(60,testtrg);
+ sm->smRenderBegin3D(60,true,testtrg);
//camera position and rotation.
static float pos[3]={0,0,600};
static float rot[3]={0,0,-30};
diff --git a/smelt/glfw/makefile b/smelt/glfw/makefile
index e325ff3..d487454 100644
--- a/smelt/glfw/makefile
+++ b/smelt/glfw/makefile
@@ -1,5 +1,5 @@
CC= g++
-CXXFLAGS= -c -g -O2 -std=c++11 -Wall -I../include -D_LINUX -fPIC
+CXXFLAGS= -c -g -O2 -std=c++11 -Wall -I../../include -D_LINUX -fPIC
TARGET= libsmelt.a
all: objects-normal archive-normal
diff --git a/smelt/glfw/sys_glfw.cpp b/smelt/glfw/sys_glfw.cpp
index 6a35016..2c8b2e9 100644
--- a/smelt/glfw/sys_glfw.cpp
+++ b/smelt/glfw/sys_glfw.cpp
@@ -62,7 +62,7 @@ bool SMELT_IMPL::smInit()
int CPUInfo[4]={-1};
__cpuid(CPUInfo,0x80000000);
unsigned int nExIds=CPUInfo[0];
- char *cpuName,*loced;cpuName=calloc(0x40,sizeof(char));loced=cpuName;
+ char *cpuName,*loced;cpuName=(char*)calloc(0x40,sizeof(char));loced=cpuName;
for(unsigned int i=0x80000000;i<=nExIds;++i)
{
__cpuid(CPUInfo, i);
@@ -106,7 +106,8 @@ bool SMELT_IMPL::smInit()
return false;
}
GLFWmonitor *moninfo=glfwGetPrimaryMonitor();
- glfwGetMonitorPhysicalSize(moninfo,&dispw,&disph);
+ dispw=glfwGetVideoMode(moninfo)->width;
+ disph=glfwGetVideoMode(moninfo)->height;
smLog("%s:" SLINE ": Screen: %d x %d\n",SYS_GLFW_SRCFN,dispw,disph);
glfwWindowHint(GLFW_RED_BITS,8);
glfwWindowHint(GLFW_GREEN_BITS,8);
diff --git a/smelt/sdl/makefile b/smelt/sdl/makefile
index d58f077..f118481 100644
--- a/smelt/sdl/makefile
+++ b/smelt/sdl/makefile
@@ -1,5 +1,5 @@
CC= g++
-CXXFLAGS= -c -g -O2 -std=c++11 -Wall -I/usr/include/SDL/ -I../include -D_LINUX -fPIC
+CXXFLAGS= -c -g -O2 -std=c++11 -Wall -I/usr/include/SDL/ -I../../include -D_LINUX -fPIC
TARGET= libsmelt.a
all: objects-normal archive-normal
diff --git a/smelt/sdl/sys_sdl.cpp b/smelt/sdl/sys_sdl.cpp
index beb07a0..c0f64d0 100644
--- a/smelt/sdl/sys_sdl.cpp
+++ b/smelt/sdl/sys_sdl.cpp
@@ -51,7 +51,7 @@ bool SMELT_IMPL::smInit()
int CPUInfo[4]={-1};
__cpuid(CPUInfo,0x80000000);
unsigned int nExIds=CPUInfo[0];
- char *cpuName,*loced;cpuName=calloc(0x40,sizeof(char));loced=cpuName;
+ char *cpuName,*loced;cpuName=(char*)calloc(0x40,sizeof(char));loced=cpuName;
for(unsigned int i=0x80000000;i<=nExIds;++i)
{
__cpuid(CPUInfo, i);