to ios-image.cpp, but disable it on OS X because UIKit isn't available.legacy
| @@ -232,6 +232,20 @@ AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes") | |||||
| AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes") | AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes") | ||||
| dnl Use Cocoa? | |||||
| ac_cv_my_have_cocoa="no" | |||||
| LIBS_save="$LIBS" | |||||
| LIBS="$LIBS -Wl,-framework -Wl,Cocoa" | |||||
| AC_MSG_CHECKING(for -framework Cocoa) | |||||
| AC_TRY_LINK([], [], | |||||
| [ac_cv_my_have_cocoa="yes" | |||||
| AC_MSG_RESULT(yes) | |||||
| CXXFLAGS="${CXXFLAGS} -ObjC++"], | |||||
| [AC_MSG_RESULT(no)]) | |||||
| LIBS="$LIBS_save" | |||||
| AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" != "no") | |||||
| dnl Use EGL? | dnl Use EGL? | ||||
| ac_cv_my_have_egl="no" | ac_cv_my_have_egl="no" | ||||
| PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:]) | PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:]) | ||||
| @@ -26,7 +26,7 @@ liblol_a_SOURCES = \ | |||||
| \ | \ | ||||
| image/image.cpp image/image.h image/image-private.h \ | image/image.cpp image/image.h image/image-private.h \ | ||||
| image/codec/android-image.cpp \ | image/codec/android-image.cpp \ | ||||
| image/codec/ios-image.mm \ | |||||
| image/codec/ios-image.cpp \ | |||||
| image/codec/sdl-image.cpp \ | image/codec/sdl-image.cpp \ | ||||
| image/codec/ps3-image.cpp \ | image/codec/ps3-image.cpp \ | ||||
| image/codec/dummy-image.cpp \ | image/codec/dummy-image.cpp \ | ||||
| @@ -73,16 +73,16 @@ Dict::~Dict() | |||||
| int Dict::MakeSlot(char const *name) | int Dict::MakeSlot(char const *name) | ||||
| { | { | ||||
| int id, empty = -1; | |||||
| int slotid, empty = -1; | |||||
| /* If the entry is already registered, remember its ID. Look for an | /* If the entry is already registered, remember its ID. Look for an | ||||
| * empty slot at the same time. */ | * empty slot at the same time. */ | ||||
| for (id = 0; id < data->maxid; id++) | |||||
| for (slotid = 0; slotid < data->maxid; slotid++) | |||||
| { | { | ||||
| Entity *e = data->entities[id]; | |||||
| Entity *e = data->entities[slotid]; | |||||
| if (!e) | if (!e) | ||||
| { | { | ||||
| empty = id; | |||||
| empty = slotid; | |||||
| break; | break; | ||||
| } | } | ||||
| else | else | ||||
| @@ -104,9 +104,9 @@ int Dict::MakeSlot(char const *name) | |||||
| } | } | ||||
| /* If this is a new entry, create a new slot for it. */ | /* If this is a new entry, create a new slot for it. */ | ||||
| if (id == data->maxid || !data->entities[id]) | |||||
| if (slotid == data->maxid || !data->entities[slotid]) | |||||
| { | { | ||||
| if (id == data->maxid) | |||||
| if (slotid == data->maxid) | |||||
| { | { | ||||
| empty = data->maxid++; | empty = data->maxid++; | ||||
| data->entities = (Entity **)realloc(data->entities, | data->entities = (Entity **)realloc(data->entities, | ||||
| @@ -114,32 +114,32 @@ int Dict::MakeSlot(char const *name) | |||||
| } | } | ||||
| data->entities[empty] = NULL; | data->entities[empty] = NULL; | ||||
| id = empty; | |||||
| slotid = empty; | |||||
| data->nentities++; | data->nentities++; | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| Ticker::Ref(data->entities[id]); | |||||
| Ticker::Ref(data->entities[slotid]); | |||||
| } | } | ||||
| return id; | |||||
| return slotid; | |||||
| } | } | ||||
| void Dict::RemoveSlot(int id) | |||||
| void Dict::RemoveSlot(int slotid) | |||||
| { | { | ||||
| if (Ticker::Unref(data->entities[id]) == 0) | |||||
| if (Ticker::Unref(data->entities[slotid]) == 0) | |||||
| { | { | ||||
| data->entities[id] = NULL; | |||||
| data->entities[slotid] = NULL; | |||||
| data->nentities--; | data->nentities--; | ||||
| } | } | ||||
| } | } | ||||
| void Dict::RemoveSlot(Entity *entity) | void Dict::RemoveSlot(Entity *entity) | ||||
| { | { | ||||
| for (int id = 0; id < data->maxid; id++) | |||||
| if (data->entities[id] == entity) | |||||
| for (int slotid = 0; slotid < data->maxid; slotid++) | |||||
| if (data->entities[slotid] == entity) | |||||
| { | { | ||||
| RemoveSlot(id); | |||||
| RemoveSlot(slotid); | |||||
| return; | return; | ||||
| } | } | ||||
| @@ -148,15 +148,15 @@ void Dict::RemoveSlot(Entity *entity) | |||||
| #endif | #endif | ||||
| } | } | ||||
| void Dict::SetEntity(int id, Entity *entity) | |||||
| void Dict::SetEntity(int slotid, Entity *entity) | |||||
| { | { | ||||
| Ticker::Ref(entity); | Ticker::Ref(entity); | ||||
| data->entities[id] = entity; | |||||
| data->entities[slotid] = entity; | |||||
| } | } | ||||
| Entity *Dict::GetEntity(int id) | |||||
| Entity *Dict::GetEntity(int slotid) | |||||
| { | { | ||||
| return data->entities[id]; | |||||
| return data->entities[slotid]; | |||||
| } | } | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -30,11 +30,11 @@ public: | |||||
| ~Dict(); | ~Dict(); | ||||
| int MakeSlot(char const *name); | int MakeSlot(char const *name); | ||||
| void RemoveSlot(int id); | |||||
| void RemoveSlot(int slotid); | |||||
| void RemoveSlot(Entity *entity); | void RemoveSlot(Entity *entity); | ||||
| void SetEntity(int id, Entity *entity); | |||||
| Entity *GetEntity(int id); | |||||
| void SetEntity(int slotid, Entity *entity); | |||||
| Entity *GetEntity(int slotid); | |||||
| private: | private: | ||||
| DictData *data; | DictData *data; | ||||
| @@ -12,7 +12,7 @@ | |||||
| # include "config.h" | # include "config.h" | ||||
| #endif | #endif | ||||
| #if defined __APPLE__ && defined __MACH__ | |||||
| #if defined __APPLE__ && defined __MACH__ && defined __arm__ | |||||
| #include <cmath> | #include <cmath> | ||||
| #import <UIKit/UIKit.h> | #import <UIKit/UIKit.h> | ||||
| @@ -97,5 +97,5 @@ void * IosImageData::GetData() const | |||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| #endif /* defined __APPLE__ && defined __MACH__ */ | |||||
| #endif /* defined __APPLE__ && defined __MACH__ && defined __arm__ */ | |||||
| @@ -28,7 +28,7 @@ bool ImageLoader::RegisterAllLoaders() | |||||
| REGISTER_IMAGE_LOADER(AndroidImageData) | REGISTER_IMAGE_LOADER(AndroidImageData) | ||||
| #endif | #endif | ||||
| REGISTER_IMAGE_LOADER(DummyImageData) | REGISTER_IMAGE_LOADER(DummyImageData) | ||||
| #if defined __APPLE__ && defined __MACH__ | |||||
| #if defined __APPLE__ && defined __MACH__ && defined __arm__ | |||||
| REGISTER_IMAGE_LOADER(IosImageData) | REGISTER_IMAGE_LOADER(IosImageData) | ||||
| #endif | #endif | ||||
| #if defined __CELLOS_LV2__ | #if defined __CELLOS_LV2__ | ||||
| @@ -14,6 +14,10 @@ | |||||
| #include <cstdio> | #include <cstdio> | ||||
| #if USE_SDL | |||||
| # include <SDL_main.h> | |||||
| #endif | |||||
| #include "core.h" | #include "core.h" | ||||
| using namespace std; | using namespace std; | ||||
| @@ -28,6 +28,10 @@ using namespace lol; | |||||
| # include "platform/sdl/sdlinput.h" | # include "platform/sdl/sdlinput.h" | ||||
| #endif | #endif | ||||
| #if USE_SDL | |||||
| # include <SDL_main.h> | |||||
| #endif | |||||
| #if defined _WIN32 | #if defined _WIN32 | ||||
| # undef main /* FIXME: still needed? */ | # undef main /* FIXME: still needed? */ | ||||
| #endif | #endif | ||||
| @@ -12,6 +12,10 @@ | |||||
| # include "config.h" | # include "config.h" | ||||
| #endif | #endif | ||||
| #if USE_SDL | |||||
| # include <SDL_main.h> | |||||
| #endif | |||||
| #include "core.h" | #include "core.h" | ||||
| using namespace std; | using namespace std; | ||||
| @@ -15,9 +15,13 @@ | |||||
| #include <cstdio> | #include <cstdio> | ||||
| #include <cstdlib> | #include <cstdlib> | ||||
| #if USE_SDL | |||||
| # include <SDL_main.h> | |||||
| #endif | |||||
| #include <lol/unit.h> | #include <lol/unit.h> | ||||
| int main(void) | |||||
| int main(int argc, char **argv) | |||||
| { | { | ||||
| lol::TextTestRunner runner; | lol::TextTestRunner runner; | ||||
| bool success = runner.Run(); | bool success = runner.Run(); | ||||