mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-21 14:32:20 +00:00
Compare commits
11 commits
507186821c
...
b1fdc58bed
Author | SHA1 | Date | |
---|---|---|---|
|
b1fdc58bed | ||
|
1b5e30cb51 | ||
|
ef1a5a1350 | ||
|
b8bf87f9e8 | ||
|
b1d7144ad2 | ||
|
1510e5326b | ||
|
f80bf532ff | ||
|
ffb08c5764 | ||
|
35ddfba78a | ||
|
da0423c76d | ||
|
013da78dde |
15 changed files with 222 additions and 27 deletions
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
@ -17,9 +17,9 @@ jobs:
|
||||||
|
|
||||||
- name: Build library and examples
|
- name: Build library and examples
|
||||||
run: |
|
run: |
|
||||||
(cd GRRLIB && make clean all install)
|
make -C GRRLIB clean all install
|
||||||
(cd GRRLIB/GRRLIB && make PLATFORM=cube clean all install)
|
make -C GRRLIB/GRRLIB PLATFORM=cube clean all install
|
||||||
(cd examples && make)
|
make -C examples
|
||||||
|
|
||||||
- uses: actions/upload-artifact@master
|
- uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
|
|
2
.github/workflows/doc.yml
vendored
2
.github/workflows/doc.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install doxygen
|
- name: Install doxygen
|
||||||
run: |
|
run: |
|
||||||
wget https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz -O - | tar -xzv --directory=/tmp/
|
wget https://www.doxygen.nl/files/doxygen-1.12.0.linux.bin.tar.gz -O - | tar -xzv --directory=/tmp/
|
||||||
cd /tmp/doxygen-*
|
cd /tmp/doxygen-*
|
||||||
sudo make install
|
sudo make install
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
|
@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## [Unreleased][]
|
## [Unreleased][]
|
||||||
|
|
||||||
|
- Allow compilation and installation with cmake.
|
||||||
- Added `GRRLIB_CreateEmptyTextureFmt()` to create an empty texture with a given format.
|
- Added `GRRLIB_CreateEmptyTextureFmt()` to create an empty texture with a given format.
|
||||||
|
|
||||||
## [4.5.1][] - 2024-03-02
|
## [4.5.1][] - 2024-03-02
|
||||||
|
|
66
CMakeLists.txt
Normal file
66
CMakeLists.txt
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
cmake_minimum_required(VERSION 3.18)
|
||||||
|
project(grrlib)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
|
pkg_check_modules(PNG REQUIRED libpng)
|
||||||
|
pkg_check_modules(FREETYPE REQUIRED freetype2)
|
||||||
|
pkg_check_modules(JPEG REQUIRED libjpeg)
|
||||||
|
|
||||||
|
add_library(pngu STATIC)
|
||||||
|
|
||||||
|
target_sources(pngu
|
||||||
|
PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/lib/pngu/pngu.c"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(pngu
|
||||||
|
PUBLIC
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/lib/pngu>"
|
||||||
|
PRIVATE
|
||||||
|
${PNG_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(pngu PUBLIC
|
||||||
|
${PNG_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(grrlib STATIC)
|
||||||
|
|
||||||
|
target_compile_options(grrlib
|
||||||
|
PRIVATE
|
||||||
|
-Wall
|
||||||
|
-Wshadow
|
||||||
|
-Wunused
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE GRRLIB_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/GRRLIB/*.c")
|
||||||
|
target_sources(grrlib
|
||||||
|
PRIVATE
|
||||||
|
"${GRRLIB_SRC_FILES}"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(grrlib
|
||||||
|
PUBLIC
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/GRRLIB>"
|
||||||
|
PRIVATE
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/GRRLIB/grrlib>"
|
||||||
|
${FREETYPE_INCLUDE_DIRS}
|
||||||
|
${JPEG_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(grrlib PUBLIC
|
||||||
|
pngu
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/GRRLIB/"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
FILES_MATCHING PATTERN "*.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS pngu grrlib
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
|
@ -28,6 +28,64 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include <grrlib.h>
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
#define TPL_HDR_VERSION_FIELD 0 /**< Version field. */
|
||||||
|
#define TPL_HDR_NTEXTURE_FIELD 4 /**< Textrure field. */
|
||||||
|
#define TPL_HDR_HDRSIZE_FIELD 8 /**< Header size field. */
|
||||||
|
#define TPL_HDR_DESCR_FIELD 12 /**< Descriptor field. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Texture header.
|
||||||
|
*/
|
||||||
|
typedef struct _tplimgheader TPLImgHeader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Texture header.
|
||||||
|
*/
|
||||||
|
struct _tplimgheader {
|
||||||
|
u16 height; /**< Height of the texture in pixels. */
|
||||||
|
u16 width; /**< Width of the texture in pixels. */
|
||||||
|
u32 fmt; /**< Format of the texture. */
|
||||||
|
void *data; /**< Pointer to the texture data. */
|
||||||
|
u32 wraps; /**< Texture coordinate wrapping strategy in the S direction. */
|
||||||
|
u32 wrapt; /**< Texture coordinate wrapping strategy in the T direction. */
|
||||||
|
u32 minfilter; /**< Filter mode when the texel/pixel ratio is ≤ 1.0. */
|
||||||
|
u32 magfilter; /**< Filter mode when the texel/pixel ratio is > 1.0. */
|
||||||
|
f32 lodbias; /**< LOD bias. */
|
||||||
|
u8 edgelod; /**< Edge LOD. */
|
||||||
|
u8 minlod; /**< Minimum LOD value. */
|
||||||
|
u8 maxlod; /**< Maximum LOD value. */
|
||||||
|
u8 unpacked; /**< Internal flag. */
|
||||||
|
} ATTRIBUTE_PACKED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Texture palette header.
|
||||||
|
*/
|
||||||
|
typedef struct _tplpalheader TPLPalHeader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Texture palette header.
|
||||||
|
*/
|
||||||
|
struct _tplpalheader {
|
||||||
|
u16 nitems; /**< Number of palette entries. */
|
||||||
|
u8 unpacked; /**< Internal flag. */
|
||||||
|
u8 pad; /**< Padding. */
|
||||||
|
u32 fmt; /**< Format of the color lookup table (CLUT). */
|
||||||
|
void *data; /**< Pointer to the color lookup table (CLUT) data. */
|
||||||
|
} ATTRIBUTE_PACKED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Texture descriptor.
|
||||||
|
*/
|
||||||
|
typedef struct _tpldesc TPLDescHeader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Texture descriptor.
|
||||||
|
*/
|
||||||
|
struct _tpldesc {
|
||||||
|
TPLImgHeader *imghead; /**< Pointer to texture header structure. */
|
||||||
|
TPLPalHeader *palhead; /**< Pointer to color lookup table (CLUT) header. */
|
||||||
|
} ATTRIBUTE_PACKED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This structure contains information about the type, size, and layout of a file that containing a device-independent bitmap (DIB).
|
* This structure contains information about the type, size, and layout of a file that containing a device-independent bitmap (DIB).
|
||||||
*/
|
*/
|
||||||
|
@ -143,6 +201,44 @@ GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const u32 width, const u32 height)
|
||||||
return GRRLIB_CreateEmptyTextureFmt(width, height, GX_TF_RGBA8);
|
return GRRLIB_CreateEmptyTextureFmt(width, height, GX_TF_RGBA8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TPL data to a GRRLIB_texImg structure.
|
||||||
|
* @param my_tpl The TPL buffer to set.
|
||||||
|
* @param size Size of the TPL buffer to set.
|
||||||
|
* @return A GRRLIB_texImg structure filled with image information.
|
||||||
|
*/
|
||||||
|
GRRLIB_texImg* GRRLIB_LoadTextureTPL (const u8 *my_tpl, const int size, u32 id) {
|
||||||
|
if(my_tpl == NULL || size <= 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const u32 ntextures = *(u32*)(my_tpl + TPL_HDR_NTEXTURE_FIELD);
|
||||||
|
if(id > ntextures) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GRRLIB_texImg *my_texture = calloc(1, sizeof(GRRLIB_texImg));
|
||||||
|
if (my_texture == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TPLDescHeader *deschead = (TPLDescHeader*)(my_tpl + TPL_HDR_DESCR_FIELD);
|
||||||
|
|
||||||
|
u32 pos = (u32)deschead[id].imghead;
|
||||||
|
const TPLImgHeader *imghead = (TPLImgHeader*)(my_tpl + pos);
|
||||||
|
|
||||||
|
pos = (u32)imghead->data;
|
||||||
|
my_texture->data = (u8*)(my_tpl + pos);
|
||||||
|
my_texture->w = imghead->width;
|
||||||
|
my_texture->h = imghead->height;
|
||||||
|
my_texture->format = imghead->fmt;
|
||||||
|
my_texture->freedata = true;
|
||||||
|
GRRLIB_SetHandle( my_texture, 0, 0 );
|
||||||
|
GRRLIB_FlushTex( my_texture );
|
||||||
|
|
||||||
|
return my_texture;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a texture from a buffer.
|
* Load a texture from a buffer.
|
||||||
* @param my_img The JPEG, PNG or Bitmap buffer to load.
|
* @param my_img The JPEG, PNG or Bitmap buffer to load.
|
||||||
|
|
|
@ -123,6 +123,7 @@ typedef struct GRRLIB_texImg {
|
||||||
f32 ofnormaltexy;/**< Offset of normalized texture on y. */
|
f32 ofnormaltexy;/**< Offset of normalized texture on y. */
|
||||||
|
|
||||||
void *data; /**< Pointer to the texture data. */
|
void *data; /**< Pointer to the texture data. */
|
||||||
|
bool freedata; /**< Should the data be freed. */
|
||||||
} GRRLIB_texImg;
|
} GRRLIB_texImg;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
@ -142,6 +142,7 @@ GRRLIB_texImg* GRRLIB_LoadTexturePNG (const u8 *my_png);
|
||||||
GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg);
|
GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg);
|
||||||
GRRLIB_texImg* GRRLIB_LoadTextureJPGEx (const u8 *my_jpg, const u32 my_size);
|
GRRLIB_texImg* GRRLIB_LoadTextureJPGEx (const u8 *my_jpg, const u32 my_size);
|
||||||
GRRLIB_texImg* GRRLIB_LoadTextureBMP (const u8 *my_bmp);
|
GRRLIB_texImg* GRRLIB_LoadTextureBMP (const u8 *my_bmp);
|
||||||
|
GRRLIB_texImg* GRRLIB_LoadTextureTPL (const u8 *my_tpl, const int size, u32 id);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// GRRLIB_gecko.c - USB_Gecko output facilities
|
// GRRLIB_gecko.c - USB_Gecko output facilities
|
||||||
|
|
|
@ -49,7 +49,7 @@ void GRRLIB_FreeTexture (GRRLIB_texImg *tex) {
|
||||||
if(tex == NULL) {
|
if(tex == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tex->data != NULL) {
|
if (tex->data != NULL && tex->freedata == true) {
|
||||||
free(tex->data);
|
free(tex->data);
|
||||||
}
|
}
|
||||||
free(tex);
|
free(tex);
|
||||||
|
@ -61,7 +61,7 @@ void GRRLIB_FreeTexture (GRRLIB_texImg *tex) {
|
||||||
*/
|
*/
|
||||||
INLINE
|
INLINE
|
||||||
void GRRLIB_ClearTex(GRRLIB_texImg* tex) {
|
void GRRLIB_ClearTex(GRRLIB_texImg* tex) {
|
||||||
if(tex == NULL) {
|
if(tex == NULL || tex->freedata == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(tex->data, 0, GX_GetTexBufferSize(tex->w, tex->h, tex->format, 0, 0));
|
memset(tex->data, 0, GX_GetTexBufferSize(tex->w, tex->h, tex->format, 0, 0));
|
||||||
|
|
43
README.md
43
README.md
|
@ -82,14 +82,31 @@ libjpeg is supplied via devkitPro pacman (ppc-libjpeg-turbo)
|
||||||
libfat is supplied via devkitPro pacman (libfat-ogc)
|
libfat is supplied via devkitPro pacman (libfat-ogc)
|
||||||
```
|
```
|
||||||
|
|
||||||
The easy way is to install GRRLIB and all the required libraries with a few
|
First, you need to make sure that all required library dependencies are installed.
|
||||||
commands:
|
Install them with a single command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
|
||||||
|
```
|
||||||
|
|
||||||
|
Go to the directory where the code was downloaded:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
c:
|
c:
|
||||||
cd \grr\GRRLIB
|
cd \grr
|
||||||
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
|
```
|
||||||
make clean all install
|
|
||||||
|
To install GRRLIB with Make in a single command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make -C GRRLIB clean all install
|
||||||
|
```
|
||||||
|
|
||||||
|
If you prefer to use CMake, it can also be installed with a few commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/opt/devkitpro/portlibs/wii/bin/powerpc-eabi-cmake -B build
|
||||||
|
cmake --build build --target install
|
||||||
```
|
```
|
||||||
|
|
||||||
This process may take some time depending on the speed of your PC.
|
This process may take some time depending on the speed of your PC.
|
||||||
|
@ -97,36 +114,26 @@ This process may take some time depending on the speed of your PC.
|
||||||
If you used the method above the following steps are not required, GRRLIB is
|
If you used the method above the following steps are not required, GRRLIB is
|
||||||
installed and you are ready to start developing Wii homebrew games.
|
installed and you are ready to start developing Wii homebrew games.
|
||||||
|
|
||||||
If you want, you could install the libfat, libpng,
|
|
||||||
libfreetype and libjpeg with there dependencies in a single command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
|
|
||||||
```
|
|
||||||
|
|
||||||
Each library could also be installed individually:
|
Each library could also be installed individually:
|
||||||
|
|
||||||
To install libpngu:
|
To install libpngu:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
c:
|
cd GRRLIB\lib\pngu
|
||||||
cd \grr\GRRLIB\lib\pngu
|
|
||||||
make clean all install
|
make clean all install
|
||||||
```
|
```
|
||||||
|
|
||||||
To install libgrrlib for Wii:
|
To install libgrrlib for Wii:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
c:
|
cd GRRLIB\GRRLIB
|
||||||
cd \grr\GRRLIB\GRRLIB
|
|
||||||
make clean all install
|
make clean all install
|
||||||
```
|
```
|
||||||
|
|
||||||
To install libgrrlib for GameCube:
|
To install libgrrlib for GameCube:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
c:
|
cd GRRLIB\GRRLIB
|
||||||
cd \grr\GRRLIB\GRRLIB
|
|
||||||
make PLATFORM=cube clean all install
|
make PLATFORM=cube clean all install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ TARGET := $(notdir $(CURDIR))
|
||||||
BUILD := build
|
BUILD := build
|
||||||
SOURCES := source
|
SOURCES := source
|
||||||
DATA := data
|
DATA := data
|
||||||
|
TEXTURES := textures
|
||||||
INCLUDES :=
|
INCLUDES :=
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -51,7 +52,8 @@ ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
|
@ -63,6 +65,8 @@ CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||||
|
SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
|
||||||
|
TPLFILES := $(SCFFILES:.scf=.tpl)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
@ -73,11 +77,11 @@ else
|
||||||
export LD := $(CXX)
|
export LD := $(CXX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
|
||||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
|
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
|
||||||
|
|
||||||
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# build a list of include paths
|
# build a list of include paths
|
||||||
|
@ -155,6 +159,12 @@ $(OFILES_SOURCES) : $(HFILES)
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
$(bin2o)
|
$(bin2o)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.tpl.o %_tpl.h : %.tpl
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
-include $(DEPENDS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include "ocean_bmf.h"
|
#include "ocean_bmf.h"
|
||||||
#include "frontal_bmf.h"
|
#include "frontal_bmf.h"
|
||||||
|
|
||||||
|
#include "textures_tpl.h"
|
||||||
|
#include "textures.h"
|
||||||
|
|
||||||
// Tile stuff
|
// Tile stuff
|
||||||
#define TILE_DELAY 10
|
#define TILE_DELAY 10
|
||||||
#define TILE_UP 12 * 0
|
#define TILE_UP 12 * 0
|
||||||
|
@ -91,6 +94,10 @@ int main() {
|
||||||
GRRLIB_texImg *tex_BMfont5 = GRRLIB_LoadTexture(BMfont5_png);
|
GRRLIB_texImg *tex_BMfont5 = GRRLIB_LoadTexture(BMfont5_png);
|
||||||
GRRLIB_InitTileSet(tex_BMfont5, 8, 16, 0);
|
GRRLIB_InitTileSet(tex_BMfont5, 8, 16, 0);
|
||||||
|
|
||||||
|
GRRLIB_texImg *tex_test_tpl1 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, ballsprites);
|
||||||
|
GRRLIB_texImg *tex_test_tpl2 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, pirate);
|
||||||
|
GRRLIB_texImg *tex_test_tpl3 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, girl);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
WPAD_SetVRes(0, 640, 480);
|
WPAD_SetVRes(0, 640, 480);
|
||||||
WPAD_ScanPads();
|
WPAD_ScanPads();
|
||||||
|
@ -109,6 +116,9 @@ int main() {
|
||||||
GRRLIB_DrawImg(10, 50, tex_test_jpg, 0, 1, 1, GRRLIB_WHITE); // Draw a jpeg
|
GRRLIB_DrawImg(10, 50, tex_test_jpg, 0, 1, 1, GRRLIB_WHITE); // Draw a jpeg
|
||||||
GRRLIB_DrawImg(350, 50, tex_test_bmp, 0, 4, 4, GRRLIB_WHITE); // Draw a bitmap
|
GRRLIB_DrawImg(350, 50, tex_test_bmp, 0, 4, 4, GRRLIB_WHITE); // Draw a bitmap
|
||||||
|
|
||||||
|
GRRLIB_DrawImg(400, 200, tex_test_tpl1, 0, 2, 2, GRRLIB_WHITE); // Draw a TPL
|
||||||
|
GRRLIB_DrawImg(100, 200, tex_test_tpl3, 0, 1, 1, GRRLIB_WHITE); // Draw a TPL
|
||||||
|
|
||||||
// Draw a sprite
|
// Draw a sprite
|
||||||
GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee
|
GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee
|
||||||
GRRLIB_DrawTile(320+left, 240+top, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, frame);
|
GRRLIB_DrawTile(320+left, 240+top, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, frame);
|
||||||
|
|
BIN
examples/basic_drawing/textures/ballsprites.png
Normal file
BIN
examples/basic_drawing/textures/ballsprites.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
BIN
examples/basic_drawing/textures/girl.png
Normal file
BIN
examples/basic_drawing/textures/girl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 154 KiB |
BIN
examples/basic_drawing/textures/pirate.png
Normal file
BIN
examples/basic_drawing/textures/pirate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
3
examples/basic_drawing/textures/textures.scf
Normal file
3
examples/basic_drawing/textures/textures.scf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<filepath="ballsprites.png" id="ballsprites" colfmt=6 />
|
||||||
|
<filepath="pirate.png" id="pirate" colfmt=6 />
|
||||||
|
<filepath="girl.png" id="girl" colfmt=5 />
|
Loading…
Reference in a new issue