160 lines
5.9 KiB
Plaintext
160 lines
5.9 KiB
Plaintext
/\ +--------------------------------------------------------------+
|
|
____/ \____ /| - zlib/MIT/Unlicenced game framework licensed to freely use, |
|
|
\ / / | copy, modify and sell without restriction |
|
|
+--\ ^__^ /--+ | |
|
|
| ~/ \~ | | - originally created at [http://nugget.fun] |
|
|
| ~~~~~~~~~~~~ | +--------------------------------------------------------------+
|
|
| SPACE ~~~~~ | /
|
|
| ~~~~~~~ BOX |/
|
|
+--------------+
|
|
|
|
[SPACE BOX] is a C++ framework that facilitates the creation of SDL + OpenGL projects
|
|
through the use of generic objects that can be used and extended by the programmer. It
|
|
focuses on game projects but its usefulness is not limited to games.
|
|
|
|
The main intention for the project is to make running cross-platform applications easier
|
|
and more immediate by providing a universal tool set that exists as a hidden, extensible
|
|
layer between SDL + OpenGL and the project.
|
|
|
|
An important quality of the framework is it should allow the programmer to start a project
|
|
by extending only a single function, the Game class's update function. Additionally, the
|
|
framework should by default create applications that can be easily exported to many
|
|
platforms (PC, OS/X, Linux, Web GL, Raspberry Pi, and Android) by using a standard
|
|
Makefile.
|
|
|
|
It is in an early, untested state. It comes with a few simple examples that demonstrate
|
|
how in can be used to create interactive graphics programs.
|
|
|
|
################
|
|
# Requirements #
|
|
################
|
|
|
|
The repository includes some external libraries in lib/ that the default Makefile included
|
|
with the demo shows how to compile, but there are other requirements, including external
|
|
libraries that must be linked to a project in order to compile it.
|
|
|
|
* libSDL2 (developed against v2.0.14)
|
|
* libSDL2-image
|
|
* libSDL2-ttf
|
|
* libSDL2-mixer
|
|
* OpenGL/GLES/GLES2
|
|
* compiler that supports C++17
|
|
|
|
###########################
|
|
# Installing Requirements #
|
|
###########################
|
|
|
|
libSDL2, libSDL2-image, libSDL2-ttf, and libSDL2-mixer must be available to link with your
|
|
project, so you can try your package manager's libSDL2 dev packages or build from source.
|
|
The included sdl2-config utility program can be used to generate flags for linking to SDL2
|
|
when it is installed outside of your platform's usual library location.
|
|
|
|
libSDL2
|
|
```````
|
|
- Download from http://libsdl.org/download-2.0.php
|
|
- Run ./configure --prefix=[YOUR LIBRARIES PATH] (I'm using $HOME/local/sdl)
|
|
- Run make && make install
|
|
|
|
libSDL2-image, libSDL2-ttf, libSDL2-mixer
|
|
`````````````````````````````````````````
|
|
- Download from:
|
|
- https://www.libsdl.org/projects/SDL_image/
|
|
- https://www.libsdl.org/projects/SDL_ttf/
|
|
- https://www.libsdl.org/projects/SDL_mixer/
|
|
- Run ./configure --prefix=[YOUR LIB PATH] --with-sdl-prefix=[YOUR SDL PATH]
|
|
- In my case, prefix and SDL prefix are both $HOME/local/sdl
|
|
|
|
OpenGL/GLES/GLES2
|
|
`````````````````
|
|
- Install GL/GLES according to your platform and link to it during compilation. GLEW is
|
|
included in the lib/ folder of this framework and should find GL on your platform if it
|
|
is installed.
|
|
|
|
#########
|
|
# Demos #
|
|
#########
|
|
|
|
The `demo/` folder contains programs that demonstrate and test the capabilities of the
|
|
framework. In order to compile each, you should edit the definitions in the Makefile.
|
|
|
|
cube
|
|
````
|
|
Switch between GL and SDL contexts by pressing spacebar. The GL context draws a textured,
|
|
rotating cube, and the SDL context draws basic geometric shapes and a moving 2D sprite.
|
|
|
|
2d_collision
|
|
````````````
|
|
Test collision detection between a 2D sprite and other 2D sprites and boxes. Per-pixel
|
|
collision can be tested.
|
|
|
|
squircle
|
|
````````
|
|
Map an image from a rectangle to a circle or from a circle to a rectangle using a shader
|
|
program. Based on the elliptical grid mapping equations at:
|
|
|
|
- http://squircular.blogspot.com/2015/09/mapping-circle-to-square.html
|
|
|
|
###################
|
|
# Other libraries #
|
|
###################
|
|
|
|
These are other libraries that have been used in projects that use this framework but
|
|
aren't required by the framework
|
|
|
|
opencv
|
|
``````
|
|
- Download from https://opencv.org/releases/
|
|
- configure (with custom installation path)
|
|
cmake -DCMAKE_INSTALL_PREFIX=$HOME/local/opencv ..
|
|
- make && make install
|
|
|
|
zbar
|
|
````
|
|
- Download from http://zbar.sourceforge.net/download.html
|
|
- configure to only use image processing features (requires imagemagick) and
|
|
choose your installation directory
|
|
./configure --without-gtk --without-python --without-qt --disable-video --prefix=$HOME/local/zbar
|
|
- make && make install
|
|
|
|
########
|
|
# Font #
|
|
########
|
|
|
|
When initializing a Game object, the framework will attempt to load the font file
|
|
"BPmono.ttf" from the project root (where the compiled executable is located). If this
|
|
file isn't found, the program can still run successfully, but the framerate indicator
|
|
(mapped to CTRL+f by default) will be disabled. The repository contains "BPmono.ttf", so
|
|
you can create a symlink to the file in the project root if you want to use the framerate
|
|
indicator.
|
|
|
|
###########
|
|
# License #
|
|
###########
|
|
|
|
The original code for this framework is licensed to freely use, copy, modify and sell,
|
|
without restriction under the zlib license. See LICENSE.txt for details.
|
|
|
|
Included libraries are included under various permissive licenses:
|
|
|
|
- BPmono.ttf is licensed under the Creative Commons Attribution - No Derivative Works 3.0
|
|
license. See LICENSE_BPmono.txt for details.
|
|
|
|
- gif-h is unlicensed, public domain code released under the The Unlicense. See
|
|
lib/gif-h/LICENSE
|
|
|
|
- GLEW is included under a permissive license in lib/glew/LICENSE.txt
|
|
|
|
- GLM is included under the MIT license in lib/glm/LICENSE
|
|
|
|
- nlohmann's json library is included under the MIT license in lib/json/LICENSE.MIT
|
|
|
|
- SDL2 GFX is included under a permissive license in lib/sdl2-gfx/LICENSE
|
|
|
|
- superxbr.cpp is included under the permissive license at the top of lib/superxbr.cpp
|
|
|
|
############
|
|
# Business #
|
|
############
|
|
|
|
egg@shampoo.ooo
|