Skip to content

Commit

Permalink
Merge pull request #73 from MisterGC/feature/multi-sbx-support
Browse files Browse the repository at this point in the history
Feature/multi sbx support
  • Loading branch information
MisterGC authored Aug 26, 2021
2 parents 06cf615 + 02a6d32 commit cdf2d85
Show file tree
Hide file tree
Showing 81 changed files with 388 additions and 362 deletions.
14 changes: 4 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ add_subdirectory (thirdparty/qml-box2d)
add_subdirectory (thirdparty/simple-svg-writer)
add_subdirectory (plugins)

# Qt has problems with multiple executables when building for Android
# TODO Re-check if support for Android got better in Qt6
if(NOT ANDROID)
add_subdirectory (liveloader)
endif()

if(NOT ANDROID)
add_subdirectory (sandboxes/gui)
add_subdirectory (sandboxes/visualfx)
add_subdirectory (sandboxes/platformer)
add_subdirectory (sandboxes/pluginlive)
add_subdirectory (sandboxes/topdown)
add_subdirectory (sandboxes/void)
add_subdirectory (tools)
add_subdirectory (examples)
endif()
62 changes: 33 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@



## Flow, form, create
## Overview: Flow, Form, Create
When participating at [Ludum Dare 44](https://ldjam.com) I started to develop
utilities and a LiveLoading app to ease game creation. As I really enjoyed
using these components, I decided to create separate project and make it
utilities and a live loading app to ease game creation. As I really enjoyed
using these components, I decided to create a separate project and to make it
open source.

Clayground is a [Qt](https://www.qt.io) based toolset that allows using C++, JavaScript
and [QML](https://doc.qt.io/qt-5/qtqml-index.html) to rapidly develop apps in a sandbox environment with live loading capabilities.
It provides tools that try both facilitating learning and allowing more
focused and faster development by reducing typical build and restart times
significantly.
and [QML](https://doc.qt.io/qt-5/qtqml-index.html) to rapidly develop apps in a sandbox
environment with live loading capabilities. It provides tools that try both, facilitating
learning and allowing more focused and faster development by reducing typical build and restart times significantly.

![Platformer Screenshot](res/screenshot_platformer.png)

Goals/Basic Design Decisions:
- Use Qt (Quick): Don't write everything from scratch, but think how to re-combine Qt's capabilities
- Code > Graphical Tools: Focus on minimizing time needed to write and debug applications
- Don't write graphical tools, but support formats which can be used with popular free tools
- Add dedicated APIs but still allow bypassing them (full power of Qt/Qml, C++, JavaScript)
- Target (rapid) prototyping and small/medium app development

### Available Plugins
- Target Scope: Optimize for (rapid) prototyping and small/medium app development
- Focus on written source code and keyboard actions not for usage of graphical tools
- Full control: Add dedicated APIs but allow bypassing them easily (full power of C++, Qt/Qml, JavaScript)
- Don't provide (graphical) tools: Go for approaches that allow usage of freely available, popular tools like Qt Creator, Git and Inkscape
- Qt as Foundation: Don't write everything from scratch, but think how to re-combine Qt's capabilities

Main components:
- **Dojo**: Sandbox environment which is designed to be used for rapid dev, it is typically put next to a code editor/IDE, code changes are automatically applied
- **Plugins**: Different packages that can be used to build (interactive) apps
- **Examples**: Demonstrate the usage of Clayground, all examples can be either used with Dojo or standalone

### Plugins: Clayground's basic building blocks
Clayground comes with a set of plugins that extend Qt capabilities in order to
build interactive experiences:
- Physics/Box2D: Adds 2D Physics capabilities
Expand All @@ -34,40 +38,40 @@ build interactive experiences:
- Storage: Get persistent storage with a very simple API
- World: Uses Canvas, Physics and SVG to provide a foundation for small games and simulations

### Available Examples
### Examples: See how problems can be solved with Clayground
A bunch of example application allow you to try it out easily:
- GUI: Visual training app for keyboard shortcuts, comes with a configuration for Inkscape.
- VisualFX: Implementation of different visual effects, includes usage of the [Qt Particle System](https://doc.qt.io/qt-5/qtquick-effects-particles.html).
- Platformer: Starting point for a platformer game.
- TopDown: Starting point for a topdown game (for example a classical RPG).
- PluginLive: Demonstrates how to use the Clayground LiveLoader to develop a C++ plugin.
- TopDown: Starting point for a topdown game (for example a classical RPG), comes with network support
- PluginLive: Demonstrates how to use the Clayground LiveLoader to develop a C++ plugin

### How to work with a sandbox?
1. Clone this repo and build it (Qt 5.15.x, Qt Creator)
2. Start the qml_live_loader app `clayrestarter --dynimportdir=<clone-dir>/sandboxes/void`
2. Start the dojo app `claydojo --sbx=<clone-dir>/sandboxes/void/Sandbox.qml`
3. Move the window to a location that allows you to keep it visible even when your are editing code.
4. Make changes to `<clone-dir>/sandboxes/void/Sandbox.qml` -> see the changes live applied
5. Check out the other sandboxes in the same way :)
4. Make changes to `<clone-dir>/sandboxes/void/Sandbox.qml` -> see the changes applied automatically
5. Press `G` in the app window to show the Guide/Help overlay.
6. Check out the other sandboxes in the same way :)


#### Using the Logging Overlay
The sandbox comes with a logging overlay that shows all
`console.log(...)` messages in a continous log view and
watched properties/expressions in a sticky section. You can
easily show/hide the overlay by using the `log` button of the
restarter or by pressing lower-case L when the Sbx Window has the focus.
The sandbox comes with a logging overlay that shows all `console.log(...)` messages in a continous log view and watched properties/expressions in a sticky section. You can
easily show/hide the logging overlay by pressing `L` when the Sandbox Window has the focus.

<img src="res/log_overlay.png" width="50%" height="50%" alt="LogOverlay Screenshot">

Have a look at the `onMapLoaded` signal handler of the Platformer
Sandbox to see how you can use them.
Have a look at the `onMapLoaded` signal handler of the Platformer Sandbox to see how you can use them.

### How to create a deployable app?
Each of the demo sandboxes also comes with a CMake application configuration which
allows to build a standalone app. So you can just use one as a template to build your own app.

### Is there any recommended development setup?
- OS: Linux (fastest and easy to use) - I have also used it on macOS and Windows 10, still good but use Linux if you can
- IDE/Editor: Qt Creator as it also allows you to easily debug and profile resulting apps - additionally I use Vim for various text processing tasks
- IDE/Editor: Qt Creator as it also allows you to easily debug and profile resulting apps - additionally I use Vim and VS Code for various text processing tasks

Feel free to contact me, create issues or to contribute :)

I hope you enjoy using clayground, feel free to create issues or to contribute :)
Enjoy life,<br>
`mgc`
9 changes: 9 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.16)
project (examples)

add_subdirectory (gui)
add_subdirectory (visualfx)
add_subdirectory (platformer)
add_subdirectory (pluginlive)
add_subdirectory (topdown)
add_subdirectory (void)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions liveloader/CMakeLists.txt

This file was deleted.

95 changes: 0 additions & 95 deletions liveloader/loader/main.qml

This file was deleted.

109 changes: 0 additions & 109 deletions liveloader/restarter/graphics.svg

This file was deleted.

6 changes: 6 additions & 0 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project (clayground_tools)

add_subdirectory (common)
add_subdirectory (dojo)
add_subdirectory (loader)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project (clayutilities)
project (claytoolscommon)

import_qt_components(Core)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ void addCommonArgs(QCommandLineParser &parser)
{
parser.addOption({DYN_PLUGIN_ARG, DYN_PLUGIN_ARG_DESCR, "directory-pair"});
parser.addOption({DYN_IMPORT_DIR_ARG, DYN_IMPORT_DIR_ARG_DESCR, "directory", "<working directory>"});
parser.addOption({SBX_ARG, SBX_ARG_DESCR, "file-path", "<none>"});
parser.addOption({SBX_INDEX_ARG, SBX_INDEX_ARG_DESCR, "index", QString::number(USE_FIRST_SBX_IDX)});
parser.addOption({MESSAGE_ARG, MESSAGE_ARG_DESCR, "N/A"});
}
Loading

0 comments on commit cdf2d85

Please sign in to comment.