Code Monkey home page Code Monkey logo

bacon2d's Introduction

2D Game Engine for QML

Bacon2D is a framework to ease 2D game development, providing ready-to-use QML 
components useful for creating compeling games.

API documentation can be found at http://bacon2d.github.io/docs/

========
1. Build
========

1.1) Dependencies

* Qt5
  	Qt5 source repository: https://qt.gitorious.org/qt/qt5

1.2) Building

Available QMake parameters:

* QTPATH (Optional)
	Prefix where Qt has been installed. It is required to install
	Bacon2D's QML import plugin and related files.
	The default path is /usr/lib/qt5


If building from a git checkout, you will need to initialize the git submodules:

$ git submodule update --init

Sample build from Bacon2D's root source tree:

$ mkdir build && cd build
$ qmake QTPATH=/opt/Qt5 ..
$ make
$ sudo make install


*MacOS note*:

If you get some error like 'could not resolve SDK path for...', add 
'QMAKE_MAC_SDK=MAC_SDK_VERSION'to the qmake command, like this (issue #80):

$ qmake QMAKE_MAC_SDK=macosx10.9 ..

Where MAC_SDK_VERSION points to the OSX version you're using (in the above 
example it is 10.9.x).

===========
2. Examples
===========

If you have installed the QML plugin to the proper Qt import directory,
you can run the examples directly from their specific source directories.

Each example can be opened and run from QtCreator, to open the fixtures 
example, open examples/fixtures/fixtures.qmlproject from QtCreator

To run the fixtures example without QtCreator:

$ cd examples/fixtures
$ qmlscene main.qml

If Bacon2D QML plugin was not installed you can export QML2_IMPORT_PATH 
environment variable or specify the path to your built plugin on 
the command line.

$ cd examples/fixtures
$ qmlscene -I ../../build/src/imports main.qml


===============
3. Get Involved
===============

http://bacon2d.com/contact.html

bacon2d's People

Contributors

arcrowel avatar elleo avatar etam avatar kenvandine avatar mdkcore0 avatar paulovap avatar ragner avatar rogerzanoni avatar tnoleto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bacon2d's Issues

Add Native Behavior (cpp)

The idea is to create a simple class for easy subclassing.
I have some code to test, it extends from behavior and instead of calling the script it calls a std::function which the user should provide.

Sometimes, doing all the logic from javascript add some extra/unnecessary overhead not only on processing but in memory.

Await for the pull.

@kenvandine i guess providing a clean interface will suffice.

Modal Menu and Popups

Talking to the Bacon2D developers we found that we need a way to handle modal items, like popups and menus.
Now the we have a scene stack it might be a good feature to let the user create non-opaque scenes and let the scene behind it visible. It will be useful to create menu with transparency or blur, for instance.

Add viewport

We need to add support for a Viewport in a Scene

Refactor ImageLayer

The current ImageLayer should be refactored, much of the complexity was to work around a Qt crasher with large images.

The current implementation doesn't handle resizing well, so anchoring it causes problems.

Build fails on Windows

copy /y E:/Dev/Bacon2D/src/PhysicsEntity.qml E:/Dev/Bacon2D/src/BoxBody.qml E:/Dev/Bacon2D/src/ChainBody.qml E:/Dev/Bacon2D/src/CircleBody.qml E:/Dev/Bacon2D/src/EdgeBody.qml E:/Dev/Bacon2D/src/ImageBoxBody.qml E:/Dev/Bacon2D/src/PolygonBody.qml E:/Dev/Bacon2D/src/Boundaries.qml E:/Dev/Bacon2D/src/RectangleBoxBody.qml E:/Dev/Bacon2D/src/qmldir E:/Dev/Bacon2D-Debug/src/imports/Bacon2D/
The syntax of the command is incorrect.

I think that the problem is here:

qmlplugin.commands = $$QMAKE_COPY $$QMLFILES $$OUT_PWD/imports/Bacon2D/
qmlplugin.path = $$target.path

Windows requires backslashes for its paths, but its copy command also doesn't seem to be able to take multiple files.

I'm not very good with qmake, but the INSTALLS variable as documented here seems to already take care of producing a valid copy command on all supported platforms, so the .commands stuff shouldn't be necessary:

qmlplugin.path = $$target.path
qmlplugin.files = $$QMLFILES

You might also be able to use the for loop approach shown here somehow, in combination with shell_path.

Add transitions for scene changes

We should provide optional transitions for scene changes, toggling visible doesn't even let the app developer create interesting transitions.

Perhaps a couple predefined transitions like horizontal slide, fade, etc. Default could be toggling visibility.

ImageLayer missing features

The imagelayer is a great component really useful, at this moment it does not take into account many cases of usage related to the image aspectratio along with the imagelayer item.

When you have a vertical image (imageWidth<ImageHeight) it is imposible to makeit fit into the imagelayer's width, it only uses the image's width.

Also with the scrollingType: Infinite, it does not uses a great start point insite the texture coords. For example: If you have a huge image which it will scroll over, it needs to start at the beggining of the image or the end to prevent weird unplanned visual behaviors.

"make install" places plugins.qmltypes in the wrong directory

plugins.qmltypes seems to be copied to the wrong place during "make install":

~/Bacon2D/build$ sudo make install
cd src/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/nn/Bacon2D/src/src.pro -o Makefile ) && make -f Makefile install
make[1]: Entering directory `/home/nn/Bacon2D/build/src'
install -m 755 -p "imports/Bacon2D/libbacon2dplugin.so" "/usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so"
strip --strip-unneeded "/usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so"
install -m 644 -p /home/nn/Bacon2D/src/qmldir /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/
/usr/lib/x86_64-linux-gnu/qt5/bin/qmlplugindump -notrelocatable Bacon2D 1.0 /home/nn/Bacon2D/build/src/imports > /home/nn/Bacon2D/build/src/imports/Bacon2D/plugins.qmltypes
make[1]: Leaving directory `/home/nn/Bacon2D/build/src'
~/Bacon2D/build$

Request: Use custom path for Settings class

It could be useful to add a path property to Settings item, like this:

Window {
    id: mainWindow
    width: mainSettings.window_width
    height: mainSettings.window_height

    Settings {
         id: mainSettings
         path: "path/to/settings.ini"
         format: "ini"
         category: "mainSettings"
    }
    Settings {
        id: gameplaySettings
        path: "path/to/settings.ini"
        format: "ini"
        category: "gameplaySettings"
    }
   Settings {
        id: otherSettings
        category: "otherSettings"
       // no path defined, use default QSettings properties...
    }
}
# path/to/settings.ini
[mainSettings]
window_width=800
window_height=600
[gameplaySettings]
hud_color=red
...

We can use this constructor to do that in the Settings class

QSettings(const QString & fileName, Format format, QObject * parent = 0);

As you can see, there's no defined properties in the Settings item, but settings are already defined in the INI file, so the Settings could be able to define all properties using defined settings (like window_width, window_height and hud_color in my example).

Switching scenes carry along the viewport from the previous one

When switching scenes with by setting a new .currentScene I still see the content of the viewport defined in the previous scene. The new scene do not have a viewport defined.

Expected result is that the viewport content is only visible in the scene it is defined.

SteeringBehavior

Create new SteeringBehavior for autonomous characters, using OpenSteer

Build Error with MAC OX 10.9

Undefined symbols for architecture x86_64:
"Tiled::MapReader::readMap(QString const&)", referenced from:
TiledScene::loadMap(QString const&) in tiledscene.o
"Tiled::MapReader::MapReader()", referenced from:
TiledScene::loadMap(QString const&) in tiledscene.o
"Tiled::MapReader::~MapReader()", referenced from:
TiledScene::loadMap(QString const&) in tiledscene.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [imports/Bacon2D/libbacon2dplugin.dylib] Error 1
make: *** [sub-src-make_first] Error 2

How to install Bacon2D on Qt 5.7 (MacOS 10.11.5)

Hello,

I've been trying to install Bacon2D on Qt5.7 on my MacOS 10.11.5 machine, but it simply doesn't work.

I followed the README explanation, no error at all at the end. My QtCreator installation is on the /Users//Applications/QtCreator folder. So I defined that folder. I ended with two folders:

/Users/<myUser>/Applications/QtCreator/Examples/Qt-5.7/bacon2d
and
/Users/<myUser>//Applications/QtCreator/imports/Bacon2D

Then I start Qt and create a QtQuick2 project to see that the import Bacon2D doesn't return anything. When I try to run the example from the QtCreator folder directly on the terminal the message is the same:

qrc:/main.qml:3 module "Bacon2D" is not installed

What am I doing wrong?

Rework old examples

Rework/rewrite all old examples to create more compelling ones.

The old examples should give a good view of the features they are presenting, like the new physics examples.

Build for Android on Windows

Hi. Its not working.

My system: Windows 8.1.

Pathes:
Qt: C:\Qt
Android: C:\Android

First bug:

18:56:38: Выполняются этапы для проекта Bacon2D...
18:56:38: Настройки не изменились, этап qmake пропускается.
18:56:38: Запускается: «C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe»
makefile:347: warning: overriding recipe for target 'dist'
makefile:331: warning: ignoring old recipe for target 'dist'
C:/Qt/5.5/android_armv7/bin/qmake.exe -spec android-g++ -o Makefile ../Bacon2D/Bacon2D.pro
makefile:376: warning: overriding recipe for target 'dist'
makefile:357: warning: ignoring old recipe for target 'dist'
cd src/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/src/src.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/src'
mingw32-make[1]: Nothing to be done for 'first'.
mingw32-make[1]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/src'
cd tests/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/tests/tests.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/tests'
C:\Android\android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQUICK_TEST_SOURCE_DIR=""C:/Users/kafeg/Documents/GitHub/Bacon2D/tests"" -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_QMLTEST_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/tests"' -I../../Bacon2D/tests -I. -IC:/Qt/5.5/android_armv7/include -IC:/Qt/5.5/android_armv7/include/QtQuick -IC:/Qt/5.5/android_armv7/include/QtQml -IC:/Qt/5.5/android_armv7/include/QtNetwork -IC:/Qt/5.5/android_armv7/include/QtQuickTest -IC:/Qt/5.5/android_armv7/include/QtWidgets -IC:/Qt/5.5/android_armv7/include/QtGui -IC:/Qt/5.5/android_armv7/include/QtTest -IC:/Qt/5.5/android_armv7/include/QtCore -I. -isystem C:/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem C:/Android/android-ndk-r10e/platforms/android-9/arch-arm/usr/include -IC:/Qt/5.5/android_armv7/mkspecs/android-g++ -o tst_bacon2d.obj ../../Bacon2D/tests/tst_bacon2d.cpp
/usr/bin/sh: C:Androidandroid-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
Makefile:420: recipe for target 'tst_bacon2d.obj' failed
mingw32-make[1]: *** [tst_bacon2d.obj] Error 127
mingw32-make[1]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/tests'
makefile:69: recipe for target 'sub-tests-make_first' failed
mingw32-make: *** [sub-tests-make_first] Error 2
18:56:41: Процесс «C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe» завершился с кодом 2.
Ошибка при сборке/установке проекта Bacon2D (комплект: Android для armeabi-v7a (GCC 4.9, Qt 5.5.0) )
Во время выполнения этапа «Сборка»
18:56:41: Прошло времени: 00:03.

Its when test enabled.
Second bug, when i comment tests:

18:57:42: Выполняются этапы для проекта Bacon2D...
18:57:42: Настройки не изменились, этап qmake пропускается.
18:57:42: Запускается: «C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe»
makefile:376: warning: overriding recipe for target 'dist'
makefile:357: warning: ignoring old recipe for target 'dist'
C:/Qt/5.5/android_armv7/bin/qmake.exe -spec android-g++ -o Makefile ../Bacon2D/Bacon2D.pro
makefile:347: warning: overriding recipe for target 'dist'
makefile:331: warning: ignoring old recipe for target 'dist'
cd src/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/src/src.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/src'
mingw32-make[1]: Nothing to be done for 'first'.
mingw32-make[1]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/src'
cd examples/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/examples.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples'
cd behaviorchange/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/behaviorchange/behaviorchange.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/behaviorchange'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/behaviorchange'
cd cannon/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/cannon/cannon.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/cannon'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/cannon'
cd contacts/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/contacts/contacts.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/contacts'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/contacts'
cd fixtures/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/fixtures/fixtures.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/fixtures'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/fixtures'
cd imagelayer/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/imagelayer/imagelayer.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/imagelayer'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/imagelayer'
cd impulse/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/impulse/impulse.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/impulse'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/impulse'
cd infinitefall/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/infinitefall/infinitefall.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/infinitefall'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/infinitefall'
cd infinite_scroll/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/infinite_scroll/infinite_scroll.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/infinite_scroll'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/infinite_scroll'
cd layerscroll/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/layerscroll/layerscroll.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/layerscroll'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/layerscroll'
cd manysprites/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/manysprites/manysprites.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/manysprites'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/manysprites'
cd movement/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/movement/movement.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/movement'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/movement'
cd parallax_layers/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/parallax_layers/parallax_layers.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/parallax_layers'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/parallax_layers'
cd raycast/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/raycast/raycast.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/raycast'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/raycast'
cd rope/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/rope/rope.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/rope'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/rope'
cd scene_transition/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/scene_transition/scene_transition.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/scene_transition'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/scene_transition'
cd settings/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/settings/settings.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/settings'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/settings'
cd sprite/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/sprite/sprite.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/sprite'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/sprite'
cd viewport_parallax/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/viewport_parallax/viewport_parallax.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/viewport_parallax'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/viewport_parallax'
cd weld/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/examples/weld/weld.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/weld'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples/weld'
mingw32-make[1]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/examples'
18:57:58: Процесс «C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe» завершился успешно.
18:57:58: Удаление каталога C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/android-build
18:57:58: Запускается: «C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe» "INSTALL_ROOT=C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/android-build" install
makefile:347: warning: overriding recipe for target 'dist'
makefile:331: warning: ignoring old recipe for target 'dist'
cd src/ && ( test -e Makefile || C:/Qt/5.5/android_armv7/bin/qmake.exe C:/Users/kafeg/Documents/GitHub/Bacon2D/src/src.pro -spec android-g++ -o Makefile ) && C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile install
mingw32-make[1]: Entering directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/src'
cygwin warning:
MS-DOS style path detected: C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/android-build/libs/armeabi-v7a/
Preferred POSIX equivalent is: /cygdrive/c/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/android-build/libs/armeabi-v7a/
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
cp -f imports/Bacon2D/libbacon2dplugin.so C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/android-build/libs/armeabi-v7a/libbacon2dplugin.so
"C:/Program Files (x86)/Git/cmd/mkdir.exe": cannot create directory `C:C:': No such file or directory
Makefile:11147: recipe for target 'install_qmltypes' failed
mingw32-make[1]: *** [install_qmltypes] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/kafeg/Documents/GitHub/build-Bacon2D-Android_armeabi_v7a_GCC_4_9_Qt_5_5_0-Release/src'
makefile:55: recipe for target 'sub-src-install_subtargets' failed
mingw32-make: *** [sub-src-install_subtargets] Error 2
18:58:00: Процесс «C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe» завершился с кодом 2.
Ошибка при сборке/установке проекта Bacon2D (комплект: Android для armeabi-v7a (GCC 4.9, Qt 5.5.0) )
Во время выполнения этапа «Копирование данных приложения»
18:58:00: Прошло времени: 00:18.

Create development git branch

Create a branch outside master, this could ease up the development without having the worry that something could brake the master branch.

Level loader

We should provide a generic level loader to load scene layouts, including Box2D fixtures, etc.

Add Settings component

Create a settings component, for storing in game settings, scores, etc. Should be a child of Game.

build error on mac os 10.11, Qt 5.10

I try to build but i get this. I cloned the git with the recursive argument so i have all submodules.

Undefined symbols for architecture x86_64:
  "_deflate", referenced from:
      Tiled::compress(QByteArray const&, Tiled::CompressionMethod) in compression.o
  "_deflateEnd", referenced from:
      Tiled::compress(QByteArray const&, Tiled::CompressionMethod) in compression.o
  "_deflateInit2_", referenced from:
      Tiled::compress(QByteArray const&, Tiled::CompressionMethod) in compression.o
  "_inflate", referenced from:
      Tiled::decompress(QByteArray const&, int) in compression.o
  "_inflateEnd", referenced from:
      Tiled::decompress(QByteArray const&, int) in compression.o
  "_inflateInit2_", referenced from:
      Tiled::decompress(QByteArray const&, int) in compression.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [qml/Bacon2D/libbacon2dplugin.dylib] Error 1
make: *** [sub-src-make_first] Error 2

Scene should provide the Box2D world

Scene should provide World automatically without needing to add a World container around all entities and bodies.

Add a property to Scene for "physics", if set to true the scene should create a World.

World and Body should be uncreatable types.

Layer behavior

The Layer element should provide endless scrolling behavior by repeating its elements (It should behave like the ImageLayer element)

Getting started tutorial

We need a tutorial to help developers get started creating a game using Bacon2D.

Game templates would be useful as well.

horizontalMirror and single frame SpriteAnimations

Hi, I'm trying to transition between "walking" and "idle" SpriteAnimations of my player character. However, if I change the animation property to "walking" and horizontalMirror to true when moving right and afterwards switch the animation property of my sprite back to "idle" when stopping, the horizontalMirror gets lost if my idle animation has just 1 frame so that my character is facing left. So whenever I stop moving my character it's always facing left, even after moving right before. When using a 2 frame idle animation it works normally and my character still looks to the right after stopping (this is my workaround atm). I tried to debug that myself and had no success. The strange point is that horizontalMirror and m_horizontal seem to have correct values (true and -1). But the idle animation is facing left and I even don't get to a breakpoint that is set to the paint method of the spritesheet then. So I'm confused what is drawing the unscaled pixmap then?! I made a sample project here to show the effect:
https://github.com/yoktobit/bacon2dhm/blob/master/main.qml
The pro file includes the static version of Bacon2D at the parent dir of the project, so compiling without a few changes to the dirs won't work.

Default Scene Transition

It would be nice if the user could set default animations for Scene transition. Something like:
Game{
defaultExitTransition: NumberAnimation{..}
defaultEnterTransition: NumberAnimation{..}
}

Scene.debug doesn't work if is set directly

The debug property of Scene doesn't work if is set in the Scene itself, you have to declare after the component is completed.

This doesn't work:
Scene { debug: true }

This works:
Scene { Component.onCompleted: debug = true }

Fixtures

The fixture components RectangleBoxBody, Boundaries, and PolygonBody will throw the error in qmlscene: "cannot assign object to list". Circle, Box, and CircleBody work fine.

I have tried to include the components inside brackets (fixtures: [RectangleBoxBody{} ] ), but it still threw the same error.

App goes in core dump if the physics = true is istantiated at startup in heavy scenes

In very heavy scenes (sorry, not able to provide a useful code right now) if physics: true the app produces a core dump.

The same code works if I use Component.onCompleted: physics = true.

Here the backtrack:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fc3f68d7230 in QList<ContactEvent>::QList(QList<ContactEvent> const&) ()
   from /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so
(gdb) bt
#0  0x00007fc3f68d7230 in QList<ContactEvent>::QList(QList<ContactEvent> const&) ()
   from /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so
#1  0x00007fc3f68d7013 in Box2DWorld::SayGoodbye(b2Fixture*) ()
   from /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so
#2  0x00007fc3f68bf851 in b2World::DestroyBody(b2Body*) ()
   from /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so
#3  0x00007fc3f68d8f2d in Box2DBody::setWorld(Box2DWorld*) ()
   from /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so
#4  0x00007fc3f68f5f3c in Box2DBody::qt_metacall(QMetaObject::Call, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so
#5  0x00007fc40e526944 in QQmlVMEMetaObject::metaCall(QMetaObject::Call, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#6  0x00007fc40e541b7f in QQmlPropertyPrivate::write(QObject*, QQmlPropertyData const&, QVariant const&, QQmlContextData*, QFlags<QQmlPropertyPrivate::WriteFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#7  0x00007fc40e5435fb in QQmlPropertyPrivate::writeValueProperty(QObject*, QQmlPropertyData const&, QVariant const&, QQmlContextData*, QFlags<QQmlPropertyPrivate::WriteFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#8  0x00007fc40e543d31 in QQmlPropertyPrivate::writeBinding(QObject*, QQmlPropertyData const&, QQmlContextData*, QQmlJavaScriptExpression*, QV4::ValueRef, bool, QFlags<QQmlPropertyPrivate::WriteFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#9  0x00007fc40e5b851c in QQmlBinding::update(QFlags<QQmlPropertyPrivate::WriteFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#10 0x00007fc40e5b8c7e in QQmlBinding::expressionChanged(QQmlJavaScriptExpression*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#11 0x00007fc40e592497 in QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#12 0x00007fc40e52f10c in QQmlData::signalEmitted(QAbstractDeclarativeData*, QObject*, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#13 0x00007fc40f324141 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007fc3f68e238b in Scene::initializeEntities(QQuickItem*) ()
   from /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so
#15 0x00007fc3f68e2604 in Scene::componentComplete() ()
   from /usr/lib/x86_64-linux-gnu/qt5/qml/Bacon2D.1.0/libbacon2dplugin.so
#16 0x00007fc40e5c19c7 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#17 0x00007fc40e545bab in QQmlComponentPrivate::complete(QQmlEnginePrivate*, QQmlComponentPrivate::ConstructionState*) () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#18 0x00007fc40e545c67 in QQmlComponentPrivate::completeCreate() ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#19 0x00007fc40e547d70 in QQmlComponent::create(QQmlContext*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#20 0x00007fc40fcf51ab in QQuickView::continueExecute() ()
   from /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5
#21 0x00007fc40fcf55fd in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5
#22 0x0000000000400d2f in main ()

I'll try to provide other useful informations asap

Windows build failure

Error:

cp -f D:\QT\Bacon2D-master\src\InfiniteScrollEntity.qml D:\QT\Bacon2D-master\build\src\imports\Bacon2D\
cp: cannot create regular file `D:\\QT\\Bacon2D-master\\build\\src\\imports\\Bacon2D /D:\\QT\\Bacon2D-master\\src\\InfiniteScrollEntity.qml': No such file or directory
Makefile.Release:481: recipe for target 'imports/Bacon2D/bacon2dplugin.dll' failed
mingw32-make[2]: *** [imports/Bacon2D/bacon2dplugin.dll] Error 1
mingw32-make[2]: Leaving directory 'd:/QT/Bacon2D-master/build/src'
Makefile:34: recipe for target 'release' failed
mingw32-make[1]: *** [release] Error 2
mingw32-make[1]: Leaving directory 'd:/QT/Bacon2D-master/build/src'
makefile:40: recipe for target 'sub-src-make_first' failed
mingw32-make: *** [sub-src-make_first] Error 2

OS: Windows 10 x64 (fresh install)
QT: qt-opensource-windows-x86-android-5.5.1.exe (fresh install, same error on version 5.5.0)
QT path: D:/Programs/QT5.5.1
Project path: D:/QT/Bacon2D-master
Compiler: MinGW32
Steps:

  1. mkdir build && cd build
  2. qmake QTPATH=D:/Programs/QT5.5.1 ..
  3. mingw32-make

Top of generated Makefile:

#############################################################################
# Makefile for building: Bacon2D
# Generated by qmake (3.0) (Qt 5.5.1)
# Project:  ../Bacon2D.pro
# Template: subdirs
# Command: d:/Programs/Qt5.5.1/5.5/mingw492_32/bin/qmake.exe QTPATH=D:/Programs/QT5.5.1 -o Makefile ../Bacon2D.pro
#############################################################################

MAKEFILE      = Makefile

first: make_first
QMAKE         = d:/Programs/Qt5.5.1/5.5/mingw492_32/bin/qmake.exe
DEL_FILE      = rm -f
CHK_DIR_EXISTS= test -d
MKDIR         = mkdir -p
COPY          = cp -f
COPY_FILE     = cp -f
COPY_DIR      = cp -f -R
INSTALL_FILE  = cp -f
INSTALL_PROGRAM = cp -f
INSTALL_DIR   = cp -f -R
DEL_FILE      = rm -f
SYMLINK       = $(QMAKE) -install ln -f -s
DEL_DIR       = rmdir
MOVE          = mv -f
SUBTARGETS    =  \
        sub-src \
        sub-tests \
        sub-examples

Note: same Bacon2D source compiles and works fine on OSX.

Suggestion to change the way Box2D bindings are integrated

The current way of integrating qml-box2d is quick and easy, and somewhat convenient in terms of API because users don't have to write import Box2D in addition to import Bacon2D and certain public classes are avoided because they're automatically part of some Bacon2D classes.

However, it is less ideal in terms of cooperating on making the best QML Box2D bindings possible and it is less modular than it could be.

So a few questions I'm wondering about are:

  • What is the advantage of embedding World into Scene, and could there be alternative approaches that are still convenient but more flexible?
  • What is the advantage of deriving Entity directly from Body and couldn't there be a more flexible approach?

In both cases I think the answer is convenience. And maybe also a bit that the qml-box2d API is limited in some ways.

Some alternatives that come to mind:

Scene {
    id: scene

    property World world: World { root: scene }

    Entity {
        id: entity

        property Body body: Body { target: entity }
    }
}

The above example relies on two new properties that could be added to the World and Body objects, which would allow them to be directed at the Bacon2D classes independently. In advantage is, that they can still be used with non-Bacon2D classes as well, for example for driving a simple Image item by physics or using a basic Item as the root of the world. In addition unlike is currently the case, World and Body could derive from QObject instead of being a full QQuickItem.

But of course, it comes at a level of verbosity that's painful to deal with. I haven't figured out a way to reduce this without relying on qml-box2d directly yet, so here's my proposal by still having a hard dependency on the qml-box2d plugin:

Scene {
    id: scene

    world.gravity: Qt.point(0, 10)

    Entity {
        body.bullet: true
        body.fixtures: [ ... ]
    }
}

This example uses aggregation in both cases. The changes to qml-box2d would be the same as described above (so World would have a root property that Scene automatically sets to itself, and Body has a target property that Entity automatically sets to itself). And, the World and Body instances don't need to be created as long as they're not accessed, so scenes or entities without physical properties can automatically avoid the overhead.

What do you think about the last proposed API changes? What are your own thoughts about this issue in general? Does it make sense for me to try finding some time for working towards making this possible?

Referencing a non-existing SpriteAnimation causes a seg fault

Changing the name of the SpriteAnimation in for example Bacon2D/examples/sprite/main.qml, line 75 to something that is not a valid name of a SpriteAnimation causes a segfault:

spriteItem.animation = spriteItem.animation == "sliding" ? "somethingbogus"

Run with qmlscene, then click with mouse at least twice.

qmlscene crashed with SIGSEGV in SpriteAnimation::setRunning()

Performace problems

There are many places where Bacon2D can be optimized, before rushing into "solve/improve" some code it is better to point those things here.

** Things measured and in need for improvement **

  1. The Layer class has at least 50% of the code in Entity, along the same interfaces for interaction with the update loops. Could be wise to make Layer inherit Entity, which will delete some code and introduce a boost in update loops Scene.update for example.
  2. Entity uses QTime in it's update() function which is a performance kill when calling QTime.restart(), having a lot of entities will denote the speed hole. I know it is used for flexibility but it is placed in a critical part so there is no way of evading the performance drag.
  3. Scene.update call Scene.updateEntities which is an unnecesary call, should be deleted.
  4. Entity always updates, there is no way to stop a specify Entity from updating its behavior, which is more like a intuitive thing: You may found yourself using Entity.setEnabled(false) and expecting to pause its execution, in reallity all the items in the Scene are being updated all the time.
  5. Bacon2D uses childItems from QQuickItem to update its Entities, but by doing that they iterate over all the properties inside that specific Entity even if nothing is done to it. It would be better to centralize all Entity's update in the Scene update, taking into account the state of the Entity of course. This will reduce execution time as well as some memory savings.

** Wishy/Washy Alternatives **

  • I would like to have faster Behaviors, is there any faster way to achieve this?
  • Settings could be make async to have a faster startup time.

Rework Mirrored effect on ImageLayer

Now that ImageLayer was redone using shaders, try to implement the Mirrored effect using it (today's solution - workaround - is to create a texture that is 2 times wider than the original image and "mirror" it using QPainter")

Problem with signals

git clone https://github.com/Bacon2D/Bacon2D.git
cd Bacon2D
git submodule update --init

cd 3rdparty/qml-box2d
qmake
mingw32-make
mingw32-make install

cd ..
cd ..

mkdir build && cd build
qmake ..
mingw32-make                // !!!!!!!!!!!!!!!
mingw32-make install

Layer should extend from Entity

I see in a lot of places in the sources, sequential casting for Entity and Layer along with calling exact same methods in either case.
If Layer extends from Entity the overhead in the game loop will be reduced by almost half in evaluation time in each game/scene initialization or/and update.
A little code from scene.cpp:

    QQuickItem *item;
    foreach (item, parent->childItems()) {
        if (Entity *entity = qobject_cast<Entity *>(item))
            entity->update(delta);
        else if (Layer *layer = qobject_cast<Layer *>(item))
            layer->update(delta);
    }

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.