Giter Site home page Giter Site logo

skeleton's Introduction

skeleton

Simple 2D application framework written in C++/SFML.

Skeleton is a simple framework for creating apps and games using C++ and SFML. It has some tools that make creating new projects easier and faster. It comes with built-in classes such as Buttons, Popups, ResourceManager etc. so you can focus on other aspects of creating your app and stop worrying about creating GUI components or playing sounds - Skeleton has it all!

Brief overview of Skeleton's modules and most important classes

  • GUI - Contains all GUI based components
    • Text - Basic sf::Text wrapper with some more functionallity
    • Box - Basic sf::RectangleShape wrapper with some more functionallity
    • TextBox - Combination of Text and Box classes
    • Button - A clickable TextBox with callback
    • InputBox - A box which handles user's input
    • Popup - Can be used as an notifiaction
    • Prompt - Contains InputBox and Buttons and can act as a prompt window
  • States - Contains State interface which is used with StateManager
    • FrameworkSplashscreen - an example of state that implements State interface
  • Managers - All classes that help with managing the framework resources, states etc.
    • CacheSystem - Manages loading and caching resources such as sf::Texture, sf::SoundBuffer etc.
    • AudioProvider - Uses CacheSystem to play music and sounds (defalut implementation is SFMLSoundProvider)
    • StateManager - Manages State classes. Lets push new States and updates the current state
    • ButtonManager - Manages laying out the buttons, put's them in groups which results in nicely handled keyboard navigation
    • bunch of other Manager classes
  • Util
    • Animation - (work in progress) Handles animating of GUI components
    • Random - Random integer/float distribution with range
    • FPSCounter - Useful utility to check the performance
    • Math - Some basic functions that I found helpful in creating SFML apps
  • Application - Handles running the app, updating all managers, changing backgrounds etc.

Example App

Skeleton provides an example Sandbox app that creates a simple menu state. It shows how the buttons and state managing works. It also uses a background using CacheSystem. Here are example screenshots of the Sandbox app using Skeleton framework

Main menu

Example App

Handling user input

Example Prompt

How to build

CMake

Download SFML compatible with your compiler and extract it to folder in the project or use your package manager to download the library.

Linux

Root project Makefile takes care of building the project. It accepts two flags that are passed to CMake.

  • CMAKE_BUILD_TYPE - the build type. If not specified Debug is used.
  • SFML_DIR - CMake configuration path. This should be used when SFML was installed manually to tell find_package where to search SFML for.

Example: Linux with defualt parameters

make
build/Sandbox

Example: Linux with non default parameters

This shows CMAKE_BUILD_TYPE and SFML_DIR passed as parameters. This assumes SFML was downloaded and extracted in vendor folder.

make CMAKE_BUILD_TYPE=Release SFML_DIR=vendor/SFML-2.5.1/lib/cmake/SFML
build/Sandbox

Windows

Example: Windows Visual Studio

CMake should take care of creating the solution files. As this example does not use Makefile, you need to pass the SFML_DIR parameter directly to CMake:

mkdir build
cd build
cmake -DSFML_DIR="vendor\SFML-2.5.1\lib\cmake\SFML"  ..

# for 32 bit version:
# cmake -A Win32 -DSFML_DIR="vendor\SFML-2.5.1\lib\cmake\SFML"  ..

After that open generated solution file and hit build. Copy needed dlls to binary location. Note: You may need to set Sandbox as the startup project.

Example: Windows MinGW Makefiles

This works similiar to the previous example but uses different generator.

mkdir build
cd build
cmake -G "MinGW Makefiles" -DSFML_DIR="vendor\SFML-2.5.1\lib\cmake\SFML"  ..
make
# run the app after copying dll files
Sandbox.exe

Skeleton resources folder

Skeleton resources folder is located in res folder in the root of the project. CMake sets the absolute path to this folder as a RESOURCES_DIR macro available in the code. This is then used by the CacheSystem in order to find the resources.

This lets users to run the app from anywhere as long as the resources folder is in the same place as when the app was built.

Tested on:

  • Ubuntu using libsfml-dev package. This is also used for CI builds.
  • Arch using sfml package.
  • Windows using Visual Studio 2019 with SFML for Visual Studio 2015 32-bit version.
  • Windows using MinGW Makefiles with SFML for GCC 7.3.0 32-bit version.
  • MacOS using SFML package from homebrew.

Skeleton used in other projects:

  • szykol/Tetris - simple tetris game that uses Skeleton to manage the game state and menus.

skeleton's People

Contributors

szykol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.