A Qt-based library which uses libscratchcpp and QNanoPainter to render running Scratch projects.
Report Bug
·
Request Feature
Table of Contents
scratchcpp-render is a library which provides a set of Qt Quick components that can be used to run and render Scratch projects.
It uses QNanoPainter on top of Qt for hardware accelerated rendering and libscratchcpp to read, run and maintain the state of Scratch projects.
This library is still in development and it shouldn't be used in production yet.
There might be incompatible API changes anytime before version 1.0.0 releases!
We're working on the documentation, it'll be available soon.
Get started by using the ProjectPlayer
component.
import QtQuick
import ScratchCPP.Render
Window {
width: 480
height: 360
visible: true
title: qsTr("Hello World")
ProjectPlayer {
id: player
fileName: "/path/to/project.sb3"
onLoaded: start()
}
}
The project will start when the window opens.
If you would like to have a "green flag" button instead, call player.start()
from the button:
Button {
onClicked: player.start()
}
The library must be initialized by the application.
To initialize the library, call scratchcpprender::init()
before constructing the Q(Gui)Application object.
#include <scratchcpp-render/scratchcpp-render.h>
int main(int argc, char **argv) {
scratchcpprender::init();
QApplication a(argc, argv);
...
}
- JPEG and PNG rendering
- Everything related to displaying sprites (position, rotation, size, etc.)
- Loading projects in another thread
- API for engine properties (FPS, turbo mode, etc.)
- Loading projects from URL
- SVG rendering
- Mouse position
- Key press events
- Mouse press events
- Sprite click events
- Clones
- Sprite dragging
- Touching sprite block
- Touching color blocks
- Pen blocks
- Monitors
- Graphics effects
- Speech and thought bubbles
- Question text box ("ask and wait" block)
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Format changed source files (
clang-format src/some_file.cpp
) - Commit your Changes (
git add -A && git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU Lesser General Public License. See LICENSE for more information.