From e8f1942db48afb1ffc84d0ed01675148579bcb5d Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 21 Jun 2018 20:44:58 +0200 Subject: [PATCH 1/5] Add first commit on wut branch --- .gitignore | 1 + .travis.yml | 20 +- CMakeLists.txt | 31 + Makefile | 151 - README.md | 22 +- {source => include}/gui/FreeTypeGX.h | 82 +- {source => include}/gui/GameBgImage.h | 7 +- {source => include}/gui/GridBackground.h | 7 +- {source => include}/gui/Gui.h | 44 +- include/gui/GuiButton.h | 117 + {source => include}/gui/GuiCheckBox.h | 36 +- {source => include}/gui/GuiController.h | 32 +- include/gui/GuiDragListener.h | 52 + include/gui/GuiElement.h | 542 ++++ include/gui/GuiFrame.h | 100 + {source => include}/gui/GuiImage.h | 67 +- include/gui/GuiImageAsync.h | 60 + {source => include}/gui/GuiImageData.h | 38 +- {source => include}/gui/GuiParticleImage.h | 28 +- include/gui/GuiScrollbar.h | 134 + include/gui/GuiSelectBox.h | 130 + include/gui/GuiSound.h | 58 + {source => include}/gui/GuiSwitch.h | 40 +- {source => include}/gui/GuiText.h | 80 +- {source => include}/gui/GuiToggle.h | 6 +- {source => include}/gui/GuiTrigger.h | 42 +- {source => include}/gui/VPadController.h | 41 +- {source => include}/gui/WPadController.h | 87 +- include/gui/gx2_ext.h | 171 ++ include/gui/sigslot.h | 2377 ++++++++++++++ {source => include}/resources/Resources.h | 13 +- include/resources/filelist.h | 16 + include/sounds/BufferCircle.hpp | 111 + {source => include}/sounds/Mp3Decoder.hpp | 35 +- {source => include}/sounds/OggDecoder.hpp | 25 +- include/sounds/SoundDecoder.hpp | 138 + {source => include}/sounds/SoundHandler.hpp | 59 +- include/sounds/Voice.h | 154 + {source => include}/sounds/WavDecoder.hpp | 62 +- {source => include}/video/CVideo.h | 82 +- {source => include}/video/CursorDrawer.h | 15 +- .../video/shaders/ColorShader.h | 50 +- .../video/shaders/FXAAShader.h | 40 +- .../video/shaders/FetchShader.h | 21 +- include/video/shaders/PixelShader.h | 137 + include/video/shaders/Shader.h | 69 + {source => include}/video/shaders/Shader3D.h | 69 +- .../video/shaders/ShaderFractalColor.h | 75 +- .../video/shaders/Texture2DShader.h | 67 +- include/video/shaders/VertexShader.h | 167 + libgui.layout | 169 + libs/portlibs.zip | Bin 2818927 -> 2818911 bytes source/gui/FreeTypeGX.cpp | 551 ++-- source/gui/GameBgImage.cpp | 27 +- source/gui/GridBackground.cpp | 75 +- source/gui/GuiButton.cpp | 308 +- source/gui/GuiButton.h | 117 - source/gui/GuiCheckBox.cpp | 46 +- source/gui/GuiDragListener.cpp | 52 +- source/gui/GuiDragListener.h | 53 - source/gui/GuiElement.cpp | 456 ++- source/gui/GuiElement.h | 529 ---- source/gui/GuiFrame.cpp | 111 +- source/gui/GuiFrame.h | 98 - source/gui/GuiImage.cpp | 204 +- source/gui/GuiImageAsync.cpp | 143 +- source/gui/GuiImageAsync.h | 62 - source/gui/GuiImageData.cpp | 169 +- source/gui/GuiParticleImage.cpp | 66 +- source/gui/GuiScrollbar.cpp | 254 +- source/gui/GuiScrollbar.h | 129 - source/gui/GuiSelectBox.cpp | 163 +- source/gui/GuiSelectBox.h | 131 - source/gui/GuiSound.cpp | 101 +- source/gui/GuiSound.h | 60 - source/gui/GuiSwitch.cpp | 76 +- source/gui/GuiText.cpp | 820 +++-- source/gui/GuiToggle.cpp | 20 +- source/gui/GuiTrigger.cpp | 119 +- source/gui/sigslot.h | 2731 ----------------- source/resources/Resources.cpp | 172 +- source/resources/filelist.h | 16 - source/sounds/BufferCircle.cpp | 154 +- source/sounds/BufferCircle.hpp | 86 - source/sounds/Mp3Decoder.cpp | 39 +- source/sounds/OggDecoder.cpp | 137 +- source/sounds/SoundDecoder.cpp | 297 +- source/sounds/SoundDecoder.hpp | 105 - source/sounds/SoundHandler.cpp | 406 ++- source/sounds/Voice.h | 170 - source/sounds/WavDecoder.cpp | 179 +- source/video/CVideo.cpp | 228 +- source/video/CursorDrawer.cpp | 44 +- source/video/shaders/ColorShader.cpp | 74 +- source/video/shaders/FXAAShader.cpp | 82 +- source/video/shaders/PixelShader.h | 150 - source/video/shaders/Shader.h | 74 - source/video/shaders/Shader3D.cpp | 105 +- source/video/shaders/ShaderFractalColor.cpp | 118 +- source/video/shaders/Texture2DShader.cpp | 98 +- source/video/shaders/VertexShader.h | 178 -- 101 files changed, 8082 insertions(+), 8678 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile rename {source => include}/gui/FreeTypeGX.h (59%) rename {source => include}/gui/GameBgImage.h (77%) rename {source => include}/gui/GridBackground.h (85%) rename {source => include}/gui/Gui.h (57%) create mode 100644 include/gui/GuiButton.h rename {source => include}/gui/GuiCheckBox.h (60%) rename {source => include}/gui/GuiController.h (81%) create mode 100644 include/gui/GuiDragListener.h create mode 100644 include/gui/GuiElement.h create mode 100644 include/gui/GuiFrame.h rename {source => include}/gui/GuiImage.h (63%) create mode 100644 include/gui/GuiImageAsync.h rename {source => include}/gui/GuiImageData.h (57%) rename {source => include}/gui/GuiParticleImage.h (75%) create mode 100644 include/gui/GuiScrollbar.h create mode 100644 include/gui/GuiSelectBox.h create mode 100644 include/gui/GuiSound.h rename {source => include}/gui/GuiSwitch.h (58%) rename {source => include}/gui/GuiText.h (68%) rename {source => include}/gui/GuiToggle.h (94%) rename {source => include}/gui/GuiTrigger.h (79%) rename {source => include}/gui/VPadController.h (55%) rename {source => include}/gui/WPadController.h (70%) create mode 100644 include/gui/gx2_ext.h create mode 100644 include/gui/sigslot.h rename {source => include}/resources/Resources.h (62%) create mode 100644 include/resources/filelist.h create mode 100644 include/sounds/BufferCircle.hpp rename {source => include}/sounds/Mp3Decoder.hpp (68%) rename {source => include}/sounds/OggDecoder.hpp (75%) create mode 100644 include/sounds/SoundDecoder.hpp rename {source => include}/sounds/SoundHandler.hpp (54%) create mode 100644 include/sounds/Voice.h rename {source => include}/sounds/WavDecoder.hpp (62%) rename {source => include}/video/CVideo.h (70%) rename {source => include}/video/CursorDrawer.h (89%) rename {source => include}/video/shaders/ColorShader.h (71%) rename {source => include}/video/shaders/FXAAShader.h (71%) rename {source => include}/video/shaders/FetchShader.h (70%) create mode 100644 include/video/shaders/PixelShader.h create mode 100644 include/video/shaders/Shader.h rename {source => include}/video/shaders/Shader3D.h (67%) rename {source => include}/video/shaders/ShaderFractalColor.h (67%) rename {source => include}/video/shaders/Texture2DShader.h (66%) create mode 100644 include/video/shaders/VertexShader.h create mode 100644 libgui.layout delete mode 100644 source/gui/GuiButton.h delete mode 100644 source/gui/GuiDragListener.h delete mode 100644 source/gui/GuiElement.h delete mode 100644 source/gui/GuiFrame.h delete mode 100644 source/gui/GuiImageAsync.h delete mode 100644 source/gui/GuiScrollbar.h delete mode 100644 source/gui/GuiSelectBox.h delete mode 100644 source/gui/GuiSound.h delete mode 100644 source/gui/sigslot.h delete mode 100644 source/resources/filelist.h delete mode 100644 source/sounds/BufferCircle.hpp delete mode 100644 source/sounds/SoundDecoder.hpp delete mode 100644 source/sounds/Voice.h delete mode 100644 source/video/shaders/PixelShader.h delete mode 100644 source/video/shaders/Shader.h delete mode 100644 source/video/shaders/VertexShader.h diff --git a/.gitignore b/.gitignore index 6afae90..53b12f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +build/* release/* libgui.cbp \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 0370289..5077e58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,14 +6,14 @@ dist: trusty env: global: - - DEVKITPRO=/opt/devkitpro + - DEVKITPRO=/opt/devkitpro + - WUT_ROOT=/opt/devkitpro/wut - DEVKITPPC=/opt/devkitpro/devkitPPC - PORTLIBREPOS=$HOME/portlibrepos cache: directories: - "$HOME/.local" - - "$PORTLIBREPOS" - "$DEVKITPRO" addons: @@ -27,17 +27,23 @@ before_install: - 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/dynamic_libs.git -b lib && (7z x -y ./dynamic_libs/libs/portlibs.zip -o${DEVKITPRO})) || (cd dynamic_libs && git pull)) - - (git clone https://github.com/Maschell/libutils.git || (cd libutils && git pull)) - - (cd dynamic_libs && ((make -j8 | grep -c "built ... ") && make install && echo "installed" ) || (echo "no need for make install" && make)) - - (cd libutils && ((make -j8 | grep -c "built ... ") && make install && echo "installed" ) || (echo "no need for make install" && make)) + - 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: - - make && make install \ No newline at end of file + - 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 new file mode 100644 index 0000000..9c8d753 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.2) +project(gui) +include("${WUT_ROOT}/share/wut.cmake" REQUIRED) + +file(GLOB_RECURSE SOURCE_FILES *.c *.cpp) +file(GLOB_RECURSE HEADER_FILES *.h*) + +add_library(gui STATIC ${SOURCE_FILES} ${HEADER_FILES}) + +target_link_libraries(gui + utilswut) + + +include_directories("$ENV{WUT_ROOT}/include/libutils" REQUIRED) +include_directories("$ENV{DEVKITPRO}/portlibs/ppc/include" REQUIRED) +include_directories("$ENV{DEVKITPRO}/portlibs/ppc/include/freetype2" REQUIRED) + +target_include_directories(gui PUBLIC "include") +target_include_directories(gui PRIVATE "src") + +wut_enable_stdcpp(gui) +wut_default_malloc(gui) + +target_include_directories(gui PUBLIC "include") +target_compile_options(gui PUBLIC "-D__LOGGING__") + +install(TARGETS gui + ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib") +install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ + DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libgui" + FILES_MATCHING PATTERN "*.h*") \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 4a84f10..0000000 --- a/Makefile +++ /dev/null @@ -1,151 +0,0 @@ -DO_LOGGING := 0 - -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- -ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC) -endif - -export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH) -export PORTLIBS := $(DEVKITPRO)/portlibs/ppc - -PREFIX := powerpc-eabi- - -export AS := $(PREFIX)as -export CC := $(PREFIX)gcc -export CXX := $(PREFIX)g++ -export AR := $(PREFIX)ar -export OBJCOPY := $(PREFIX)objcopy - -include $(DEVKITPPC)/base_rules - -#--------------------------------------------------------------------------------- -# BUILD is the directory where object files & intermediate files will be placed -# SOURCES is a list of directories containing source code -# INCLUDES is a list of directories containing extra header files -# DATA is a list of directories containing binary files -# LIBDIR is where the built library will be placed -# all directories are relative to this makefile -#--------------------------------------------------------------------------------- -BUILD ?= release -SOURCES := source \ - source/gui \ - source/resources \ - source/sounds \ - source/video \ - source/video/shaders -INCLUDES := source \ - include -DATA := -LIB := lib - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -CFLAGS = -g -Os -Wall -D__wiiu__ -D_GNU_SOURCE $(MACHDEP) $(INCLUDE) -CXXFLAGS = $(CFLAGS) - -ifeq ($(DO_LOGGING), 1) - CFLAGS += -D__LOGGING__ - CXXFLAGS += -D__LOGGING__ -endif - -ASFLAGS := -mregnames - -export WIIUBIN := $(LIB)/libgui.a - -#--------------------------------------------------------------------------------- -# any extra libraries we wish to link with the project -#--------------------------------------------------------------------------------- -LIBS := -lutils -ldynamiclibs -lfreetype -lgd -lpng -ljpeg -lz -lmad -lvorbisidec - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := - -#--------------------------------------------------------------------------------- -# 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 DEPSDIR := $(CURDIR)/$(BUILD) - -export INCLUDEDIR := $(PORTLIBS)/include/libgui - -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))) -SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) -BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) - - -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) $(sFILES:.s=.o) - -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) -I$(LIBOGC_INC) \ - -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \ - -I$(PORTLIBS)/include/freetype2 -I$(PORTLIBS)/include/libutils - -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) $(PORTLIBS)/lib - -.PHONY: $(BUILD) clean - -#--------------------------------------------------------------------------------- -$(BUILD): - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile - -#--------------------------------------------------------------------------------- -clean: - @echo clean ... - @rm -fr debug release $(LIB) include - -all: $(WIIUBIN) - -install: - @cp $(BUILD)/lib/libgui.a $(PORTLIBS)/lib - @mkdir -p $(INCLUDEDIR)/gui/ - @mkdir -p $(INCLUDEDIR)/resources/ - @mkdir -p $(INCLUDEDIR)/sounds/ - @mkdir -p $(INCLUDEDIR)/video/shaders - @cp source/gui/*.h $(INCLUDEDIR)/gui/ - @cp source/resources/*.h $(INCLUDEDIR)/resources/ - @cp source/sounds/*.h $(INCLUDEDIR)/sounds/ - @cp source/sounds/*.hpp $(INCLUDEDIR)/sounds/ - @cp source/video/*.h $(INCLUDEDIR)/video/ - @cp source/video/shaders/*.h $(INCLUDEDIR)/video/shaders/ - -#--------------------------------------------------------------------------------- -else - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- -$(WIIUBIN) : $(OFILES) $(LIB) - @rm -f "$(WIIUBIN)" - @$(AR) rcs "$(WIIUBIN)" $(OFILES) - @echo built ... $(notdir $@) - - -$(LIB): - mkdir $(LIB) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------------- - diff --git a/README.md b/README.md index 14fca0d..07addaa 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,26 @@ # libgui -[![Build Status](https://travis-ci.org/Maschell/libgui.svg?branch=master)](https://travis-ci.org/Maschell/libgui) +[![Build Status](https://travis-ci.org/Maschell/libgui.svg?branch=wut)](https://travis-ci.org/Maschell/libgui/tree/wut) ## Usage Following steps are required for initialization: ```C -InitOSFunctionPointers(); // Load OS functions -InitPadScoreFunctionPointers(); -InitVPadFunctionPointers(); // Input functions for GUI control -InitFSFunctionPointers(); // To load file from the SD Card -InitGX2FunctionPointers(); // For rendering -InitAXFunctionPointers(); // For sound - -mount_sd_fat("sd"); // Mounting the SD Card memoryInitialize(); // Initialize memory management //DO GUI STUFF HERE! memoryRelease(); -unmount_sd_fat("sd"); ``` Link the application with: ```Makefile --lgui -lutils -ldynamiclibs -lfreetype -lgd -lpng -ljpeg -lz -lmad -lvorbisidec +-lgui -lutilswut -lfreetype -lgd -lpng -ljpeg -lz -lmad -lvorbisidec ``` You also need to add the include path to your Makefile. Example: ```Makefile export INCLUDE := [...] -I$(PORTLIBS)/include/freetype2 \ - -I$(PORTLIBS)/include/libgui \ + -I$(WUT_ROOT)/include/libgui \ -I$(PORTLIBS)/include ``` @@ -39,10 +30,11 @@ TODO: provide more information To be able to use libgui, you need to install the following dependencies: - Application needs to be loaded from the [homebrew_launcher](https://github.com/dimok789/homebrew_launcher) -- [libutils](https://github.com/Maschell/libutils) for common functions. -- [dynamic_libs](https://github.com/Maschell/dynamic_libs/tree/lib) for access to the functions. +- [libutils](https://github.com/Maschell/libutils/tree/wut) (WUT branch) for common functions. +- [wut](https://github.com/decaf-emu/wut) -And other portable libraries that can be found in the "libs" folder of this repository. Extract the "portlibs.zip" into your devkitPro directory. +And other portable libraries that can be found in the "libs" folder of this repository. Extract the "portlibs.zip" into your devkitPro directory. +`7z x -y ./libs/portlibs.zip -o${DEVKITPRO}` This package includes: - freetype2 diff --git a/source/gui/FreeTypeGX.h b/include/gui/FreeTypeGX.h similarity index 59% rename from source/gui/FreeTypeGX.h rename to include/gui/FreeTypeGX.h index b93341d..49170d3 100644 --- a/source/gui/FreeTypeGX.h +++ b/include/gui/FreeTypeGX.h @@ -34,17 +34,20 @@ #include #include + +#include + +#include +#include + #include #include -#include - /*! \struct ftgxCharData_ * * Font face character glyph relevant data structure. */ -typedef struct ftgxCharData_ -{ +typedef struct ftgxCharData_ { int16_t renderOffsetX; /**< Texture X axis bearing offset. */ uint16_t glyphAdvanceX; /**< Character glyph X coordinate advance in pixels. */ uint16_t glyphAdvanceY; /**< Character glyph Y coordinate advance in pixels. */ @@ -61,8 +64,7 @@ typedef struct ftgxCharData_ * * Offset structure which hold both a maximum and minimum value. */ -typedef struct ftgxDataOffset_ -{ +typedef struct ftgxDataOffset_ { int16_t ascender; /**< Maximum data offset. */ int16_t descender; /**< Minimum data offset. */ int16_t max; /**< Maximum data offset. */ @@ -93,7 +95,9 @@ typedef struct ftgxDataOffset_ ftgxDataOffset; #define FTGX_STYLE_MASK 0xf000 /**< Constant color value used only to sanitize Doxygen documentation. */ -static const GX2ColorF32 ftgxWhite = (GX2ColorF32){ 1.0f, 1.0f, 1.0f, 1.0f }; +static const GX2ColorF32 ftgxWhite = (GX2ColorF32) { + 1.0f, 1.0f, 1.0f, 1.0f +}; //! forward declaration @@ -108,48 +112,46 @@ class CVideo; * a specified texture format. Rendering of the data to the EFB is accomplished through the application of high performance * GX texture functions resulting in high throughput of string rendering. */ -class FreeTypeGX -{ - private: - FT_Library ftLibrary; /**< FreeType FT_Library instance. */ - FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */ - int16_t ftPointSize; /**< Current set size of the rendered font. */ - bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */ - uint8_t vertexIndex; /**< Vertex format descriptor index. */ - GX2Sampler ftSampler; +class FreeTypeGX { +private: + FT_Library ftLibrary; /**< FreeType FT_Library instance. */ + FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */ + int16_t ftPointSize; /**< Current set size of the rendered font. */ + bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */ + uint8_t vertexIndex; /**< Vertex format descriptor index. */ + GX2Sampler ftSampler; - typedef struct _ftGX2Data - { - ftgxDataOffset ftgxAlign; - std::map ftgxCharMap; - } ftGX2Data; + typedef struct _ftGX2Data { + ftgxDataOffset ftgxAlign; + std::map ftgxCharMap; + } ftGX2Data; - std::map fontData; /**< Map which holds the glyph data structures for the corresponding characters in one size. */ + std::map fontData; /**< Map which holds the glyph data structures for the corresponding characters in one size. */ - int16_t getStyleOffsetWidth(uint16_t width, uint16_t format); - int16_t getStyleOffsetHeight(int16_t format, uint16_t pixelSize); + int16_t getStyleOffsetWidth(uint16_t width, uint16_t format); + int16_t getStyleOffsetHeight(int16_t format, uint16_t pixelSize); - void unloadFont(); - ftgxCharData *cacheGlyphData(wchar_t charCode, int16_t pixelSize); - uint16_t cacheGlyphDataComplete(int16_t pixelSize); - void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData); + void unloadFont(); + ftgxCharData *cacheGlyphData(wchar_t charCode, int16_t pixelSize); + uint16_t cacheGlyphDataComplete(int16_t pixelSize); + void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData); - void copyTextureToFramebuffer(CVideo * pVideo, GX2Texture *tex, int16_t screenX, int16_t screenY, int16_t screenZ, const glm::vec4 & color, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale); + void copyTextureToFramebuffer(CVideo * pVideo, GX2Texture *tex, int16_t screenX, int16_t screenY, int16_t screenZ, const glm::vec4 & color, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale); - public: - FreeTypeGX(const uint8_t* fontBuffer, FT_Long bufferSize, bool lastFace = false); - ~FreeTypeGX(); +public: + FreeTypeGX(const uint8_t* fontBuffer, FT_Long bufferSize, bool lastFace = false); + ~FreeTypeGX(); - uint16_t drawText(CVideo * pVideo, int16_t x, int16_t y, int16_t z, const wchar_t *text, int16_t pixelSize, const glm::vec4 & color, - uint16_t textStyling, uint16_t textWidth, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale); + uint16_t drawText(CVideo * pVideo, int16_t x, int16_t y, int16_t z, const wchar_t *text, int16_t pixelSize, const glm::vec4 & color, + uint16_t textStyling, uint16_t textWidth, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale); - uint16_t getWidth(const wchar_t *text, int16_t pixelSize); - uint16_t getCharWidth(const wchar_t wChar, int16_t pixelSize, const wchar_t prevChar = 0x0000); - uint16_t getHeight(const wchar_t *text, int16_t pixelSize); - void getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widthLimit = 0); + uint16_t getWidth(const wchar_t *text, int16_t pixelSize); + uint16_t getCharWidth(const wchar_t wChar, int16_t pixelSize, const wchar_t prevChar = 0x0000); + uint16_t getHeight(const wchar_t *text, int16_t pixelSize); + void getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widthLimit = 0); - static wchar_t* charToWideChar(const char* p); - static char* wideCharToUTF8(const wchar_t* strChar); + static wchar_t* charToWideChar(const char* p); + static char* wideCharToUTF8(const wchar_t* strChar); }; #endif /* FREETYPEGX_H_ */ diff --git a/source/gui/GameBgImage.h b/include/gui/GameBgImage.h similarity index 77% rename from source/gui/GameBgImage.h rename to include/gui/GameBgImage.h index a78b715..f778d1a 100644 --- a/source/gui/GameBgImage.h +++ b/include/gui/GameBgImage.h @@ -1,11 +1,10 @@ #ifndef _GAME_BG_IMAGE_H_ #define _GAME_BG_IMAGE_H_ -#include "GuiImageAsync.h" -#include "video/shaders/Shader3D.h" +#include +#include