diff --git a/.gitignore b/.gitignore index 53b12f9..5d5c112 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ build/* release/* -libgui.cbp \ No newline at end of file +libgui.cbp +lib/ +*.bz2 +libgui.layout diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5077e58..0000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -language: cpp - -os: linux -sudo: false -dist: trusty - -env: - global: - - DEVKITPRO=/opt/devkitpro - - WUT_ROOT=/opt/devkitpro/wut - - DEVKITPPC=/opt/devkitpro/devkitPPC - - PORTLIBREPOS=$HOME/portlibrepos - -cache: - directories: - - "$HOME/.local" - - "$DEVKITPRO" - -addons: - apt: - packages: - - p7zip-full - -before_install: - - mkdir -p "${PORTLIBREPOS}" - - mkdir -p "${DEVKITPRO}" - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb -O /tmp/devkitpro-pacman.deb; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo dpkg -i /tmp/devkitpro-pacman.deb; fi - - yes | sudo dkp-pacman -Syu devkitPPC --needed - - wget $(curl -s https://api.github.com/repos/decaf-emu/wut/releases/latest | grep 'browser_' | grep 'linux' | cut -d\" -f4) - -install: - - 7z x -y $(ls | grep "linux") -o${WUT_ROOT} - - 7z x -y ./libs/portlibs.zip -o${DEVKITPRO} - - cd $PORTLIBREPOS - - git clone https://github.com/Maschell/libutils.git -b wut - - cd libutils - - mkdir build && cd build - - cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$WUT_ROOT ../ - - make install - - cd $PORTLIBREPOS - -before_script: - - cd $TRAVIS_BUILD_DIR/ - -script: - - mkdir build && cd build - - cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$WUT_ROOT ../ - - make install \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index a2e18b4..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -cmake_minimum_required(VERSION 3.2) -project(guiwut) -include("${WUT_ROOT}/share/wut.cmake" REQUIRED) - -file(GLOB_RECURSE SOURCE_FILES *.c *.cpp) -file(GLOB_RECURSE HEADER_FILES *.h*) - -add_library(guiwut STATIC ${SOURCE_FILES} ${HEADER_FILES}) - -target_link_libraries(guiwut - utilswut) - - -include_directories("$ENV{WUT_ROOT}/include/libutilswut" REQUIRED) -include_directories("$ENV{DEVKITPRO}/portlibs/ppc/include" REQUIRED) -include_directories("$ENV{DEVKITPRO}/portlibs/ppc/include/freetype2" REQUIRED) - -target_include_directories(guiwut PUBLIC "include") -target_include_directories(guiwut PRIVATE "src") - -wut_enable_stdcpp(guiwut) -wut_default_malloc(guiwut) - -target_include_directories(guiwut PUBLIC "include") -target_compile_options(guiwut PUBLIC "-D__LOGGING__") - -install(TARGETS guiwut - ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib") -install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ - DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libguiwut" - FILES_MATCHING PATTERN "*.h*") \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0741e5a --- /dev/null +++ b/Makefile @@ -0,0 +1,162 @@ +#------------------------------------------------------------------------------- +.SUFFIXES: +#------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") +endif + +TOPDIR ?= $(CURDIR) + +include $(DEVKITPRO)/wut/share/wut_rules + +export VER_MAJOR := 1 +export VER_MINOR := 0 +export VER_PATCH := 0 + +VERSION := $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH) + +#------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +#------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source \ + source/gui \ + source/sounds \ + source/video \ + source/video/shaders \ + +DATA := data +INCLUDES := source \ + include \ + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +CFLAGS := -Wall -Werror -save-temps \ + -ffunction-sections -fdata-sections \ + $(MACHDEP) \ + $(BUILD_CFLAGS) + +CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ + +CXXFLAGS := $(CFLAGS) -std=gnu++17 + +ASFLAGS := $(MACHDEP) + +LDFLAGS = $(ARCH) -Wl,--gc-sections + + +LIBS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) $(WUT_ROOT) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export TOPDIR := $(CURDIR) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +DEFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.def))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) +#--------------------------------------------------------------------------------- + export LD := $(CC) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- + export LD := $(CXX) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SRC := $(DEFFILES:.def=.o) $(SFILES:.s=.o) $(CFILES:.c=.o) $(CPPFILES:.cpp=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SRC) +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I. -I$(PORTLIBS_PATH)/ppc/include/freetype2 + +.PHONY: all dist-bin dist-src dist install clean + +#--------------------------------------------------------------------------------- +all: lib/libgui.a + +dist-bin: all + @tar --exclude=*~ -cjf libgui-$(VERSION).tar.bz2 include lib + +dist-src: + @tar --exclude=*~ -cjf libgui-src-$(VERSION).tar.bz2 include source Makefile + +dist: dist-src dist-bin + +install: dist-bin + mkdir -p $(DESTDIR)$(DEVKITPRO)/wut + bzip2 -cd libgui-$(VERSION).tar.bz2 | tar -xf - -C $(DESTDIR)$(DEVKITPRO)/wut + +lib: + @[ -d $@ ] || mkdir -p $@ + +release: + @[ -d $@ ] || mkdir -p $@ + +lib/libgui.a :$(SOURCES) $(INCLUDES) | lib release + @$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \ + BUILD_CFLAGS="-DNDEBUG=1 -O2 -s" \ + DEPSDIR=$(CURDIR)/release \ + --no-print-directory -C release \ + -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -rf release lib + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT) : $(OFILES) + +$(OFILES_SRC) : $(HFILES) + +#--------------------------------------------------------------------------------- +%_bin.h %.bin.o : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- diff --git a/include/gui/GameBgImage.h b/include/gui/GameBgImage.h index f778d1a..855fb3d 100644 --- a/include/gui/GameBgImage.h +++ b/include/gui/GameBgImage.h @@ -2,7 +2,7 @@ #define _GAME_BG_IMAGE_H_ #include -#include