diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-04-25 23:47:43 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-04-25 23:47:43 +0800 |
commit | c2b99f6321965b2c5b30a1b72b29119281c2d7e1 (patch) | |
tree | 949b2a1ad1d522df5e02dea75f174bc546d869f2 | |
parent | 261bfb611a92c5dec13f65fb225a127a66a1b43b (diff) | |
download | SMELT-c2b99f6321965b2c5b30a1b72b29119281c2d7e1.tar.xz |
Compile with -fPIC to allow linkage to libraries.
Make several math functions static.
Elimate several warnings from the compiler.
-rw-r--r-- | extensions/makefile | 2 | ||||
-rw-r--r-- | extensions/smgrid.cpp | 2 | ||||
-rw-r--r-- | include/smelt.hpp | 4 | ||||
-rw-r--r-- | include/smmath.hpp | 8 | ||||
-rw-r--r-- | smelt/sdl/.directory | 2 | ||||
-rw-r--r-- | smelt/sdl/CxImage/makefile | 2 | ||||
-rw-r--r-- | smelt/sdl/CxImage/ximadef.h | 1 | ||||
-rw-r--r-- | smelt/sdl/makefile | 2 |
8 files changed, 12 insertions, 11 deletions
diff --git a/extensions/makefile b/extensions/makefile index 4c6b3fe..c5f30e1 100644 --- a/extensions/makefile +++ b/extensions/makefile @@ -1,5 +1,5 @@ CC= g++ -CXXFLAGS= -c -std=c++11 -Wall -I../include -I/usr/include/freetype2 +CXXFLAGS= -c -g -std=c++11 -Wall -I../include -I/usr/include/freetype2 -fPIC all: objects archive clean diff --git a/extensions/smgrid.cpp b/extensions/smgrid.cpp index d78864f..5e00a6b 100644 --- a/extensions/smgrid.cpp +++ b/extensions/smgrid.cpp @@ -70,7 +70,7 @@ void smGrid::setBlend(int blend){quad.blend=blend;} void smGrid::setColor(int c,int r,DWORD col){if(c<cc&&r<rc)pos[r*cc+c].col=col;} void smGrid::setPos(int c,int r,float x,float y,float z,int ref) { - if(c<cc&&r<rc) + if(c>=0&&r>=0&&c<cc&&r<rc) { if(ref==GRID_REFCENTER)x+=cw*(cc-1)/2,y+=ch*(rc-1)/2; if(ref==GRID_REFNODE)x+=c*cw,y+=r*ch; diff --git a/include/smelt.hpp b/include/smelt.hpp index 90ffc22..3894e34 100644 --- a/include/smelt.hpp +++ b/include/smelt.hpp @@ -74,7 +74,9 @@ typedef bool (*smHook)(); //Wrapper abstract class for a function that can hook into SMELT class smHandler { - public: virtual bool handlerFunc()=0; + public: + virtual ~smHandler(){} + virtual bool handlerFunc()=0; }; //Special FPS modes diff --git a/include/smmath.hpp b/include/smmath.hpp index 5172772..b9763b7 100644 --- a/include/smmath.hpp +++ b/include/smmath.hpp @@ -23,10 +23,10 @@ template<class T>const T& max(const T& a,const T& b){return a>b?a:b;} class smMath { public: - double deg2rad(double deg){return deg/180.*PI;} - double rad2deg(double rad){return rad/PI*180.;} - double clamprad(double a){while(a<0)a+=2*PI;while(a>2*PI)a-=2*PI;return a;} - double clampdeg(double a){while(a<0)a+=360.;while(a>360)a-=360.;return a;} + static double deg2rad(double deg){return deg/180.*PI;} + static double rad2deg(double rad){return rad/PI*180.;} + static double clamprad(double a){while(a<0)a+=2*PI;while(a>2*PI)a-=2*PI;return a;} + static double clampdeg(double a){while(a<0)a+=360.;while(a>360)a-=360.;return a;} }; class smvec2d { diff --git a/smelt/sdl/.directory b/smelt/sdl/.directory index 395d8d9..f403253 100644 --- a/smelt/sdl/.directory +++ b/smelt/sdl/.directory @@ -2,5 +2,5 @@ GroupedSorting=true PreviewsShown=true SortRole=type -Timestamp=2015,7,23,0,2,36 +Timestamp=2016,1,25,22,42,36 Version=3 diff --git a/smelt/sdl/CxImage/makefile b/smelt/sdl/CxImage/makefile index 6dcb28b..725a62a 100644 --- a/smelt/sdl/CxImage/makefile +++ b/smelt/sdl/CxImage/makefile @@ -1,5 +1,5 @@ CC= g++ -CXXFLAGS= -c -Os -D_LINUX +CXXFLAGS= -c -Os -D_LINUX -Wall -fPIC AR= ar all: objects archive clean diff --git a/smelt/sdl/CxImage/ximadef.h b/smelt/sdl/CxImage/ximadef.h index 11af155..372ec13 100644 --- a/smelt/sdl/CxImage/ximadef.h +++ b/smelt/sdl/CxImage/ximadef.h @@ -1,4 +1,3 @@ -// -*- C++ -*-
#if !defined(__ximadefs_h)
#define __ximadefs_h
diff --git a/smelt/sdl/makefile b/smelt/sdl/makefile index 09d9237..28a3629 100644 --- a/smelt/sdl/makefile +++ b/smelt/sdl/makefile @@ -1,5 +1,5 @@ CC= g++ -CXXFLAGS= -c -g -std=c++11 -Wall -I/usr/include/SDL/ -I../include -D_LINUX +CXXFLAGS= -c -g -std=c++11 -Wall -I/usr/include/SDL/ -I../include -D_LINUX -fPIC all: objects-normal archive-normal |