on automake platforms, too.legacy
@@ -378,7 +378,7 @@ LOL_DEPENDENCIES="${LOL_DEPENDENCIES} \$(top_builddir)/src/bullet/liblolbullet.a | |||||
dnl How to use the Lol Engine inside this tree | dnl How to use the Lol Engine inside this tree | ||||
AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/src" | AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/src" | ||||
AM_CPPFLAGS="${AM_CPPFLAGS} -DLOL_SOURCE_SUBDIR=\\\"\$(subdir)\\\"" | |||||
AM_CPPFLAGS="${AM_CPPFLAGS} -DLOL_CONFIG_SOURCESUBDIR=\\\"\$(subdir)\\\"" | |||||
AM_CPPFLAGS="${AM_CPPFLAGS} ${LOL_CFLAGS}" | AM_CPPFLAGS="${AM_CPPFLAGS} ${LOL_CFLAGS}" | ||||
AM_LDFLAGS="${AM_LDFLAGS} ${LOL_DEPENDENCIES}" | AM_LDFLAGS="${AM_LDFLAGS} ${LOL_DEPENDENCIES}" | ||||
AM_LDFLAGS="${AM_LDFLAGS} ${LOL_LIBS}" | AM_LDFLAGS="${AM_LDFLAGS} ${LOL_LIBS}" | ||||
@@ -44,12 +44,12 @@ DebugFps::DebugFps(int x, int y) | |||||
#if 0 | #if 0 | ||||
for (int i = 0; i < 5; i ++) | for (int i = 0; i < 5; i ++) | ||||
{ | { | ||||
data->lines[i] = new Text(NULL, "src/data/font/ascii.png"); | |||||
data->lines[i] = new Text(NULL, "data/font/ascii.png"); | |||||
data->lines[i]->SetPos(ivec3(x, y + (i ? 8 : 0) + 16 * i, 0)); | data->lines[i]->SetPos(ivec3(x, y + (i ? 8 : 0) + 16 * i, 0)); | ||||
Ticker::Ref(data->lines[i]); | Ticker::Ref(data->lines[i]); | ||||
} | } | ||||
#else | #else | ||||
data->lines[0] = new Text(NULL, "src/data/font/ascii.png"); | |||||
data->lines[0] = new Text(NULL, "data/font/ascii.png"); | |||||
data->lines[0]->SetPos(ivec3(x, y, 100)); | data->lines[0]->SetPos(ivec3(x, y, 100)); | ||||
Ticker::Ref(data->lines[0]); | Ticker::Ref(data->lines[0]); | ||||
#endif | #endif | ||||
@@ -34,6 +34,10 @@ namespace lol | |||||
# define LOL_CONFIG_SOLUTIONDIR "" | # define LOL_CONFIG_SOLUTIONDIR "" | ||||
#endif | #endif | ||||
#if !defined LOL_CONFIG_SOURCESUBDIR | |||||
# define LOL_CONFIG_SOURCESUBDIR "" | |||||
#endif | |||||
/* | /* | ||||
* System namespace. The platform-specific stuff in there makes the API | * System namespace. The platform-specific stuff in there makes the API | ||||
* not as clean as the rest of the framework. | * not as clean as the rest of the framework. | ||||
@@ -44,7 +48,8 @@ namespace System | |||||
extern void Init(int argc, char *argv[], | extern void Init(int argc, char *argv[], | ||||
String const &projectdir = LOL_CONFIG_PROJECTDIR, | String const &projectdir = LOL_CONFIG_PROJECTDIR, | ||||
String const &solutiondir = LOL_CONFIG_SOLUTIONDIR); | |||||
String const &solutiondir = LOL_CONFIG_SOLUTIONDIR, | |||||
String const &sourcesubdir = LOL_CONFIG_SOURCESUBDIR); | |||||
extern void AddDataDir(String const &dir); | extern void AddDataDir(String const &dir); | ||||
extern Array<String> GetPathList(String const &file); | extern Array<String> GetPathList(String const &file); | ||||
@@ -38,7 +38,9 @@ namespace System | |||||
static Array<String> data_dir; | static Array<String> data_dir; | ||||
void Init(int argc, char *argv[], | void Init(int argc, char *argv[], | ||||
String const &projectdir, String const &solutiondir) | |||||
String const &projectdir, | |||||
String const &solutiondir, | |||||
String const &sourcesubdir) | |||||
{ | { | ||||
using namespace std; | using namespace std; | ||||
@@ -76,10 +78,17 @@ void Init(int argc, char *argv[], | |||||
* assume it was. */ | * assume it was. */ | ||||
if (i) | if (i) | ||||
{ | { | ||||
String rootdir = projectdir; | |||||
String rootdir = solutiondir; | |||||
if (rootdir.Last() != SEPARATOR) | if (rootdir.Last() != SEPARATOR) | ||||
rootdir += SEPARATOR; | rootdir += SEPARATOR; | ||||
rootdir += "../../src/"; /* FIXME: use SEPARATOR? */ | |||||
AddDataDir(rootdir); | AddDataDir(rootdir); | ||||
rootdir = projectdir; | |||||
if (rootdir.Last() != SEPARATOR) | |||||
rootdir += SEPARATOR; | |||||
AddDataDir(rootdir); | |||||
got_rootdir = true; | got_rootdir = true; | ||||
} | } | ||||
break; | break; | ||||
@@ -89,7 +98,22 @@ void Init(int argc, char *argv[], | |||||
/* If no rootdir found, use the executable location */ | /* If no rootdir found, use the executable location */ | ||||
if (!got_rootdir) | if (!got_rootdir) | ||||
{ | { | ||||
AddDataDir(binarydir); | |||||
String rootdir = binarydir; | |||||
if (rootdir.Last() != SEPARATOR) | |||||
rootdir += SEPARATOR; | |||||
for (int i = 1; i < sourcesubdir.Count(); ++i) | |||||
{ | |||||
if ((sourcesubdir[i] == SEPARATOR | |||||
&& sourcesubdir[i - 1] != SEPARATOR) | |||||
|| i == sourcesubdir.Count() - 1) | |||||
rootdir += "../"; | |||||
} | |||||
rootdir += "src/"; | |||||
AddDataDir(rootdir); | |||||
rootdir = binarydir; | |||||
AddDataDir(rootdir); | |||||
got_rootdir = true; | got_rootdir = true; | ||||
} | } | ||||
@@ -113,7 +137,7 @@ Array<String> GetPathList(String const &file) | |||||
Array<String> ret; | Array<String> ret; | ||||
for (int i = 0; i < data_dir.Count(); ++i) | for (int i = 0; i < data_dir.Count(); ++i) | ||||
ret << data_dir[0] + file; | |||||
ret << data_dir[i] + file; | |||||
if (ret.Count() == 0) | if (ret.Count() == 0) | ||||
ret << file; | ret << file; | ||||
@@ -104,15 +104,15 @@ public: | |||||
} | } | ||||
#if !defined __native_client__ | #if !defined __native_client__ | ||||
m_centertext = new Text(NULL, "src/data/font/ascii.png"); | |||||
m_centertext = new Text(NULL, "data/font/ascii.png"); | |||||
m_centertext->SetPos(ivec3(5, m_window_size.y - 15, 1)); | m_centertext->SetPos(ivec3(5, m_window_size.y - 15, 1)); | ||||
Ticker::Ref(m_centertext); | Ticker::Ref(m_centertext); | ||||
m_mousetext = new Text(NULL, "src/data/font/ascii.png"); | |||||
m_mousetext = new Text(NULL, "data/font/ascii.png"); | |||||
m_mousetext->SetPos(ivec3(5, m_window_size.y - 29, 1)); | m_mousetext->SetPos(ivec3(5, m_window_size.y - 29, 1)); | ||||
Ticker::Ref(m_mousetext); | Ticker::Ref(m_mousetext); | ||||
m_zoomtext = new Text(NULL, "src/data/font/ascii.png"); | |||||
m_zoomtext = new Text(NULL, "data/font/ascii.png"); | |||||
m_zoomtext->SetPos(ivec3(5, m_window_size.y - 43, 1)); | m_zoomtext->SetPos(ivec3(5, m_window_size.y - 43, 1)); | ||||
Ticker::Ref(m_zoomtext); | Ticker::Ref(m_zoomtext); | ||||
#endif | #endif | ||||