/xd

A simple framework for OpenGL 3.x projects.

Primary LanguageC++

XD is a framework/library specifically aimed for writing games, and hence goes beyond most multimedia libraries like SDL and
SFML and provides you tools that makes writing games easier and faster.

It is cross-platform and is developed on Windows and OS X, but it'll also compile on variety of UNIX systems. The officially
supported platforms will at least be Windows, OS X and Linux. Due to the modular design of the framework you can easily just
use parts of the framework if you don't need the whole thing.

XD is written in C++11, but only uses C++11 features that are available in recent major compilers. Currently the code is
being tested on Visual C++ 2011, LLVM Clang 3.0 and G++ 4.6. Some features such as variadic templates are used when
available, but alternative code is provided for platforms that do not yet support them.

For graphics XD uses OpenGL. It is designed towards the new programmable OpenGL 3.x API, and does not use the deprecated
fixed-function OpenGL API. However XD does not require OpenGL 3, you can use it with OpenGL 2 applications as well. However
some features of the framework might require features that are not available in older OpenGL versions, but the framework
will use corresponding extensions on older hardware if possible.

Currently XD has the following libraries: system, graphics, audio, lua.

Additionally there's also a plenty of header-only tools that can be found in the include folder.

Some of the features XD supports:
- Window handling (window creation, closing, etc.)
- Input handling (keyboard and mouse is supported at the moment, supports querying and callbacks)
- Input filtering (can register callbacks based on filter such as the input device used, or modifier keys)
- Virtual keys (maps physical key to a name, making it easy to remap keys or assign multiple keys per action)
- Tick handler (handler that is executed at specified timesteps, for physics updates for example)
- Matrix stack (supports pushing/popping matrices, translating, scaling and rotating the matrix)
- Geometry transformation (easy construction of model-view-projection matrix from projection and model-view matrix stacks)
- Text rendering (supports ttf/otf formats and various effects like coloring, outlines and shadowing)
- Unicode support (uses UTF-8 encoding)
- Text decorators (text formatter allows custom decorators that makes it easy to write your own animations or text effects)
- Stock text formatter (comes with stock effects such as bold, italic, color, shadow, rainbow and typewriter)
- Textures (allows you to easily create textures, or load them from image files)
- Shader program (makes it easy to compile and use GLSL shader programs)
- Stock shaders (shaders for many common cases like font rendering, textured rendering, etc.)
- Vertex batch (for rendering models)
- Lua virtual machine (loading and executing lua scripts, accessing lua globals and registry)
- Lua scheduler (a co-operative scheduler that makes it easy to run multiple lua scripts at the same time)
- XD Lua API (XD's API is exposed to Lua, which means you can write your game completely in Lua if you wish)
- Audio support (streaming music and sound effects, can control volume/pitch/looping/etc.)
- Generic event bus (allows you to easily create your own event handlers with filtering support)
- Entity/component system (supports logic, render and data components, event dispatching to interact with other code)
- Generic factory (creating objects via a generic factory, also allows your own types to plug into it)
- Sprite batching (allows to easily render sprite textures)
- Asset manager (manages and caches loaded assets, so that resources are re-used when possible)

TODO:
- Change GLFW to SFML for various reasons
- Make API calls that use GL functions not change the previous state of GL (use DSA extension when available)
- More advanced features for text rendering, such as bounding boxes with auto-wrapping
- Allow creationg of textures from custom data (not just loaded images), for texture generation
- Add separate class for sprite, sprite_batch will use it internally
- Make sprite_batch to be more efficient
- Finish binding rest of the XD API to Lua
- Generic scene graph (scene/entity structuring/ordering)
- Joystick and gamepad support
- Support for mouse move event callback (possibly figure a way to plug it to the virtual input system)
- Configuration files (loading and saving)
- Support for indexed arrays in vertex_batch
- Support for loading resources from other sources than files (i.e. memory)
- Setting loop points for music
- Positional audio (one listener and multiple emitters, makes it easy to create environmental sounds such as waterfall)
- Music effects such as fade in/fade out
- Signed distance field fonts and new effects (and possibly other vectorized graphics)
- VAO support for vertex_batch
- Render-to-texture (via FBOs)
- Saving textures as images (i.e. take screenshot feature)
- Generic particle system
- Write documentation/tutorials

Features that might be implemented in future:
- Networking (game networking is big and complex, it might be a good idea to use a library such as RakNet for it instead)
- Python support
- JavaScript support
- Recording audio

XD depends on some external libraries. When at more complete stage, XD will ship with a single prebuilt dynamic library
that also links all the dependancies in it, making XD easy to use and deploy. But if you wish to link XD statically,
or build XD yourself, you will need these libraries:

- boost (this is required even if you use the prebuilt dynamic library)
- glm (this is header-only library that is included in the vendor folder of xd)
- utf8-cpp (this is header-only library that is included in the vendor folder of xd)
- sfml_audio (and its dependancies if linking statically)
- DevIL (and its dependancies if linking statically)
- glew
- glfw
- freetype2
- lua
- luabind (currently xd requires the user to have this always installed, but the plan is to include this in vendor folder)