diff --git a/alienblaster/Application.mk b/alienblaster/Application.mk index 8617f67fc..9253a501d 100644 --- a/alienblaster/Application.mk +++ b/alienblaster/Application.mk @@ -1,2 +1,2 @@ APP_PROJECT_PATH := $(call my-dir)/project -APP_MODULES := stlport sdl alienblaster sdl_mixer tremor +APP_MODULES := application stlport sdl sdl_mixer tremor diff --git a/alienblaster/project/jni/Android.mk b/alienblaster/project/jni/Android.mk index dbb9a92f1..c14cba715 100644 --- a/alienblaster/project/jni/Android.mk +++ b/alienblaster/project/jni/Android.mk @@ -14,6 +14,6 @@ SDL_CURDIR_PATH := /data/data/de.schwardtnet.alienblaster/files # this will make Up/Down/Left/Right key up events with X frames delay, # so if application expects you to press and hold button it will process the event correctly. # TODO: create a libsdl config file for that option and for key mapping/on-screen keyboard -SDL_TRACKBALL_KEYUP_DELAY := 4 +SDL_TRACKBALL_KEYUP_DELAY := 0 include $(call all-subdir-makefiles) diff --git a/alienblaster/project/jni/alienblaster/Android.mk b/alienblaster/project/jni/alienblaster/Android.mk deleted file mode 100644 index 054eebc13..000000000 --- a/alienblaster/project/jni/alienblaster/Android.mk +++ /dev/null @@ -1,29 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := alienblaster - -CG_SUBDIRS := \ -src \ - -# Add more subdirs here, like src/subdir1 src/subdir2 - -LOCAL_CFLAGS := $(foreach D, $(CG_SUBDIRS), -I$(CG_SRCDIR)/$(D)) \ - -I$(LOCAL_PATH)/../sdl/include \ - -I$(LOCAL_PATH)/../sdl_mixer \ - -I$(LOCAL_PATH)/../stlport/stlport \ - -#Change C++ file extension as appropriate -LOCAL_CPP_EXTENSION := .cc - -LOCAL_SRC_FILES := $(foreach F, $(CG_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.cc)))) -# Uncomment to also add C sources -LOCAL_SRC_FILES += $(foreach F, $(CG_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c)))) - -LOCAL_STATIC_LIBRARIES := sdl_mixer sdl tremor stlport - -LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog - -include $(BUILD_SHARED_LIBRARY) - diff --git a/alienblaster/project/jni/application/Android.mk b/alienblaster/project/jni/application/Android.mk new file mode 100644 index 000000000..87757d134 --- /dev/null +++ b/alienblaster/project/jni/application/Android.mk @@ -0,0 +1,31 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := application + +APP_SUBDIRS := $(patsubst $(LOCAL_PATH)/%, %, $(shell find $(LOCAL_PATH)/src -type d)) + +# Add more subdirs here, like src/subdir1 src/subdir2 + +LOCAL_CFLAGS := -DSDL_JAVA_PACKAGE_PATH=$(SDL_JAVA_PACKAGE_PATH) \ + -DSDL_CURDIR_PATH=\"$(SDL_CURDIR_PATH)\" \ + $(foreach D, $(APP_SUBDIRS), -I$(LOCAL_PATH)/$(D)) \ + -I$(LOCAL_PATH)/../sdl/include \ + -I$(LOCAL_PATH)/../sdl_mixer \ + -I$(LOCAL_PATH)/../stlport/stlport \ + + +#Change C++ file extension as appropriate +LOCAL_CPP_EXTENSION := .cpp + +LOCAL_SRC_FILES := $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.cpp)))) +# Uncomment to also add C sources +LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c)))) + +LOCAL_SHARED_LIBRARIES := sdl sdl_mixer tremor stlport + +LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog + +include $(BUILD_SHARED_LIBRARY) + diff --git a/alienblaster/project/jni/alienblaster/src/Makefile b/alienblaster/project/jni/application/src/Makefile similarity index 100% rename from alienblaster/project/jni/alienblaster/src/Makefile rename to alienblaster/project/jni/application/src/Makefile diff --git a/alienblaster/project/jni/alienblaster/src/Makefile.dep b/alienblaster/project/jni/application/src/Makefile.dep similarity index 100% rename from alienblaster/project/jni/alienblaster/src/Makefile.dep rename to alienblaster/project/jni/application/src/Makefile.dep diff --git a/alienblaster/project/jni/alienblaster/src/asstring.h b/alienblaster/project/jni/application/src/asstring.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/asstring.h rename to alienblaster/project/jni/application/src/asstring.h diff --git a/alienblaster/project/jni/alienblaster/src/background.cc b/alienblaster/project/jni/application/src/background.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/background.cc rename to alienblaster/project/jni/application/src/background.cpp diff --git a/alienblaster/project/jni/alienblaster/src/background.h b/alienblaster/project/jni/application/src/background.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/background.h rename to alienblaster/project/jni/application/src/background.h diff --git a/alienblaster/project/jni/alienblaster/src/banner.cc b/alienblaster/project/jni/application/src/banner.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/banner.cc rename to alienblaster/project/jni/application/src/banner.cpp diff --git a/alienblaster/project/jni/alienblaster/src/banner.h b/alienblaster/project/jni/application/src/banner.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/banner.h rename to alienblaster/project/jni/application/src/banner.h diff --git a/alienblaster/project/jni/alienblaster/src/banners.cc b/alienblaster/project/jni/application/src/banners.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/banners.cc rename to alienblaster/project/jni/application/src/banners.cpp diff --git a/alienblaster/project/jni/alienblaster/src/banners.h b/alienblaster/project/jni/application/src/banners.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/banners.h rename to alienblaster/project/jni/application/src/banners.h diff --git a/alienblaster/project/jni/alienblaster/src/boundingBox.cc b/alienblaster/project/jni/application/src/boundingBox.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/boundingBox.cc rename to alienblaster/project/jni/application/src/boundingBox.cpp diff --git a/alienblaster/project/jni/alienblaster/src/boundingBox.h b/alienblaster/project/jni/application/src/boundingBox.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/boundingBox.h rename to alienblaster/project/jni/application/src/boundingBox.h diff --git a/alienblaster/project/jni/alienblaster/src/enemy.cc b/alienblaster/project/jni/application/src/enemy.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/enemy.cc rename to alienblaster/project/jni/application/src/enemy.cpp diff --git a/alienblaster/project/jni/alienblaster/src/enemy.h b/alienblaster/project/jni/application/src/enemy.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/enemy.h rename to alienblaster/project/jni/application/src/enemy.h diff --git a/alienblaster/project/jni/alienblaster/src/enemys.cc b/alienblaster/project/jni/application/src/enemys.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/enemys.cc rename to alienblaster/project/jni/application/src/enemys.cpp diff --git a/alienblaster/project/jni/alienblaster/src/enemys.h b/alienblaster/project/jni/application/src/enemys.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/enemys.h rename to alienblaster/project/jni/application/src/enemys.h diff --git a/alienblaster/project/jni/alienblaster/src/explosion.cc b/alienblaster/project/jni/application/src/explosion.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/explosion.cc rename to alienblaster/project/jni/application/src/explosion.cpp diff --git a/alienblaster/project/jni/alienblaster/src/explosion.h b/alienblaster/project/jni/application/src/explosion.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/explosion.h rename to alienblaster/project/jni/application/src/explosion.h diff --git a/alienblaster/project/jni/alienblaster/src/explosions.cc b/alienblaster/project/jni/application/src/explosions.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/explosions.cc rename to alienblaster/project/jni/application/src/explosions.cpp diff --git a/alienblaster/project/jni/alienblaster/src/explosions.h b/alienblaster/project/jni/application/src/explosions.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/explosions.h rename to alienblaster/project/jni/application/src/explosions.h diff --git a/alienblaster/project/jni/alienblaster/src/font.cc b/alienblaster/project/jni/application/src/font.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/font.cc rename to alienblaster/project/jni/application/src/font.cpp diff --git a/alienblaster/project/jni/alienblaster/src/font.h b/alienblaster/project/jni/application/src/font.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/font.h rename to alienblaster/project/jni/application/src/font.h diff --git a/alienblaster/project/jni/alienblaster/src/formation.cc b/alienblaster/project/jni/application/src/formation.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/formation.cc rename to alienblaster/project/jni/application/src/formation.cpp diff --git a/alienblaster/project/jni/alienblaster/src/formation.h b/alienblaster/project/jni/application/src/formation.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/formation.h rename to alienblaster/project/jni/application/src/formation.h diff --git a/alienblaster/project/jni/alienblaster/src/game.cc b/alienblaster/project/jni/application/src/game.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/game.cc rename to alienblaster/project/jni/application/src/game.cpp diff --git a/alienblaster/project/jni/alienblaster/src/game.h b/alienblaster/project/jni/application/src/game.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/game.h rename to alienblaster/project/jni/application/src/game.h diff --git a/alienblaster/project/jni/alienblaster/src/geometry.cc b/alienblaster/project/jni/application/src/geometry.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/geometry.cc rename to alienblaster/project/jni/application/src/geometry.cpp diff --git a/alienblaster/project/jni/alienblaster/src/geometry.h b/alienblaster/project/jni/application/src/geometry.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/geometry.h rename to alienblaster/project/jni/application/src/geometry.h diff --git a/alienblaster/project/jni/alienblaster/src/global.cc b/alienblaster/project/jni/application/src/global.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/global.cc rename to alienblaster/project/jni/application/src/global.cpp diff --git a/alienblaster/project/jni/alienblaster/src/global.h b/alienblaster/project/jni/application/src/global.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/global.h rename to alienblaster/project/jni/application/src/global.h diff --git a/alienblaster/project/jni/alienblaster/src/gpl.txt b/alienblaster/project/jni/application/src/gpl.txt similarity index 100% rename from alienblaster/project/jni/alienblaster/src/gpl.txt rename to alienblaster/project/jni/application/src/gpl.txt diff --git a/alienblaster/project/jni/alienblaster/src/infoscreen.cc b/alienblaster/project/jni/application/src/infoscreen.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/infoscreen.cc rename to alienblaster/project/jni/application/src/infoscreen.cpp diff --git a/alienblaster/project/jni/alienblaster/src/infoscreen.h b/alienblaster/project/jni/application/src/infoscreen.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/infoscreen.h rename to alienblaster/project/jni/application/src/infoscreen.h diff --git a/alienblaster/project/jni/alienblaster/src/input.cc b/alienblaster/project/jni/application/src/input.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/input.cc rename to alienblaster/project/jni/application/src/input.cpp diff --git a/alienblaster/project/jni/alienblaster/src/input.h b/alienblaster/project/jni/application/src/input.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/input.h rename to alienblaster/project/jni/application/src/input.h diff --git a/alienblaster/project/jni/alienblaster/src/intro.cc b/alienblaster/project/jni/application/src/intro.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/intro.cc rename to alienblaster/project/jni/application/src/intro.cpp diff --git a/alienblaster/project/jni/alienblaster/src/intro.h b/alienblaster/project/jni/application/src/intro.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/intro.h rename to alienblaster/project/jni/application/src/intro.h diff --git a/alienblaster/project/jni/alienblaster/src/item.cc b/alienblaster/project/jni/application/src/item.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/item.cc rename to alienblaster/project/jni/application/src/item.cpp diff --git a/alienblaster/project/jni/alienblaster/src/item.h b/alienblaster/project/jni/application/src/item.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/item.h rename to alienblaster/project/jni/application/src/item.h diff --git a/alienblaster/project/jni/alienblaster/src/items.cc b/alienblaster/project/jni/application/src/items.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/items.cc rename to alienblaster/project/jni/application/src/items.cpp diff --git a/alienblaster/project/jni/alienblaster/src/items.h b/alienblaster/project/jni/application/src/items.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/items.h rename to alienblaster/project/jni/application/src/items.h diff --git a/alienblaster/project/jni/alienblaster/src/main.cc b/alienblaster/project/jni/application/src/main.cpp similarity index 98% rename from alienblaster/project/jni/alienblaster/src/main.cc rename to alienblaster/project/jni/application/src/main.cpp index 347188e9c..bd1b449b6 100644 --- a/alienblaster/project/jni/alienblaster/src/main.cc +++ b/alienblaster/project/jni/application/src/main.cpp @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ***************************************************************************/ +#include "SDL_main.h" #include "game.h" #include "SDL.h" #include diff --git a/alienblaster/project/jni/alienblaster/src/menuArcadeMode.cc b/alienblaster/project/jni/application/src/menuArcadeMode.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/menuArcadeMode.cc rename to alienblaster/project/jni/application/src/menuArcadeMode.cpp diff --git a/alienblaster/project/jni/alienblaster/src/menuArcadeMode.h b/alienblaster/project/jni/application/src/menuArcadeMode.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/menuArcadeMode.h rename to alienblaster/project/jni/application/src/menuArcadeMode.h diff --git a/alienblaster/project/jni/alienblaster/src/mixer.cc b/alienblaster/project/jni/application/src/mixer.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/mixer.cc rename to alienblaster/project/jni/application/src/mixer.cpp diff --git a/alienblaster/project/jni/alienblaster/src/mixer.h b/alienblaster/project/jni/application/src/mixer.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/mixer.h rename to alienblaster/project/jni/application/src/mixer.h diff --git a/alienblaster/project/jni/alienblaster/src/options.cc b/alienblaster/project/jni/application/src/options.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/options.cc rename to alienblaster/project/jni/application/src/options.cpp diff --git a/alienblaster/project/jni/alienblaster/src/options.h b/alienblaster/project/jni/application/src/options.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/options.h rename to alienblaster/project/jni/application/src/options.h diff --git a/alienblaster/project/jni/alienblaster/src/racer.cc b/alienblaster/project/jni/application/src/racer.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/racer.cc rename to alienblaster/project/jni/application/src/racer.cpp diff --git a/alienblaster/project/jni/alienblaster/src/racer.h b/alienblaster/project/jni/application/src/racer.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/racer.h rename to alienblaster/project/jni/application/src/racer.h diff --git a/alienblaster/project/jni/alienblaster/src/racers.cc b/alienblaster/project/jni/application/src/racers.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/racers.cc rename to alienblaster/project/jni/application/src/racers.cpp diff --git a/alienblaster/project/jni/alienblaster/src/racers.h b/alienblaster/project/jni/application/src/racers.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/racers.h rename to alienblaster/project/jni/application/src/racers.h diff --git a/alienblaster/project/jni/alienblaster/src/setDifficulty.cc b/alienblaster/project/jni/application/src/setDifficulty.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/setDifficulty.cc rename to alienblaster/project/jni/application/src/setDifficulty.cpp diff --git a/alienblaster/project/jni/alienblaster/src/setDifficulty.h b/alienblaster/project/jni/application/src/setDifficulty.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/setDifficulty.h rename to alienblaster/project/jni/application/src/setDifficulty.h diff --git a/alienblaster/project/jni/alienblaster/src/settings.cc b/alienblaster/project/jni/application/src/settings.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/settings.cc rename to alienblaster/project/jni/application/src/settings.cpp diff --git a/alienblaster/project/jni/alienblaster/src/settings.h b/alienblaster/project/jni/application/src/settings.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/settings.h rename to alienblaster/project/jni/application/src/settings.h diff --git a/alienblaster/project/jni/alienblaster/src/shieldGlow.cc b/alienblaster/project/jni/application/src/shieldGlow.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/shieldGlow.cc rename to alienblaster/project/jni/application/src/shieldGlow.cpp diff --git a/alienblaster/project/jni/alienblaster/src/shieldGlow.h b/alienblaster/project/jni/application/src/shieldGlow.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/shieldGlow.h rename to alienblaster/project/jni/application/src/shieldGlow.h diff --git a/alienblaster/project/jni/alienblaster/src/shot.cc b/alienblaster/project/jni/application/src/shot.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/shot.cc rename to alienblaster/project/jni/application/src/shot.cpp diff --git a/alienblaster/project/jni/alienblaster/src/shot.h b/alienblaster/project/jni/application/src/shot.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/shot.h rename to alienblaster/project/jni/application/src/shot.h diff --git a/alienblaster/project/jni/alienblaster/src/shots.cc b/alienblaster/project/jni/application/src/shots.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/shots.cc rename to alienblaster/project/jni/application/src/shots.cpp diff --git a/alienblaster/project/jni/alienblaster/src/shots.h b/alienblaster/project/jni/application/src/shots.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/shots.h rename to alienblaster/project/jni/application/src/shots.h diff --git a/alienblaster/project/jni/alienblaster/src/smokePuff.cc b/alienblaster/project/jni/application/src/smokePuff.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/smokePuff.cc rename to alienblaster/project/jni/application/src/smokePuff.cpp diff --git a/alienblaster/project/jni/alienblaster/src/smokePuff.h b/alienblaster/project/jni/application/src/smokePuff.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/smokePuff.h rename to alienblaster/project/jni/application/src/smokePuff.h diff --git a/alienblaster/project/jni/alienblaster/src/smokePuffs.cc b/alienblaster/project/jni/application/src/smokePuffs.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/smokePuffs.cc rename to alienblaster/project/jni/application/src/smokePuffs.cpp diff --git a/alienblaster/project/jni/alienblaster/src/smokePuffs.h b/alienblaster/project/jni/application/src/smokePuffs.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/smokePuffs.h rename to alienblaster/project/jni/application/src/smokePuffs.h diff --git a/alienblaster/project/jni/alienblaster/src/sonic.cc b/alienblaster/project/jni/application/src/sonic.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/sonic.cc rename to alienblaster/project/jni/application/src/sonic.cpp diff --git a/alienblaster/project/jni/alienblaster/src/sonic.h b/alienblaster/project/jni/application/src/sonic.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/sonic.h rename to alienblaster/project/jni/application/src/sonic.h diff --git a/alienblaster/project/jni/alienblaster/src/soundDB.cc b/alienblaster/project/jni/application/src/soundDB.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/soundDB.cc rename to alienblaster/project/jni/application/src/soundDB.cpp diff --git a/alienblaster/project/jni/alienblaster/src/soundDB.h b/alienblaster/project/jni/application/src/soundDB.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/soundDB.h rename to alienblaster/project/jni/application/src/soundDB.h diff --git a/alienblaster/project/jni/alienblaster/src/surfaceDB.cc b/alienblaster/project/jni/application/src/surfaceDB.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/surfaceDB.cc rename to alienblaster/project/jni/application/src/surfaceDB.cpp diff --git a/alienblaster/project/jni/alienblaster/src/surfaceDB.h b/alienblaster/project/jni/application/src/surfaceDB.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/surfaceDB.h rename to alienblaster/project/jni/application/src/surfaceDB.h diff --git a/alienblaster/project/jni/alienblaster/src/video.cc b/alienblaster/project/jni/application/src/video.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/video.cc rename to alienblaster/project/jni/application/src/video.cpp diff --git a/alienblaster/project/jni/alienblaster/src/video.h b/alienblaster/project/jni/application/src/video.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/video.h rename to alienblaster/project/jni/application/src/video.h diff --git a/alienblaster/project/jni/alienblaster/src/wreck.cc b/alienblaster/project/jni/application/src/wreck.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/wreck.cc rename to alienblaster/project/jni/application/src/wreck.cpp diff --git a/alienblaster/project/jni/alienblaster/src/wreck.h b/alienblaster/project/jni/application/src/wreck.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/wreck.h rename to alienblaster/project/jni/application/src/wreck.h diff --git a/alienblaster/project/jni/alienblaster/src/wrecks.cc b/alienblaster/project/jni/application/src/wrecks.cpp similarity index 100% rename from alienblaster/project/jni/alienblaster/src/wrecks.cc rename to alienblaster/project/jni/application/src/wrecks.cpp diff --git a/alienblaster/project/jni/alienblaster/src/wrecks.h b/alienblaster/project/jni/application/src/wrecks.h similarity index 100% rename from alienblaster/project/jni/alienblaster/src/wrecks.h rename to alienblaster/project/jni/application/src/wrecks.h diff --git a/alienblaster/project/jni/sdl/Android.mk b/alienblaster/project/jni/sdl/Android.mk index 1373a3024..ecd01a49f 100644 --- a/alienblaster/project/jni/sdl/Android.mk +++ b/alienblaster/project/jni/sdl/Android.mk @@ -41,5 +41,5 @@ LOCAL_SRC_FILES := $(foreach F, $(SDL_SRCS), $(addprefix $(dir $(F)),$(notdir $( LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -include $(BUILD_STATIC_LIBRARY) +include $(BUILD_SHARED_LIBRARY) diff --git a/alienblaster/project/jni/sdl/include/SDL.h b/alienblaster/project/jni/sdl/include/SDL.h index 119ed7ff1..eba39f537 100644 --- a/alienblaster/project/jni/sdl/include/SDL.h +++ b/alienblaster/project/jni/sdl/include/SDL.h @@ -27,7 +27,9 @@ #ifndef _SDL_H #define _SDL_H +#ifndef ANDROID #include "SDL_main.h" +#endif #include "SDL_stdinc.h" #include "SDL_audio.h" #include "SDL_cdrom.h" diff --git a/alienblaster/project/jni/sdl/include/SDL_config_android.h b/alienblaster/project/jni/sdl/include/SDL_config_android.h index 881254917..4407ab21c 100644 --- a/alienblaster/project/jni/sdl/include/SDL_config_android.h +++ b/alienblaster/project/jni/sdl/include/SDL_config_android.h @@ -29,8 +29,7 @@ #include #include -#include // for memmove etc -#include // for bcopy etc +#include #define SDL_AUDIO_DRIVER_ANDROID 1 @@ -52,19 +51,81 @@ #define NO_SDL_GLEXT 1 /* FireSlash found that SDL native memcpy crashes sometimes, these defines fix it (and they are faster) */ +#define HAVE_LIBC 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#undef HAVE_ICONV_H +#define HAVE_SIGNAL_H 1 +#undef HAVE_ALTIVEC_H + +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 -#define HAVE_BCOPY 1 #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 #define HAVE_STRDUP 1 +#undef HAVE__STRREV +#undef HAVE__STRUPR +#undef HAVE__STRLWR #define HAVE_INDEX 1 #define HAVE_RINDEX 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 +#undef HAVE_ITOA +#undef HAVE__LTOA +#undef HAVE__UITOA +#undef HAVE__ULTOA +#define HAVE_STRTOL +#define HAVE_STRTOUL +#undef HAVE__I64TOA +#undef HAVE__UI64TOA +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#undef HAVE__STRICMP +#define HAVE_STRCASECMP 1 +#undef HAVE__STRNICMP +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#undef HAVE_ICONV +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_CLOCK_GETTIME 1 +#define HAVE_GETPAGESIZE 1 +#define HAVE_MPROTECT 1 #endif /* _SDL_config_minimal_h */ diff --git a/alienblaster/project/jni/sdl/include/SDL_main.h b/alienblaster/project/jni/sdl/include/SDL_main.h index b7f6b2c82..f9cb1f8b9 100644 --- a/alienblaster/project/jni/sdl/include/SDL_main.h +++ b/alienblaster/project/jni/sdl/include/SDL_main.h @@ -103,4 +103,51 @@ extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); #endif /* Need to redefine main()? */ +#ifdef ANDROID + +#include +#include +#include "SDL_thread.h" + +/* JNI-C wrapper stuff */ + +#ifdef __cplusplus +#define C_LINKAGE "C" +#else +#define C_LINKAGE +#endif + + + +extern C_LINKAGE int main( int argc, char ** argv ); +static int SDLCALL MainThreadWrapper(void * dummy) +{ + int argc = 1; + char * argv[] = { "sdl" }; + chdir(SDL_CURDIR_PATH); + return main( argc, argv ); +}; + +#ifndef SDL_JAVA_PACKAGE_PATH +#error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles" +#endif +#define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name +#define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package) +#define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH) + +extern C_LINKAGE SDL_Thread * SDL_mainThread; + +extern C_LINKAGE void +JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz ) +{ + SDL_mainThread = SDL_CreateThread( MainThreadWrapper, NULL ); +} + +#undef JAVA_EXPORT_NAME +#undef JAVA_EXPORT_NAME1 +#undef JAVA_EXPORT_NAME2 +#undef C_LINKAGE + +#endif + #endif /* _SDL_main_h */ diff --git a/alienblaster/project/jni/sdl/src/video/android/SDL_androidvideo.c b/alienblaster/project/jni/sdl/src/video/android/SDL_androidvideo.c index db26486e6..2980bce35 100644 --- a/alienblaster/project/jni/sdl/src/video/android/SDL_androidvideo.c +++ b/alienblaster/project/jni/sdl/src/video/android/SDL_androidvideo.c @@ -103,7 +103,8 @@ static void * memBuffer1 = NULL; static void * memBuffer2 = NULL; static void * memBuffer = NULL; // We have one Java thread drawing on GL surface, and another native C thread (typically main()) feeding it with video data -static SDL_Thread * mainThread = NULL; +extern SDL_Thread * SDL_mainThread; +SDL_Thread * SDL_mainThread = NULL; // Some wicked multithreading static SDL_mutex * WaitForNativeRender = NULL; static SDL_cond * WaitForNativeRender1 = NULL; @@ -411,15 +412,6 @@ int ANDROID_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) /* JNI-C++ wrapper stuff */ -extern int main( int argc, char ** argv ); -static int SDLCALL MainThreadWrapper(void * dummy) -{ - int argc = 1; - char * argv[] = { "sdl" }; - chdir(SDL_CURDIR_PATH); - return main( argc, argv ); -}; - #ifndef SDL_JAVA_PACKAGE_PATH #error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles" #endif @@ -427,12 +419,6 @@ static int SDLCALL MainThreadWrapper(void * dummy) #define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package) #define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH) -extern void -JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz ) -{ - mainThread = SDL_CreateThread( MainThreadWrapper, NULL ); -} - extern void JAVA_EXPORT_NAME(DemoRenderer_nativeResize) ( JNIEnv* env, jobject thiz, jint w, jint h ) { @@ -445,12 +431,12 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeResize) ( JNIEnv* env, jobject thiz, jint extern void JAVA_EXPORT_NAME(DemoRenderer_nativeDone) ( JNIEnv* env, jobject thiz ) { - if( mainThread ) + if( SDL_mainThread ) { __android_log_print(ANDROID_LOG_INFO, "libSDL", "quitting..."); SDL_PrivateQuit(); - SDL_WaitThread(mainThread, NULL); - mainThread = NULL; + SDL_WaitThread(SDL_mainThread, NULL); + SDL_mainThread = NULL; __android_log_print(ANDROID_LOG_INFO, "libSDL", "quit OK"); } } diff --git a/alienblaster/project/jni/sdl_mixer/Android.mk b/alienblaster/project/jni/sdl_mixer/Android.mk index b6daa78c6..a3aba59da 100644 --- a/alienblaster/project/jni/sdl_mixer/Android.mk +++ b/alienblaster/project/jni/sdl_mixer/Android.mk @@ -12,5 +12,7 @@ LOCAL_CPP_EXTENSION := .cpp # Note this simple makefile var substitution, you can find even simpler examples in different Android projects LOCAL_SRC_FILES := $(notdir $(wildcard $(LOCAL_PATH)/*.c)) -include $(BUILD_STATIC_LIBRARY) +LOCAL_SHARED_LIBRARIES := sdl tremor + +include $(BUILD_SHARED_LIBRARY) diff --git a/alienblaster/project/jni/sdl_mixer/playmus.c b/alienblaster/project/jni/sdl_mixer/playmus.c deleted file mode 100644 index 320853fd2..000000000 --- a/alienblaster/project/jni/sdl_mixer/playmus.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - PLAYMUS: A test application for the SDL mixer library. - Copyright (C) 1997-2009 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -/* $Id: playmus.c 4211 2008-12-08 00:27:32Z slouken $ */ - -#include -#include -#include -#include -#ifdef unix -#include -#endif - -#include "SDL.h" -#include "SDL_mixer.h" - - -static int audio_open = 0; -static Mix_Music *music = NULL; -static int next_track = 0; - -void CleanUp(int exitcode) -{ - if( Mix_PlayingMusic() ) { - Mix_FadeOutMusic(1500); - SDL_Delay(1500); - } - if ( music ) { - Mix_FreeMusic(music); - music = NULL; - } - if ( audio_open ) { - Mix_CloseAudio(); - audio_open = 0; - } - SDL_Quit(); - exit(exitcode); -} - -void Usage(char *argv0) -{ - fprintf(stderr, "Usage: %s [-i] [-l] [-8] [-r rate] [-c channels] [-b buffers] [-v N] [-rwops] \n", argv0); -} - -void Menu(void) -{ - char buf[10]; - - printf("Available commands: (p)ause (r)esume (h)alt volume(v#) > "); - fflush(stdin); - scanf("%s",buf); - switch(buf[0]){ - case 'p': case 'P': - Mix_PauseMusic(); - break; - case 'r': case 'R': - Mix_ResumeMusic(); - break; - case 'h': case 'H': - Mix_HaltMusic(); - break; - case 'v': case 'V': - Mix_VolumeMusic(atoi(buf+1)); - break; - } - printf("Music playing: %s Paused: %s\n", Mix_PlayingMusic() ? "yes" : "no", - Mix_PausedMusic() ? "yes" : "no"); -} - -void IntHandler(int sig) -{ - switch (sig) { - case SIGINT: - next_track++; - break; - } -} - -int main(int argc, char *argv[]) -{ - SDL_RWops *rwfp; - int audio_rate; - Uint16 audio_format; - int audio_channels; - int audio_buffers; - int audio_volume = MIX_MAX_VOLUME; - int looping = 0; - int interactive = 0; - int rwops = 0; - int i; - - /* Initialize variables */ - audio_rate = 22050; - audio_format = AUDIO_S16; - audio_channels = 2; - audio_buffers = 4096; - - /* Check command line usage */ - for ( i=1; argv[i] && (*argv[i] == '-'); ++i ) { - if ( (strcmp(argv[i], "-r") == 0) && argv[i+1] ) { - ++i; - audio_rate = atoi(argv[i]); - } else - if ( strcmp(argv[i], "-m") == 0 ) { - audio_channels = 1; - } else - if ( (strcmp(argv[i], "-c") == 0) && argv[i+1] ) { - ++i; - audio_channels = atoi(argv[i]); - } else - if ( (strcmp(argv[i], "-b") == 0) && argv[i+1] ) { - ++i; - audio_buffers = atoi(argv[i]); - } else - if ( (strcmp(argv[i], "-v") == 0) && argv[i+1] ) { - ++i; - audio_volume = atoi(argv[i]); - } else - if ( strcmp(argv[i], "-l") == 0 ) { - looping = -1; - } else - if ( strcmp(argv[i], "-i") == 0 ) { - interactive = 1; - } else - if ( strcmp(argv[i], "-8") == 0 ) { - audio_format = AUDIO_U8; - } else - if ( strcmp(argv[i], "-rwops") == 0 ) { - rwops = 1; - } else { - Usage(argv[0]); - return(1); - } - } - if ( ! argv[i] ) { - Usage(argv[0]); - return(1); - } - - /* Initialize the SDL library */ - if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) { - fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); - return(255); - } - - signal(SIGINT, IntHandler); - signal(SIGTERM, CleanUp); - - /* Open the audio device */ - if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) { - fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); - return(2); - } else { - Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); - printf("Opened audio at %d Hz %d bit %s (%s), %d bytes audio buffer\n", audio_rate, - (audio_format&0xFF), - (audio_channels > 2) ? "surround" : (audio_channels > 1) ? "stereo" : "mono", - (audio_format&0x1000) ? "BE" : "LE", - audio_buffers ); - } - audio_open = 1; - - /* Set the music volume */ - Mix_VolumeMusic(audio_volume); - - /* Set the external music player, if any */ - Mix_SetMusicCMD(getenv("MUSIC_CMD")); - - while (argv[i]) { - next_track = 0; - - /* Load the requested music file */ - if ( rwops ) { - rwfp = SDL_RWFromFile(argv[i], "rb"); - music = Mix_LoadMUS_RW(rwfp); - } else { - music = Mix_LoadMUS(argv[i]); - } - if ( music == NULL ) { - fprintf(stderr, "Couldn't load %s: %s\n", - argv[i], SDL_GetError()); - CleanUp(2); - } - - /* Play and then exit */ - printf("Playing %s\n", argv[i]); - Mix_FadeInMusic(music,looping,2000); - while ( !next_track && (Mix_PlayingMusic() || Mix_PausedMusic()) ) { - if(interactive) - Menu(); - else - SDL_Delay(100); - } - Mix_FreeMusic(music); - if ( rwops ) { - SDL_FreeRW(rwfp); - } - music = NULL; - - /* If the user presses Ctrl-C more than once, exit. */ - SDL_Delay(500); - if ( next_track > 1 ) break; - - i++; - } - CleanUp(0); - - /* Not reached, but fixes compiler warnings */ - return 0; -} diff --git a/alienblaster/project/jni/sdl_mixer/playwave.c b/alienblaster/project/jni/sdl_mixer/playwave.c deleted file mode 100644 index f0863fd4c..000000000 --- a/alienblaster/project/jni/sdl_mixer/playwave.c +++ /dev/null @@ -1,494 +0,0 @@ -/* - PLAYWAVE: A test application for the SDL mixer library. - Copyright (C) 1997-2009 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -/* $Id: playwave.c 5191 2009-11-05 00:02:50Z slouken $ */ - -#include -#include -#include -#include -#ifdef unix -#include -#endif - -#include "SDL.h" -#include "SDL_mixer.h" - - -/* - * rcg06132001 various mixer tests. Define the ones you want. - */ -/*#define TEST_MIX_DECODERS*/ -/*#define TEST_MIX_VERSIONS*/ -/*#define TEST_MIX_CHANNELFINISHED*/ -/*#define TEST_MIX_PANNING*/ -/*#define TEST_MIX_DISTANCE*/ -/*#define TEST_MIX_POSITION*/ - - -#if (defined TEST_MIX_POSITION) - -#if (defined TEST_MIX_PANNING) -#error TEST_MIX_POSITION interferes with TEST_MIX_PANNING. -#endif - -#if (defined TEST_MIX_DISTANCE) -#error TEST_MIX_POSITION interferes with TEST_MIX_DISTANCE. -#endif - -#endif - - -/* rcg06192001 for debugging purposes. */ -static void output_test_warnings(void) -{ -#if (defined TEST_MIX_CHANNELFINISHED) - fprintf(stderr, "Warning: TEST_MIX_CHANNELFINISHED is enabled in this binary...\n"); -#endif -#if (defined TEST_MIX_PANNING) - fprintf(stderr, "Warning: TEST_MIX_PANNING is enabled in this binary...\n"); -#endif -#if (defined TEST_MIX_VERSIONS) - fprintf(stderr, "Warning: TEST_MIX_VERSIONS is enabled in this binary...\n"); -#endif -#if (defined TEST_MIX_DISTANCE) - fprintf(stderr, "Warning: TEST_MIX_DISTANCE is enabled in this binary...\n"); -#endif -#if (defined TEST_MIX_POSITION) - fprintf(stderr, "Warning: TEST_MIX_POSITION is enabled in this binary...\n"); -#endif -} - - -static int audio_open = 0; -static Mix_Chunk *wave = NULL; - -/* rcg06042009 Report available decoders. */ -#if (defined TEST_MIX_DECODERS) -static void report_decoders(void) -{ - int i, total; - - printf("Supported decoders...\n"); - total = Mix_GetNumChunkDecoders(); - for (i = 0; i < total; i++) { - fprintf(stderr, " - chunk decoder: %s\n", Mix_GetChunkDecoder(i)); - } - - total = Mix_GetNumMusicDecoders(); - for (i = 0; i < total; i++) { - fprintf(stderr, " - music decoder: %s\n", Mix_GetMusicDecoder(i)); - } -} -#endif - -/* rcg06192001 Check new Mixer version API. */ -#if (defined TEST_MIX_VERSIONS) -static void output_versions(const char *libname, const SDL_version *compiled, - const SDL_version *linked) -{ - fprintf(stderr, - "This program was compiled against %s %d.%d.%d,\n" - " and is dynamically linked to %d.%d.%d.\n", libname, - compiled->major, compiled->minor, compiled->patch, - linked->major, linked->minor, linked->patch); -} - -static void test_versions(void) -{ - SDL_version compiled; - const SDL_version *linked; - - SDL_VERSION(&compiled); - linked = SDL_Linked_Version(); - output_versions("SDL", &compiled, linked); - - SDL_MIXER_VERSION(&compiled); - linked = Mix_Linked_Version(); - output_versions("SDL_mixer", &compiled, linked); -} -#endif - - -#ifdef TEST_MIX_CHANNELFINISHED /* rcg06072001 */ -static volatile int channel_is_done = 0; -static void channel_complete_callback(int chan) -{ - Mix_Chunk *done_chunk = Mix_GetChunk(chan); - fprintf(stderr, "We were just alerted that Mixer channel #%d is done.\n", chan); - fprintf(stderr, "Channel's chunk pointer is (%p).\n", done_chunk); - fprintf(stderr, " Which %s correct.\n", (wave == done_chunk) ? "is" : "is NOT"); - channel_is_done = 1; -} -#endif - - -/* rcg06192001 abstract this out for testing purposes. */ -static int still_playing(void) -{ -#ifdef TEST_MIX_CHANNELFINISHED - return(!channel_is_done); -#else - return(Mix_Playing(0)); -#endif -} - - -#if (defined TEST_MIX_PANNING) -static void do_panning_update(void) -{ - static Uint8 leftvol = 128; - static Uint8 rightvol = 128; - static Uint8 leftincr = -1; - static Uint8 rightincr = 1; - static int panningok = 1; - static Uint32 next_panning_update = 0; - - if ((panningok) && (SDL_GetTicks() >= next_panning_update)) { - panningok = Mix_SetPanning(0, leftvol, rightvol); - if (!panningok) { - fprintf(stderr, "Mix_SetPanning(0, %d, %d) failed!\n", - (int) leftvol, (int) rightvol); - fprintf(stderr, "Reason: [%s].\n", Mix_GetError()); - } - - if ((leftvol == 255) || (leftvol == 0)) { - if (leftvol == 255) - printf("All the way in the left speaker.\n"); - leftincr *= -1; - } - - if ((rightvol == 255) || (rightvol == 0)) { - if (rightvol == 255) - printf("All the way in the right speaker.\n"); - rightincr *= -1; - } - - leftvol += leftincr; - rightvol += rightincr; - next_panning_update = SDL_GetTicks() + 10; - } -} -#endif - - -#if (defined TEST_MIX_DISTANCE) -static void do_distance_update(void) -{ - static Uint8 distance = 1; - static Uint8 distincr = 1; - static int distanceok = 1; - static Uint32 next_distance_update = 0; - - if ((distanceok) && (SDL_GetTicks() >= next_distance_update)) { - distanceok = Mix_SetDistance(0, distance); - if (!distanceok) { - fprintf(stderr, "Mix_SetDistance(0, %d) failed!\n", (int) distance); - fprintf(stderr, "Reason: [%s].\n", Mix_GetError()); - } - - if (distance == 0) { - printf("Distance at nearest point.\n"); - distincr *= -1; - } - else if (distance == 255) { - printf("Distance at furthest point.\n"); - distincr *= -1; - } - - distance += distincr; - next_distance_update = SDL_GetTicks() + 15; - } -} -#endif - - -#if (defined TEST_MIX_POSITION) -static void do_position_update(void) -{ - static Sint16 distance = 1; - static Sint8 distincr = 1; - static Uint16 angle = 0; - static Sint8 angleincr = 1; - static int positionok = 1; - static Uint32 next_position_update = 0; - - if ((positionok) && (SDL_GetTicks() >= next_position_update)) { - positionok = Mix_SetPosition(0, angle, distance); - if (!positionok) { - fprintf(stderr, "Mix_SetPosition(0, %d, %d) failed!\n", - (int) angle, (int) distance); - fprintf(stderr, "Reason: [%s].\n", Mix_GetError()); - } - - if (angle == 0) { - printf("Due north; now rotating clockwise...\n"); - angleincr = 1; - } - - else if (angle == 360) { - printf("Due north; now rotating counter-clockwise...\n"); - angleincr = -1; - } - - distance += distincr; - - if (distance < 0) { - distance = 0; - distincr = 3; - printf("Distance is very, very near. Stepping away by threes...\n"); - } else if (distance > 255) { - distance = 255; - distincr = -3; - printf("Distance is very, very far. Stepping towards by threes...\n"); - } - - angle += angleincr; - next_position_update = SDL_GetTicks() + 30; - } -} -#endif - - -static void CleanUp(int exitcode) -{ - if ( wave ) { - Mix_FreeChunk(wave); - wave = NULL; - } - if ( audio_open ) { - Mix_CloseAudio(); - audio_open = 0; - } - SDL_Quit(); - - exit(exitcode); -} - - -static void Usage(char *argv0) -{ - fprintf(stderr, "Usage: %s [-8] [-r rate] [-c channels] [-f] [-F] [-l] [-m] \n", argv0); -} - - -/* - * rcg06182001 This is sick, but cool. - * - * Actually, it's meant to be an example of how to manipulate a voice - * without having to use the mixer effects API. This is more processing - * up front, but no extra during the mixing process. Also, in a case like - * this, when you need to touch the whole sample at once, it's the only - * option you've got. And, with the effects API, you are altering a copy of - * the original sample for each playback, and thus, your changes aren't - * permanent; here, you've got a reversed sample, and that's that until - * you either reverse it again, or reload it. - */ -static void flip_sample(Mix_Chunk *wave) -{ - Uint16 format; - int channels, i, incr; - Uint8 *start = wave->abuf; - Uint8 *end = wave->abuf + wave->alen; - - Mix_QuerySpec(NULL, &format, &channels); - incr = (format & 0xFF) * channels; - - end -= incr; - - switch (incr) { - case 8: - for (i = wave->alen / 2; i >= 0; i -= 1) { - Uint8 tmp = *start; - *start = *end; - *end = tmp; - start++; - end--; - } - break; - - case 16: - for (i = wave->alen / 2; i >= 0; i -= 2) { - Uint16 tmp = *start; - *((Uint16 *) start) = *((Uint16 *) end); - *((Uint16 *) end) = tmp; - start += 2; - end -= 2; - } - break; - - case 32: - for (i = wave->alen / 2; i >= 0; i -= 4) { - Uint32 tmp = *start; - *((Uint32 *) start) = *((Uint32 *) end); - *((Uint32 *) end) = tmp; - start += 4; - end -= 4; - } - break; - - default: - fprintf(stderr, "Unhandled format in sample flipping.\n"); - return; - } -} - - -int main(int argc, char *argv[]) -{ - int audio_rate; - Uint16 audio_format; - int audio_channels; - int loops = 0; - int i; - int reverse_stereo = 0; - int reverse_sample = 0; - - setbuf(stdout, NULL); /* rcg06132001 for debugging purposes. */ - setbuf(stderr, NULL); /* rcg06192001 for debugging purposes, too. */ - output_test_warnings(); - - /* Initialize variables */ - audio_rate = MIX_DEFAULT_FREQUENCY; - audio_format = MIX_DEFAULT_FORMAT; - audio_channels = 2; - - /* Check command line usage */ - for ( i=1; argv[i] && (*argv[i] == '-'); ++i ) { - if ( (strcmp(argv[i], "-r") == 0) && argv[i+1] ) { - ++i; - audio_rate = atoi(argv[i]); - } else - if ( strcmp(argv[i], "-m") == 0 ) { - audio_channels = 1; - } else - if ( (strcmp(argv[i], "-c") == 0) && argv[i+1] ) { - ++i; - audio_channels = atoi(argv[i]); - } else - if ( strcmp(argv[i], "-l") == 0 ) { - loops = -1; - } else - if ( strcmp(argv[i], "-8") == 0 ) { - audio_format = AUDIO_U8; - } else - if ( strcmp(argv[i], "-f") == 0 ) { /* rcg06122001 flip stereo */ - reverse_stereo = 1; - } else - if ( strcmp(argv[i], "-F") == 0 ) { /* rcg06172001 flip sample */ - reverse_sample = 1; - } else { - Usage(argv[0]); - return(1); - } - } - if ( ! argv[i] ) { - Usage(argv[0]); - return(1); - } - - /* Initialize the SDL library */ - if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) { - fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); - return(255); - } - signal(SIGINT, CleanUp); - signal(SIGTERM, CleanUp); - - /* Open the audio device */ - if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, 4096) < 0) { - fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); - CleanUp(2); - } else { - Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); - printf("Opened audio at %d Hz %d bit %s", audio_rate, - (audio_format&0xFF), - (audio_channels > 2) ? "surround" : - (audio_channels > 1) ? "stereo" : "mono"); - if ( loops ) { - printf(" (looping)\n"); - } else { - putchar('\n'); - } - } - audio_open = 1; - -#if (defined TEST_MIX_VERSIONS) - test_versions(); -#endif - -#if (defined TEST_MIX_DECODERS) - report_decoders(); -#endif - - /* Load the requested wave file */ - wave = Mix_LoadWAV(argv[i]); - if ( wave == NULL ) { - fprintf(stderr, "Couldn't load %s: %s\n", - argv[i], SDL_GetError()); - CleanUp(2); - } - - if (reverse_sample) { - flip_sample(wave); - } - -#ifdef TEST_MIX_CHANNELFINISHED /* rcg06072001 */ - Mix_ChannelFinished(channel_complete_callback); -#endif - - if ( (!Mix_SetReverseStereo(MIX_CHANNEL_POST, reverse_stereo)) && - (reverse_stereo) ) - { - printf("Failed to set up reverse stereo effect!\n"); - printf("Reason: [%s].\n", Mix_GetError()); - } - - /* Play and then exit */ - Mix_PlayChannel(0, wave, loops); - - while (still_playing()) { - -#if (defined TEST_MIX_PANNING) /* rcg06132001 */ - do_panning_update(); -#endif - -#if (defined TEST_MIX_DISTANCE) /* rcg06192001 */ - do_distance_update(); -#endif - -#if (defined TEST_MIX_POSITION) /* rcg06202001 */ - do_position_update(); -#endif - - SDL_Delay(1); - - } /* while still_playing() loop... */ - - CleanUp(0); - - /* Not reached, but fixes compiler warnings */ - return 0; -} - -/* end of playwave.c ... */ - diff --git a/alienblaster/project/jni/stlport/Android.mk b/alienblaster/project/jni/stlport/Android.mk index 00340f9bd..f38d518cf 100644 --- a/alienblaster/project/jni/stlport/Android.mk +++ b/alienblaster/project/jni/stlport/Android.mk @@ -10,5 +10,5 @@ LOCAL_CPP_EXTENSION := .cpp LOCAL_SRC_FILES := $(addprefix src/,$(notdir $(wildcard $(LOCAL_PATH)/src/*.cpp $(LOCAL_PATH)/src/*.c)))) -include $(BUILD_STATIC_LIBRARY) +include $(BUILD_SHARED_LIBRARY) diff --git a/alienblaster/project/jni/tremor/Android.mk b/alienblaster/project/jni/tremor/Android.mk index 82232eac4..f668a42bc 100644 --- a/alienblaster/project/jni/tremor/Android.mk +++ b/alienblaster/project/jni/tremor/Android.mk @@ -11,5 +11,5 @@ LOCAL_CPP_EXTENSION := .cpp # Note this simple makefile var substitution, you can find even simpler examples in different Android projects LOCAL_SRC_FILES := $(notdir $(wildcard $(LOCAL_PATH)/*.c)) -include $(BUILD_STATIC_LIBRARY) +include $(BUILD_SHARED_LIBRARY) diff --git a/alienblaster/project/src/DemoActivity.java b/alienblaster/project/src/DemoActivity.java index 5bce2885f..c79e5bfa1 100644 --- a/alienblaster/project/src/DemoActivity.java +++ b/alienblaster/project/src/DemoActivity.java @@ -1,44 +1,3 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This is a small port of the "San Angeles Observation" demo - * program for OpenGL ES 1.x. For more details, see: - * - * http://jet.ro/visuals/san-angeles-observation/ - * - * This program demonstrates how to use a GLSurfaceView from Java - * along with native OpenGL calls to perform frame rendering. - * - * Touching the screen will start/stop the animation. - * - * Note that the demo runs much faster on the emulator than on - * real devices, this is mainly due to the following facts: - * - * - the demo sends bazillions of polygons to OpenGL without - * even trying to do culling. Most of them are clearly out - * of view. - * - * - on a real device, the GPU bus is the real bottleneck - * that prevent the demo from getting acceptable performance. - * - * - the software OpenGL engine used in the emulator uses - * the system bus instead, and its code rocks :-) - * - * Fixing the program to send less polygons to the GPU is left - * as an exercise to the reader. As always, patches welcomed :-) - */ package de.schwardtnet.alienblaster; import javax.microedition.khronos.egl.EGLConfig; @@ -73,7 +32,7 @@ import java.nio.ByteBuffer; // TODO: export vibrator to SDL - interface is available in SDL 1.3 class Globals { - public static String ApplicationName = "alienblaster"; + public static String ApplicationName = "AlienBlaster"; // Should be zip file public static String DataDownloadUrl = "http://sites.google.com/site/xpelyax/Home/alienblaster110_data.zip?attredirects=0&d=1"; // Set DownloadToSdcard to true if your app data is bigger than 5 megabytes. @@ -86,7 +45,11 @@ class Globals { class LoadLibrary { public LoadLibrary() {} static { - System.loadLibrary(Globals.ApplicationName); + System.loadLibrary("stlport"); + System.loadLibrary("tremor"); + System.loadLibrary("sdl"); + System.loadLibrary("sdl_mixer"); + System.loadLibrary("application"); } } diff --git a/alienblaster/readme.txt b/alienblaster/readme.txt index 6dece5106..bfcb79749 100644 --- a/alienblaster/readme.txt +++ b/alienblaster/readme.txt @@ -38,9 +38,8 @@ In the future I'm planning to use accelerometer as a SDL joystick. Replace all strings "alienblaster" and "de.schwardtnet.alienblaster" with the name of your application and your reversed webpage address (or any unique string): - Application.mk:2 project/AndroidManifest.xml:3 - project/src/DemoActivity.java:42 and 71 + project/src/DemoActivity.java:35 project/jni/Android.mk:3 and 10 project/res/values/strings.xml:3 (that's all, maybe I forgot something)