Skip to content

Commit 835e5df

Browse files
committed
Initial commit
0 parents  commit 835e5df

File tree

98 files changed

+32409
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+32409
-0
lines changed

.clang-format

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
BasedOnStyle: Mozilla
3+
AllowAllArgumentsOnNextLine: false
4+
AlwaysBreakAfterDefinitionReturnType: None
5+
AlwaysBreakAfterReturnType: None
6+
BraceWrapping:
7+
AfterCaseLabel: false
8+
AfterClass: true
9+
AfterControlStatement: Never
10+
AfterEnum: true
11+
AfterFunction: true
12+
AfterNamespace: true
13+
AfterObjCDeclaration: false
14+
AfterStruct: true
15+
AfterUnion: true
16+
AfterExternBlock: true
17+
BeforeCatch: false
18+
BeforeElse: false
19+
BeforeLambdaBody: false
20+
BeforeWhile: false
21+
IndentBraces: false
22+
SplitEmptyFunction: true
23+
SplitEmptyRecord: false
24+
SplitEmptyNamespace: true
25+
BreakBeforeBraces: Custom
26+
BreakBeforeTernaryOperators: false
27+
BreakConstructorInitializers: AfterColon
28+
ColumnLimit: 200
29+
ConstructorInitializerIndentWidth: 4
30+
ContinuationIndentWidth: 4
31+
FixNamespaceComments: true
32+
IncludeBlocks: Merge
33+
IndentAccessModifiers: true
34+
IndentWidth: 4
35+
PackConstructorInitializers: Never
36+
PointerAlignment: Right
37+
SortIncludes: Never
38+
SortUsingDeclarations: false
39+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
40+
AllowAllConstructorInitializersOnNextLine: true
41+
AllowShortFunctionsOnASingleLine: InlineOnly
42+
SpaceInEmptyBlock: true
43+
PenaltyIndentedWhitespace: 100

.gitignore

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This file is used to ignore files which are generated
2+
# ----------------------------------------------------------------------------
3+
4+
*~
5+
*.autosave
6+
*.a
7+
*.core
8+
*.moc
9+
*.o
10+
*.obj
11+
*.orig
12+
*.rej
13+
*.so
14+
*.so.*
15+
*_pch.h.cpp
16+
*_resource.rc
17+
*.qm
18+
.#*
19+
*.*#
20+
core
21+
!core/
22+
tags
23+
.DS_Store
24+
.directory
25+
*.debug
26+
Makefile*
27+
*.prl
28+
*.app
29+
moc_*.cpp
30+
ui_*.h
31+
qrc_*.cpp
32+
Thumbs.db
33+
*.res
34+
*.rc
35+
/.qmake.cache
36+
/.qmake.stash
37+
38+
# qtcreator generated files
39+
*.pro.user*
40+
41+
# xemacs temporary files
42+
*.flc
43+
44+
# Vim temporary files
45+
.*.swp
46+
47+
# Visual Studio generated files
48+
*.ib_pdb_index
49+
*.idb
50+
*.ilk
51+
*.pdb
52+
*.sln
53+
*.suo
54+
*.vcproj
55+
*vcproj.*.*.user
56+
*.ncb
57+
*.sdf
58+
*.opensdf
59+
*.vcxproj
60+
*vcxproj.*
61+
62+
# MinGW generated files
63+
*.Debug
64+
*.Release
65+
66+
# Python byte code
67+
*.pyc
68+
69+
# Binaries
70+
# --------
71+
*.dll
72+
*.exe
73+

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libscratchcpp"]
2+
path = libscratchcpp
3+
url = https://github.com/scratchcpp/libscratchcpp

CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project(scratchcpp-gui VERSION 1.0.0 LANGUAGES CXX)
4+
5+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
6+
set(CMAKE_AUTOUIC ON)
7+
set(CMAKE_AUTOMOC ON)
8+
set(CMAKE_AUTORCC ON)
9+
set(CMAKE_CXX_STANDARD 17)
10+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11+
12+
include(build/FindQt.cmake)
13+
14+
qt_standard_project_setup(REQUIRES 6.6)
15+
add_subdirectory(ScratchCPPGui)
16+
17+
set(QML_IMPORT_PATH "${QML_IMPORT_PATH};${PROJECT_SOURCE_DIR}/src/qml" PARENT_SCOPE)
18+
19+
target_compile_definitions(libscratchcpp-gui PRIVATE SCRATCHCPPGUI_LIBRARY)
20+
21+
target_link_libraries(libscratchcpp-gui PRIVATE Qt6::Gui Qt6::Qml Qt6::Quick)
22+
23+
include(build/SetUpLibscratchcpp.cmake)
24+
target_link_libraries(libscratchcpp-gui PRIVATE scratchcpp)
25+
26+
add_subdirectory(thirdparty/libqnanopainter)
27+
target_include_directories(libscratchcpp-gui PRIVATE thirdparty/libqnanopainter)
28+
target_link_libraries(libscratchcpp-gui PRIVATE qnanopainter)

README.md

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
2+
<a name="readme-top"></a>
3+
4+
<!-- PROJECT SHIELDS -->
5+
<!--
6+
*** I'm using markdown "reference style" links for readability.
7+
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
8+
*** See the bottom of this document for the declaration of the reference variables
9+
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
10+
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
11+
-->
12+
[![Contributors][contributors-shield]][contributors-url]
13+
[![Forks][forks-shield]][forks-url]
14+
[![Stargazers][stars-shield]][stars-url]
15+
[![Issues][issues-shield]][issues-url]
16+
[![MIT License][license-shield]][license-url]
17+
18+
19+
20+
<!-- PROJECT LOGO -->
21+
<br />
22+
<div align="center">
23+
<!-- TODO: Add logo: <a href="https://github.com/scratchcpp/scratchcpp-gui">
24+
<img src="images/logo.png" alt="Logo" width="80" height="80">
25+
</a> -->
26+
27+
<h3 align="center">ScratchCPP GUI</h3>
28+
29+
<p align="center">
30+
A Qt-based library which uses **libscratchcpp** and **QNanoPainter** to render running Scratch projects.
31+
<br />
32+
<!-- TODO: Add link to documentation: <a href="https://github.com/scratchcpp/scratchcpp-gui"><strong>Explore the docs »</strong></a>
33+
<br /> -->
34+
<br />
35+
<a href="https://github.com/scratchcpp/scratchcpp-gui/issues">Report Bug</a>
36+
·
37+
<a href="https://github.com/scratchcpp/scratchcpp-gui/issues">Request Feature</a>
38+
</p>
39+
</div>
40+
41+
42+
43+
<!-- TABLE OF CONTENTS -->
44+
<details>
45+
<summary>Table of Contents</summary>
46+
<ol>
47+
<li>
48+
<a href="#about-the-project">About The Project</a>
49+
</li>
50+
<li>
51+
<a href="#getting-started">Getting Started</a>
52+
</li>
53+
<li><a href="#usage">Usage</a></li>
54+
<li><a href="#roadmap">Roadmap</a></li>
55+
<li><a href="#contributing">Contributing</a></li>
56+
<li><a href="#license">License</a></li>
57+
</ol>
58+
</details>
59+
60+
61+
62+
<!-- ABOUT THE PROJECT -->
63+
## About The Project
64+
65+
**scratchcpp-gui** is a library which provides a set of Qt Quick components that can be used to run Scratch projects.
66+
67+
It uses **QNanoPainter** on top of Qt for hardware accelerated rendering
68+
and **libscratchcpp** to read, run and maintain the state of Scratch projects.
69+
70+
## NOTE
71+
This library is still in development and it shouldn't be used in production yet.
72+
73+
**There might be incompatible API changes anytime before version 1.0.0 releases!**
74+
75+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
76+
77+
78+
79+
<!-- GETTING STARTED -->
80+
## Getting Started
81+
82+
We're working on the documentation, it'll be available soon.
83+
<!-- TODO: Add link to documentation -->
84+
85+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
86+
87+
88+
89+
<!-- USAGE EXAMPLES -->
90+
## Usage
91+
The most common way to get started is to use the `ProjectPlayer` component.
92+
```qml
93+
import QtQuick
94+
import ScratchCPPGui
95+
96+
Window {
97+
width: 480
98+
height: 360
99+
visible: true
100+
title: qsTr("Hello World")
101+
102+
ProjectPlayer {
103+
id: player
104+
fileName: "/path/to/project.sb3"
105+
Component.onCompleted: start()
106+
}
107+
}
108+
```
109+
The project will start when the window opens.
110+
If you would like to have a "green flag" button instead, call `player.start()` from the button:
111+
```qml
112+
Button {
113+
onClicked: player.start()
114+
}
115+
```
116+
117+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
118+
119+
120+
121+
<!-- ROADMAP -->
122+
## Roadmap
123+
124+
- [x] JPEG and PNG rendering
125+
- [ ] Everything related to displaying sprites (position, rotation, size, etc.)
126+
- [ ] Loading projects in another thread
127+
- [ ] API for engine properties (FPS, turbo mode, etc.)
128+
- [ ] Loading projects from URL
129+
- [ ] SVG rendering
130+
- [ ] Mouse position
131+
- [ ] Key press events
132+
- [ ] Mouse press events
133+
- [ ] Sprite click events
134+
- [ ] Clones
135+
- [ ] Sprite dragging
136+
- [ ] Touching color blocks
137+
- [ ] Pen blocks
138+
- [ ] Monitors
139+
- [ ] Graphics effects (maybe using shaders)
140+
- [ ] Speech and thought bubbles
141+
- [ ] Question text box ("ask and wait" block)
142+
143+
See the [open issues](https://github.com/scratchcpp/scratchcpp-gui/issues) for a full list of proposed features (and known issues).
144+
145+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
146+
147+
148+
149+
<!-- CONTRIBUTING -->
150+
## Contributing
151+
152+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
153+
154+
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".
155+
Don't forget to give the project a star! Thanks again!
156+
157+
1. Fork the Project
158+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
159+
3. Format changed source files (`clang-format src/some_file.cpp`)
160+
4. Commit your Changes (`git add -A && git commit -m 'Add some AmazingFeature'`)
161+
5. Push to the Branch (`git push origin feature/AmazingFeature`)
162+
6. Open a Pull Request
163+
164+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
165+
166+
167+
168+
<!-- LICENSE -->
169+
## License
170+
171+
Distributed under the GNU Lesser General Public License. See [LICENSE](LICENSE) for more information.
172+
173+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
174+
175+
176+
177+
<!-- MARKDOWN LINKS & IMAGES -->
178+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
179+
[contributors-shield]: https://img.shields.io/github/contributors/scratchcpp/scratchcpp-gui.svg?style=for-the-badge
180+
[contributors-url]: https://github.com/scratchcpp/scratchcpp-gui/graphs/contributors
181+
[forks-shield]: https://img.shields.io/github/forks/scratchcpp/scratchcpp-gui.svg?style=for-the-badge
182+
[forks-url]: https://github.com/scratchcpp/scratchcpp-gui/network/members
183+
[stars-shield]: https://img.shields.io/github/stars/scratchcpp/scratchcpp-gui.svg?style=for-the-badge
184+
[stars-url]: https://github.com/scratchcpp/scratchcpp-gui/stargazers
185+
[issues-shield]: https://img.shields.io/github/issues/scratchcpp/scratchcpp-gui.svg?style=for-the-badge
186+
[issues-url]: https://github.com/scratchcpp/scratchcpp-gui/issues
187+
[license-shield]: https://img.shields.io/github/license/scratchcpp/scratchcpp-gui.svg?style=for-the-badge
188+
[license-url]: https://github.com/scratchcpp/scratchcpp-gui/blob/master/LICENSE

ScratchCPPGui/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
qt_add_library(libscratchcpp-gui STATIC)
2+
3+
set_target_properties(libscratchcpp-gui PROPERTIES AUTOMOC ON)
4+
5+
qt_add_qml_module(libscratchcpp-gui
6+
URI ScratchCPPGui
7+
VERSION 1.0
8+
QML_FILES
9+
ProjectPlayer.qml
10+
SOURCES
11+
global.h
12+
projectloader.cpp
13+
projectloader.h
14+
projectscene.cpp
15+
projectscene.h
16+
stagemodel.cpp
17+
stagemodel.h
18+
spritemodel.cpp
19+
spritemodel.h
20+
renderedtarget.cpp
21+
renderedtarget.h
22+
targetpainter.cpp
23+
targetpainter.h
24+
)

0 commit comments

Comments
 (0)