Skip to content

Commit

Permalink
added example
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio committed Jan 16, 2013
1 parent 59fb059 commit b56439c
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 87 deletions.
92 changes: 5 additions & 87 deletions Makefile
Expand Up @@ -3,92 +3,10 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
all:
@$(MAKE) -C libmove --no-print-directory
@$(MAKE) -C sample/libmove-NoRSX pkg --no-print-directory

ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
endif

include $(PSL1GHT)/ppu_rules

#---------------------------------------------------------------------------------
BUILD := build

#---------------------------------------------------------------------------------
ifeq ($(strip $(PLATFORM)),)
#---------------------------------------------------------------------------------
export BASEDIR := $(CURDIR)
export DEPS := $(BASEDIR)/deps
export LIBS := $(BASEDIR)/lib

#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LIBDIR := $(LIBS)/$(PLATFORM)
export DEPSDIR := $(DEPS)/$(PLATFORM)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

LIBRARY := $(LIBDIR)/libmove

#---------------------------------------------------------------------------------
DEFINCS := -I$(PORTLIBS)/include/freetype2 -I$(PORTLIBS)/include/ -I$(PORTLIBS)/include/libmove -I$(PORTLIBS)/include/ -I$(PSL1GHT)/ppu/include -I$(PSL1GHT)/ppu/include/rsx -I$(PSL1GHT)/ppu/include/lv2 -I$(PSL1GHT)/ppu/include/sys -I$(CURDIR)
INCLUDES := $(DEFINCS)

CFLAGS := -O2 -mregnames -Wall -mcpu=cell $(MACHDEP) $(INCLUDES) -Wl,-mcell
CXXFLAGS := $(CFLAGS)

#---------------------------------------------------------------------------------
VPATH := $(BASEDIR)

#---------------------------------------------------------------------------------
OBJS := libmove.o moveutil.o spursutil.o

#---------------------------------------------------------------------------------
all: install-headers ppu install
#---------------------------------------------------------------------------------


#---------------------------------------------------------------------------------
install-headers:
#---------------------------------------------------------------------------------
@[ -d $(PORTLIBS) ] || mkdir -p $(PORTLIBS)
@[ ! -d $(PORTLIBS)/include/libmove ] || rm -rf $(PORTLIBS)/include/libmove
@cp -frv libmove $(PORTLIBS)/include/libmove

#---------------------------------------------------------------------------------
ppu:
#---------------------------------------------------------------------------------
@[ -d $(LIBS)/ppu ] || mkdir -p $(LIBS)/ppu
@[ -d $(DEPS)/ppu ] || mkdir -p $(DEPS)/ppu
@[ -d ppu ] || mkdir -p ppu
@$(MAKE) PLATFORM=ppu lib -C ppu -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
install:
#---------------------------------------------------------------------------------
@[ -d $(PORTLIBS)/lib ] || mkdir -p $(PORTLIBS)/lib
@cp -frv $(CURDIR)/lib/ppu/*.a $(PORTLIBS)/lib

#---------------------------------------------------------------------------------
$(LIBRARY).a: $(OBJS)
#---------------------------------------------------------------------------------

.PHONY: lib ppu

#---------------------------------------------------------------------------------
lib: $(LIBRARY).a
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
clean:
#---------------------------------------------------------------------------------
@echo lib cleaned ...
@rm -rf ppu
@rm -rf $(DEPS)
@rm -rf $(LIBS)

#---------------------------------------------------------------------------------
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------
@$(MAKE) -C libmove clean --no-print-directory
@$(MAKE) -C sample/libmove-NoRSX clean --no-print-directory
94 changes: 94 additions & 0 deletions libmove/Makefile
@@ -0,0 +1,94 @@
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
endif

include $(PSL1GHT)/ppu_rules

#---------------------------------------------------------------------------------
BUILD := build

#---------------------------------------------------------------------------------
ifeq ($(strip $(PLATFORM)),)
#---------------------------------------------------------------------------------
export BASEDIR := $(CURDIR)
export DEPS := $(BASEDIR)/deps
export LIBS := $(BASEDIR)/lib

#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LIBDIR := $(LIBS)/$(PLATFORM)
export DEPSDIR := $(DEPS)/$(PLATFORM)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

LIBRARY := $(LIBDIR)/libmove

#---------------------------------------------------------------------------------
DEFINCS := -I$(PORTLIBS)/include/freetype2 -I$(PORTLIBS)/include/ -I$(PORTLIBS)/include/libmove -I$(PORTLIBS)/include/ -I$(PSL1GHT)/ppu/include -I$(PSL1GHT)/ppu/include/rsx -I$(PSL1GHT)/ppu/include/lv2 -I$(PSL1GHT)/ppu/include/sys -I$(CURDIR)
INCLUDES := $(DEFINCS)

CFLAGS := -O2 -mregnames -Wall -mcpu=cell $(MACHDEP) $(INCLUDES) -Wl,-mcell
CXXFLAGS := $(CFLAGS)

#---------------------------------------------------------------------------------
VPATH := $(BASEDIR)

#---------------------------------------------------------------------------------
OBJS := libmove.o moveutil.o spursutil.o

#---------------------------------------------------------------------------------
all: install-headers ppu install
#---------------------------------------------------------------------------------


#---------------------------------------------------------------------------------
install-headers:
#---------------------------------------------------------------------------------
@[ -d $(PORTLIBS) ] || mkdir -p $(PORTLIBS)
@[ ! -d $(PORTLIBS)/include/libmove ] || rm -rf $(PORTLIBS)/include/libmove
@cp -frv libmove $(PORTLIBS)/include/libmove

#---------------------------------------------------------------------------------
ppu:
#---------------------------------------------------------------------------------
@[ -d $(LIBS)/ppu ] || mkdir -p $(LIBS)/ppu
@[ -d $(DEPS)/ppu ] || mkdir -p $(DEPS)/ppu
@[ -d ppu ] || mkdir -p ppu
@$(MAKE) PLATFORM=ppu lib -C ppu -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
install:
#---------------------------------------------------------------------------------
@[ -d $(PORTLIBS)/lib ] || mkdir -p $(PORTLIBS)/lib
@cp -frv $(CURDIR)/lib/ppu/*.a $(PORTLIBS)/lib

#---------------------------------------------------------------------------------
$(LIBRARY).a: $(OBJS)
#---------------------------------------------------------------------------------

.PHONY: lib ppu

#---------------------------------------------------------------------------------
lib: $(LIBRARY).a
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
clean:
#---------------------------------------------------------------------------------
@echo lib cleaned ...
@rm -rf ppu
@rm -rf $(DEPS)
@rm -rf $(LIBS)

#---------------------------------------------------------------------------------
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------
56 changes: 56 additions & 0 deletions libmove/README.md
@@ -0,0 +1,56 @@
libmove for PSL1GHT V2
======================

This lib will be installed inside the PORTLIBS

Authors
-------
* deroad - libmove.cpp/.h movebuttons.h
* José Ramos Márquez (bigboss) - moveutil.cpp/.h spursutil.cpp/.h
* Youness Alaoui (KaKaRoTo) - moveutil.cpp/.h spursutil.cpp/.h

Changelog:
----------
* 0.3

Now is possible to choose the move controller to use.
Added move_set_rumble/move_get_rumble function
Added set_move_led_color to force the ball color of the PS Move

* 0.2

fixed gyro axis

* 0.1

initial release

Linking
-------

Add these libs on your makefile to compile your homebrew.
-lmove -lgem -lcamera -lspurs

License
-------

This lib is released under BSD License.

Example
-------

#include <libmove/libmove.h>
int main(s32 argc, const char* argv[]){
movePadData data;
init_move();
while(1){
getMovePadData(PLAYSTATION_MOVE_PAD_0 , &data);
if(data.BTN_ACTION)
calibrate_move(PLAYSTATION_MOVE_PAD_0);
}else if(data.BTN_T){
goto end;
}
}
end:
end_move();
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions sample/libmove-NoRSX
Submodule libmove-NoRSX added at e94829

0 comments on commit b56439c

Please sign in to comment.