update doc, travis poging1

This commit is contained in:
wgroeneveld 2018-08-14 09:08:31 +02:00
parent db43d447da
commit 778de89501
7 changed files with 49 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
build/
# Created by https://www.gitignore.io/api/clion,cmake

15
.travis.yml Normal file
View File

@ -0,0 +1,15 @@
language: cpp
compiler: g++
before_install:
# Install a supported cmake version
- wget -O cmake.sh https://cmake.org/files/v3.12/cmake-3.12.1-Linux-x86_64.sh
- sudo sh cmake.sh --skip-license --exclude-subdir --prefix=/usr/local
script:
- mkdir build
- cd build
- cmake -DCMAKE_CXX_COMPILER=$BIN_PATH/clang++ -DCMAKE_INSTALL_PREFIX=./ ../
- cd test
- make
- ./unittest

View File

@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.12)
SET(CMAKE_C_COMPILER arm-none-eabi-gcc)
SET(CMAKE_CXX_COMPILER arm-none-eabi-g++)
SET(CMAKE_OBJCOPY arm-none-eabi-objcopy)
SET(CMAKE_AR arm-none-eabi-ar)
SET(CMAKE_AR arm-none-eabi-ar CACHE FILEPATH "Archiver")
SET(CMAKE_RANLIB arm-none-eabi-ranlib)
SET(BASE_CMAKE_LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")

View File

@ -1,6 +1,8 @@
## A high-level object-oriented Gameboy Advance sprite engine library
![travis build status](https://travis-ci.org/wgroeneveld/gba-sprite-engine.svg?branch=master)
That's a mouthful - let's break that down:
#### High-level object-oriented
@ -117,7 +119,9 @@ Creating sprites is easy with the `SpriteBuilder`. Specify what kind of sprite y
Sample rotation demo 3.
**Sprite animation is built-in**! Just feed your sprite data to the builder and use `.withAnimated(amountOfFrames, frameDelay)`. Remember to position each frame in one column in the image itself (vertically).
**Sprite animation is built-in**! Just feed your sprite data to the builder and use `.withAnimated(amountOfFrames, frameDelay)`. Remember to position each frame in one column in the image itself (vertically). Like this:
![lama gif example](https://github.com/wgroeneveld/gba-sprite-engine/blob/master/demos/demo1-basicfeatures/lama.png?raw=true)
Useful sprite methods:
@ -160,15 +164,34 @@ The engine comes with (some) [Google Test](https://github.com/google/googletest)
### Compiling everything
The project has been developed with CLion. The `.idea` dir is there for you to get started.
#### Prerequirements
1. cmake 3.12.x or higher: the cmake linker toolchain set contains a bug in .11
2. A compiled Google Test 1.8.x or higher with `$GTEST_DIR` env. var
3. The [DevkitPro toolchain](https://devkitpro.org/wiki/Getting_Started) installed in your `$PATH`
4. The [mGBA emulator](https://mgba.io/downloads.html)
#### Compiling with cmake
The project has been developed with CLion. The `.idea` dir is there for you to get started. The project can be imported as a cmake project.
As such, `CMake` was an easy choice. Use the following commands to build everything, including the demos:
1. `mkdir cmake-build-debug && cd cmake-build-debug`
2. `cmake ./../`
3. `make`
The demos will be in `cmake-build-debug/demox/demoname.gba`.
Things you might need to change in `CMakeLists.txt` files:
1. I'm assuming your GBA cross compiler is in your `$PATH`. If it's not, add an absolute path to `SET(CMAKE_C_COMPILER arm-none-eabi-gcc)` etc.
2. The Google Test Library should be compiled from source in some directory. I have mine hardcoded: `SET(GTEST_LIBRARY "/Users/jefklak/CLionProjects/googletest-release-1.8.0/googletest")` so adjust accordinly or exclude the test subproject.
2. I'm assuming your Google Test Library is compiled and in your `$GTEST_DIR` path. If not, add an absolute path to: `SET(GTEST_LIBRARY "/Users/jefklak/CLionProjects/googletest-release-1.8.0/googletest")`.
#### Running unit tests
After compiling, execute the `unittest` main executable:
`./cmake-build-debug/test/unittest`
And hope for exit code 0!

View File

@ -48,8 +48,8 @@ private:
protected:
const void *data;
u32 x, y, priority, dx, dy;
u32 w, h, size_bits, shape_bits;
int x, y, dx, dy;
u32 priority, w, h, size_bits, shape_bits;
bool stayWithinBounds;
u32 imageSize, tileIndex;
SpriteSize spriteSize;

View File

@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.12)
project(Unittest)
enable_testing()
SET(GTEST_LIBRARY "/Users/jefklak/CLionProjects/googletest-release-1.8.0/googletest")
SET(GTEST_LIBRARY "$ENV{GTEST_DIR}")
# reset linker flags; ARM + GTest doesn't work
SET(CMAKE_EXE_LINKER_FLAGS "${BASE_CMAKE_LINK_FLAGS}")

View File

@ -17,12 +17,12 @@ protected:
}
};
class SomeScene : public scene {
class SomeScene : public Scene {
private:
std::unique_ptr<Sprite> someSprite1;
std::unique_ptr<Sprite> someSprite2;
public:
SomeScene() : scene(nullptr) { };
SomeScene() : Scene(nullptr) { };
std::vector<Sprite *> sprites() override {
return {
someSprite1.get(), someSprite2.get()