Просмотр исходного кода

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 13 лет назад
Родитель
Сommit
2435bd47ed
10 измененных файлов: 57 добавлений и 27 удалений
  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 Просмотреть файл

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


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?
ac_cv_my_have_egl="no"
PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])


+ 1
- 1
src/Makefile.am Просмотреть файл

@@ -26,7 +26,7 @@ liblol_a_SOURCES = \
\
image/image.cpp image/image.h image/image-private.h \
image/codec/android-image.cpp \
image/codec/ios-image.mm \
image/codec/ios-image.cpp \
image/codec/sdl-image.cpp \
image/codec/ps3-image.cpp \
image/codec/dummy-image.cpp \


+ 19
- 19
src/dict.cpp Просмотреть файл

@@ -73,16 +73,16 @@ Dict::~Dict()

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
* 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)
{
empty = id;
empty = slotid;
break;
}
else
@@ -104,9 +104,9 @@ int Dict::MakeSlot(char const *name)
}

/* 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++;
data->entities = (Entity **)realloc(data->entities,
@@ -114,32 +114,32 @@ int Dict::MakeSlot(char const *name)
}

data->entities[empty] = NULL;
id = empty;
slotid = empty;
data->nentities++;
}
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--;
}
}

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

@@ -148,15 +148,15 @@ void Dict::RemoveSlot(Entity *entity)
#endif
}

void Dict::SetEntity(int id, Entity *entity)
void Dict::SetEntity(int slotid, Entity *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 */


+ 3
- 3
src/dict.h Просмотреть файл

@@ -30,11 +30,11 @@ public:
~Dict();

int MakeSlot(char const *name);
void RemoveSlot(int id);
void RemoveSlot(int slotid);
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:
DictData *data;


src/image/codec/ios-image.mm → src/image/codec/ios-image.cpp Просмотреть файл

@@ -12,7 +12,7 @@
# include "config.h"
#endif

#if defined __APPLE__ && defined __MACH__
#if defined __APPLE__ && defined __MACH__ && defined __arm__

#include <cmath>
#import <UIKit/UIKit.h>
@@ -97,5 +97,5 @@ void * IosImageData::GetData() const

} /* namespace lol */

#endif /* defined __APPLE__ && defined __MACH__ */
#endif /* defined __APPLE__ && defined __MACH__ && defined __arm__ */


+ 1
- 1
src/image/image.cpp Просмотреть файл

@@ -28,7 +28,7 @@ bool ImageLoader::RegisterAllLoaders()
REGISTER_IMAGE_LOADER(AndroidImageData)
#endif
REGISTER_IMAGE_LOADER(DummyImageData)
#if defined __APPLE__ && defined __MACH__
#if defined __APPLE__ && defined __MACH__ && defined __arm__
REGISTER_IMAGE_LOADER(IosImageData)
#endif
#if defined __CELLOS_LV2__


+ 4
- 0
test/benchsuite.cpp Просмотреть файл

@@ -14,6 +14,10 @@

#include <cstdio>

#if USE_SDL
# include <SDL_main.h>
#endif

#include "core.h"

using namespace std;


+ 4
- 0
test/debug/quad.cpp Просмотреть файл

@@ -28,6 +28,10 @@ using namespace lol;
# include "platform/sdl/sdlinput.h"
#endif

#if USE_SDL
# include <SDL_main.h>
#endif

#if defined _WIN32
# undef main /* FIXME: still needed? */
#endif


+ 4
- 0
test/debug/sandbox.cpp Просмотреть файл

@@ -12,6 +12,10 @@
# include "config.h"
#endif

#if USE_SDL
# include <SDL_main.h>
#endif

#include "core.h"

using namespace std;


+ 5
- 1
test/testsuite.cpp Просмотреть файл

@@ -15,9 +15,13 @@
#include <cstdio>
#include <cstdlib>

#if USE_SDL
# include <SDL_main.h>
#endif

#include <lol/unit.h>

int main(void)
int main(int argc, char **argv)
{
lol::TextTestRunner runner;
bool success = runner.Run();


Загрузка…
Отмена
Сохранить