Quellcode durchsuchen

osx: automake does not support .mm files yet, so rename ios-image.mm back

to ios-image.cpp, but disable it on OS X because UIKit isn't available.
legacy
Sam Hocevar sam vor 13 Jahren
Ursprung
Commit
2435bd47ed
10 geänderte Dateien mit 57 neuen und 27 gelöschten Zeilen
  1. +14
    -0
      configure.ac
  2. +1
    -1
      src/Makefile.am
  3. +19
    -19
      src/dict.cpp
  4. +3
    -3
      src/dict.h
  5. +2
    -2
      src/image/codec/ios-image.cpp
  6. +1
    -1
      src/image/image.cpp
  7. +4
    -0
      test/benchsuite.cpp
  8. +4
    -0
      test/debug/quad.cpp
  9. +4
    -0
      test/debug/sandbox.cpp
  10. +5
    -1
      test/testsuite.cpp

+ 14
- 0
configure.ac Datei anzeigen

@@ -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"], [:])


+ 1
- 1
src/Makefile.am Datei anzeigen

@@ -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 \


+ 19
- 19
src/dict.cpp Datei anzeigen

@@ -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 */


+ 3
- 3
src/dict.h Datei anzeigen

@@ -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;


src/image/codec/ios-image.mm → src/image/codec/ios-image.cpp Datei anzeigen

@@ -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__ */



+ 1
- 1
src/image/image.cpp Datei anzeigen

@@ -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__


+ 4
- 0
test/benchsuite.cpp Datei anzeigen

@@ -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;


+ 4
- 0
test/debug/quad.cpp Datei anzeigen

@@ -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


+ 4
- 0
test/debug/sandbox.cpp Datei anzeigen

@@ -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;


+ 5
- 1
test/testsuite.cpp Datei anzeigen

@@ -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();


Laden…
Abbrechen
Speichern