프로 안드로이드 게임 개발

- 출판사 상세 페이지 - 가격 검색 - 원서 페이지 - 예제 코드

차례 [+]

관련 글

링크 모음

서문

제1장

제2장

제3장

제5장

제6장

제7장

부록 A

예제 다운로드에 없거나 다른 코드

제6장 목록 6-19

CC = agcc

# 모든 경고 표시, 최적화 수준 2
CFLAGS = -Wall -O2

# 목적 파일들
OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \
   wl_act1.o wl_act2.o wl_act3.o wl_agent.o wl_game.o \
   wl_inter.o wl_menu.o wl_play.o wl_state.o wl_text.o wl_main.o \
   wl_debug.o vi_comm.o sd_comm.o sd_null.o wl_draw.o

# JNI 파일들
JNIOBJS = jni_wolf.o vi_null.o

OBJS += $(JNIOBJS)

# 주 대상
all: lib

# 라이브러리
lib: $(OBJS) j
	ald  -shared -o libwolf_jni.so $(OBJS)

.c.o:
	@echo
	$(CC) -fpic -c $(CFLAGS) $(INCLUDES) $<

# JNI 헤더 생성
jni:
	@echo "Creating JNI C headers..."
	javah -jni -classpath ../../bin -d include wolf.jni.Natives

clean:
	rm -rf *.o

부록 A Doom 예제

Application.mk(NDK 1.6, r3용):

APP_PROJECT_PATH := $(call my-dir)/project
APP_MODULES := doom_jni

Android.mk(NDK 1.6, r3용) :

LOCAL_PATH := $(call my-dir)

# 변수들을 비운다.
include $(CLEAR_VARS)

# 모듈 이름
LOCAL_MODULE := doom_jni
LP := $(LOCAL_PATH)

# Doom 네이티브 코드 폴더
DOOM := apps/Doom/project/jni

# 헤더 위치
INC := -I$(DOOM) -I$(DOOM)/include

DOOM_FLAGS := -DNORMALUNIX -DLINUX -DHAVE_CONFIG_H
OPTS := -O3 -ffast-math  -fexpensive-optimizations
LOCAL_CFLAGS := $(DOOM_FLAGS)  $(OPTS) $(INC)

# 소스 파일들
LOCAL_SRC_FILES := \
 am_map.c    m_cheat.c    p_lights.c  p_user.c    sounds.c \
 hu_lib.c    md5.c        p_map.c     r_bsp.c     s_sound.c \
 d_deh.c     hu_stuff.c   m_menu.c    p_maputl.c  r_data.c  st_lib.c \
 d_items.c   m_misc.c     p_mobj.c    r_demo.c    st_stuff.c \
 d_main.c    info.c       p_plats.c   r_draw.c    tables.c \
 doomdef.c   m_random.c   p_pspr.c    r_filter.c  version.c \
 doomstat.c  p_ceilng.c   p_saveg.c   r_fps.c     v_video.c \
 p_checksum.c  p_setup.c  r_main.c    wi_stuff.c \
 dstrings.c  p_doors.c    p_sight.c   r_patch.c   w_memcache.c \
 f_finale.c  p_enemy.c    p_spec.c    r_plane.c   w_mmap.c \
 f_wipe.c    lprintf.c    p_floor.c   p_switch.c  r_segs.c   w_wad.c \
 g_game.c    m_argv.c     p_genlin.c  p_telept.c  r_sky.c    z_bmalloc.c \
 m_bbox.c    p_inter.c    p_tick.c    r_things.c  z_zone.c \
 d_client.c  d_server.c \
 i_video.c   i_network.c  i_system.c  i_main.c    i_sound.c \
 jni_doom.c

# libdoom_jni.so를 만든다
include $(BUILD_SHARED_LIBRARY)

부록 B OpenGL 입방체 예제

Application.mk(NDK 1.6, r3용)

APP_PROJECT_PATH := $(call my-dir)/project
APP_MODULES      := gltest-jni

Android.mk(NDK 1.6, r3용)

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := gltest-jni
LOCAL_CFLAGS    := -Wall -O2 -fpic
LOCAL_SRC_FILES := cuberenderer.c cube.c
LOCAL_LDLIBS    := -lGLESv1_CM
include $(BUILD_SHARED_LIBRARY)

부록 B Wolf3D 예제

Application.mk(NDK 1.6, r3용)

APP_PROJECT_PATH := $(call my-dir)/project
APP_MODULES      := wolf_jni

Android.mk(NDK 1.6, r3용)

LOCAL_PATH := $(call my-dir)/gp2xwolf3d

include $(CLEAR_VARS)

LOCAL_MODULE  := wolf_jni

INC := -Iinclude
OPTS := -O6 -ffast-math -fexpensive-optimizations \
     -funroll-loops -fomit-frame-pointer

LOCAL_CFLAGS := $(OPTS) $(INC)

LOCAL_SRC_FILES := objs.c misc.c id_ca.c id_vh.c id_us.c \
  wl_act1.c wl_act2.c wl_act3.c wl_agent.c wl_game.c \
  wl_inter.c wl_menu.c wl_play.c wl_state.c wl_text.c wl_main.c \
  wl_debug.c vi_comm.c sd_comm.c \
  wl_draw.c jni_wolf.c vi_null.c sd_null.c

include $(BUILD_SHARED_LIBRARY)


comments powered by Disqus