File Makefile changed (mode: 100644) (index 81629dc..cbf1cb9) |
... |
... |
libSDL2.a: $(SDL2_DIR) |
118 |
118 |
cp $(SDL2_DIR)/build/build/.libs/libSDL2.a $@ |
cp $(SDL2_DIR)/build/build/.libs/libSDL2.a $@ |
119 |
119 |
touch $@ |
touch $@ |
120 |
120 |
|
|
121 |
|
$(PROGRAM)-mac: libs-mac.o SDL2.framework $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES) |
|
|
121 |
|
# Mac builds currently link boost::filesystem regardless of C++ standard version. The assumption on Mac is c++1z |
|
122 |
|
$(PROGRAM)-mac: libs-mac.o SDL2.framework libboost_filesystem.a $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES) |
122 |
123 |
# Building Steam version for Mac. |
# Building Steam version for Mac. |
123 |
124 |
$(MACCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -D__STEAM__ -o $@ $(PROGRAM).cpp libs-mac.o $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) \ |
$(MACCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -D__STEAM__ -o $@ $(PROGRAM).cpp libs-mac.o $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) \ |
124 |
|
-F. -L. -Wl,-rpath,"." -framework SDL2 -ldl -pthread -lsteam_api |
|
|
125 |
|
-F. -L. -Wl,-rpath,"." -framework SDL2 -ldl -pthread -lboost_filesystem -lsteam_api |
125 |
126 |
|
|
126 |
|
$(PROGRAM_DRMFREE)-mac: libs-mac.o SDL2.framework $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES) |
|
|
127 |
|
$(PROGRAM_DRMFREE)-mac: libs-mac.o SDL2.framework libboost_filesystem.a $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES) |
127 |
128 |
# Building DRM-free version for Mac. |
# Building DRM-free version for Mac. |
128 |
129 |
$(MACCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -o $@ $(PROGRAM).cpp libs-mac.o $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) \ |
$(MACCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -o $@ $(PROGRAM).cpp libs-mac.o $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) \ |
129 |
|
-F. -L. -Wl,-rpath,"." -framework SDL2 -ldl -pthread |
|
|
130 |
|
-F. -L. -Wl,-rpath,"." -framework SDL2 -ldl -pthread -lboost_filesystem |
130 |
131 |
|
|
131 |
132 |
libs-mac.o: libs.cpp micropather.cpp include/tm_json.h $(BOOST_DIR) |
libs-mac.o: libs.cpp micropather.cpp include/tm_json.h $(BOOST_DIR) |
132 |
133 |
$(MACCXX) $(CXXFLAGS) -O3 -o $@ libs.cpp -c |
$(MACCXX) $(CXXFLAGS) -O3 -o $@ libs.cpp -c |
|
... |
... |
libboost_system.a: $(BOOST_DIR) |
220 |
221 |
cp $(BOOST_DIR)/stage/lib/$@ . |
cp $(BOOST_DIR)/stage/lib/$@ . |
221 |
222 |
touch $@ |
touch $@ |
222 |
223 |
|
|
|
224 |
|
libboost_filesystem.a: $(BOOST_DIR) |
|
225 |
|
# POSIX target |
|
226 |
|
cd $(BOOST_DIR) && ./b2 --with-filesystem cxxflags="-std=$(CXXSTD)" release |
|
227 |
|
cp $(BOOST_DIR)/stage/lib/$@ . |
|
228 |
|
touch $@ |
|
229 |
|
|
223 |
230 |
libboost_system-win.a: $(BOOST_DIR) |
libboost_system-win.a: $(BOOST_DIR) |
224 |
231 |
# Windows target |
# Windows target |
225 |
232 |
# https://stackoverflow.com/questions/5411282#11907834 |
# https://stackoverflow.com/questions/5411282#11907834 |
File confec.cpp changed (mode: 100644) (index 44006b9..40bd058) |
... |
... |
FILE *FileOpen( const char* filename, const char* modes ); |
116 |
116 |
|
|
117 |
117 |
#include <algorithm> |
#include <algorithm> |
118 |
118 |
#include <exception> |
#include <exception> |
119 |
|
#include <filesystem> |
|
120 |
119 |
#include <limits> |
#include <limits> |
121 |
120 |
#include <map> |
#include <map> |
122 |
121 |
#include <random> |
#include <random> |
123 |
122 |
#include <string> |
#include <string> |
124 |
123 |
#include <vector> |
#include <vector> |
125 |
124 |
|
|
|
125 |
|
// Use C++17 std::filesystem where available, or fall back to boost::filesystem. |
|
126 |
|
#if __cplusplus >= 201703L |
|
127 |
|
#include <filesystem> |
|
128 |
|
namespace filesystem = std::filesystem; |
|
129 |
|
#else |
|
130 |
|
#include <boost/filesystem.hpp> |
|
131 |
|
namespace filesystem = boost::filesystem; |
|
132 |
|
#endif |
|
133 |
|
|
126 |
134 |
#define DBL_INF std::numeric_limits<double>::infinity() |
#define DBL_INF std::numeric_limits<double>::infinity() |
127 |
135 |
|
|
128 |
136 |
double lerp( double a, double b, double f ){ |
double lerp( double a, double b, double f ){ |
|
... |
... |
struct SpecialItem { |
455 |
463 |
int32_t special_item_result = 0; |
int32_t special_item_result = 0; |
456 |
464 |
|
|
457 |
465 |
// App variable definitions. |
// App variable definitions. |
458 |
|
std::string app_version = "v0.5.0"; |
|
|
466 |
|
std::string app_version = "v0.6.0"; |
459 |
467 |
#ifdef __DEMO__ |
#ifdef __DEMO__ |
460 |
468 |
app_version += " demo"; |
app_version += " demo"; |
461 |
469 |
std::string app_name = "Confectioner Engine Demo"; |
std::string app_name = "Confectioner Engine Demo"; |
|
... |
... |
int main( int argc, char* argv[] ){ |
1238 |
1246 |
for( std::string &path : search_paths ){ |
for( std::string &path : search_paths ){ |
1239 |
1247 |
std::string dir_check = |
std::string dir_check = |
1240 |
1248 |
path + ( is_foreground ? "/fg/" : "/bg/" ) + dir_name; |
path + ( is_foreground ? "/fg/" : "/bg/" ) + dir_name; |
1241 |
|
std::filesystem::path fspath{ dir_check }; |
|
|
1249 |
|
filesystem::path fspath{ dir_check }; |
1242 |
1250 |
try{ |
try{ |
1243 |
|
for( const auto &entry : std::filesystem::directory_iterator{ fspath } ){ |
|
|
1251 |
|
for( const auto &entry : filesystem::directory_iterator{ fspath } ){ |
1244 |
1252 |
if( entry.is_regular_file() ){ |
if( entry.is_regular_file() ){ |
1245 |
1253 |
auto ext = entry.path().extension(); |
auto ext = entry.path().extension(); |
1246 |
1254 |
if( ext == ".png" || ext == ".PNG" |
if( ext == ".png" || ext == ".PNG" |