Parcourir la source

sys: add the base source directory to the list of search directories

on automake platforms, too.
legacy
Sam Hocevar sam il y a 11 ans
Parent
révision
7e8edd7c3e
5 fichiers modifiés avec 40 ajouts et 11 suppressions
  1. +1
    -1
      configure.ac
  2. +2
    -2
      src/debug/fps.cpp
  3. +6
    -1
      src/lol/sys/init.h
  4. +28
    -4
      src/sys/init.cpp
  5. +3
    -3
      tutorial/11_fractal.cpp

+ 1
- 1
configure.ac Voir le fichier

@@ -378,7 +378,7 @@ LOL_DEPENDENCIES="${LOL_DEPENDENCIES} \$(top_builddir)/src/bullet/liblolbullet.a

dnl How to use the Lol Engine inside this tree
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_LDFLAGS="${AM_LDFLAGS} ${LOL_DEPENDENCIES}"
AM_LDFLAGS="${AM_LDFLAGS} ${LOL_LIBS}"


+ 2
- 2
src/debug/fps.cpp Voir le fichier

@@ -44,12 +44,12 @@ DebugFps::DebugFps(int x, int y)
#if 0
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));
Ticker::Ref(data->lines[i]);
}
#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));
Ticker::Ref(data->lines[0]);
#endif


+ 6
- 1
src/lol/sys/init.h Voir le fichier

@@ -34,6 +34,10 @@ namespace lol
# define LOL_CONFIG_SOLUTIONDIR ""
#endif

#if !defined LOL_CONFIG_SOURCESUBDIR
# define LOL_CONFIG_SOURCESUBDIR ""
#endif

/*
* System namespace. The platform-specific stuff in there makes the API
* not as clean as the rest of the framework.
@@ -44,7 +48,8 @@ namespace System

extern void Init(int argc, char *argv[],
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 Array<String> GetPathList(String const &file);


+ 28
- 4
src/sys/init.cpp Voir le fichier

@@ -38,7 +38,9 @@ namespace System
static Array<String> data_dir;

void Init(int argc, char *argv[],
String const &projectdir, String const &solutiondir)
String const &projectdir,
String const &solutiondir,
String const &sourcesubdir)
{
using namespace std;

@@ -76,10 +78,17 @@ void Init(int argc, char *argv[],
* assume it was. */
if (i)
{
String rootdir = projectdir;
String rootdir = solutiondir;
if (rootdir.Last() != SEPARATOR)
rootdir += SEPARATOR;
rootdir += "../../src/"; /* FIXME: use SEPARATOR? */
AddDataDir(rootdir);

rootdir = projectdir;
if (rootdir.Last() != SEPARATOR)
rootdir += SEPARATOR;
AddDataDir(rootdir);

got_rootdir = true;
}
break;
@@ -89,7 +98,22 @@ void Init(int argc, char *argv[],
/* If no rootdir found, use the executable location */
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;
}

@@ -113,7 +137,7 @@ Array<String> GetPathList(String const &file)
Array<String> ret;

for (int i = 0; i < data_dir.Count(); ++i)
ret << data_dir[0] + file;
ret << data_dir[i] + file;

if (ret.Count() == 0)
ret << file;


+ 3
- 3
tutorial/11_fractal.cpp Voir le fichier

@@ -104,15 +104,15 @@ public:
}

#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));
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));
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));
Ticker::Ref(m_zoomtext);
#endif


Chargement…
Annuler
Enregistrer