Changeset 2241
- Timestamp:
- Jan 21, 2013, 2:11:58 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build/vs2010/Lol.Core.Rules.props
r1822 r2241 14 14 <AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(GlIncludes);$(SdlIncludes);$(D3d9Includes);$(XinputIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 15 15 <PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 16 <PreprocessorDefinitions>LOL_CONFIG_PROJECTDIR="$(ProjectDir.Replace('\',"\\"))";%(PreprocessorDefinitions)</PreprocessorDefinitions> 17 <PreprocessorDefinitions>LOL_CONFIG_SOLUTIONDIR="$(SolutionDir.Replace('\',"\\"))";%(PreprocessorDefinitions)</PreprocessorDefinitions> 16 18 <PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">WIN32;$(Win32Defines);%(PreprocessorDefinitions)</PreprocessorDefinitions> 17 19 <PreprocessorDefinitions Condition="'$(Platform)'=='x64'">WIN32;$(Win32Defines);%(PreprocessorDefinitions)</PreprocessorDefinitions> -
trunk/src/image/codec/gdiplus-image.cpp
r2237 r2241 86 86 #if !LOL_RELEASE 87 87 if (status != Gdiplus::InvalidParameter) 88 Log::Error("error %d loading %s\n", status, path); 88 Log::Error("error %d loading %s\n", 89 status, &fullpath[0]); 89 90 #endif 90 91 delete bitmap; -
trunk/src/lol/sys/init.h
r2237 r2241 22 22 { 23 23 24 /* 25 * Module-specific macros. These can be overridden by the build process, 26 * typically with compiler command-line flags. 27 */ 28 29 #if !defined LOL_CONFIG_PROJECTDIR 30 # define LOL_CONFIG_PROJECTDIR "" 31 #endif 32 33 #if !defined LOL_CONFIG_SOLUTIONDIR 34 # define LOL_CONFIG_SOLUTIONDIR "" 35 #endif 36 24 37 namespace System 25 38 { 26 39 27 extern void Init(Array<char const *> &args); 40 extern void Init(int argc, char *argv[], 41 char const *projectdir = LOL_CONFIG_PROJECTDIR, 42 char const *solutiondir = LOL_CONFIG_SOLUTIONDIR); 43 28 44 extern void SetDataDir(char const *dir); 29 45 extern char const *GetDataDir(); 30 31 static inline void Init(int argc, char *argv[])32 {33 Array<char const *> args;34 35 for (int i = 0; i < argc; i++)36 args << argv[i];37 38 Init(args);39 }40 46 41 47 } /* namespace System */ -
trunk/src/sys/init.cpp
r2237 r2241 21 21 { 22 22 23 void Init(Array<char const *> &args)24 {25 /* Try to guess the data directory from the executable location. */26 if (args.Count() > 0)27 {28 23 #if defined _WIN32 29 24 # define SEPARATOR '\\' … … 31 26 # define SEPARATOR '/' 32 27 #endif 33 char const *last_slash = strrchr(args[0], SEPARATOR); 28 29 void Init(int argc, char *argv[], 30 char const *projectdir, char const *solutiondir) 31 { 32 bool got_rootdir = false; 33 34 /* Find the common prefix between project dir and solution dir. */ 35 for (int i = 0; ; i++) 36 { 37 if (projectdir[i] != solutiondir[i] || projectdir[i] == '\0') 38 { 39 /* FIXME: at this point we should check whether the binary 40 * was launched from this subdirectory; from now we just 41 * assume it was. */ 42 if (i) 43 { 44 String rootdir = projectdir; 45 if (rootdir.Last() != SEPARATOR) 46 rootdir += SEPARATOR; 47 SetDataDir(&rootdir[0]); 48 got_rootdir = true; 49 } 50 break; 51 } 52 } 53 54 /* Try to guess the data directory from the executable location. */ 55 if (!got_rootdir && argc > 0) 56 { 57 char const *last_slash = strrchr(argv[0], SEPARATOR); 34 58 35 59 if (last_slash) 36 60 { 37 String dir; 38 dir.Resize(last_slash - args[0] + 1); 39 memcpy(&dir[0], args[0], last_slash - args[0] + 1); 40 61 String dir(argv[0], last_slash - argv[0] + 1); 41 62 SetDataDir(&dir[0]); 63 got_rootdir = true; 42 64 } 43 65 } -
trunk/test/BtPhysTest.cpp
r2237 r2241 8 8 #if defined HAVE_CONFIG_H 9 9 # include "config.h" 10 #endif11 12 #if defined _WIN3213 # include <direct.h>14 10 #endif 15 11 … … 480 476 Application app("BtPhysTest", ivec2(1280, 720), 60.0f); 481 477 482 #if defined _MSC_VER && !defined _XBOX483 _chdir("..");484 #elif defined _WIN32 && !defined _XBOX485 _chdir("../..");486 #endif487 488 478 new BtPhysTest(argc > 1); 489 479 app.ShowPointer(false); -
trunk/tools/neercs/neercs.cpp
r2237 r2241 7 7 #if defined HAVE_CONFIG_H 8 8 # include "config.h" 9 #endif10 11 #if defined _WIN3212 # include <direct.h>13 9 #endif 14 10 … … 75 71 Application app("Neercs", ivec2(800, 600), 60.0f); 76 72 77 #if defined _MSC_VER && !defined _XBOX78 _chdir("../..");79 #elif defined _WIN32 && !defined _XBOX80 _chdir("../..");81 #endif82 83 73 new Neercs(argc, argv); 84 74 app.ShowPointer(false); -
trunk/tutorial/01_triangle.cpp
r2237 r2241 18 18 using namespace std; 19 19 using namespace lol; 20 21 #if defined _WIN3222 # include <direct.h>23 #endif24 20 25 21 extern char const *lolfx_01_triangle; … … 79 75 Application app("Tutorial 1: Triangle", ivec2(640, 480), 60.0f); 80 76 81 #if defined _MSC_VER && !defined _XBOX82 _chdir("..");83 #elif defined _WIN32 && !defined _XBOX84 _chdir("../..");85 #endif86 87 77 new DebugFps(5, 5); 88 78 new Triangle(); -
trunk/tutorial/02_cube.cpp
r2237 r2241 18 18 using namespace std; 19 19 using namespace lol; 20 21 #if defined _WIN3222 # include <direct.h>23 #endif24 20 25 21 extern char const *lolfx_02_cube; … … 140 136 Application app("Tutorial 2: Cube", ivec2(640, 480), 60.0f); 141 137 142 #if defined _MSC_VER && !defined _XBOX143 _chdir("..");144 #elif defined _WIN32 && !defined _XBOX145 _chdir("../..");146 #endif147 148 138 new DebugFps(5, 5); 149 139 new Cube(); -
trunk/tutorial/03_noise.cpp
r2237 r2241 18 18 using namespace std; 19 19 using namespace lol; 20 21 #if defined _WIN3222 # include <direct.h>23 #endif24 20 25 21 extern char const *lolfx_03_noise; … … 90 86 Application app("Tutorial 3: Noise", ivec2(1280, 720), 60.0f); 91 87 92 #if defined _MSC_VER && !defined _XBOX93 _chdir("..");94 #elif defined _WIN32 && !defined _XBOX95 _chdir("../..");96 #endif97 98 88 new NoiseDemo(); 99 89 -
trunk/tutorial/08_fbo.cpp
r2237 r2241 18 18 using namespace std; 19 19 using namespace lol; 20 21 #if defined _WIN3222 # include <direct.h>23 #endif24 20 25 21 extern char const *lolfx_08_fbo; … … 143 139 Application app("Tutorial 08: Framebuffer Object", ivec2(640, 480), 60.0f); 144 140 145 #if defined _MSC_VER && !defined _XBOX146 _chdir("..");147 #elif defined _WIN32 && !defined _XBOX148 _chdir("../..");149 #endif150 151 141 new FBO(); 152 142 -
trunk/tutorial/11_fractal.cpp
r2237 r2241 18 18 #include "core.h" 19 19 #include "loldebug.h" 20 21 #if defined _WIN3222 # include <direct.h>23 #endif24 20 25 21 using namespace lol; … … 557 553 Application app("Tutorial 3: Fractal", window_size, 60.0f); 558 554 559 #if defined _MSC_VER && !defined _XBOX560 _chdir("..");561 #elif defined _WIN32 && !defined _XBOX562 _chdir("../..");563 #endif564 565 555 new DebugFps(5, 5); 566 556 new Fractal(window_size);
Note: See TracChangeset
for help on using the changeset viewer.