Is-Daouda / is-Engine

C++, SDL 2 and SFML game engine that allows to create games on Web (HTML 5), Mobile and PC.
https://linktr.ee/is_daouda
zlib License
203 stars 15 forks source link
android android-studio box-2d code-blocks cplusplus cpp cpp17 css3 emscripten game-engine html html5 ios qt sdl sfml tmx visual-studio-code web webassembly

header

is::Engine (Infinity Solutions::Engine) 3.4.0

Open source C++ framework which uses the mechanisms of SFML 2 and which also allows to develop with several libraries at the same time (SDL 2, Emscripten) in order to easily export your games / applications on the Web (HTML 5), Mobile and PC (Windows, Linux, macOS).

Contents

SFML logo SDL Web Box2D Logo Tiled Logo Admob Logo Tiny File Dialog VS logo

Features

What's new in this version

3.3.10

3.3.9

3.3.8

Previous version

3.3.7

3.3.6

3.3.5

3.3.4

  1. Now you can put texts and geometric forms (Rectangle, Circle) in Outline (Support of SFML functions setOutlineColor and setOutlineThickness) on Web and Android.
  2. Use text styles (Underline, Bold, Italic, ...) on Web et Android.
  3. Correction of bugs. (That was well hidden!)
  4. Added new resource management functions that allow easy development with the engine (GSM.h, GameDisplay.h, GameSystem.h).
  5. Improved engine resource management (possibility of making your resources permanent and global).
    Sample code :
class HelloScene : public is::GameDisplay
{
public:
    HelloScene(is::GameSystemExtended &gameSysExt):
        GameDisplay(gameSysExt, sf::Color::Black /* => scene color*/) {}

    void loadResources()
    {
        // Load font and texture of the engine
        // Allows to load system resource (very important never forgot to call him)
        // Also allows the scene to use permanent resources (loaded before this line)
        GameDisplay::loadParentResources(); 

        // We load a sound that will be global and permanent in all scenes (Throughout the engine)
        m_gameSysExt.GRMaddSound("is_engine_is_cool", is::GameConfig::SFX_DIR + "is_engine_is_cool.wav");

        // We load these textures (that will only be used in this scene)
        GRMaddTexture("sfml", is::GameConfig::SPRITES_DIR + "sfml.png");
        GRMaddTexture("sdl_2", is::GameConfig::SPRITES_DIR + "sdl_2.png");

        // We load this font (that will only be used in this scene)
        GRMaddFont("yeah", is::GameConfig::FONT_DIR + "yeah.ttf");

        // Allows the scene to use sound permanent resources ("is_engine_is_cool.wav" and others)
        GRMuseGameSystemSound();

        GRMdeleteFont("yeah"); // Manual font Removal
    }
};

3.3.3

  1. Now your SFML games will run on the Web (HTML 5) with SDL 2!

    • The advantage is that most of the engine functions will be able to run on the web, your games will be compatible with several web browsers and more fluid!
    • You can see for yourself the improvements that are made to the engine with this new version of the game I Can Transform Web (HTML 5).
      Game Trailer : Youtube
  2. Engine demo (Super Mario Bros NES) is now web compatible!

Image

3.3.2

This release focuses more on improving engine resource management:

  1. Fixed the bug which prevented the permanent deletion of files on the Web (HTML 5) (see the removeFile function).
  2. Delete unused resources and permissions on Android.
  3. Optimizing the part of the engine that loads resources.
    You can notice it with this new version of I Can Transform Web. Now the levels load faster than before!

3.3.1

  1. Fixed the bug that distorted images when using rotation.
  2. Optimization of the rendering part of the engine that uses SDL. Games are now smoother!
  3. Integration of a file saving system for the Web (HTML 5). No need to re-implement yours anymore!
  4. The OpenURL function now allows making phone calls (on Android) and contacting by email.
    is::openURL("www.yoursiteweb.com", is::OpenURLAction::Http); // open link
    is::openURL("youremail@gmail.com", is::OpenURLAction::Email); // open email
    is::openURL("+2280011223344", is::OpenURLAction::Tel); // Make a call

3.3

  1. The is::LibConnect function: Allows you to develop with several game libraries at the same time (SFML, SDL 2, Emscripten) in one and the same project!
  2. Possibility to develop C++ SFML games with SDL 2 (Your SFML games will run on the SDL 2 library! Yes, yes it is possible!). Book for Code::Block users for the moment!
  3. Support for Android x64 architectures: Now you can export your C++ games to several Android architectures (armeabi-v7a, arm64-v8a, x86, x64, ...). Which means that you can now publish your C++ games on Google Play! (Yeaaah !!!)
  4. The OpenURL function now allows you to open web links on many system: PC (Windows / Linux), Web (HTML 5), Android.
  5. A new function to manipulate dates
    • Very practical data sending system for sending C++ data to Javascript.

Example code to display C++ data in Javascript:

std::vector<std::string> vectorArray;
vectorArray.push_back("is::Engine is really great!");
vectorArray.push_back("With this tool everything is possible!");
vectorArray.push_back("I'm sure you'll love it!");

// The javascripts part
EM_ASM_ARGS({
    var vectorArray = new Module.VectorString($0);
    console.log(vectorArray.get(0));
    console.log(vectorArray.get(1));
    console.log(vectorArray.get(2));
    }, &vectorArray);

Output in the browser console:

is::Engine is really great!
With this tool everything is possible!
I'm sure you'll love it!

Extras

Image

Image

Game Engine User Guide and Youtube Tutorial

Example of a project created with the engine

Hello Scene Example

Here is an example code of a Scene (the place where the game objects come to life). In less than 50 lines of code, the engine allows to:

class HelloScene : public is::GameDisplay {
public:
    HelloScene(is::GameSystemExtended &gameSysExt):
        GameDisplay(gameSysExt, sf::Color::White /* => scene color*/) {}

    void loadResources() {
        m_gameSysExt.m_gameLanguage = is::lang::ENGLISH; // set default game language

        // uncomment to change English language in French
        // m_gameSysExt.m_gameLanguage = is::lang::FRANCAIS;

        // load font and texture
        GameDisplay::loadParentResources(); // allows to load system resource (very important never forgot to call him)
        GRMaddTexture("hello_world", is::GameConfig::SPRITES_DIR + "hello_world.png");
        auto &texBg = GRMaddTexture("background", is::GameConfig::TILES_DIR + "background.png");
        auto &texDialog = GRMaddTexture("dialog_box", is::GameConfig::GUI_DIR + "dialog_box.png");

        // add a background to the position x = 0, y = 0 which will fill the scene and which will be scrolled (scrolling speed = 0.5)
        SDMaddSceneObject(std::make_shared<is::Background>(texBg, 0.f, 0.f, this, 0.5f, -0.5f, false, false));

        // add an object at position x = 0, y = 0 which will be updated and displayed in the scene
        SDMaddSceneObject(std::make_shared<HelloWorld>(0.f, 0.f, this));

        // add RPG style game dialog
        auto gameDialog = std::make_shared<is::GameDialog>(texDialog, GRMgetFont("font_msg"), this);
        gameDialog->setDepth(-2); // the display depth (make it appear on all objects. The object with the smallest value appears on the others)
        gameDialog->setDialog(is::GameDialog::DialogIndex::DIALOG_HELLO); // set the corresponding dialog (See GameDialog.h and GameLanguage.h for more details on creating a message for dialogue)
        SDMaddSceneObject(gameDialog);

        GSMaddSound("game_music", is::GameConfig::MUSIC_DIR + "game_music.wav"); // add music
        GSMplaySound("game_music"); // play music
    }
};

Prerequisites


How to use is::Engine with the different development tools:

android Android Studio

This project uses the template of Georgik and Lauchmelder23.

1. Prerequisites

danger Very important

2. Installation

Windows
  1. Download Android Studio 3.x (recommended version 4.0.1).
  2. Download the Android SDK and install it in C:/Android/SDK.
  3. Download Android NDK android-ndk-r20b-windows-x86_64 and create a folder on your disk as follows C:/Android/NDK then extract the contents of the zip in this folder.
  4. Set the environment variable ANDROID_NDK with the path C:/Android/NDK.
  5. Move the is-Engine project to your C:/ (C:/is-Engine).
  6. Open the is-Engine folder with Android Studio and start the compilation.

If all goes well you will have a Hello World Screen on your Android emulator.

Image

Enjoy!

2. How to replace the package name (com.author.isengine) of the application

3. Adding Source Files

4. Application location


web Web (HTML 5 - CSS 3)

If you want to make your SFML project compatible with the Web (Be able to run it in a web browser), please watch this video tutorial.
danger Now you can put texts and geometric shapes (Rectangle, Circle) in Outline on the Web (It was not available in the old versions)!

1. Prerequisites

2. Installation

Windows
  1. Download Emscripten and install it in C:/emsdk, define its path in the environment variable Path
  2. Download Python after installation, define its path in the environment variable Path
  3. Download CMake after installation, define its path in the environment variable Path
  4. Download Java after installation, define its path in the environment variable Path
  5. Move the is-Engine project to your C:/ (C:/is-Engine).
  6. Execute this command :
    cd c:/is-Engine/app/src/main
    mkdir bin-web
    cd bin-web
    emsdk activate latest
    emcmake cmake ..
    make -j3
    python -m http.server
  7. Visit this url localhost:8000 in your Web Browser.

If all goes well you will have a Hello World Screen on your Web Browser.

Image

Enjoy!

3. Adding Source Files

danger Very important


Web Push Notification Web Push Notification

Installation

image

Configure the Push Notification

  1. To change the information (title, details, ...) of the Push Notification you must refer to the sw.js file.
  2. To change the Push Notification image files, refer to the images folder.
  3. To change the page that is launched when you click on the notification, refer to the sw.js file.

cmake CMake

1. Prerequisites

2. Installation

Windows

  1. Compile SFML with CMake to have static libraries and put on C:/ (C:/SFML).
  2. Move the is-Engine project to your C:/ (C:/is-Engine).
  3. Execute this command :
    cmake -S "C:/is-Engine" -B "C:/build"
    cd build
    make

Linux

  1. Install SFML 2.5.1 on your machine.
  2. Move the is-Engine project to /home/user/ (/home/user/is-Engine).
  3. Execute this command :
    sudo cmake -S "is-Engine" -B "build"
    cd build
    sudo make

3. After installation

5. Adding Source Files


vs Visual Studio

1. Installation

Windows

Download Visual Studio Community 2022 here and install it.

2. Opening the project with the IDE:

Windows

Open the file vs-sfml.sln in the location is-Engine/app/src/main/


qt Qt

1. Installation

Windows

  1. Download Qt 5.12.9 MinGW here and install it.
  2. Download this version of SFML already compiled for Qt 5.12.9 and extract it in C:/ (C:/SFML_Qt_MinGW).

2. Opening the project with the IDE:

Windows

  1. Run the file open_qt_creator.bat in the main directory (Make sure you have included the path to the Qt executable in your PATH environment variable).
  2. Or open the file is-Engine.pro in the location is-Engine/app/src/main/qt

3. Executable location


vsc Visual Studio Code

This project uses the template of andrew-r-king. For more information on this template click here.

1. Prerequisites

Windows

Linux

2. Installation

Windows

  1. Download & Extract SFML 2.5.1 to C:/SFML/ where the bin/lib/include folders are contained within.
  2. Download & Extract MinGW to C:/mingw32/ where the bin/lib/include folders are contained within.

Linux

  1. Ensure the GCC Toolchain is installed (sudo apt install build-essential).
  2. Run sudo apt install libsfml-dev. The SFML version you got will vary depending on the distro. 2.5.1 is included in Ubuntu 19.04 Disco Dingo for example.

3. Opening the project with the IDE:

Windows

  1. Run the file open_vscode.bat in the main directory.

Linux

  1. Execute this command in the main directory:
    code -n "./app/src/main"

All

  1. Or open the is-Engine/app/src/main folder with Solution Explorer.

4. Executable location


cb Code::Blocks

1. Installation

Windows

  1. Download Code::Blocks 20.03 MinGW here and install it.
  2. Download this version of SFML already compiled for Code::Blocks 20.03 and extract it in C:/ (C:/SFML_CB_MinGW).

Linux

  1. Download Code::Blocks 20.03 and install it.
  2. Ensure the GCC Toolchain is installed (sudo apt install build-essential).
  3. Run sudo apt install libsfml-dev. The SFML version you got will vary depending on the distro. 2.5.1 is included in Ubuntu 19.04 Disco Dingo for example.

2. Opening the project with the IDE:

Windows

  1. Run the file open_codeblocks.bat in the main directory (Make sure you have included the path to the Code::Blocks executable in your PATH environment variable).
  2. Or open the file is-Engine-windows.cbp in the location is-Engine/app/src/main

Linux

  1. Execute this command in the main directory:
    codeblocks "./app/src/main/is-Engine-linux.cbp"
  2. Or open the file is-Engine-linux.cbp in the location is-Engine/app/src/main.

3. Executable location


cb Develop SFML games with SDL 2

1. Installation

Windows

  1. Download Code::Blocks 20.03 MinGW here and install it.
  2. Download this version of SDL 2 and extract it in C:/ (C:/SDL2).
  3. Put the .dll files which is in the bin folder of SDL2 in the main folder.

Linux

  1. Download Code::Blocks 20.03 and install it.
  2. Ensure the GCC Toolchain is installed (sudo apt install build-essential).
  3. Run sudo apt install libsdl2-2.0-0 libsdl2-gfx-1.0-0 libsdl2-image-2.0-0 libsdl2-mixer-2.0-0 libsdl2-net-2.0-0 libsdl2-ttf-2.0-0 to install all SDL 2 libraries.

2. Opening the project with the IDE:

Windows

  1. Run the file open_codeblocks_sdl.bat in the main directory (Make sure you have included the path to the Code::Blocks executable in your PATH environment variable).
  2. Or open the file is-Engine-windows-SDL2.cbp in the location is-Engine/app/src/main

Linux

  1. Execute this command in the main directory:
    codeblocks "./app/src/main/is-Engine-linux-SDL2.cbp"
  2. Or open the file is-Engine-linux-SDL2.cbp in the location is-Engine/app/src/main.

3. Executable location

danger Very important


icon Change application icon:

Android

Web (HTML 5 - CSS 3)

Windows

Linux


Description of the project structure:

header

1. main.cpp file

Contains the entry point of the program, inside there are two instructions :


2. app_src folder

Contains the source code of the game. Description of these sub-directories:


3. assets folder

Contains game resource files (music, sound sfx, image, ...)


4. isEngine folder

Contains the source code of the game engine


Special things to know about the engine

is::LibConnect

With the is::LibConnect you can write code for a specific library. Here is how to do it:

sf::Text text;
text.setString(
// on PC (Windows / Linux)
#if define(IS_ENGINE_SFML)    
    "We use SFML 2 library"

// on Android or when you use SDL to create SFML games on PC (only for Code::Block at the moment)    
#elif define(IS_ENGINE_SDL_2)
    "Run SFML 2 with SDL 2"

// When we develop for the web (HTML 5) with Emscripten    
#elif define(IS_ENGINE_HTML_5)
    "SFML 2 on Web"
#endif
              );

If you have discovered another way to use the game engine, don't hesitate to share it! We will put it in this Special section so that other people can benefit from it!


How to update an is::Engine project

  1. First of all the part of is::Engine that changes most often during updates is the isEngine folder. But it also happens that these files can be modified:
  2. To update your old project with a new version of is::Engine: the files (.h and .cpp) you need to move are in objects and scenes. Note that these folders never change whatever the version!

How to activate the use of Admob?

Coming soon!


Contribute

Contacts