/scratchcpp-render

Qt library for running and rendering Scratch projects

Primary LanguageC++GNU Lesser General Public License v3.0LGPL-3.0

Contributors Forks Stargazers Issues MIT License


ScratchCPP Render

A Qt-based library which uses libscratchcpp and QNanoPainter to render running Scratch projects.

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License

About The Project

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.

NOTE

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!

(back to top)

Getting Started

We're working on the documentation, it'll be available soon.

(back to top)

Usage

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);
    ...
}

(back to top)

Roadmap

  • 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 (color, brightness and ghost are implemented)
  • 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).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Format changed source files (clang-format src/some_file.cpp)
  4. Commit your Changes (git add -A && git commit -m 'Add some AmazingFeature')
  5. Push to the Branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

(back to top)

License

Distributed under the GNU Lesser General Public License. See LICENSE for more information.

(back to top)