diff --git a/README.md b/README.md index 2e7f27d..1b02a50 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,9 @@ There is no function to convert between `bopti_image_t` and `img_t`. Both types * If the image needs to be read or transformed, use libimg. Set the fxconv parameters of the resource to `type:libimg-image` and declare it as `extern img_t myimage`. * Otherwise, bopti should be used for maximum performance. Set the fxconv parameters to `type:bopti_image` and declare it as `extern bopti_image_t myimage`. -## Installing libimg with GiteaPC +## Installing and using libimg in a program + +**Installing with GiteaPC** libimg can be installed with [GiteaPC](https://gitea.planet-casio.com/Lephenixnoir/GiteaPC), a tool designed to automate library maintenance in the fxSDK. @@ -34,7 +36,7 @@ libimg can be installed with [GiteaPC](https://gitea.planet-casio.com/Lephenixno % giteapc install Lephenixnoir/libimg ``` -## Compiling and installing libimg manually +**Installing manually** libimg should be built with the [fxSDK](/Lephenixnoir/fxsdk), which provides the tools and settings needed to compile for the calculator. @@ -48,12 +50,33 @@ Additionally, this repository has a simple testing system for Linux in the `test * Use `make` from that folder to compile `main.c` into a `libimg` executable that reads RGB565 bitmap files into `img_t` images and performs a few transforms. * Use `make all` to also run it to generate the `transform.png` file that is shown at the top of this README (uses ImageMagick's `convert` to get the PNG). +**Using in a CMake-based add-in** + +Find the `LibImg` package, then link against `LibImg::LibImg`. You should request the same version for gint and libimg. + +```cmake +find_package(LibImg 2.1 REQUIRED) +target_link_libraries( LibImg::LibImg) +``` + +**Using in a Makefile-based add-in** + +Link with `-limg-fx` on fx-9860G and `-limg-cg` on fx-CG 50. In `project.cfg`: + +```makefile +LIBS_FX := -limg-fx +LIBS_CG := -limg-cg +``` + ## Converting images and rendering to VRAM -The first step to use libimg in a calculator program is to convert assets to the `img_t` format. This is done by setting the `type` parameter of the resource to `libimg-image`. For example: +The first step to use libimg in a calculator program is to convert assets to the `img_t` format. This is done by setting the `type` parameter of the resource to `libimg-image`. When using `fxconv-metadata.txt`, this would look like this: -```c -IMG.sprite.png = type:libimg-image name:sprite +``` +sprite.png: + type: libimg-image + name: sprite + # etc ``` Then the newly-converted image can be accessed from a C program by extern-declaring it as any other fxconv resource. It is ready to use immediately. The definition of `img_t` and the libimg functions are provided by ``, which needs to be included.