Oxygine is C++ engine and framework for 2D games on iOS, Android, Windows, Linux and Mac

Overview

BUILD AND RUN

See oxygine-framework/readme/ folder. It has instructions on how to build and run oxygine on different platforms.

Wiki available at

https://github.com/oxygine/oxygine-framework/wiki

Oxygine is a C++ engine for 2D mobile games.

Yet another shell around OpenGL/D3D API you would say? No, this is a set of classes and tools to create a game according to your requirements.

At the basis of the engine there is a scene graph, that is similar to Flash. In short, You can call this as Flash for C++, but more comfortable and way faster. Initially it was developed for mobile platforms (iOS, Android), but can also be used for PC games.

Source code is available under MIT license (use for free anywhere).

SDK includes:

  • Source code, libraries
  • Necessary tools, documentation
  • Examples
  • Demo for testing and demonstration of base features

Supported platforms:

  • Android
  • iOS
  • Windows
  • MacOSX
  • Emscripten (web)

Examples of code:

//create sprite and display it
spSprite sprite = new Sprite();
sprite->attachTo(getStage());

//run animation tween
sprite->addTween(Sprite::TweenAnim(gameResources.getResAnim("anim2")), duration, loops);

//run position tween
sprite->addTween(Sprite::TweenPosition(x, y), duration, loops);

//handle click event
sprite->addEventListener(TouchEvent::CLICK, [sprite](Event*){
    
    log::messageln("clicked to sprite!");
    //change sprite color
    sprite->setColor(Color::Gray);
});

Features:

  • Programming language is C++.
  • For rendering OpenGL(ES) 2.0 is used. Custom shaders supported.
  • Compressed textures supported.
  • Component based system, simple and predictable OOP API. Possibility to inherit from classes and overload their behavior.
  • No global mega managers of everything, that dictate the requirements and the way you write your code.
  • Effective and flexible work with resources, very close to your game.
  • Components of the engine have weak links between each other. Can be used together, separately or not at all.
  • Fast creation and deletion of objects using memory pools for all engine objects.
  • SceneGraph is somewhat similar to Flash (diagrams with inheritance models). It is built on smart pointers (analogue boost:intrusive_ptr). No need to hassle with memory control, memory leaks.
  • Debug Tools (screenshot). Tree Inspector is “Visual profiler” for Scene Graph. Right in the game you can view the graph and different branches to analyze and errors search. “Textures Inspector” shows you currently loaded textures into memory (screenshot)
  • Render to texture.
  • Resources description is stored in xml file. It has multiple different parameters: you can add your own resources types, format can be set, in which you will store the texture(atlas) in memory, number of columns and rows for animation, etc. Any resource can have user-data attributes.
  • Tweens for frame-by-frame animation, color, position, rotation, etc. Easily create your own.
  • A set of basic UI components commonly used in games: Button, Sprite, ProgressBar and others (image) Command-line tool on Python to process your resources: Build you resources from XML files into atlases, determining the optimal size of atlases. Resize assets from high-res to necessary for your game. Does additional work to optimize work with resources in the game. Compress automatically to ETC1 or PVRTC textures format.
  • Well-designed handling of events from mouse and multi-touch (for example you can press two buttons with two fingers at the same time without collisions) based on AS3 Flash model.
  • It is possible to write code and dialogs in blocking style (concurency programming/coroutines).
  • Accurate rendering of text with line-wraps, vertical and horizontal alignment support, localization, utf-8. Base HTML tags support (screenshot).
  • If you want to add multiple sets of assets for different game resolutions it can be done on the engine level by writing just a few lines of code. You won’t need to adjust coordinates manually for different resolution. It is enough just to keep initial art in high-res.
  • Masking (screenshot, screenshot)
  • Atlas assembling on the fly during the loading, if you didn't provide it yourself.
  • Multi-threaded resources loading.
  • It is possible to partially unload “heavy” resources like atlases from memory. The resouce handle to work with atlas will be still valid (as well as its size) and will even have texture points, but the texture itself will be empty. This is very important when you have strict memory limitations: for example if you created the whole UI with all resources loaded, but there is no need to display them all at once.
  • Fast automatic batching.
  • Bitmap fonts based on BMFont and FreeType. Possibility to add your own font type.

You could build it on top of Marmalade, SDL2 or adapt it for your platform. Oxygine can be built with Emscripten for internet browsers as well.

And this is not everything. There are a lot of easy-to-use features, this framework is not a monster and is clear and intuitive. Viewing a couple of examples is enough to understand how it works.

Contacts

You can find more information at oxygine.org

Comments
  • FreeBSD Compatibility, find SDL2, libpng, libjpeg via CMake

    FreeBSD Compatibility, find SDL2, libpng, libjpeg via CMake

    • Suppress switch errors with -Wswitch (clang 3.7)
    • Find libpng and libjpeg via CMake
    • Find SDL2 through CMake modules, this should also fix #8, eliminating the step to copy SDL libraries manually
    • Switch shebangs on all scripts to /usr/bin/env sh to work in cases where BASH(1) is elsewhere or not present.
    • chmod all scripts as executable 755 +x
    • Tested on FreeBSD 11-CURRENT

    freebsd-current

    opened by tony 8
  • Touch events slightly offset from sprite

    Touch events slightly offset from sprite

    It seems to me touch events are slightly offset down and to the right from the actual sprite position. That is, in the upper left of the sprite, oxygine is not recognizing that my mouse is over the sprite. Similarly, if my mouse is nearby the sprite's bottom right but not actually on the sprite oxygine incorrectly recognizes that as being over the sprite.

    I hacked in a quick color tint on mouseover to illustrate the problem in the following video: https://vimeo.com/277803674

    opened by Qbz23 6
  • Is it possible to add tint?

    Is it possible to add tint?

    Hi, @frankinshtein

    Is there a way to tint a sprite with color? I've tried VStyleActor::setColor - it works but colors are blended. What I want to achieve is to save source texture alpha and apply tint colour over it without blending colors.

    opened by sdelaysam 5
  • Crash on Android when activity recreated

    Crash on Android when activity recreated

    Hi, @frankinshtein

    Steps are fairly simple:

    1. Enable "Do not keep activities" flag.
    2. Minimize application (I tested on several projects, including HelloWorld from examples)
    3. Restore
    4. Repeat steps 2- 3 several times Note: better reproducible when tap on "Recents", not "Home"

    What seems take place:

    1. SDL sends SDL_WINDOWEVENT_MINIMIZED/SDL_WINDOWEVENT_FOCUS_LOST/SDL_QUIT almost instantly, because SDLActivity got destroyed right after paused/stopped.
    2. Oxygine calls reset() / release() Note: process is alive, static still in memory
    3. When app restored, there is a message in log
    error: Assert! i == _restorable.end() in oxygine-framework/oxygine/src/core/Restorable.cpp:88
    
    1. After several times app sent to background/restored, crash occurs
    Fatal signal 11 (SIGSEGV), code 2, fault addr 0xa0c3add4 in tid 17277 (SDLThread)
    
    Crashed: ru.zw9.testcpp|
    0  libandroid-lib.so              0xb41139f4 (Missing)
    1  libgame-lib.so                 0xa0c82dc1 oxygine::Restorable::releaseAll() (Restorable.cpp:55)
    2  libgame-lib.so                 0xa0c86b57 oxygine::core::reset() (oxygine.cpp:562)
    3  libgame-lib.so                 0xa0c62643 oxygine::EventDispatcher::dispatchEvent(oxygine::Event*) (closure_impl.h:60)
    4  libgame-lib.so                 0xa0c59395 oxygine::Actor::dispatchEvent(oxygine::Event*) (Actor.cpp:386)
    5  libgame-lib.so                 0xa0c871cf oxygine::core::SDL_handleEvent(SDL_Event&, bool&) (oxygine.cpp:720)
    6  libgame-lib.so                 0xa0c8737b oxygine::core::update() (oxygine.cpp:841)
    7  libgame-lib.so                 0xa0c561fd mainloop() (main.cpp:25)
    8  libgame-lib.so                 0xa0c56449 run() (main.cpp:120)
    9  libgame-lib.so                 0xa0c56553 SDL_main (main.cpp:181)
    10 libgame-lib.so                 0xa0d0fd81 Java_org_libsdl_app_SDLActivity_nativeRunMain (SDL_android.c:460)
    11 base.odex                      0xa1e9b995 oatexec
    12 base.odex                      0xa1ea55c9 oatexec
    13 system@[email protected]      0x732798d1 oatexec
    

    Will appreciate any advice!

    UPD: I've added the following method and call it from oxygine::release() and crash gone.

    void Restorable::unregAll()
    {
        MutexAutoLock al(_mutex);
        auto it = _restorable.begin();
        while(it != _restorable.end()) {
            it = _restorable.erase(it);
        }
    }
    
    opened by sdelaysam 5
  • Text on buttons disappearing sometimes.

    Text on buttons disappearing sometimes.

    On the demo website http://oxygine.org/online_demo.php When i start Demo (the second one), then i select Performance, and then push Animate button several times, the text will disappear. I have seen multiple places with empty green buttons, i think there should be text on most of them. (Linux 64bit / Chrome Version 49.0.2623.110 (64-bit))

    opened by jsaak 5
  • Oxygine + boost::asio

    Oxygine + boost::asio

    Hello! I am using Oxygine and boost::asio and getting strange compiler errors that depend on the order of #include statements

    include oxygine-framework.h

    include boost/asio.hpp

    // Works good

    include boost/asio.hpp

    include oxygine-framework.h

    // Generates errors

    Errors are following: ...\oxygine-framework\oxygine\src\Event.h(94): error C2332: 'enum' : missing tag name ...\oxygine-framework\oxygine\src\Event.h(94): error C2059: syntax error : 'constant' ...\oxygine-framework\oxygine\src\Event.h(94): error C2334: unexpected token(s) preceding '{'; skipping apparent function body ...\oxygine-framework\oxygine\src\Event.h(100): error C2059: syntax error : 'constant' ...\oxygine-framework\oxygine\src\Event.h(100): error C2065: 'k' : undeclared identifier ...\oxygine-framework\oxygine\src\Event.h(100): error C2065: 'd' : undeclared identifier

    I tried searching for common #defines, but except OUT didnt find a lot. Can you check it out please?

    opened by Neo7k 5
  • Replaced POSIX threads under Windows with stdlib implementations since it is under LGPL license

    Replaced POSIX threads under Windows with stdlib implementations since it is under LGPL license

    The oxygine engine uses POSIX threads under Windows which is a handy library but sadly under LGPL so we cannot link it statically. Since C++ 11 there are official implementations std::mutex, std::thread and std::conditional_variable. So I put those in which gets rid of POSIX threads under Windows which resolves our licensing issue. There is a define OX_CPP11THREADS that needs to be set in order to enable the use of the stdlib classes.

    opened by holoeye-photonics 4
  • Error cast from void*’ to ‘int’ loses precision in OpenGL Test

    Error cast from void*’ to ‘int’ loses precision in OpenGL Test

    Problem with compile on Ubuntu 'gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) '

    oxygine/oxygine-framework/examples/Demo/src/TestOpenGL.h:95:63: error: cast from ‘oxygine::nativeTextureHandle {aka void*}’ to ‘int’ loses precision [-fpermissive]
             int texture = (int)frame.getDiffuse().base->getHandle();
    

    Solution: intptr_t texture = reinterpret_cast<intptr_t>(frame.getDiffuse().base->getHandle());

    Casting to intptr_t type. It's an int type guaranteed to be big enough to contain a handle.

    EDIT. same problem on mac and ios

    opened by lukaszml 4
  • Emscripten build uses SDL version 1, but why?

    Emscripten build uses SDL version 1, but why?

    Unless you specify "-s USE_SDL=2" it uses SDL version 1. When i pass USE_SDL=2 then input is not working (keyboard, touch).

    I wanted to include SDL_net, that is why i am asking. I am not sure that using SDL 1 is the way.

    opened by jsaak 4
  • Input Text Demo not Rendering

    Input Text Demo not Rendering

    The text on the input text demo isn't rendering. I noticed the text is getting captured and set but it's not rendering correctly for some reason. I'm trying to figure out the problem but I've only started to use oxygine and only have a basic knowledge of C++ so I don't know how quick I'll figure it out.

    opened by cxsquared 4
  • Tween Text demo fails during utf-8 to wstring conversion

    Tween Text demo fails during utf-8 to wstring conversion

    OS Linux: Branch: master at hash 44eec70

     uname -a
    Linux xxxxxx 4.4.0-138-generic #164-Ubuntu SMP Tue Oct 2 17:16:02 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    

    sizeof(wstring_t) is 4, but the following SDL call returns 0 (stringUtils.cpp)

    s = (wchar_t*)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", utf8str, n);
    

    I'm able to work around the issue by disabling the two relevant #ifdef sections as follows (USE_SDL_UTF_CONV) is not defined on my system.

    #if defined(OXYGINE_SDL) && !defined(EMSCRIPTEN)
    

    to:

    #if defined(OXYGINE_SDL) && defined(USE_SDL_UTF_CONV) && !defined(EMSCRIPTEN)
    
    opened by on-three 3
  • Cannot find

    Cannot find

    im trying to compile with mingw and codeblocks followed all instructions in readme but i get these errors E:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibcurl_imp E:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibpng E:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibzlib

    plz help me i will gladly appreciate it

    opened by tsukoyumi 1
  • Game Part5 release build .exe issue --- Game closes instantly

    Game Part5 release build .exe issue --- Game closes instantly

    Hi @frankinshtein

    Are you able to shed some light on this?

    Once I've built Game part 5... oxygine-framework\examples\Game\part5\proj.win32\Release-v141

    I run GamePart5.exe, for some reason it opens a window then closes straight away.

    i've noticed all examples do this, with the acception of helloworld.exe and demo.exe

    It works fine when running the game in visual studio 2017, just not from the .exe file

    As far as i can tell i have build everything correctly.

    i think it might be something to do with libs and dll but just not sure.

    Im using windows 10 and visual studio 2017 with redistribution pack.

    opened by codeQueries 0
  • SailfsihOS support

    SailfsihOS support

    Its would be nice if your engine will support SailfishOS.
    I get some code from PR #117 and fix it. Now it build binary for SailfishOS properly ( inside SailfishOS Build Engine virtual machine)
    I want add full support of SailfishOS to your engine ( screen rotation, sound, maybe gyroscope, accelerometer, lock screen blanking), and add ability to build application from host system ( using SailfishSDK tools ).
    but now i have few questions about screen rotation:

    1. In SailfishOS, system not rotate application render, if we use not Qt application ( like SDL2 ), that mean we need render target for all application content, and we should rotate it inside oxygine. My question is: do oxygine render all in RT, or it draw any sprite directly to screen buffer? If it use RT, please tel me where it render, i just add special shader for it, for rotation rendered picture inside shader, and change its size ( if application is use landscape mode ). If oxygine not use main RT for all content, where is the best place for adding that RT ( maybe inside set global RT in core::beginRendering, then draw that global RT in core::swapDisplayBuffers ) ?
    2. is oxygine have some enums for current screen orientation? If not, where i should add that enum? it need for locking screen orientation to landscape/portrait mode for applications in SailfishOS
    opened by savegame 1
  • [Feature] Half-Pixel correction on prebuilt atlasses

    [Feature] Half-Pixel correction on prebuilt atlasses

    Lets have a small texture (lets say under 10 px wide) put it in a big atlas (1024x1024) somewhere in the middle create a sprite with said texture and set its width to something big, maybe 500px neigbour pixels of the atlas bleed into it that's because the UV coords refer to the left border of the most left pixel and to the right border of the most right pixel of the texture this pull request adresses this by imposing a halfpixel correction on AnimationFrame Generation time making the UVs point to the middle of those pixels

    opened by berinhardt 4
Owner
Oxygine
CROSS-PLATFORM 2D C++ GAME ENGINE
Oxygine
Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2

Filament Filament is a real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows, and WebGL. It is designed to be as small a

Google 15.1k Jan 8, 2023
Drmemory - Memory Debugger for Windows, Linux, Mac, and Android

Dr. Memory: the memory debugger About Dr. Memory Dr. Memory is a memory monitoring tool capable of identifying memory-related programming errors such

DynamoRIO 2.1k Dec 28, 2022
An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.

中文版本请参看这里 MMKV is an efficient, small, easy-to-use mobile key-value storage framework used in the WeChat application. It's currently available on Andr

Tencent 15.4k Jan 8, 2023
OS X command line tool to inject Frameworks and dylibs on mach-o binaries (iOS & Mac Apps).

macho-inject OS X command line tool to inject Frameworks and dylibs on mach-o binaries. It does the injection of the framework and the codesigning. It

Jon Gabilondo 6 Nov 8, 2022
Visualization Library is a C++ middleware for high-performance 2D and 3D graphics applications based on OpenGL 1.x-4.x supporting Windows, Linux and Mac OS X.

Visualization Library 2.2 Gallery About Visualization Library is a C++ middleware for high-performance 2D and 3D graphics applications based on the in

Michele 313 Nov 8, 2022
Serial Data Monitor is a multiplatform (Windows, Linux, Mac, ...) tool to interactively receive/edit/monitor data and send commands to an embedded system via the serial bus

See wiki for full documentation Serial Data Monitor Description Serial Data Monitor is a multiplatform (Windows, Linux, Mac, ...) tool to interactivel

monnoliv 4 Oct 29, 2021
Windscribe 2.0 desktop client for Windows, Mac and Linux

Windscribe 2.0 Desktop Application This repo contains the complete source code for the Windscribe 2.0 app. This includes installer, service/helper, ba

Windscribe 362 Jan 3, 2023
Free (libre) font editor for Windows, Mac OS X and GNU+Linux

FontForge FontForge is a free (libre) font editor for Windows, Mac OS X and GNU+Linux. Use it to create, edit and convert fonts in OpenType, TrueType,

null 5k Dec 27, 2022
Qt5 "Hello, world!" app for Linux, BSD, Windows, Mac.

hello world in qt5 Contributions in all forms (code, bug reports, community engagement, localization, etc) are warmly welcomed. Development activity I

Jakob Flierl 2 Jan 26, 2022
A cross-platform (Android/iOS/Windows/macOS) cronet plugin for Flutter via `dart:ffi`

cronet_flutter A cross-platform (Android/iOS/Windows/macOS) cronet plugin for Flutter via dart:ffi

null 25 Dec 11, 2022
Defold Engine integration with Yandex.Metrica to track your games on Yandex.Games.

Yandex.Metrica for Defold Yandex.Metrica is a free of charge web analytics tool for websites, that's the reason why we can use it for HTML5 games. Yan

Indiesoft LLC 8 Nov 26, 2022
Sega Master System / Game Gear / SG-1000 emulator for iOS, macOS, Raspberry Pi, Windows, Linux, BSD and RetroArch.

Gearsystem is a very accurate, cross-platform Sega Master System / Game Gear / SG-1000 emulator written in C++ that runs on Windows, macOS, Linux, BSD, iOS, Raspberry Pi and RetroArch.

Ignacio Sanchez Gines 181 Dec 18, 2022
Make your Pop!_OS (Ubuntu Linux) shortcut key experience more like Mac OS

Meta Mac Enables a Mac OS-like shortcut key experience on Pop!_OS (and most Ubuntu-based Linux distros). Installation Download or git clone this repos

Duane Johnson 14 Dec 31, 2022
A Mac like Control Center for Windows

A Mac like Control Center for Windows.

LoadingName 1 Mar 8, 2022
An easy to build CO2 Monitor/Meter with Android and iOS App for real time visualization and charting of air data, data logger, a variety of communication options (BLE, WIFI, MQTT, ESP-Now) and many supported sensors.

CO2-Gadget An easy to build CO2 Monitor/Meter with cell phone App for real time visualization and charting of air data, datalogger, a variety of commu

Mariete 30 Dec 17, 2022
🗺️ OMAPS.APP — Offline OpenStreetMap maps for iOS and Android. A community-driven fork of MAPS.ME.

OMaps is an open source cross-platform offline maps application, built on top of crowd-sourced OpenStreetMap data. It was publicly released for iOS and Android.

OMaps 4.4k Jan 7, 2023
Tactile-Arcade-Games - Wrote a C program comprised of four separate games that run in a loop using the PSoC 5LP board and Cypress IDE.

Tactile-Arcade-Games - Wrote a C program comprised of four separate games that run in a loop using the PSoC 5LP board and Cypress IDE. Used two potentiometers, two ADCs to convert their voltages to digital values, a PWM to drive two servos, an 8x8 RGB LED matrix, 40 digital output pins and 8 power MOSFETS to control the matrix, and a character LCD display.

null 2 Dec 30, 2022
First open source android modding library for Geometry Dash Based on Hooking-and-Patching-android-template

Android-ML First open source android modding library for Geometry Dash Based on Hooking-and-Patching-android-template Installation Download this githu

BlackTea ML 21 Jul 17, 2022
A repository for experimenting with elf loading and in-place patching of android native libraries on non-android operating systems.

droidports: A repository for experimenting with elf loading and in-place patching of android native libraries on non-android operating systems. Discla

João Henrique 26 Dec 15, 2022