Features • How to build • Get Started • Screenshots • Showcase • Support
NasNas is a lightweight cross platform modular 2D game framework.
It is entirely written in modern C++17, and uses SFML2 for rendering.
It provides a clean and easy to use API.
The framework is separated in multiple modules :
- Core is the only non-optional module. It is needed to create a NasNas application. It contains core classes and data needed by the framework.
- ECS is an efficient data driven Entity Component System. It allows you to attach components to entities and run systems on specific sets of components.
- Reslib contains the resource manager and resource loader. It handles resource loading and accessing in an elegant way.
- Tilemapping is a Tiled Map loader (.tmx). It seamlessly integrates with NasNas and speeds up development for tile based games.
- Tween allows you to animate any object using the provided or custom easing functions.
- UI contains the User Interface utilities. (WIP)
- More modules will be developed in the future !
Click to see platforms support
Core | Ecs | Reslib | Tilemapping | Tween | Ui | |
---|---|---|---|---|---|---|
Windows | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
Linux | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
MacOS | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
Android | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
iOS | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
- Scene and Layers system
- Cameras and Shaders
- Application states (using StateStackApp or StateMachineApp)
- Automatic resource loader and manager
- Data oriented ECS inspired by entt with a bunch of provided components and defaults systems.
- Tiled map loader (.tmx)
- Text and bitmap fonts
- Customizable Transitions
- Flexible Tween and MultiTween utilities.
- Extensible Particles system
- Multi texture SpriteBatching
- App configuration and settings
- Debug text display in-game
- Convenient console Logger
- And more !
- Menus and UI
- Splash screens
- Levels and game events management
- In-game command line for debugging
You can find a global roadmap for the version 1.0 on the project board
Clone the repository.
git clone https://github.com/Madour/NasNas
cd NasNas
Then, you can build the static libraries with :
mkdir build && cd build
cmake ..
cmake --build . -j4
Finally, you can install those libraries using :
cmake --install .
To build the framework for Android, please refer to the Android example's readme
-
-DNASNAS_BUILD_ECS=OFF
to disable the ECS module -
-DNASNAS_BUILD_RESLIB=OFF
to disable the Reslib module -
-DNASNAS_BUILD_TILEMAPPING=OFF
to disable the Tilemapping module -
-DNASNAS_BUILD_TWEEN=OFF
to disable the Tween module -
-DNASNAS_BUILD_UI=OFF
to disable the UI module -
-DNASNAS_EXAMPLES=ON
to create the example applications targets -
-DNASNAS_BUILD_SFML=ON
to download and build SFML inside the project (enabled automatically if SFML package is not found) -
-DNASNAS_STATIC_VCRT=ON
to link the Visual C++ runtime statically (/MT) when using the Microsoft Visual C++ compiler
Here is a sample code using NasNas framework, this will create a 720x480 window and log a string to the console :
#include <NasNas/Core.hpp>
class Game : public ns::App {
public:
Game() : ns::App("My game", 720, 480) {
ns_LOG("Created a NasNas app !");
}
void onEvent(const sf::Event& event) override {
if (event.type == sf::Event::Closed)
getWindow().close();
}
void update() override {}
};
int main() {
Game g;
g.run();
return 0;
}
An introduction tutorial to learn how to use the framework can be found on the wiki.
Documentation can be found here.
You can also check examples source code for a small overview of what you can do with the framework.
All of these programs source code can be found in the examples
folder.
particles.mp4
platformer2.mp4
platformer_android.mp4
The following games were created with NasNas :
- Warp Runner on itch (Desktop)
- History Leaks on itch and github (Desktop)
- Cyber Slayer on github (Desktop and Android)
A simple physics engine made with NasNas only
2021-07-14_21-06-10.mp4
If you like the project, please consider starring this repository.
If you would like to discuss anything about the project, feel free to open a new discussion.
- Modar Nasser