Rewrite loader and a small part of the UI
This commit is contained in:
parent
b5acd36479
commit
b564d79476
54 changed files with 1209 additions and 2793 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "dist/submodules/CORE"]
|
||||
path = dist/submodules/CORE
|
||||
url = https://git.staropensource.de/StarOpenSource/CORE-distrib-git.git
|
17
.stignore
Normal file
17
.stignore
Normal file
|
@ -0,0 +1,17 @@
|
|||
.godot/
|
||||
*.import
|
||||
/node_modules
|
||||
/out
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
pnpm-lock.yaml
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
1
CORE
Symbolic link
1
CORE
Symbolic link
|
@ -0,0 +1 @@
|
|||
dist/submodules/CORE
|
97
Console.tscn
97
Console.tscn
|
@ -1,97 +0,0 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://btyi16dkvbly1"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/console.gd" id="1_viv5y"]
|
||||
[ext_resource type="FontFile" uid="uid://b325yyejgxcyt" path="res://assets/fonts/FiraCode/Regular.ttf" id="2_ebuk0"]
|
||||
[ext_resource type="FontFile" uid="uid://bbo5ifp3raaog" path="res://assets/fonts/FiraCode/Bold.ttf" id="3_102to"]
|
||||
[ext_resource type="FontFile" uid="uid://yvdh4nvjqmbk" path="res://assets/fonts/FiraCode/Medium.ttf" id="4_jqfsc"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_u40jo"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wj4aw"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ime8b"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_hjtld"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xa0gg"]
|
||||
|
||||
[node name="Console" type="ColorRect"]
|
||||
offset_right = 767.0
|
||||
offset_bottom = 426.0
|
||||
script = ExtResource("1_viv5y")
|
||||
|
||||
[node name="Bar" type="ColorRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 2.5
|
||||
offset_top = 2.5
|
||||
offset_right = 764.5
|
||||
offset_bottom = 27.5
|
||||
color = Color(0.839216, 0.0196078, 0.196078, 1)
|
||||
|
||||
[node name="X1" type="Line2D" parent="Bar"]
|
||||
points = PackedVector2Array(760, 2, 739, 23)
|
||||
width = 2.0
|
||||
|
||||
[node name="X2" type="Line2D" parent="Bar"]
|
||||
points = PackedVector2Array(760, 23, 739, 2)
|
||||
width = 2.0
|
||||
|
||||
[node name="CloseButton" type="Button" parent="Bar"]
|
||||
layout_mode = 0
|
||||
offset_left = 737.0
|
||||
offset_right = 762.0
|
||||
offset_bottom = 25.0
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_u40jo")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_wj4aw")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ime8b")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_hjtld")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_xa0gg")
|
||||
|
||||
[node name="DragButton" type="Button" parent="Bar"]
|
||||
layout_mode = 0
|
||||
offset_right = 737.0
|
||||
offset_bottom = 25.0
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_u40jo")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_wj4aw")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ime8b")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_hjtld")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_xa0gg")
|
||||
|
||||
[node name="Shell" type="ColorRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 2.5
|
||||
offset_top = 27.5
|
||||
offset_right = 764.5
|
||||
offset_bottom = 423.5
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Output" type="RichTextLabel" parent="Shell"]
|
||||
layout_mode = 0
|
||||
offset_right = 762.0
|
||||
offset_bottom = 361.0
|
||||
theme_override_fonts/normal_font = ExtResource("2_ebuk0")
|
||||
theme_override_fonts/bold_font = ExtResource("3_102to")
|
||||
theme_override_fonts/italics_font = ExtResource("2_ebuk0")
|
||||
theme_override_fonts/bold_italics_font = ExtResource("3_102to")
|
||||
theme_override_fonts/mono_font = ExtResource("2_ebuk0")
|
||||
theme_override_font_sizes/normal_font_size = 18
|
||||
theme_override_font_sizes/bold_font_size = 18
|
||||
theme_override_font_sizes/italics_font_size = 18
|
||||
theme_override_font_sizes/bold_italics_font_size = 18
|
||||
theme_override_font_sizes/mono_font_size = 18
|
||||
bbcode_enabled = true
|
||||
scroll_following = true
|
||||
|
||||
[node name="Input" type="TextEdit" parent="Shell"]
|
||||
layout_mode = 0
|
||||
offset_top = 361.0
|
||||
offset_right = 762.0
|
||||
offset_bottom = 396.0
|
||||
theme_override_colors/background_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_fonts/font = ExtResource("4_jqfsc")
|
||||
theme_override_font_sizes/font_size = 18
|
||||
placeholder_text = "Enter a command here"
|
||||
|
||||
[connection signal="pressed" from="Bar/CloseButton" to="." method="toggle_console"]
|
||||
[connection signal="text_changed" from="Shell/Input" to="." method="input_changed"]
|
847
LICENSE
847
LICENSE
|
@ -1,187 +1,662 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
TERMS AND CONDITIONS
|
||||
0. Definitions.
|
||||
|
||||
“This License” refers to version 3 of the GNU General Public License.
|
||||
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||
|
||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||
|
||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
1. Source Code.
|
||||
|
||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||
|
||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
7. Additional Terms.
|
||||
|
||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
11. Patents.
|
||||
|
||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||
|
||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
|
10
Loader.tscn
10
Loader.tscn
|
@ -1,10 +0,0 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dp7lmanb36qp1"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/loader.gd" id="1_dpffy"]
|
||||
|
||||
[node name="Loader" type="ColorRect"]
|
||||
offset_right = 1920.0
|
||||
offset_bottom = 1440.0
|
||||
size_flags_horizontal = 4
|
||||
color = Color(0, 0, 0, 1)
|
||||
script = ExtResource("1_dpffy")
|
BIN
assets/fonts/FiraCode-Bold.ttf
Normal file
BIN
assets/fonts/FiraCode-Bold.ttf
Normal file
Binary file not shown.
33
assets/fonts/FiraCode-Bold.ttf.import
Normal file
33
assets/fonts/FiraCode-Bold.ttf.import
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://djwvfu0kc4id2"
|
||||
path="res://.godot/imported/FiraCode-Bold.ttf-bdc34227b8eb211c962e30966e74392e.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/FiraCode-Bold.ttf"
|
||||
dest_files=["res://.godot/imported/FiraCode-Bold.ttf-bdc34227b8eb211c962e30966e74392e.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
assets/fonts/FiraCode-Light.ttf
Normal file
BIN
assets/fonts/FiraCode-Light.ttf
Normal file
Binary file not shown.
33
assets/fonts/FiraCode-Light.ttf.import
Normal file
33
assets/fonts/FiraCode-Light.ttf.import
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://h15xdwoalk6r"
|
||||
path="res://.godot/imported/FiraCode-Light.ttf-3af4edcd803164cf600e96fd2e11c911.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/FiraCode-Light.ttf"
|
||||
dest_files=["res://.godot/imported/FiraCode-Light.ttf-3af4edcd803164cf600e96fd2e11c911.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
assets/fonts/FiraCode-Medium.ttf
Normal file
BIN
assets/fonts/FiraCode-Medium.ttf
Normal file
Binary file not shown.
33
assets/fonts/FiraCode-Medium.ttf.import
Normal file
33
assets/fonts/FiraCode-Medium.ttf.import
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://b3enb1sp754f2"
|
||||
path="res://.godot/imported/FiraCode-Medium.ttf-54c145b70340c0890bd0d9a1c2bc35e9.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/FiraCode-Medium.ttf"
|
||||
dest_files=["res://.godot/imported/FiraCode-Medium.ttf-54c145b70340c0890bd0d9a1c2bc35e9.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
assets/fonts/FiraCode-Regular.ttf
Normal file
BIN
assets/fonts/FiraCode-Regular.ttf
Normal file
Binary file not shown.
33
assets/fonts/FiraCode-Regular.ttf.import
Normal file
33
assets/fonts/FiraCode-Regular.ttf.import
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bm4c80iwak3x8"
|
||||
path="res://.godot/imported/FiraCode-Regular.ttf-e4f8ed682e3900686172fbffb0e825d3.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/FiraCode-Regular.ttf"
|
||||
dest_files=["res://.godot/imported/FiraCode-Regular.ttf-e4f8ed682e3900686172fbffb0e825d3.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
assets/fonts/FiraCode-Retina.ttf
Normal file
BIN
assets/fonts/FiraCode-Retina.ttf
Normal file
Binary file not shown.
33
assets/fonts/FiraCode-Retina.ttf.import
Normal file
33
assets/fonts/FiraCode-Retina.ttf.import
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://htdewngiycmx"
|
||||
path="res://.godot/imported/FiraCode-Retina.ttf-9acf171c8fac846ad43952348afe2e07.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/FiraCode-Retina.ttf"
|
||||
dest_files=["res://.godot/imported/FiraCode-Retina.ttf-9acf171c8fac846ad43952348afe2e07.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
|
@ -3,12 +3,12 @@
|
|||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dx8p74p0i62m6"
|
||||
path="res://.godot/imported/ExtraLight.ttf-3fa60adf0aa6232c1bedbcddebc8e723.fontdata"
|
||||
path="res://.godot/imported/ExtraLight.ttf-bb0e19eea80f6a68e9107c48b55d0648.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/Inter/ExtraLight.ttf"
|
||||
dest_files=["res://.godot/imported/ExtraLight.ttf-3fa60adf0aa6232c1bedbcddebc8e723.fontdata"]
|
||||
source_file="res://docs/static/assets/fonts/Inter/ExtraLight.ttf"
|
||||
dest_files=["res://.godot/imported/ExtraLight.ttf-bb0e19eea80f6a68e9107c48b55d0648.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dffks11lnsxs5"
|
||||
path="res://.godot/imported/ExtraLightItalic.ttf-5034a983f9184e065574fa0f4e73bbcf.fontdata"
|
||||
path="res://.godot/imported/ExtraLightItalic.ttf-422675fedd9c4ec04d69e43c744eaa4f.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/Inter/ExtraLightItalic.ttf"
|
||||
dest_files=["res://.godot/imported/ExtraLightItalic.ttf-5034a983f9184e065574fa0f4e73bbcf.fontdata"]
|
||||
source_file="res://docs/static/assets/fonts/Inter/ExtraLightItalic.ttf"
|
||||
dest_files=["res://.godot/imported/ExtraLightItalic.ttf-422675fedd9c4ec04d69e43c744eaa4f.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dg7h7kl4d14ow"
|
||||
path="res://.godot/imported/Icon.png-93ca016a3d581ee8be85859272221470.ctex"
|
||||
uid="uid://da2wntwvo475w"
|
||||
path="res://.godot/imported/Icon.png-d79ea379e3fba006ce2fd281411ee899.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/Icon.png"
|
||||
dest_files=["res://.godot/imported/Icon.png-93ca016a3d581ee8be85859272221470.ctex"]
|
||||
source_file="res://docs/static/assets/images/Icon.png"
|
||||
dest_files=["res://.godot/imported/Icon.png-d79ea379e3fba006ce2fd281411ee899.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dqwbdoq6pb7nq"
|
||||
path="res://.godot/imported/IconRound.png-e2e3ca1c6a931df6c0dde4865e1c2ef1.ctex"
|
||||
uid="uid://8f1flcdctjhr"
|
||||
path="res://.godot/imported/IconRound.png-1afd952ea59d10fc5e3b0a78c073f524.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/IconRound.png"
|
||||
dest_files=["res://.godot/imported/IconRound.png-e2e3ca1c6a931df6c0dde4865e1c2ef1.ctex"]
|
||||
source_file="res://docs/static/assets/images/IconRound.png"
|
||||
dest_files=["res://.godot/imported/IconRound.png-1afd952ea59d10fc5e3b0a78c073f524.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b47njmhn3hvhn"
|
||||
uid="uid://b23f0o450c2xl"
|
||||
path="res://.godot/imported/IconText.png-ba84e8aaca79c24529b5915da9118cd4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bfu6nsmqqjppf"
|
||||
uid="uid://7cnblsrwyn85"
|
||||
path="res://.godot/imported/IconTextInverted.png-72aab43aa4c298c56bda31ba0fe7e2b3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cj1twbwvogrn0"
|
||||
uid="uid://b7ym2ws80io7h"
|
||||
path="res://.godot/imported/Wallpaper.png-85e0d5ffbcbc2cbf398dce31e002e693.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
|
|
BIN
assets/images/WallpaperResized.png
Normal file
BIN
assets/images/WallpaperResized.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 MiB |
|
@ -2,16 +2,16 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b2201ulvth1qp"
|
||||
path="res://.godot/imported/meme.jpg-9a7233508d56192f29bdb233352ed64b.ctex"
|
||||
uid="uid://485ypkeljwca"
|
||||
path="res://.godot/imported/WallpaperResized.png-8e303142bbdb3b4dd37d13f2caaafbad.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://example/images/meme.jpg"
|
||||
dest_files=["res://.godot/imported/meme.jpg-9a7233508d56192f29bdb233352ed64b.ctex"]
|
||||
source_file="res://assets/images/WallpaperResized.png"
|
||||
dest_files=["res://.godot/imported/WallpaperResized.png-8e303142bbdb3b4dd37d13f2caaafbad.ctex"]
|
||||
|
||||
[params]
|
||||
|
|
@ -16,7 +16,7 @@ Copyright holder: JeremyStarTM
|
|||
-> Website: https://jstm.staropensource.de
|
||||
License: CC-BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
### Wallpaper.png
|
||||
### Wallpaper.png & WallpaperResized.png
|
||||
Title: Basteibrücke morgen
|
||||
Copyright holder: Thomas Wolf
|
||||
-> Website: www.foto-tw.de
|
||||
|
|
0
dist/.gdignore
vendored
Normal file
0
dist/.gdignore
vendored
Normal file
47
dist/setup-presentation.sh
vendored
Executable file
47
dist/setup-presentation.sh
vendored
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/usr/sbin/env bash
|
||||
set -eo pipefail
|
||||
if [ -n "${VERBOSE}" ]; then set -x; fi
|
||||
# Print banner
|
||||
echo " ____ __"
|
||||
echo "/\\ _\`\\ /\\ \\"
|
||||
echo "\\ \\ \\L\\ \\_ __ __ ____ __ ___ ___ ___ \\_\\ \\ __"
|
||||
echo " \\ \\ ,__/\\\`'__\\/'__\`\\ /',__\\ /'__\`\\/' _ \`\\ /'___\\ / __\`\\ /'_\` \\ /'__\`\\"
|
||||
echo " \\ \\ \\/\\ \\ \\//\\ __//\\__, \`\\/\\ __//\\ \\/\\ \\/\\ \\__//\\ \\L\\ \\/\\ \\L\\ \\/\\ __/"
|
||||
echo " \\ \\_\\ \\ \\_\\\\ \\____\\/\\____/\\ \\____\\ \\_\\ \\_\\ \\____\\ \\____/\\ \\___,_\\ \\____\\"
|
||||
echo " \\/_/ \\/_/ \\/____/\\/___/ \\/____/\\/_/\\/_/\\/____/\\/___/ \\/__,_ /\\/____/"
|
||||
# Initialize
|
||||
echo ":: Initializing"
|
||||
## Environment variables
|
||||
if [ -z "${REPOSITORY_SERVER}" ]; then
|
||||
export "REPOSITORY_SERVER=git.staropensource.de"
|
||||
fi
|
||||
if [ -z "${REPOSITORY_OWNER}" ]; then
|
||||
export "REPOSITORY_OWNER=JeremyStarTM"
|
||||
fi
|
||||
if [ -z "${REPOSITORY_NAME}" ]; then
|
||||
export "REPOSITORY_NAME=Presencode"
|
||||
fi
|
||||
## Dependency checks
|
||||
if ! which git &> /dev/null; then
|
||||
echo ":: Error: git is not installed in \$PATH."
|
||||
exit 2
|
||||
fi
|
||||
if ! which godot &> /dev/null; then
|
||||
if ! which flatpak &> /dev/null; then
|
||||
echo ":: Error: godot is not installed in \$PATH and could not be installed using flatpak."
|
||||
exit 2
|
||||
else
|
||||
if ! flatpak install flathub org.godotengine.Godot --user --app --assumeyes --noninteractive; then
|
||||
echo ":: Error: godot is not installed in \$PATH and could not be installed using flatpak."
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# Download source code
|
||||
echo ":: Downloading source code"
|
||||
if ! git clone "https://${REPOSITORY_SERVER}/${REPOSITORY_OWNER}/${REPOSITORY_NAME}.git"; then
|
||||
echo ":: Error: Could not download source code."
|
||||
exit 3
|
||||
fi
|
||||
# Update project files
|
||||
echo "Updating project files"
|
1
dist/submodules/CORE
vendored
Submodule
1
dist/submodules/CORE
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit c427f69f02ddeb85db3a38f230a0d8bf7682e074
|
|
@ -59,6 +59,8 @@ If you want something like this:
|
|||
... then Presencode is something for you!
|
||||
### Cons
|
||||
If you however like something like this:
|
||||
- safety
|
||||
- sandboxing
|
||||
- visual editor
|
||||
- fast and easy editing
|
||||
- not coding
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 76 KiB |
|
@ -1,34 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ntxfypdxmvkq"
|
||||
path="res://.godot/imported/foxxo.jpg-ef4c7ba004a3455efe7e3e1605964ac9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://example/images/foxxo.jpg"
|
||||
dest_files=["res://.godot/imported/foxxo.jpg-ef4c7ba004a3455efe7e3e1605964ac9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
Binary file not shown.
Before Width: | Height: | Size: 300 KiB |
Binary file not shown.
Before Width: | Height: | Size: 51 KiB |
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"version": 1,
|
||||
"program": "Presencode",
|
||||
"topic": "Example presentation",
|
||||
"authors": [
|
||||
"JeremyStarTM",
|
||||
"Contributors"
|
||||
],
|
||||
"ratio": "16:9",
|
||||
"entrypoint": "test.gd"
|
||||
}
|
129
example/test.gd
129
example/test.gd
|
@ -1,129 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE TEST FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### example/test.gd (Example presentation script) ###
|
||||
### ###
|
||||
### This test file serves as the entrypoint for the example presentation ###
|
||||
### bundled in Presencode's source code. It's only interesting for ###
|
||||
### developers working on Presencode and for people wanting to make their ###
|
||||
### own Presencode presentations. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# Viewport
|
||||
var viewport: Control = null
|
||||
|
||||
# Resources
|
||||
var resources_files: Array = ["foxxo.jpg", "meme.jpg"]
|
||||
var resources: Dictionary = {}
|
||||
|
||||
# Presentation controller registration
|
||||
func _ready() -> void:
|
||||
# Print debug message
|
||||
logger.diag("Example presentation entrypoint has been loaded into memory")
|
||||
# Load resources into memory
|
||||
for resource_name in resources_files:
|
||||
var resource = preader.read_file("images/" + resource_name)
|
||||
if resource_name.ends_with(".jpg"):
|
||||
var image: Image = Image.new()
|
||||
image.load_jpg_from_buffer(resource)
|
||||
resource = ImageTexture.create_from_image(image)
|
||||
elif resource_name.ends_with(".png"):
|
||||
var image: Image = Image.new()
|
||||
image.load_png_from_buffer(resource)
|
||||
resource = ImageTexture.create_from_image(image)
|
||||
#elif resource_name.ends_with(".gif"):
|
||||
# resource = GifManager.sprite_frames_from_buffer(resource)
|
||||
resources.merge({resource_name: resource}, true)
|
||||
# Register controller with these arguments:
|
||||
## version: 1
|
||||
## max slides: 3
|
||||
## animations: no
|
||||
## quit on last slide: no
|
||||
## controller: this script
|
||||
pmana.register(1, 2, false, false, self.get_path())
|
||||
|
||||
# pmana has registered this controller
|
||||
func presentation_start(viewport_: Control) -> void:
|
||||
logger.diag("presentation_start() called")
|
||||
viewport = viewport_
|
||||
# Hide log output
|
||||
pmana.hide_log()
|
||||
# Switch to slide 0
|
||||
# Note: We explicitly don't call pmana.change_slide(0) here as
|
||||
# current_slide is set to 0 already. pmana expects that the
|
||||
# presentation controller switches to slide zero automatically.
|
||||
change_slide(0)
|
||||
|
||||
# Presentation has ended
|
||||
## This function will only be called if the controller or the user exceeds
|
||||
## the maximum amount of slides by one (if quit_last_slide=true) or by two
|
||||
## (if quit_last_slide=false) and Presencode wants to shut down.
|
||||
## This is useful as you can unregister this controller and register another
|
||||
## without calling this function.
|
||||
func presentation_end() -> void:
|
||||
logger.diag("presentation_end() called")
|
||||
queue_free()
|
||||
|
||||
# Change the current slide to another one
|
||||
func change_slide(new_slide: int) -> void:
|
||||
logger.diag("change_slide(new_slide=" + str(new_slide) + ") called")
|
||||
match(new_slide):
|
||||
0:
|
||||
logger.info("Displaying slide about memes")
|
||||
pmana.clear_viewport()
|
||||
var npr: NinePatchRect = NinePatchRect.new()
|
||||
npr.name = "Educational Meme"
|
||||
npr.texture = resources["meme.jpg"]
|
||||
npr.size = Vector2(680, 453)
|
||||
npr.position = Vector2(100, 50)
|
||||
viewport.add_child(npr)
|
||||
1:
|
||||
logger.info("Displaying slide about foxes")
|
||||
pmana.clear_viewport()
|
||||
var npr: NinePatchRect = NinePatchRect.new()
|
||||
npr.name = "Fox"
|
||||
npr.texture = resources["foxxo.jpg"]
|
||||
npr.size = Vector2(400, 400)
|
||||
npr.position = misc.get_center_float(viewport.size, npr.size)
|
||||
viewport.add_child(npr)
|
||||
2:
|
||||
logger.info("Displaying slide about mario")
|
||||
pmana.clear_viewport()
|
||||
# var as2d: AnimatedSprite2D = AnimatedSprite2D.new()
|
||||
# as2d.name = "Mario Melee"
|
||||
# as2d.sprite_frames = resources["mario.gif"]
|
||||
# var size: Vector2 = as2d.sprite_frames.get_frame_texture(as2d.sprite_frames.get_animation_names()[0], 0).get_size()
|
||||
# as2d.position = Vector2(viewport.size.x-size.x, viewport.size.y-size.y)
|
||||
# viewport.add_child(as2d)
|
||||
# as2d.play()
|
||||
_:
|
||||
logger.error("Invalid slide")
|
||||
|
||||
# Display the end slide, unused if quit_last_slide=true
|
||||
func display_end_slide() -> void:
|
||||
logger.diag("display_end_slide() called")
|
||||
logger.info("Displaying end slide")
|
||||
pmana.clear_viewport()
|
||||
var rtl: RichTextLabel = RichTextLabel.new()
|
||||
rtl.name = "End"
|
||||
rtl.text = "THE END"
|
||||
rtl.scroll_active = false
|
||||
rtl.size = Vector2(69, 22)
|
||||
rtl.position = misc.get_center_float(viewport.size, rtl.size)
|
||||
viewport.add_child(rtl)
|
|
@ -11,27 +11,19 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="Presencode"
|
||||
run/main_scene="res://Loader.tscn"
|
||||
run/main_scene="res://scenesrc/Loader.tscn"
|
||||
config/use_custom_user_dir=true
|
||||
config/custom_user_dir_name="JeremyStarTM/presencode"
|
||||
config/custom_user_dir_name="JeremyStarTM/Presencode"
|
||||
config/features=PackedStringArray("4.2", "Mobile")
|
||||
boot_splash/bg_color=Color(0, 0, 0, 1)
|
||||
boot_splash/show_image=false
|
||||
boot_splash/fullsize=false
|
||||
|
||||
[autoload]
|
||||
|
||||
logger="*res://src/logger.gd"
|
||||
misc="*res://src/misc.gd"
|
||||
preader="*res://src/preader.gd"
|
||||
pmana="*res://src/pmana.gd"
|
||||
ui_engine="*res://src/ui_engine.gd"
|
||||
processor="*res://src/processor.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=960
|
||||
window/size/viewport_height=540
|
||||
window/size/viewport_width=1440
|
||||
window/size/viewport_height=810
|
||||
window/size/resizable=false
|
||||
|
||||
[editor]
|
||||
|
||||
|
@ -88,3 +80,4 @@ editor_switchres={
|
|||
[rendering]
|
||||
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
environment/defaults/default_clear_color=Color(0, 0, 0, 1)
|
||||
|
|
12
scenesrc/Loader.tscn
Normal file
12
scenesrc/Loader.tscn
Normal file
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://begbq4qpex3gq"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/loader.gd" id="1_afj6e"]
|
||||
|
||||
[node name="Loader" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_afj6e")
|
10
scenesrc/UserInterface.tscn
Normal file
10
scenesrc/UserInterface.tscn
Normal file
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cbqdxkaq5m44g"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/userinterface.gd" id="1_7rse1"]
|
||||
[ext_resource type="Texture2D" uid="uid://485ypkeljwca" path="res://assets/images/WallpaperResized.png" id="1_kfnw8"]
|
||||
|
||||
[node name="UserInterface" type="NinePatchRect"]
|
||||
offset_right = 1440.0
|
||||
offset_bottom = 810.0
|
||||
texture = ExtResource("1_kfnw8")
|
||||
script = ExtResource("1_7rse1")
|
|
@ -1,47 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/clickoverlay.gd (Click Overlay) ###
|
||||
### ###
|
||||
### This source file controls a invisible button that moves to the next ###
|
||||
### slide when it's clicked. ###
|
||||
##############################################################################
|
||||
extends Button
|
||||
|
||||
# Initialize clickoverlay
|
||||
func _ready() -> void:
|
||||
logger.diag("Initializing ClickOverlay")
|
||||
# Set button properties
|
||||
mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
position = Vector2i(0, 0)
|
||||
# Hide button
|
||||
add_theme_stylebox_override("normal", StyleBoxEmpty.new())
|
||||
add_theme_stylebox_override("hover", StyleBoxEmpty.new())
|
||||
add_theme_stylebox_override("pressed", StyleBoxEmpty.new())
|
||||
add_theme_stylebox_override("disabled", StyleBoxEmpty.new())
|
||||
add_theme_stylebox_override("focus", StyleBoxEmpty.new())
|
||||
# Connect pressed signal
|
||||
connect("pressed", Callable(self, "clicked"))
|
||||
# Simple fix for a bug
|
||||
await get_tree().process_frame
|
||||
clicked()
|
||||
|
||||
# Clicked event
|
||||
func clicked() -> void:
|
||||
logger.info("Navigating one slide forwards (click)")
|
||||
pmana.change_slide(pmana.current_slide+1, true)
|
409
src/console.gd
409
src/console.gd
|
@ -1,409 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/console.gd (Debug console) ###
|
||||
### ###
|
||||
### This source file controls the debug console, which can be enabled by ###
|
||||
### pressing the ^ key. ###
|
||||
##############################################################################
|
||||
extends ColorRect
|
||||
|
||||
# Nodes
|
||||
@onready var input: TextEdit = get_node("Shell/Input")
|
||||
@onready var output: RichTextLabel = get_node("Shell/Output")
|
||||
var expressionscript: Node = Node.new()
|
||||
|
||||
# Console information
|
||||
@onready var info: ConsoleInfo = ConsoleInfo.new()
|
||||
|
||||
# States
|
||||
var dragging: bool = false
|
||||
var drag_area: Vector2 = Vector2(0, 0)
|
||||
var cursor_origin: Vector2 = Vector2(0, 0)
|
||||
|
||||
# Initialize debug console
|
||||
func _ready() -> void:
|
||||
logger.info("Initializing debug console")
|
||||
# Set properties
|
||||
visible = false
|
||||
position = Vector2(30, 30)
|
||||
# Calculate console drag area
|
||||
processor.update_dragging_area(processor.DragNode.CONSOLE)
|
||||
# Setup window dragging
|
||||
$Bar/DragButton.connect("button_down", func() -> void:
|
||||
dragging = true
|
||||
cursor_origin = get_tree().root.get_viewport().get_mouse_position()
|
||||
)
|
||||
$Bar/DragButton.connect("button_up", func() -> void:
|
||||
dragging = false
|
||||
cursor_origin = Vector2(0,0)
|
||||
)
|
||||
# Setup ExpressionScript (in which arbitrary expressions are run)
|
||||
expressionscript.name = "ExpressionScript"
|
||||
expressionscript.set_script(ResourceLoader.load("res://src/console_expressionscript.gd"))
|
||||
expressionscript.logger = get_node("/root/logger")
|
||||
expressionscript.misc = get_node("/root/misc")
|
||||
expressionscript.preader = get_node("/root/preader")
|
||||
expressionscript.pmana = get_node("/root/pmana")
|
||||
expressionscript.ui_engine = get_node("/root/ui_engine")
|
||||
expressionscript.console = self
|
||||
expressionscript.loader = get_node("/root/Presencode")
|
||||
add_child(expressionscript)
|
||||
# Reset console session
|
||||
await process_command(PackedStringArray(["exit"]))
|
||||
logger.info("Debug console initialized")
|
||||
|
||||
# Toggle console visibility
|
||||
func toggle_console() -> void:
|
||||
logger.info("Toggling console visibility")
|
||||
visible = !visible
|
||||
|
||||
# Input changed
|
||||
func input_changed() -> void:
|
||||
# Check for newline/enter
|
||||
if input.text.contains("\n"):
|
||||
input.text = input.text.replace("\n", "")
|
||||
var input2: String = input.text
|
||||
input.text = ""
|
||||
input.editable = false
|
||||
await process_command(input2.split(" ", false))
|
||||
input.editable = true
|
||||
return
|
||||
# Highlight wrong/correct arbitrary gdscript expressions
|
||||
if input.text.begins_with("arbitrary ") and input.text != "arbitrary ":
|
||||
var expression_raw: String = " ".join(PackedStringArray(misc.get_shortened_array(input.text.split(" "), 0)))
|
||||
var expression: Expression = Expression.new()
|
||||
if expression.parse(expression_raw) == Error.OK: input.add_theme_color_override("font_color", Color.LIGHT_GREEN)
|
||||
else: input.add_theme_color_override("font_color", Color.LIGHT_CORAL)
|
||||
else: input.add_theme_color_override("font_color", Color8(255, 255, 255, 255))
|
||||
|
||||
# Write to console output
|
||||
func append_output(text: String, newline: bool = true) -> void:
|
||||
if newline: output.text = output.text + text + "\n"
|
||||
else: output.text = output.text + text
|
||||
|
||||
# Process commands
|
||||
## This function is completely undocumented, looking a bit through the function and
|
||||
## reading the append_output() calls should give you a rough understanding though.
|
||||
func process_command(command: PackedStringArray) -> void:
|
||||
logger.diag("Processing command [" + " ".join(command) + "]")
|
||||
await get_tree().process_frame
|
||||
if command.size() == 0:
|
||||
append_output("[color=gray]$ *nothing*[color=white]\nI don't think that entering nothing does anything. Try running [b]help[/b].")
|
||||
return
|
||||
else: append_output("[color=gray]$ " + " ".join(command) + "[color=white]")
|
||||
match(command[0]):
|
||||
"clear":
|
||||
match(command.size()):
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
output.text = ""
|
||||
"exit":
|
||||
match(command.size()):
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
await process_command(PackedStringArray(["clear"]))
|
||||
append_output("""[color=#d60532]Welcome to the Presencode debug console!
|
||||
|
||||
To get started, enter \"help\". To close the console, press the X button.[color=white]""")
|
||||
"shutdown":
|
||||
append_output("Shutting down...")
|
||||
var exitcode: int = 0
|
||||
match(command.size()):
|
||||
1: exitcode = 0
|
||||
2: exitcode = int(command[1])
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
misc.shutdown(exitcode)
|
||||
"help":
|
||||
match(command.size()):
|
||||
1: append_output(info.get_help_topic(ConsoleInfo.HelpTopic.INDEX))
|
||||
2:
|
||||
match(command[1]):
|
||||
"index": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.INDEX))
|
||||
"clear": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.CLEAR))
|
||||
"exit": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.EXIT))
|
||||
"shutdown": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.SHUTDOWN))
|
||||
"help": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.HELP))
|
||||
"navigate": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.NAVIGATE))
|
||||
"config": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.CONFIG))
|
||||
"pmana": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.PMANA))
|
||||
"preader": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.PREADER))
|
||||
"arbitrary": append_output(info.get_help_topic(ConsoleInfo.HelpTopic.ARBITRARY))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_HELP_TOPIC))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
"navigate":
|
||||
match(command.size()):
|
||||
1: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
2:
|
||||
if !command[1].is_valid_int():
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_ARGUMENT))
|
||||
else:
|
||||
var sign_: int = misc.get_sign(int(command[1]))
|
||||
match(sign_):
|
||||
+1:
|
||||
pmana.change_slide(pmana.current_slide+int(command[1]))
|
||||
append_output("Navigated " + command[1] + " slide(s) forwards.")
|
||||
-1:
|
||||
pmana.change_slide(pmana.current_slide+int(command[1]))
|
||||
append_output("Navigated " + command[1] + " slide(s) backwards.")
|
||||
0: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_ARGUMENT))
|
||||
_: append_output(info.generate_internal_error("Invalid sign \"" + str(sign_) + "\""))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
"config":
|
||||
match(command.size()):
|
||||
1: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
_:
|
||||
match(command[1]):
|
||||
"list":
|
||||
match(command.size()):
|
||||
2:
|
||||
append_output("""These configuration keys can be used:
|
||||
Key | Type | Description
|
||||
LOGGER_ENABLED | bool | Toggles the logger
|
||||
LOGGER_DIAGNOSTIC | bool | Toggles diagnostic log output
|
||||
LOGGER_COLORED | bool | Toggles colored log output
|
||||
LOGGER_HARDFAIL | bool | Toggles hardfailing errors (don't set this to false)
|
||||
LOGGER_LOGSTRING | String | The logging template, variables: runtime, time, file, function, line, color, type, message
|
||||
PMANA_ALLOW_FULLSCREEN | bool | Toggles window mode switching
|
||||
MISC_SHUTDOWN_INVISIBLE | bool | Toggles if the window should be made invisible on shutdown, displays white texture if disabled""")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
"set":
|
||||
match(command.size()):
|
||||
2: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
3: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
_:
|
||||
match(command[2]):
|
||||
"LOGGER_ENABLED":
|
||||
match(misc.get_bool(" ".join(misc.get_shortened_array(command, 2)))):
|
||||
misc.BooleanState.TRUE:
|
||||
logger.config_enabled = true
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]true[/b].")
|
||||
misc.BooleanState.FALSE:
|
||||
logger.config_enabled = false
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]false[/b]")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
"LOGGER_DIAGNOSTIC":
|
||||
match(misc.get_bool(" ".join(misc.get_shortened_array(command, 2)))):
|
||||
misc.BooleanState.TRUE:
|
||||
logger.config_diagnostic = true
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]true[/b]")
|
||||
misc.BooleanState.FALSE:
|
||||
logger.config_diagnostic = false
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]false[/b]")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
"LOGGER_COLORED":
|
||||
match(misc.get_bool(" ".join(misc.get_shortened_array(command, 2)))):
|
||||
misc.BooleanState.TRUE:
|
||||
logger.config_colored = true
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]true[/b]")
|
||||
misc.BooleanState.FALSE:
|
||||
logger.config_colored = false
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]false[/b]")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
"LOGGER_HARDFAIL":
|
||||
match(misc.get_bool(" ".join(misc.get_shortened_array(command, 2)))):
|
||||
misc.BooleanState.TRUE:
|
||||
logger.config_hardfail = true
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]true[/b]")
|
||||
misc.BooleanState.FALSE:
|
||||
logger.config_hardfail = false
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]false[/b]")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
"LOGGER_LOGSTRING":
|
||||
logger.config_logstring = " ".join(PackedStringArray(misc.get_shortened_array(command, 2)))
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]\"" + logger.config_logstring + "\"[/b]")
|
||||
"PMANA_ALLOW_FULLSCREEN":
|
||||
match(misc.get_bool(" ".join(misc.get_shortened_array(command, 2)))):
|
||||
misc.BooleanState.TRUE:
|
||||
pmana.config_allow_fullscreen = true
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]true[/b]")
|
||||
misc.BooleanState.FALSE:
|
||||
pmana.config_allow_fullscreen = false
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]false[/b]")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
"MISC_SHUTDOWN_INVISIBLE":
|
||||
match(misc.get_bool(" ".join(misc.get_shortened_array(command, 2)))):
|
||||
misc.BooleanState.TRUE:
|
||||
misc.config_shutdown_invisible = true
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]true[/b]")
|
||||
misc.BooleanState.FALSE:
|
||||
misc.config_shutdown_invisible = false
|
||||
append_output("Set \"" + str(command[2]) + "\" to [b]false[/b]")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_CONFIG_KEY, {"key": command[2]}))
|
||||
"get":
|
||||
match(command.size()):
|
||||
2: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
3:
|
||||
match(command[2]):
|
||||
"LOGGER_ENABLED": append_output("[b]" + command[2] + "[/b] is set to [b]" + str(logger.config_enabled) + "[/b]")
|
||||
"LOGGER_DIAGNOSTIC": append_output("[b]" + command[2] + "[/b] is set to [b]" + str(logger.config_diagnostic) + "[/b]")
|
||||
"LOGGER_COLORED": append_output("[b]" + command[2] + "[/b] is set to [b]" + str(logger.config_colored) + "[/b]")
|
||||
"LOGGER_HARDFAIL": append_output("[b]" + command[2] + "[/b] is set to [b]" + str(logger.config_hardfail) + "[/b]")
|
||||
"LOGGER_LOGSTRING": append_output("\"" + command[2] + "[/b] is set to [b]\"" + logger.config_logstring + "\"[/b]")
|
||||
"PMANA_ALLOW_FULLSCREEN": append_output("[b]" + command[2] + "[/b] is set to [b]" + str(pmana.config_allow_fullscreen) + "[/b]")
|
||||
"MISC_SHUTDOWN_INVISIBLE": append_output("[b]" + command[2] + "[/b] is set to [b]" + str(misc.config_shutdown_invisible) + "[/b]")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_CONFIG_KEY, {"key": command[2]}))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_ARGUMENT))
|
||||
"pmana":
|
||||
match(command.size()):
|
||||
1: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
_:
|
||||
match(command[1]):
|
||||
"register":
|
||||
match(command.size()):
|
||||
1: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
2: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
3: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
4: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
5: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
6: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
7:
|
||||
var version: Vector2 = misc.get_int_direct(command[2])
|
||||
var slides: Vector2 = misc.get_int_direct(command[3])
|
||||
var animations: misc.BooleanState = misc.get_bool(command[4])
|
||||
var animations_bool: bool = false
|
||||
var quit_last_slide: misc.BooleanState = misc.get_bool(command[5])
|
||||
var quit_last_slide_bool: bool = false
|
||||
var controller: NodePath = NodePath(command[6])
|
||||
if version.x != 0:
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "int"}))
|
||||
return
|
||||
if slides.x != 0:
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "int"}))
|
||||
return
|
||||
match(animations):
|
||||
misc.BooleanState.TRUE: animations_bool = true
|
||||
misc.BooleanState.FALSE: animations_bool = false
|
||||
_:
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
return
|
||||
match(quit_last_slide):
|
||||
misc.BooleanState.TRUE: quit_last_slide_bool = true
|
||||
misc.BooleanState.FALSE: quit_last_slide_bool = false
|
||||
_:
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
return
|
||||
if get_node(controller) == null or typeof(get_node(controller)) != TYPE_OBJECT:
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.NOT_AN_OBJECT))
|
||||
return
|
||||
if get_node(controller).get_script() == null:
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_SCRIPT_ATTACHED))
|
||||
return
|
||||
@warning_ignore("narrowing_conversion")
|
||||
pmana.register(version.y, slides.y, animations_bool, quit_last_slide_bool, controller)
|
||||
append_output("A new presentation controller has been registered. Look into the Presencode log output if nothing happens.")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
"unregister":
|
||||
if !pmana.registered: append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_CONTROLLER_REGISTERED))
|
||||
else:
|
||||
await pmana.unregister()
|
||||
append_output("The current presentation controller has been unregistered.")
|
||||
"change_slide":
|
||||
match(command.size()):
|
||||
3:
|
||||
if !pmana.registered: append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_CONTROLLER_REGISTERED))
|
||||
else:
|
||||
var slide: Vector2i = misc.get_int_direct(command[2])
|
||||
match(slide.x):
|
||||
0:
|
||||
pmana.change_slide(slide.y)
|
||||
append_output("Switched to slide [b]" + str(slide.y) + "[/b]")
|
||||
1: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "int"}))
|
||||
_: append_output(info.generate_internal_error("Invalid misc.get_int() status number"))
|
||||
4:
|
||||
if !pmana.registered: append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_CONTROLLER_REGISTERED))
|
||||
else:
|
||||
var slide: Vector2i = misc.get_int_direct(command[2])
|
||||
match(slide.x):
|
||||
0:
|
||||
var no_animations: misc.BooleanState = misc.get_bool(command[3])
|
||||
match(no_animations):
|
||||
misc.BooleanState.TRUE:
|
||||
pmana.change_slide(slide.y, true)
|
||||
append_output("Switched to slide [b]" + str(slide.y) + "[/b] without animations")
|
||||
misc.BooleanState.FALSE:
|
||||
pmana.change_slide(slide.y, false)
|
||||
append_output("Switched to slide [b]" + str(slide.y) + "[/b]")
|
||||
misc.BooleanState.INVALID:
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "bool"}))
|
||||
1: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_TYPE, {"expected_type": "int"}))
|
||||
_: append_output(info.generate_internal_error("Invalid misc.get_int() status number"))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
"get_slide":
|
||||
if !pmana.registered: append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_CONTROLLER_REGISTERED))
|
||||
else:
|
||||
append_output("The current slide id is [b]" + str(pmana.current_slide) + "[/b]")
|
||||
"clear_viewport":
|
||||
if !pmana.registered: append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_CONTROLLER_REGISTERED))
|
||||
else:
|
||||
pmana.clear_viewport()
|
||||
append_output("The viewport has been cleared.")
|
||||
"hide_log":
|
||||
if !pmana.registered: append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_CONTROLLER_REGISTERED))
|
||||
else:
|
||||
pmana.hide_log()
|
||||
append_output("The log output is now [b]invisible[/b].")
|
||||
"show_log":
|
||||
if !pmana.registered: append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_CONTROLLER_REGISTERED))
|
||||
else:
|
||||
pmana.show_log()
|
||||
append_output("The log output is now [b]visible[/b].")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_ARGUMENT))
|
||||
"preader":
|
||||
match(command.size()):
|
||||
1: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
_:
|
||||
match(command[1]):
|
||||
"get":
|
||||
match(command.size()):
|
||||
2: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
3:
|
||||
match(command[2]):
|
||||
"topic":
|
||||
if preader.get_topic() == "": append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_PRESENTATION_OPEN))
|
||||
else: append_output("The presentation topic is [b]" + preader.get_topic() + "[/b]")
|
||||
"authors":
|
||||
if preader.get_authors() == "": append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_PRESENTATION_OPEN))
|
||||
else: append_output("The presentation author is/authors are: [b]" + preader.get_authors() + "[/b]")
|
||||
"ratio":
|
||||
if preader.get_ratio() == "": append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_PRESENTATION_OPEN))
|
||||
else: append_output("The presentation ratio is [b]" + preader.get_ratio() + "[/b]")
|
||||
"resolution":
|
||||
if preader.get_ratio_resolution() == Vector2i(0, 0): append_output(info.get_error_string(ConsoleInfo.ConsoleError.NO_PRESENTATION_OPEN))
|
||||
else:
|
||||
var resolution: Vector2i = preader.get_ratio_resolution()
|
||||
append_output("The presentation resolution is [b]" + str(resolution.x) + "x" + str(resolution.y) + "[/b].")
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_ARGUMENT))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_MANY_ARGUMENTS))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_ARGUMENT))
|
||||
"arbitrary":
|
||||
match(command.size()):
|
||||
1: append_output(info.get_error_string(ConsoleInfo.ConsoleError.TOO_FEW_ARGUMENTS))
|
||||
_:
|
||||
var expression_raw: String = " ".join(PackedStringArray(misc.get_shortened_array(command, 0)))
|
||||
var expression: Expression = Expression.new()
|
||||
if expression.parse(expression_raw) != Error.OK:
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.EXPRESSION_PARSING_FAILED, {"error": expression.get_error_text()}))
|
||||
else:
|
||||
var returned = expression.execute([], expressionscript)
|
||||
if expression.has_execute_failed():
|
||||
append_output(info.get_error_string(ConsoleInfo.ConsoleError.EXPRESSION_EXECUTION_FAILED, {"error": expression.get_error_text(), "returned": returned}))
|
||||
else:
|
||||
append_output("""Executed arbitrary expression successfully.
|
||||
Returned: """ + str(returned))
|
||||
_: append_output(info.get_error_string(ConsoleInfo.ConsoleError.INVALID_COMMAND))
|
|
@ -1,34 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/console_expressionscript.gd (Debug console expression playground) ###
|
||||
### ###
|
||||
### This file will be used as a script for executing arbitrary expressions ###
|
||||
### by the debugging console. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# @GlobalScope
|
||||
var logger: Node = null
|
||||
var misc: Node = null
|
||||
var preader: Node = null
|
||||
var pmana: Node = null
|
||||
var ui_engine: Node = null
|
||||
# SceneTree
|
||||
var console: Node = null
|
||||
var loader: Node = null
|
|
@ -1,143 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/console_info.gd (Debug console information) ###
|
||||
### ###
|
||||
### This source file holds console information such as help topics or ###
|
||||
### console errors. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
class_name ConsoleInfo
|
||||
|
||||
# Enums
|
||||
enum ConsoleError {
|
||||
OK,
|
||||
UNIMPLEMENTED,
|
||||
INVALID_COMMAND,
|
||||
TOO_MANY_ARGUMENTS,
|
||||
TOO_FEW_ARGUMENTS,
|
||||
INVALID_ARGUMENT,
|
||||
INVALID_TYPE,
|
||||
NOT_AN_OBJECT,
|
||||
NO_SCRIPT_ATTACHED,
|
||||
INVALID_HELP_TOPIC,
|
||||
INVALID_CONFIG_KEY,
|
||||
NO_PRESENTATION_OPEN,
|
||||
CONTROLLER_ALREADY_REGISTERED,
|
||||
NO_CONTROLLER_REGISTERED,
|
||||
EXPRESSION_PARSING_FAILED,
|
||||
EXPRESSION_EXECUTION_FAILED
|
||||
}
|
||||
enum HelpTopic {
|
||||
INDEX,
|
||||
CLEAR,
|
||||
EXIT,
|
||||
SHUTDOWN,
|
||||
HELP,
|
||||
NAVIGATE,
|
||||
CONFIG,
|
||||
PMANA,
|
||||
PREADER,
|
||||
ARBITRARY
|
||||
}
|
||||
|
||||
# Variables
|
||||
var error_color: String = "[color=red]"
|
||||
var internal_error_color: String = "[b][color=red]"
|
||||
|
||||
# Generates an internal error
|
||||
func generate_internal_error(error: String) -> String:
|
||||
var origin = misc.get_origin()
|
||||
logger.warn("Debug console (" + origin["file"] + ":" + origin["function"] + ":" + str(origin["line"]) + ") experienced an internal error: " + error)
|
||||
return internal_error_color + "INTERNAL ERROR (" + error + ") [" + origin["file"] + ":" + origin["function"] + ":" + str(origin["line"]) + "]"
|
||||
|
||||
# Converts ConsoleError into a String
|
||||
func get_error_string(error: ConsoleError, context: Dictionary = {}) -> String:
|
||||
match(error):
|
||||
ConsoleError.OK: return generate_internal_error("ConsoleError.OK is not a valid error")
|
||||
ConsoleError.UNIMPLEMENTED: return error_color + "Function unimplemented, aborting."
|
||||
ConsoleError.INVALID_COMMAND: return error_color + "Invalid command. Execute \"help\" for a list of all available commands."
|
||||
ConsoleError.TOO_MANY_ARGUMENTS: return error_color + "Too many arguments."
|
||||
ConsoleError.TOO_FEW_ARGUMENTS: return error_color + "Too few arguments."
|
||||
ConsoleError.INVALID_ARGUMENT: return error_color + "Invalid argument."
|
||||
ConsoleError.INVALID_TYPE: return error_color + "Invalid type. Command expected type " + str(context["expected_type"]) + "."
|
||||
ConsoleError.NOT_AN_OBJECT: return error_color + "Invalid type. Command expected a valid NodePath."
|
||||
ConsoleError.NO_SCRIPT_ATTACHED: return error_color + "Invalid object. Command expected a script-attached object."
|
||||
ConsoleError.INVALID_HELP_TOPIC: return error_color + "Invalid help topic."
|
||||
ConsoleError.INVALID_CONFIG_KEY: return error_color + "Invalid config key \"" + str(context["key"]) + "\". Execute \"config list\" for a list of all config keys."
|
||||
ConsoleError.NO_PRESENTATION_OPEN: return error_color + "No presentation is currently open."
|
||||
ConsoleError.CONTROLLER_ALREADY_REGISTERED: return error_color + "A presentation controller has been registered already."
|
||||
ConsoleError.NO_CONTROLLER_REGISTERED: return error_color + "No presentation controller has been registered yet."
|
||||
ConsoleError.EXPRESSION_PARSING_FAILED: return error_color + "Could not parse arbitrary expression successfully.\nError: " + str(context["error"])
|
||||
ConsoleError.EXPRESSION_EXECUTION_FAILED: return error_color + "Could not execute arbitrary expression successfully.\nError: " + str(context["error"]) + "\nReturned: " + str(context["returned"])
|
||||
_: return generate_internal_error("Invalid ConsoleError \"" + str(error) + "\", context: " + str(context))
|
||||
|
||||
# Converts HelpTopic into a String
|
||||
func get_help_topic(topic: HelpTopic) -> String:
|
||||
match(topic):
|
||||
HelpTopic.INDEX:
|
||||
return """Command | Description
|
||||
clear | Clears the console output
|
||||
exit | Starts a fresh session
|
||||
shutdown | Shuts Presencode down
|
||||
help | Displays information about certain topics
|
||||
navigate | Navigate n slides forwards/backwards
|
||||
config | Reads and writes to the in-memory configuration
|
||||
pmana | Controls the Presentation Manager
|
||||
preader | Controls the Presentation Reader
|
||||
arbitrary | Execute arbitrary GDScript expressions
|
||||
|
||||
To view more information about one topic, type \"help [topic]\"."""
|
||||
HelpTopic.CLEAR:
|
||||
return """clear
|
||||
|
||||
Clears the console output."""
|
||||
HelpTopic.EXIT:
|
||||
return """exit
|
||||
|
||||
Clears the console output and starts a fresh session."""
|
||||
HelpTopic.SHUTDOWN:
|
||||
return """shutdown [exitcode: int = 0]
|
||||
|
||||
Shuts Presencode down, accepts a exitcode ranging from 0-255."""
|
||||
HelpTopic.HELP:
|
||||
return """help [topic: String = "INDEX"]
|
||||
|
||||
Displays useful information about commands."""
|
||||
HelpTopic.NAVIGATE:
|
||||
return """navigate <n|+n|-n>
|
||||
|
||||
Navigates n slides forwards or backwards."""
|
||||
HelpTopic.CONFIG:
|
||||
return """config <get <key: String>|set <key: String> <value: Variant>|list>
|
||||
|
||||
Returns, lists or overwrites Presencode's configuration. Lives in memory and cannot be saved to persistent storage."""
|
||||
HelpTopic.PMANA:
|
||||
return """pmana <register <version: int> <slides: int> <animations: bool> <quit_last_slide: bool> <controller: NodePath<String>>|unregister|change_slide <slide: int> [no_animations: bool = false]|get_slide|clear_viewport|hide_log|show_log>
|
||||
|
||||
Calls functions belonging to the Presentation Manager."""
|
||||
HelpTopic.PREADER:
|
||||
return """preader <get <topic|authors|ratio|resolution>>
|
||||
|
||||
Calls functions belonging to the Presentation Reader"""
|
||||
HelpTopic.ARBITRARY:
|
||||
return """arbitrary <expression>
|
||||
|
||||
Executes arbitrary GDScript expressions.
|
||||
-> EXPERIMENTAL"""
|
||||
_: return generate_internal_error("Invalid HelpTopic \"" + str(topic) + "\"")
|
370
src/loader.gd
370
src/loader.gd
|
@ -1,227 +1,175 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/loader.gd (Presencode application loader) ###
|
||||
### ###
|
||||
### This source file initializes the Presencode application and loads a ###
|
||||
### presentation. It's mostly just calls to the Presentation Reader. ###
|
||||
##############################################################################
|
||||
extends Control
|
||||
extends Node
|
||||
|
||||
# Enums
|
||||
enum VersionType {
|
||||
RELEASE,
|
||||
RELEASECANDIDATE,
|
||||
BETA,
|
||||
ALPHA
|
||||
}
|
||||
var core: Core
|
||||
var core_config: CoreConfiguration = CoreConfiguration.new()
|
||||
var logger: CoreLoggerInstance
|
||||
|
||||
# Constants
|
||||
const version_release: int = 1
|
||||
const version_type: VersionType = VersionType.ALPHA
|
||||
const version_typerelease: int = 2
|
||||
|
||||
# Nodes
|
||||
var logrtl: RichTextLabel = null
|
||||
var console: Control = null
|
||||
# +++ initialization +++
|
||||
# Preinitialization
|
||||
func _init() -> void:
|
||||
# Update configuration
|
||||
core_config.hide_window_on_shutdown = false
|
||||
#core_config.hide_window_on_shutdown = true
|
||||
#core_config.automatic_shutdown = false
|
||||
if OS.is_debug_build(): core_config.logger_level = CoreTypes.LoggerLevel.DIAG
|
||||
else: core_config.logger_level = CoreTypes.LoggerLevel.INFO
|
||||
# Preinitialize CORE Framework
|
||||
core = Core.new(core_config)
|
||||
|
||||
# Initialization
|
||||
func _ready() -> void:
|
||||
#while true: await get_tree().create_timer(0.05).timeout
|
||||
misc.set_main_window_visibility(false)
|
||||
logger.info("Updating loader scene")
|
||||
# Rename loader scene
|
||||
name = "Presencode"
|
||||
# Add logrtl to loader scene
|
||||
## Create new RichTextLabel
|
||||
logrtl = RichTextLabel.new()
|
||||
## Update properties
|
||||
logrtl.name = "Log"
|
||||
logrtl.bbcode_enabled = true
|
||||
logrtl.selection_enabled = false
|
||||
logrtl.deselect_on_focus_loss_enabled = true
|
||||
logrtl.drag_and_drop_selection_enabled = false
|
||||
logrtl.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
logrtl.scroll_active = true
|
||||
logrtl.scroll_following = true
|
||||
## Disable localization
|
||||
logrtl.auto_translate = false
|
||||
logrtl.localize_numeral_system = false
|
||||
## Create font override
|
||||
logrtl.add_theme_font_override("normal_font", ResourceLoader.load("res://assets/fonts/FiraCode/Regular.ttf"))
|
||||
logrtl.add_theme_font_override("bold_font", ResourceLoader.load("res://assets/fonts/FiraCode/Bold.ttf"))
|
||||
logrtl.add_theme_font_size_override("normal_font_size", 14)
|
||||
logrtl.add_theme_font_size_override("bold_font_size", 14)
|
||||
## Connect to logger
|
||||
logger.connect("log_event", func(_type: logger.Types, _message: String, logstring: String) -> void: logrtl.text = get_node("/root/Presencode/Log").text + logstring + "\n")
|
||||
## Add to SceneTree
|
||||
add_child(logrtl)
|
||||
## Remove VScrollBar
|
||||
var vsbar: VScrollBar = logrtl.get_child(0, true)
|
||||
vsbar.set_deferred("size", Vector2i(1, 1))
|
||||
vsbar.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
vsbar.add_theme_stylebox_override("scroll", StyleBoxEmpty.new())
|
||||
vsbar.add_theme_stylebox_override("scroll_focus", StyleBoxEmpty.new())
|
||||
vsbar.add_theme_stylebox_override("grabber", StyleBoxEmpty.new())
|
||||
vsbar.add_theme_stylebox_override("grabber_highlight", StyleBoxEmpty.new())
|
||||
vsbar.add_theme_stylebox_override("grabber_pressed", StyleBoxEmpty.new())
|
||||
## Initialize Presencode
|
||||
initialize()
|
||||
# Wait for CORE to initialize
|
||||
await get_tree().process_frame
|
||||
get_tree().root.add_child(core)
|
||||
await core.complete_init()
|
||||
|
||||
func initialize() -> void:
|
||||
# Print banner
|
||||
logger.info("""Initializing Presencode
|
||||
____ __
|
||||
# Set 'logger' variable
|
||||
logger = core.logger.get_instance("src/loader.gd", self)
|
||||
|
||||
# Print welcome message
|
||||
# Let's hope this doesn't break
|
||||
core.logger._log(CoreTypes.LoggerLevel.SPECIAL, "src/loader.gd", """ ____ __
|
||||
/\\ _`\\ /\\ \\
|
||||
\\ \\ \\L\\ \\_ __ __ ____ __ ___ ___ ___ \\_\\ \\ __
|
||||
\\ \\ ,__/\\`'__\\/'__`\\ /',__\\ /'__`\\/' _ `\\ /'___\\ / __`\\ /'_` \\ /'__`\\
|
||||
\\ \\ \\/\\ \\ \\//\\ __//\\__, `\\/\\ __//\\ \\/\\ \\/\\ \\__//\\ \\L\\ \\/\\ \\L\\ \\/\\ __/
|
||||
\\ \\_\\ \\ \\_\\\\ \\____\\/\\____/\\ \\____\\ \\_\\ \\_\\ \\____\\ \\____/\\ \\___,_\\ \\____\\
|
||||
\\/_/ \\/_/ \\/____/\\/___/ \\/____/\\/_/\\/_/\\/____/\\/___/ \\/__,_ /\\/____/
|
||||
Copyright (c) 2024 JeremyStarTM & Contributers
|
||||
Licensed under the GNU General Public License version 3
|
||||
""")
|
||||
# Check for platform
|
||||
misc.check_platform()
|
||||
# Create temporary directory
|
||||
DirAccess.make_dir_recursive_absolute(misc.get_temporary_dir())
|
||||
# Load debug console
|
||||
logger.info("Injecting console")
|
||||
console = ResourceLoader.load("res://Console.tscn").instantiate()
|
||||
get_tree().root.add_child.call_deferred(console)
|
||||
# Initialize processor
|
||||
processor.initialize.call_deferred()
|
||||
# Process arguments
|
||||
var path: String = parse_arguments()
|
||||
# Update window properties
|
||||
misc.set_main_window_visibility(true)
|
||||
# Check path variable
|
||||
if path == "":
|
||||
ui_engine.initialize(self)
|
||||
else:
|
||||
await load_presentation(path)
|
||||
""" + " ".repeat(4) + """\\/_/ \\/_/ \\/____/\\/___/ \\/____/\\/_/\\/_/\\/____/\\/___/ \\/__,_ /\\/____/
|
||||
Copyright (c) 2024 JeremyStarTM & Contributers.
|
||||
Licensed under the GNU Affero General Public License v3 WITHOUT ANY WARRANTY.
|
||||
You should have recieved a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.""")
|
||||
|
||||
# Register cleanup hook
|
||||
var hook: int = core.register_cleanup_hook(Callable(self, "cleanup"))
|
||||
|
||||
# Parse command line arguments
|
||||
var args: Dictionary = parse_cmdline()
|
||||
if args["shutdown"]: return
|
||||
|
||||
# Apply command line arguments
|
||||
logger.verb("Reloading CORE Configuration (applying cmdline args)")
|
||||
core_config.logger_level = args["logger_level"]
|
||||
core.reload_configuration(core_config)
|
||||
|
||||
# Initialize internals
|
||||
logger.info("Initializing internals")
|
||||
|
||||
# Load state manager
|
||||
var statemanager: Node = Node.new()
|
||||
statemanager.name = "State Manager"
|
||||
statemanager.set_script(load("res://src/statemanager.gd"))
|
||||
get_tree().root.add_child(statemanager)
|
||||
|
||||
# Decide whenether to load a presentation or the UI
|
||||
if args["load_presentation"]:
|
||||
logger.verb("Loading presentation")
|
||||
logger.crash("Not implemented.")
|
||||
else:
|
||||
logger.verb("Loading user interface")
|
||||
|
||||
# Load UserInterface.tscn
|
||||
var userinterface: NinePatchRect = load("res://scenesrc/UserInterface.tscn").instantiate()
|
||||
userinterface.name = "UserInterface"
|
||||
userinterface.core_config = core_config.duplicate()
|
||||
userinterface.ui_scale = args["ui_scale"]
|
||||
get_tree().root.add_child.call_deferred(userinterface)
|
||||
|
||||
# Perform cleanup
|
||||
core.unregister_cleanup_hook_by_id(hook)
|
||||
cleanup()
|
||||
|
||||
# +++ cleanup +++
|
||||
func cleanup() -> void:
|
||||
logger.diag("Freeing")
|
||||
core_config.queue_free()
|
||||
get_parent().remove_child.call_deferred(self)
|
||||
queue_free()
|
||||
|
||||
# +++ etc +++
|
||||
# Parses all arguments
|
||||
func parse_cmdline() -> Dictionary:
|
||||
logger.verb("Parsing command line arguments")
|
||||
var args: Dictionary = { "shutdown": false, "load_presentation": false, "presentation_path": "", "logger_level": core_config.logger_level, "ui_scale": 1.0 }
|
||||
var processed: Dictionary = { "presentation": false, "logger_level": false, "ui_scale": false }
|
||||
|
||||
# Process commandline arguments
|
||||
func parse_arguments() -> String:
|
||||
var path: String = ""
|
||||
var next_argument_value: String = ""
|
||||
for arg in OS.get_cmdline_user_args():
|
||||
match(next_argument_value):
|
||||
"logger_enabled":
|
||||
match(misc.get_bool(arg)):
|
||||
misc.BooleanState.TRUE: logger.config_enabled = true
|
||||
misc.BooleanState.FALSE: logger.config_enabled = false
|
||||
_: logger.error("Value \"" + arg + "\" does not match \"true\" or \"false\"")
|
||||
"logger_diagnostic":
|
||||
match(misc.get_bool(arg)):
|
||||
misc.BooleanState.TRUE: logger.config_diagnostic = true
|
||||
misc.BooleanState.FALSE: logger.config_diagnostic = false
|
||||
_: logger.error("Value \"" + arg + "\" does not match \"true\" or \"false\"")
|
||||
"logger_colored":
|
||||
match(misc.get_bool(arg)):
|
||||
misc.BooleanState.TRUE: logger.config_colored = true
|
||||
misc.BooleanState.FALSE: logger.config_colored = false
|
||||
_: logger.error("Value \"" + arg + "\" does not match \"true\" or \"false\"")
|
||||
"logger_hardfail":
|
||||
match(misc.get_bool(arg)):
|
||||
misc.BooleanState.TRUE: logger.config_hardfail = true
|
||||
misc.BooleanState.FALSE: logger.config_hardfail = false
|
||||
_: logger.error("Value \"" + arg + "\" does not match \"true\" or \"false\"")
|
||||
"logger_logstring": logger.config_logstring = arg
|
||||
"misc_shutdown_invisible":
|
||||
match(misc.get_bool(arg)):
|
||||
misc.BooleanState.TRUE: misc.config_shutdown_invisible = true
|
||||
misc.BooleanState.FALSE: misc.config_shutdown_invisible = false
|
||||
_: logger.error("Value \"" + arg + "\" does not match \"true\" or \"false\"")
|
||||
if next_argument_value != "":
|
||||
next_argument_value = ""
|
||||
logger.diag(core.misc.stringify_variables("Parsing cmdline argument %arg%", { "arg": arg }))
|
||||
if arg == "--help":
|
||||
# Hide diagnostic and verbose messages
|
||||
core_config.logger_level = CoreTypes.LoggerLevel.INFO
|
||||
core.reload_configuration(core_config)
|
||||
|
||||
# Please note that all spaces before any text are U+00A0 NO-BREAK SPACE characters.
|
||||
# This has been done to prevent Godot from converting them into tabs.
|
||||
# You shouldn't see a difference though. But if you decide to edit this,
|
||||
# make sure to copy this character: " "
|
||||
logger.info("""+++ PRESENCODE HELP +++
|
||||
Usage (development setup): /path/to/godot.binary -d -v --path . ++ <further arguments>
|
||||
(pack file): /path/to/godot.binary -d -v --pack /path/to/presencode.pck ++ <further arguments>
|
||||
(exported binary): /path/to/presencode.binary -d -v ++ <further arguments>
|
||||
|
||||
Further arguments:
|
||||
--logger-level=<DIAG|VERB|INFO|WARN|ERROR> Sets the logger level, defaults to DIAG in debug
|
||||
builds and INFO in release builds.
|
||||
--ui-scale=<float> Sets how large UI elements should be.
|
||||
Does not affect presentations.
|
||||
/path/to/presentation.pcar Path to the presentation Presencode should open.
|
||||
If not supplied, a user interface will appear.
|
||||
+++ PRESENCODE HELP +++""")
|
||||
|
||||
# Hide all log messages
|
||||
core_config.logger_level = CoreTypes.LoggerLevel.NONE
|
||||
core.reload_configuration(core_config)
|
||||
|
||||
# Shutdown
|
||||
core.quit_safely(0)
|
||||
args.shutdown = true
|
||||
return args
|
||||
elif arg.contains("--logger-level="):
|
||||
# Ensure this argument is not overridden
|
||||
if processed["logger_level"]:
|
||||
logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Already set", { "arg": arg }))
|
||||
continue
|
||||
match(arg):
|
||||
"--help": continue
|
||||
"--logger-enabled": next_argument_value = "logger_enabled"
|
||||
"--logger-diagnostic": next_argument_value = "logger_diagnostic"
|
||||
"--logger-colored": next_argument_value = "logger_colored"
|
||||
"--logger-hardfail": next_argument_value = "logger_hardfail"
|
||||
"--logger-logstring": next_argument_value = "logger_logstring"
|
||||
"--shutdown-invisible": next_argument_value = "misc_shutdown_invisible"
|
||||
_:
|
||||
# doesn't match any of the above, append to path instead
|
||||
## this causes an interesting side effect, which is best explained by an example:
|
||||
## C:/Users/Example User/Documents/Important --shutdown-invisible false Documents/Example --logger-colored false Presentation.pcpa
|
||||
if path == "": path = arg
|
||||
else: path = path + " " + arg
|
||||
return path
|
||||
processed["logger_level"] = true
|
||||
|
||||
# Load a presentation from commandline arguments
|
||||
func load_presentation(path: String) -> void:
|
||||
if FileAccess.file_exists(path) and path.ends_with(".zip") or path.ends_with(".pcpa"): # .pcpa = presencode presentation archive
|
||||
logger.info("Opening presentation archive")
|
||||
preader.open_presentation(path, true)
|
||||
elif DirAccess.dir_exists_absolute(path):
|
||||
logger.info("Opening presentation directory")
|
||||
preader.open_presentation(path, false)
|
||||
# Validate and update logger level
|
||||
match(arg.replace("--logger-level=", "").to_upper()):
|
||||
"DIAG": args["logger_level"] = CoreTypes.LoggerLevel.DIAG
|
||||
"VERB": args["logger_level"] = CoreTypes.LoggerLevel.VERB
|
||||
"INFO": args["logger_level"] = CoreTypes.LoggerLevel.INFO
|
||||
"WARN": args["logger_level"] = CoreTypes.LoggerLevel.WARN
|
||||
"ERROR": args["logger_level"] = CoreTypes.LoggerLevel.ERROR
|
||||
_: logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Can't match logger level %got%, possible are: %expected%", { "arg": arg, "got": arg.replace("--logger-level=", ""), "expected": [ "DIAG", "VERB", "INFO", "WARN", "ERROR" ] }))
|
||||
elif arg.contains("--ui-scale="):
|
||||
# Ensure this argument is not overridden
|
||||
if processed["ui_scale"]:
|
||||
logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Already set", { "arg": arg }))
|
||||
continue
|
||||
processed["ui_scale"] = true
|
||||
|
||||
# Run checks
|
||||
if !arg.replace("--ui-scale=", "").is_valid_float() or arg.replace("--ui-scale=", "").to_float() < 1.0:
|
||||
logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Must be a float above 1", { "arg": arg }))
|
||||
continue
|
||||
|
||||
# Update 'args'
|
||||
args["ui_scale"] = arg.replace("--ui-scale=", "").to_float()
|
||||
else:
|
||||
await logger.error("Presentation file/directory \"" + path + "\" not found")
|
||||
return
|
||||
# Read manifest & entrypoint files
|
||||
preader.read_manifest()
|
||||
preader.read_entrypoint()
|
||||
# Update window properties
|
||||
processor.update_dragging_area(processor.DragNode.CONSOLE, preader.get_ratio_resolution())
|
||||
DisplayServer.window_set_title("Presencode » Presenting \"" + preader.get_topic() + "\" by \"" + preader.get_authors() + "\"")
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
DisplayServer.window_set_size(preader.get_ratio_resolution())
|
||||
DisplayServer.window_set_min_size(preader.get_ratio_resolution())
|
||||
get_tree().root.content_scale_size = preader.get_ratio_resolution()
|
||||
get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_VIEWPORT
|
||||
get_tree().root.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_KEEP
|
||||
get_tree().root.content_scale_factor = 1.0
|
||||
await get_tree().process_frame
|
||||
DisplayServer.window_set_position(misc.get_center(DisplayServer.screen_get_size(), DisplayServer.window_get_size()))
|
||||
# Add entrypoint to SceneTree
|
||||
get_tree().root.add_child(preader.get_entrypoint())
|
||||
if arg.begins_with("--"): logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Option not recognized", { "arg": arg }))
|
||||
else:
|
||||
# Ensure this argument is not overridden
|
||||
if processed["presentation"]:
|
||||
logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Already set", { "arg": arg }))
|
||||
continue
|
||||
processed["presentation"] = true
|
||||
|
||||
func format_version(format: String) -> String:
|
||||
var version: String = format
|
||||
var version_type_normal: String = ""
|
||||
var version_type_short: String = ""
|
||||
var version_type_technical: String = ""
|
||||
match(version_type):
|
||||
VersionType.RELEASE:
|
||||
version_type_normal = "Release"
|
||||
version_type_short = "Release"
|
||||
version_type_technical = "r"
|
||||
VersionType.RELEASECANDIDATE:
|
||||
version_type_normal = "Releasecandidate"
|
||||
version_type_short = "RC"
|
||||
version_type_technical = "rc"
|
||||
VersionType.BETA:
|
||||
version_type_normal = "Beta"
|
||||
version_type_short = "Beta"
|
||||
version_type_technical = "b"
|
||||
VersionType.ALPHA:
|
||||
version_type_normal = "Alpha"
|
||||
version_type_short = "Alpha"
|
||||
version_type_technical = "a"
|
||||
_: logger.info("Invalid version type \"" + str(version_type) + "\"")
|
||||
version = version.replace("%release%", str(version_release))
|
||||
version = version.replace("%type_raw%", str(version_type))
|
||||
version = version.replace("%type%", version_type_normal)
|
||||
version = version.replace("%type_short%", version_type_short)
|
||||
version = version.replace("%type_technical%", version_type_technical)
|
||||
version = version.replace("%typerelease%", str(version_typerelease))
|
||||
return version
|
||||
# Check if file exists
|
||||
if !FileAccess.file_exists(arg):
|
||||
logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Invalid file path %arg%", { "arg": arg }))
|
||||
continue
|
||||
|
||||
# Update 'args'
|
||||
args["presentation_path"] = arg
|
||||
|
||||
return args
|
||||
|
|
103
src/logger.gd
103
src/logger.gd
|
@ -1,103 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/logger.gd (Logger) ###
|
||||
### ###
|
||||
### This source file handles... well the logging. Nothing interesting here ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# Signals
|
||||
signal log_event
|
||||
|
||||
# Enums
|
||||
enum Types { DIAG, INFO, WARN, ERROR }
|
||||
|
||||
# Logger configuration
|
||||
## Toggle log output
|
||||
var config_enabled: bool = true
|
||||
## Toggle DIAG (diagnostic) log messages
|
||||
var config_diagnostic: bool = true
|
||||
## Toggle colored output
|
||||
var config_colored: bool = true
|
||||
## Makes errors fail hard
|
||||
### Shuts Presencode down if error() is called
|
||||
### HIGHLY RECOMMENDED TO LEAVE ENABLED
|
||||
var config_hardfail: bool = true
|
||||
## Logging template
|
||||
### Variables (begin and end with '%'): runtime, time, file, function, line, color, type, message
|
||||
var config_logstring: String = "%color%[%time%] [%type% %file%:%line%] %message%"
|
||||
|
||||
# Self explanitory
|
||||
func diag(message: String) -> void:
|
||||
if config_enabled and config_diagnostic:
|
||||
var log_str: String = _log(message, Types.DIAG)
|
||||
print_rich(log_str)
|
||||
emit_signal("log_event", Types.DIAG, message, log_str)
|
||||
func info(message: String) -> void:
|
||||
if config_enabled:
|
||||
var log_str: String = _log(message, Types.INFO)
|
||||
print_rich(log_str)
|
||||
emit_signal("log_event", Types.INFO, message, log_str)
|
||||
func warn(message: String) -> void:
|
||||
if config_enabled:
|
||||
var log_str: String = _log(message, Types.WARN)
|
||||
print_rich(log_str)
|
||||
emit_signal("log_event", Types.WARN, message, log_str)
|
||||
func error(message: String) -> void:
|
||||
if config_enabled:
|
||||
var log_str: String = _log(message, Types.ERROR)
|
||||
print_rich(log_str)
|
||||
emit_signal("log_event", Types.ERROR, message, log_str)
|
||||
await misc.shutdown(1)
|
||||
|
||||
# Helper function
|
||||
func _log(message: String, type: Types) -> String:
|
||||
# Get call origin
|
||||
var origin: Dictionary = misc.get_origin(1)
|
||||
var logmsg: String = config_logstring
|
||||
# Replace variables
|
||||
logmsg = logmsg.replace("%runtime%", str(Time.get_ticks_msec()))
|
||||
logmsg = logmsg.replace("%time%", Time.get_time_string_from_system(true))
|
||||
logmsg = logmsg.replace("%file%", origin["file"])
|
||||
logmsg = logmsg.replace("%function%", origin["function"])
|
||||
logmsg = logmsg.replace("%line%", str(origin["line"]))
|
||||
# Determine log type and log message color
|
||||
var type_str: String = ""
|
||||
var color: String = ""
|
||||
match(type):
|
||||
Types.DIAG:
|
||||
type_str = "DIAG"
|
||||
color = "[color=gray]"
|
||||
Types.INFO:
|
||||
type_str = "INFO"
|
||||
color = "[color=white]"
|
||||
Types.WARN:
|
||||
type_str = "WARN"
|
||||
color = "[color=yellow]"
|
||||
Types.ERROR:
|
||||
type_str = "ERR!"
|
||||
color = "[color=red]"
|
||||
logmsg = logmsg.replace("%type%", type_str)
|
||||
if config_colored:
|
||||
logmsg = logmsg.replace("%color%", color)
|
||||
else:
|
||||
logmsg = logmsg.replace("%color%", "")
|
||||
logmsg = logmsg.replace("%message%", message)
|
||||
|
||||
return logmsg
|
253
src/misc.gd
253
src/misc.gd
|
@ -1,253 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/misc.gd (Miscellaneous) ###
|
||||
### ###
|
||||
### This source file contains various small functions that do not fit into ###
|
||||
### other source files. Shutting Presencode down, getting the center of an ###
|
||||
### object or checking the manifest consistency are examples of this. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# Enums
|
||||
enum Error {
|
||||
OK,
|
||||
PREADER_NO_PRESENTATION_OPEN,
|
||||
PREADER_NO_MANIFEST,
|
||||
PREADER_MANIFEST_PARSING_FAILED,
|
||||
MANIFEST_INCONSISTENT,
|
||||
MANIFEST_INVALID_VERSION,
|
||||
MANIFEST_INVALID_PROGRAM,
|
||||
MANIFEST_INVALID_RATIO
|
||||
}
|
||||
enum BooleanState {
|
||||
TRUE,
|
||||
FALSE,
|
||||
INVALID
|
||||
}
|
||||
|
||||
# Constants
|
||||
const manifest_version: int = 1
|
||||
const manifest_program: String = "Presencode"
|
||||
|
||||
# Configuration
|
||||
## Make window invisible on shutdown
|
||||
### Hides the main window on shutdown if true
|
||||
### Displays RenderingServer.get_white_texture() if false instead
|
||||
var config_shutdown_invisible: bool = false
|
||||
|
||||
# Helper function to retrieve a bool from a String
|
||||
func get_bool(string: String) -> BooleanState:
|
||||
match(string):
|
||||
"true": return BooleanState.TRUE
|
||||
"false": return BooleanState.FALSE
|
||||
_: return BooleanState.INVALID
|
||||
|
||||
# Helper function to retrieve the next valid int from an Array
|
||||
## Returns Vector2i(0, NUMBER) if successful
|
||||
## Returns Vector2i(1, 0) if not successful
|
||||
func get_int(array: Array) -> Vector2i:
|
||||
for value in array:
|
||||
if str(value).is_valid_int(): return Vector2i(0, int(value))
|
||||
return Vector2i(1, 0)
|
||||
|
||||
# Helper function to retrieve a int from a String
|
||||
## Returns Vector2i(0, NUMBER) if successful
|
||||
## Returns Vector2i(1, 0) if not successful
|
||||
func get_int_direct(string: String) -> Vector2i:
|
||||
if string.is_valid_int(): return Vector2i(0, int(string))
|
||||
else: return Vector2i(1, 0)
|
||||
|
||||
# Returns a shortened array, by skipping "skip" Items
|
||||
func get_shortened_array(array: Array, skip: int) -> Array:
|
||||
# We want to remove at least one item
|
||||
skip = skip+1
|
||||
# Create new array
|
||||
var new_array: Array = []
|
||||
if skip >= array.size():
|
||||
logger.error("n is bigger than array.size()")
|
||||
return []
|
||||
# Loop through array
|
||||
for value in array:
|
||||
if skip == 0: # Append to new_array
|
||||
new_array.append(value)
|
||||
else: # Count down
|
||||
skip = skip-1
|
||||
return new_array
|
||||
|
||||
# Calculate the center of a child inside its parent (Vector2i)
|
||||
func get_center(parent_size: Vector2i, child_size: Vector2i) -> Vector2i:
|
||||
@warning_ignore("integer_division")
|
||||
return Vector2i(parent_size.x/2-child_size.x/2, parent_size.y/2-child_size.y/2)
|
||||
|
||||
# Calculate the center of a child inside its parent (Vector2)
|
||||
func get_center_float(parent_size: Vector2, child_size: Vector2) -> Vector2:
|
||||
return Vector2(parent_size.x/2-child_size.x/2, parent_size.y/2-child_size.y/2)
|
||||
|
||||
# Returns the sign (-1, +1, 0) of an int
|
||||
func get_sign(number: int) -> int:
|
||||
if number > 0: return +1
|
||||
elif number < 0: return -1
|
||||
else: return 0
|
||||
|
||||
# Returns the sign (-1, +1, 0) of a float
|
||||
func get_sign_float(number: float) -> float:
|
||||
if number > 0: return +1
|
||||
elif number < 0: return -1
|
||||
else: return 0
|
||||
|
||||
# Get call origin from stacktrace
|
||||
func get_origin(n: int = 0) -> Dictionary:
|
||||
var stack: Dictionary = get_stack()[2+n]
|
||||
return {"file": stack["source"].replace("user://", "").replace("res://", ""), "line": stack["line"], "function": stack["function"]}
|
||||
|
||||
# Check platform support
|
||||
func check_platform() -> void:
|
||||
match(OS.get_name()):
|
||||
"Linux": pass
|
||||
"Windows": pass
|
||||
_: # Platform not supported
|
||||
logger.error("The \"" + OS.get_name() + "\" operating system is not supported by Presencode. You can add support for that platform to Presencode yourself, if you want.")
|
||||
|
||||
# Returns the best common resolution
|
||||
func get_best_resolution() -> Vector2i:
|
||||
logger.info("Determining best resolution")
|
||||
var screen_size: Vector2 = Vector2(DisplayServer.screen_get_size())
|
||||
var resolutions: Array[Vector2] = [Vector2(960, 540), Vector2(1920, 1080), Vector2(2560, 1440), Vector2(3840, 2160)]
|
||||
var closest_resolution: Vector2 = Vector2(NAN, NAN)
|
||||
var closest_distance: float = INF
|
||||
for resolution in resolutions:
|
||||
var distance = screen_size.distance_to(resolution)
|
||||
if distance < closest_distance:
|
||||
closest_distance = distance
|
||||
closest_resolution = resolution
|
||||
if closest_resolution == Vector2(NAN, NAN): return Vector2i(960, 540)
|
||||
else: return closest_resolution
|
||||
|
||||
# Return path to temporary directory
|
||||
## This function tries to utilize the operating system's temporary directory.
|
||||
## If all of them can't be used, it falls back to "user://temp" instead.
|
||||
func get_temporary_dir() -> String:
|
||||
match(OS.get_name()):
|
||||
"Linux": # Use "/tmp" or fallback
|
||||
if DirAccess.dir_exists_absolute("/tmp"):
|
||||
return "/tmp/presencode"
|
||||
else:
|
||||
return "user://temp"
|
||||
"Windows": # Use "%USERPROFILE%/AppData/Local/Temp/Presencode" or "C:/Users/%USERNAME%/AppData/Local/Temp/Presencode" or fallback
|
||||
if OS.get_environment("USERPROFILE") != "" and DirAccess.dir_exists_absolute(OS.get_environment("USERPROFILE").replace("\\", "/")):
|
||||
return OS.get_environment("USERPROFILE").replace("\\", "/") + "/AppData/Local/Temp/Presencode"
|
||||
elif OS.get_environment("USERNAME") != "" and DirAccess.dir_exists_absolute("C:/Users/" + OS.get_environment("USERNAME")):
|
||||
return "C:/Users/" + OS.get_environment("USERNAME") + "/AppData/Local/Temp/Presencode"
|
||||
else:
|
||||
return "user://temp"
|
||||
_: # Platform not supported
|
||||
logger.warn("The " + OS.get_name() + " platform is not supported by Presencode. You can add support for that platform to Presencode yourself, if you want.")
|
||||
return ""
|
||||
|
||||
# Shutdown Presencode safely
|
||||
func shutdown(exitcode: int = 0) -> void:
|
||||
logger.info("Shutting down (code " + str(exitcode) + ")")
|
||||
get_tree().paused = true
|
||||
# Call controller's presentation_end() function if a controller is registered
|
||||
if pmana.registered: await pmana.controller.presentation_end()
|
||||
# Display white texture
|
||||
var npr: NinePatchRect = NinePatchRect.new()
|
||||
npr.name = "OverlayTexture"
|
||||
npr.texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(RenderingServer.get_white_texture()))
|
||||
npr.size = Vector2(100000, 100000)
|
||||
npr.position = Vector2(-50000, -50000)
|
||||
get_tree().root.add_child(npr)
|
||||
get_tree().root.move_child(npr, get_tree().root.get_child_count(true))
|
||||
# Set window properties
|
||||
if config_shutdown_invisible: set_main_window_visibility(false)
|
||||
# Remove temporary directory
|
||||
logger.diag("Removing temporary directory")
|
||||
DirAccess.remove_absolute(get_temporary_dir())
|
||||
# Wait for all log messages to be printed to console/log
|
||||
logger.diag("Waiting for log messages")
|
||||
await get_tree().create_timer(0.25, true).timeout
|
||||
print("Exiting!")
|
||||
get_tree().quit(exitcode)
|
||||
# Insanely long timer to prevent Godot from executing code during exit
|
||||
await get_tree().create_timer(999, true).timeout
|
||||
|
||||
# Makes the window invisible/visible
|
||||
func set_main_window_visibility(visible: bool) -> void:
|
||||
if DisplayServer.window_get_mode() != DisplayServer.WINDOW_MODE_WINDOWED: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED, true)
|
||||
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, !visible)
|
||||
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_RESIZE_DISABLED, !visible)
|
||||
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_NO_FOCUS, !visible)
|
||||
if visible:
|
||||
DisplayServer.window_set_min_size(Vector2i(960, 540))
|
||||
DisplayServer.window_set_size(Vector2i(960, 540))
|
||||
DisplayServer.window_set_position(get_center(DisplayServer.screen_get_size(), DisplayServer.window_get_size()))
|
||||
else:
|
||||
DisplayServer.window_set_min_size(Vector2i(1, 1))
|
||||
DisplayServer.window_set_size(Vector2i(1, 1))
|
||||
DisplayServer.window_set_position(Vector2i(0, 0))
|
||||
|
||||
# Checks for manifest consistency
|
||||
func check_manifest_consistency(manifest: Dictionary) -> misc.Error:
|
||||
logger.diag("Checking manifest for consistency")
|
||||
|
||||
# version
|
||||
match(manifest.get("version")):
|
||||
null: return misc.Error.MANIFEST_INCONSISTENT
|
||||
float(1): pass
|
||||
_: return misc.Error.MANIFEST_INVALID_VERSION
|
||||
logger.diag("Manifest passed \"version\" consistency check")
|
||||
# program
|
||||
match(manifest.get("program")):
|
||||
null: return misc.Error.MANIFEST_INCONSISTENT
|
||||
manifest_program: pass
|
||||
_: return misc.Error.MANIFEST_INVALID_PROGRAM
|
||||
logger.diag("Manifest passed \"program\" consistency check")
|
||||
# topic
|
||||
if manifest.get("topic") == null:
|
||||
return misc.Error.MANIFEST_INCONSISTENT
|
||||
elif typeof(manifest.get("topic")) != TYPE_STRING:
|
||||
return misc.Error.MANIFEST_INCONSISTENT
|
||||
logger.diag("Manifest passed \"topic\" consistency check")
|
||||
# authors
|
||||
if manifest.get("authors") == null:
|
||||
return misc.Error.MANIFEST_INCONSISTENT
|
||||
elif typeof(manifest.get("authors")) != TYPE_ARRAY:
|
||||
return misc.Error.MANIFEST_INCONSISTENT
|
||||
for author in manifest.get("authors"):
|
||||
if typeof(author) != TYPE_STRING:
|
||||
return misc.Error.MANIFEST_INCONSISTENT
|
||||
logger.diag("Manifest passed \"authors\" consistency check")
|
||||
# ratio
|
||||
match(manifest.get("ratio")):
|
||||
null: return misc.Error.MANIFEST_INCONSISTENT
|
||||
"16:9": pass
|
||||
"4:3": pass
|
||||
_: return misc.Error.MANIFEST_INVALID_RATIO
|
||||
logger.diag("Manifest passed \"ratio\" consistency check")
|
||||
# entrypoint
|
||||
if manifest.get("entrypoint") == null:
|
||||
return misc.Error.MANIFEST_INCONSISTENT
|
||||
elif typeof(manifest.get("entrypoint")) != TYPE_STRING:
|
||||
return misc.Error.MANIFEST_INCONSISTENT
|
||||
elif !manifest.get("entrypoint").ends_with(".gd"):
|
||||
return misc.Error.MANIFEST_INCONSISTENT
|
||||
logger.diag("Manifest passed \"entrypoint\" consistency check")
|
||||
|
||||
logger.diag("Manifest follows the Presencode Manifest Specification")
|
||||
return misc.Error.OK
|
202
src/pmana.gd
202
src/pmana.gd
|
@ -1,202 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/pmana.gd (Presentation Manager) ###
|
||||
### ###
|
||||
### This source file handles interactions between Presencode and the ###
|
||||
### active presentation file. One example of this being slide navigation. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# Constants
|
||||
const entrypoint_version: int = 1
|
||||
|
||||
# Nodes
|
||||
var clickoverlay: Button = null
|
||||
var viewport: Control = null
|
||||
|
||||
# Configuration
|
||||
var config_allow_fullscreen: bool = true
|
||||
|
||||
# Controller information
|
||||
var controller: Node = null
|
||||
var slides: int = 0
|
||||
var animations: bool = false
|
||||
var quit_last_slide: bool = true
|
||||
|
||||
# State information
|
||||
var registered: bool = false
|
||||
var current_slide: int = -1
|
||||
var animation_active: bool = false
|
||||
var action_running: bool = false
|
||||
|
||||
# Register a controller
|
||||
func register(version: int, slides_: int, animations_: bool, quit_last_slide_: bool, controller_: NodePath) -> void:
|
||||
if registered:
|
||||
logger.warn("A presentation controller is already registered, please call unregister() before you try to register another controller.")
|
||||
return
|
||||
logger.info("Registering presentation controller")
|
||||
# Check entrypoint version
|
||||
if version != entrypoint_version:
|
||||
await logger.error("Presentation entrypoint version does not match Presencode's entrypoint version")
|
||||
# Check controller nodepath
|
||||
if get_node(controller_) == null:
|
||||
await logger.error("The presentation controller could not be located.")
|
||||
# Set controller information
|
||||
logger.diag("Setting controller information")
|
||||
slides = slides_
|
||||
animations = animations_
|
||||
quit_last_slide = quit_last_slide_
|
||||
controller = get_node(controller_)
|
||||
# Check for required functions
|
||||
logger.diag("Check for required functions")
|
||||
var lacking_functions: Array = []
|
||||
var check_functions: Array = ["change_slide", "presentation_start", "presentation_end"] ## Base functions
|
||||
## "display_end_slide" function
|
||||
if !quit_last_slide: check_functions.append("display_end_slide")
|
||||
## Animation related functions
|
||||
if animations:
|
||||
check_functions.append("animation_switch_away")
|
||||
check_functions.append("animation_switch_to")
|
||||
## Check for lacking functions
|
||||
for function in check_functions:
|
||||
if !controller.has_method(function):
|
||||
lacking_functions.append(function)
|
||||
## Print lacking functions
|
||||
if lacking_functions.size() != 0:
|
||||
logger.warn("The presentation controller is lacking these required functions:")
|
||||
for function in lacking_functions:
|
||||
logger.warn("- " + function)
|
||||
logger.warn("Consult the documentation or take a look at the example presentation if you need help.")
|
||||
await misc.shutdown(1)
|
||||
# Create presentation viewport
|
||||
logger.diag("Creating presentation viewport")
|
||||
viewport = Control.new()
|
||||
viewport.name = "Viewport"
|
||||
viewport.size = preader.get_ratio_resolution()
|
||||
viewport.position = Vector2(0, 0)
|
||||
get_node("/root/Presencode").add_child(viewport)
|
||||
# Create clickoverlay
|
||||
logger.diag("Creating clickoverlay")
|
||||
clickoverlay = Button.new()
|
||||
clickoverlay.name = "ClickOverlay"
|
||||
clickoverlay.set_script(ResourceLoader.load("res://src/clickoverlay.gd"))
|
||||
get_node("/root/Presencode").add_child(clickoverlay)
|
||||
# Did you know that every big galaxy contains a massive black hole in it's center?
|
||||
registered = true
|
||||
# Invoke controller's presentation_start()
|
||||
controller.presentation_start(viewport)
|
||||
|
||||
# Unregister a controller
|
||||
func unregister() -> void:
|
||||
if !registered:
|
||||
logger.warn("No presentation controller has been registered yet. Please call register() first.")
|
||||
return
|
||||
logger.info("Unregistering presentation controller")
|
||||
while action_running:
|
||||
logger.warn("Waiting for action to finish")
|
||||
await get_tree().create_timer(1).timeout
|
||||
# Reset variables to default values
|
||||
logger.diag("Resetting variables")
|
||||
registered = false
|
||||
current_slide = -1
|
||||
animation_active = false
|
||||
config_allow_fullscreen = true
|
||||
# Remove nodes
|
||||
logger.diag("Removing node")
|
||||
## Remove clickoverlay
|
||||
get_node("/root/Presencode/").remove_child(clickoverlay)
|
||||
clickoverlay = null
|
||||
## Remove viewport
|
||||
get_node("/root/Presencode/").remove_child(viewport)
|
||||
viewport = null
|
||||
|
||||
# Change slide
|
||||
func change_slide(slide: int, no_animations: bool = false) -> void:
|
||||
if !registered:
|
||||
logger.warn("No presentation controller has been registered yet. Please call register() first.")
|
||||
return
|
||||
# Disallow negative slides
|
||||
if slide < 0:
|
||||
logger.warn("Can't switch to a negative slide")
|
||||
return
|
||||
# Disallow current slide
|
||||
elif slide == current_slide:
|
||||
logger.warn("Can't switch to current slide")
|
||||
return
|
||||
# Is slide over max slides?
|
||||
if slide > slides:
|
||||
# Quit after last slide?
|
||||
if quit_last_slide:
|
||||
logger.info("Ending presentation")
|
||||
await misc.shutdown(0)
|
||||
return
|
||||
else:
|
||||
logger.warn("Over max slides by " + str(slide-slides))
|
||||
if slide-1 == slides: # End slide (slide is over max slides by one)
|
||||
logger.info("Displaying end slide")
|
||||
controller.display_end_slide()
|
||||
current_slide = slide
|
||||
return
|
||||
else: # End presentation (slide is over max slides by two or more)
|
||||
logger.info("Ending presentation")
|
||||
await misc.shutdown(0)
|
||||
return
|
||||
# Slide is not over max slides, continue slide change
|
||||
action_running = true
|
||||
# Play switch away animation
|
||||
if animations and !no_animations:
|
||||
await controller.animation_switch_away(current_slide, slide)
|
||||
# Check if controller has unregistered during animation
|
||||
if !registered: logger.error("The current presentation controller has been unregistered during execution")
|
||||
# Change slide
|
||||
await controller.change_slide(slide)
|
||||
# Check if controller has unregistered during slide change
|
||||
if !registered: logger.error("The current presentation controller has been unregistered during execution")
|
||||
# Set current_slide to new slide
|
||||
current_slide = slide
|
||||
# Play switch to animation
|
||||
if animations and !no_animations: await controller.animation_switch_to(current_slide, slide)
|
||||
|
||||
# Clear the viewport
|
||||
func clear_viewport() -> void:
|
||||
if !registered:
|
||||
logger.warn("No presentation controller has been registered yet. Please call register() first.")
|
||||
return
|
||||
logger.diag("Clearing viewport")
|
||||
if viewport.get_child_count(true) == 0:
|
||||
logger.warn("No children found in viewport")
|
||||
return
|
||||
for child in viewport.get_children(true):
|
||||
viewport.remove_child(child)
|
||||
|
||||
# Hide log output
|
||||
func hide_log() -> void:
|
||||
if !registered:
|
||||
logger.warn("No presentation controller has been registered yet. Please call register() first.")
|
||||
return
|
||||
logger.diag("Hiding log")
|
||||
get_node("/root/Presencode/Log").modulate = Color8(255, 255, 255, 0)
|
||||
|
||||
# Show log output
|
||||
func show_log() -> void:
|
||||
if !registered:
|
||||
logger.warn("No presentation controller has been registered yet. Please call register() first.")
|
||||
return
|
||||
logger.diag("Showing log")
|
||||
get_node("/root/Presencode/Log").modulate = Color8(255, 255, 255, 255)
|
299
src/preader.gd
299
src/preader.gd
|
@ -1,299 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/preader.gd (Presentation Reader) ###
|
||||
### ###
|
||||
### This source file handles the reading of Presencode presentation ###
|
||||
### archives and directories aswell as reading the manifest and entrypoint ###
|
||||
### files contained in the presentation archive/directory. It can also be ###
|
||||
### used to retrieve information from the manifest file. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# States
|
||||
var is_open: bool = false
|
||||
|
||||
# Reading support
|
||||
var directorypath: String = ""
|
||||
var ziphandler: ZIPReader = ZIPReader.new()
|
||||
|
||||
# Manifest & entrypoint
|
||||
var manifest: Dictionary = {}
|
||||
var entrypoint: Node = null
|
||||
|
||||
# Open a presentation archive/directory
|
||||
func open_presentation(path: String, zip: bool) -> Error:
|
||||
if is_open:
|
||||
logger.warn("Another presentation is still in memory")
|
||||
return Error.FAILED
|
||||
logger.info("Opened presentation (" + path + ")")
|
||||
if zip:
|
||||
# Open presentation archive using ziphandler
|
||||
directorypath = ""
|
||||
is_open = true
|
||||
return ziphandler.open(path)
|
||||
else:
|
||||
# Set directorypath to presentation directory
|
||||
directorypath = path
|
||||
is_open = true
|
||||
return Error.OK
|
||||
|
||||
# Close opened presentation
|
||||
func close_presentation() -> Error:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return Error.FAILED
|
||||
# Disable operations
|
||||
is_open = false
|
||||
# Reset values
|
||||
manifest = {}
|
||||
entrypoint = null
|
||||
logger.info("Closed presentation")
|
||||
if directorypath == "":
|
||||
# Remove entrypoint
|
||||
if FileAccess.file_exists(misc.get_temporary_dir() + "/entrypoint.gd"):
|
||||
DirAccess.remove_absolute(misc.get_temporary_dir() + "/entrypoint.gd")
|
||||
# Close ziphandler
|
||||
return ziphandler.close()
|
||||
else:
|
||||
# Reset directorypath
|
||||
directorypath = ""
|
||||
return Error.OK
|
||||
|
||||
# Read a file from the presentation archive/directory
|
||||
func read_file(path: String) -> PackedByteArray:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return PackedByteArray([])
|
||||
if directorypath == "":
|
||||
# Check if file exists, if not return empty PackedByteArray
|
||||
if !ziphandler.file_exists(path, true):
|
||||
logger.warn("Requested file is missing in presentation archive")
|
||||
return PackedByteArray([])
|
||||
# Read and return file
|
||||
return ziphandler.read_file(path, true)
|
||||
else:
|
||||
# Check if file exists, if not return empty PackedByteArray
|
||||
if !FileAccess.file_exists(directorypath + "/" + path):
|
||||
logger.warn("Requested file is missing in presentation directory")
|
||||
return PackedByteArray([])
|
||||
# Open file as ro
|
||||
var file = FileAccess.open(directorypath + "/" + path, FileAccess.READ)
|
||||
if file == null:
|
||||
logger.warn("Requested file could not be opened, error=" + str(FileAccess.get_open_error()))
|
||||
return PackedByteArray([])
|
||||
# Return PackedByteArray and close file
|
||||
var content = file.get_buffer(file.get_length())
|
||||
file.close()
|
||||
return content
|
||||
|
||||
# Read a resource from the presentation archive/directory
|
||||
func read_resource(path: String) -> Resource:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return null
|
||||
if directorypath == "":
|
||||
var resource_bytes: PackedByteArray = read_file(path)
|
||||
if resource_bytes.size() == 0:
|
||||
logger.warn("Resource could not be read")
|
||||
return null
|
||||
var split_path: Array = path.split("/")
|
||||
var file = FileAccess.open(misc.get_temporary_dir() + "/" + str(split_path[split_path.size()-1]), FileAccess.WRITE)
|
||||
if file == null:
|
||||
logger.warn("Resource could not be read, FileAccess[1] failed: " + str(FileAccess.get_open_error()))
|
||||
return null
|
||||
file.store_buffer(resource_bytes)
|
||||
file.close()
|
||||
var resource: Resource = null
|
||||
# Attempt workaround to mitigate loading issues
|
||||
resource = _read_resource_workaround(misc.get_temporary_dir() + "/" + str(split_path[split_path.size()-1]))
|
||||
if resource == null: # Workaround did not work, load resource normally
|
||||
resource = ResourceLoader.load(misc.get_temporary_dir() + "/" + str(split_path[split_path.size()-1]))
|
||||
if resource == null: # Resource could not be read
|
||||
logger.warn("Resource could not be read, resource is null")
|
||||
return null
|
||||
return resource
|
||||
else:
|
||||
if !FileAccess.file_exists(directorypath + "/" + path):
|
||||
logger.error("Requested resource is missing in presentation directory")
|
||||
return null
|
||||
var resource: Resource = null
|
||||
# Attempt workaround to mitigate loading issues
|
||||
resource = _read_resource_workaround(directorypath + "/" + path)
|
||||
if resource == null: # Workaround did not work, load resource normally
|
||||
resource = ResourceLoader.load(directorypath + "/" + path)
|
||||
if resource == null: # Resource could not be read
|
||||
logger.warn("Resource could not be read, resource is null")
|
||||
return null
|
||||
return resource
|
||||
|
||||
# Workaround to make loading certain resources possible, even if outside res:// and user://
|
||||
func _read_resource_workaround(path: String) -> Resource:
|
||||
var resource: Resource = null
|
||||
if path.ends_with(".ttf") or path.ends_with(".otf") or path.ends_with(".woff") or path.ends_with(".woff2"):
|
||||
# Font workaround
|
||||
resource = FontFile.new()
|
||||
resource.load_dynamic_font(path)
|
||||
elif path.ends_with(".png") or path.ends_with(".jpg") or path.ends_with(".svg") or path.ends_with(".ktx") or path.ends_with(".tga") or path.ends_with(".webp"):
|
||||
# Image workaround
|
||||
resource = Image.load_from_file(path)
|
||||
return resource
|
||||
|
||||
# Read a resource from the presentation archive/directory (unsafe, without workaround)
|
||||
func read_resource_unsafe(path: String) -> Resource:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return null
|
||||
if directorypath == "":
|
||||
var resource_bytes: PackedByteArray = read_file(path)
|
||||
if resource_bytes.size() == 0:
|
||||
logger.warn("Resource could not be read")
|
||||
return null
|
||||
var split_path: Array = path.split("/")
|
||||
var file = FileAccess.open(misc.get_temporary_dir() + "/" + str(split_path[split_path.size()-1]), FileAccess.WRITE)
|
||||
if file == null:
|
||||
logger.warn("Resource could not be read, FileAccess[1] failed: " + str(FileAccess.get_open_error()))
|
||||
return null
|
||||
file.store_buffer(resource_bytes)
|
||||
file.close()
|
||||
var resource: Resource = ResourceLoader.load(misc.get_temporary_dir() + "/" + str(split_path[split_path.size()-1]))
|
||||
if resource == null:
|
||||
logger.warn("Resource could not be read, resource is null")
|
||||
return null
|
||||
return resource
|
||||
else:
|
||||
if !FileAccess.file_exists(directorypath + "/" + path):
|
||||
logger.error("Requested resource is missing in presentation directory")
|
||||
return null
|
||||
var resource: Resource = ResourceLoader.load(directorypath + "/" + path)
|
||||
if resource == null:
|
||||
logger.warn("Resource could not be read, resource is null")
|
||||
return null
|
||||
return resource
|
||||
|
||||
# Check if file exists in presentation archive/directory
|
||||
func file_exists(path: String) -> bool:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return false
|
||||
if directorypath == "": return ziphandler.file_exists(path, true)
|
||||
else: return FileAccess.file_exists(directorypath + "/" + path)
|
||||
|
||||
# Reads the manifest.json file
|
||||
func read_manifest() -> misc.Error:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return misc.Error.PREADER_NO_PRESENTATION_OPEN
|
||||
# Read and parse manifest.json
|
||||
manifest = JSON.parse_string(read_file("manifest.json").get_string_from_utf8())
|
||||
# Check for type
|
||||
if typeof(manifest) != TYPE_DICTIONARY:
|
||||
logger.error("manifest.json could not be parsed")
|
||||
manifest = {}
|
||||
return misc.Error.PREADER_MANIFEST_PARSING_FAILED
|
||||
# Check manifest against the Presencode Manifest Specification, return error if not compliant
|
||||
var error: misc.Error = misc.check_manifest_consistency(manifest)
|
||||
if error != misc.Error.OK:
|
||||
logger.error("manifest.json is not consistent with the Presencode manifest specification")
|
||||
manifest = {}
|
||||
return error
|
||||
logger.info("Successfully read presentation manifest")
|
||||
return misc.Error.OK
|
||||
|
||||
# Read the entrypoint file defined in manifest.json
|
||||
func read_entrypoint() -> misc.Error:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return misc.Error.PREADER_NO_PRESENTATION_OPEN
|
||||
# Check if manifest is loaded in memory
|
||||
if manifest == {}:
|
||||
logger.error("Manifest not loaded in memory, please call read_manifest() first")
|
||||
return misc.Error.PREADER_NO_MANIFEST
|
||||
# Create empty script variable
|
||||
var script: Script = read_resource(manifest["entrypoint"])
|
||||
# script == null == script did not load
|
||||
if script == null:
|
||||
logger.error("Entrypoint file is invalid (does it contain errors?)")
|
||||
# Create new "Node" and attach the entrypoint script to it
|
||||
entrypoint = Node.new()
|
||||
entrypoint.name = "Entrypoint"
|
||||
entrypoint.set_script(script)
|
||||
return misc.Error.OK
|
||||
|
||||
# Return entrypoint node
|
||||
func get_entrypoint() -> Node:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return null
|
||||
if typeof(entrypoint) != TYPE_OBJECT:
|
||||
logger.error("Entrypoint not loaded in memory, please call read_entrypoint() first")
|
||||
return null
|
||||
return entrypoint
|
||||
|
||||
# Return the presentation topic
|
||||
func get_topic() -> String:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return ""
|
||||
# Check if manifest is loaded in memory
|
||||
if manifest == {}:
|
||||
logger.error("Manifest not loaded in memory, please call read_manifest() first")
|
||||
return ""
|
||||
return manifest["topic"]
|
||||
|
||||
# Return the presentation authors
|
||||
func get_authors() -> String:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return ""
|
||||
# Check if manifest is loaded in memory
|
||||
if manifest == {}:
|
||||
logger.error("Manifest not loaded in memory, please call read_manifest() first")
|
||||
return ""
|
||||
var authors: String = ""
|
||||
for author in manifest["authors"]:
|
||||
if authors == "": authors = author
|
||||
else: authors = authors + ", " + author
|
||||
return authors
|
||||
|
||||
# Return the presentation display ratio
|
||||
func get_ratio() -> String:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return ""
|
||||
# Check if manifest is loaded in memory
|
||||
if manifest == {}:
|
||||
logger.error("Manifest not loaded in memory, please call read_manifest() first")
|
||||
return ""
|
||||
return manifest["ratio"]
|
||||
|
||||
# Return the display resolution (derived from display ratio)
|
||||
func get_ratio_resolution() -> Vector2i:
|
||||
if !is_open:
|
||||
logger.warn("No presentation is currently opened")
|
||||
return Vector2i(0, 0)
|
||||
# Check if manifest is loaded in memory
|
||||
if manifest == {}:
|
||||
logger.error("Manifest not loaded in memory, please call read_manifest() first")
|
||||
return Vector2i(0, 0)
|
||||
match(manifest["ratio"]):
|
||||
"16:9": return Vector2i(1920, 1080)
|
||||
"4:3": return Vector2i(1920, 1440)
|
||||
_:
|
||||
logger.error("Invalid ratio \"" + manifest["ratio"] + "\"")
|
||||
return Vector2i(1, 1)
|
172
src/processor.gd
172
src/processor.gd
|
@ -1,172 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/processor.gd (Processor) ###
|
||||
### ###
|
||||
### This source file is solely used for doing things every frame. This ###
|
||||
### includes (for example) input handling, updating sizes, etc.. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# Enums
|
||||
enum DragNode {
|
||||
CONSOLE
|
||||
}
|
||||
|
||||
# Nodes
|
||||
var nodes: Array[Node] = [null, null]
|
||||
var loader: Node = null
|
||||
var console: Node = null
|
||||
|
||||
# States
|
||||
var initialized: bool = false
|
||||
|
||||
# Initialize processor
|
||||
func initialize() -> void:
|
||||
logger.diag("Initializing processor")
|
||||
loader = get_node("/root/Presencode")
|
||||
console = get_node("/root/Console")
|
||||
nodes = [
|
||||
loader,
|
||||
console
|
||||
]
|
||||
initialized = true
|
||||
|
||||
# What did you expect?
|
||||
func _process(_delta: float) -> void:
|
||||
if !initialized: return
|
||||
move_to_top()
|
||||
handle_keys()
|
||||
change_sizes()
|
||||
update_dragging()
|
||||
|
||||
# Move elements to top
|
||||
func move_to_top() -> void:
|
||||
if !initialized: return
|
||||
var index: int = get_tree().root.get_child_count(true)
|
||||
for node in nodes:
|
||||
get_tree().root.move_child(node, index)
|
||||
index = index-1
|
||||
|
||||
# Handles key inputs
|
||||
func handle_keys() -> void:
|
||||
if !initialized: return
|
||||
# Global
|
||||
## Scaling method
|
||||
if Input.is_action_just_pressed("content_scale_switch"):
|
||||
match(get_tree().root.content_scale_stretch):
|
||||
Window.CONTENT_SCALE_STRETCH_FRACTIONAL: # Current scaling mode is integer scaling
|
||||
logger.info("Switched to integer scaling")
|
||||
get_tree().root.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_INTEGER
|
||||
Window.CONTENT_SCALE_STRETCH_INTEGER: # Current scaling mode is fractional scaling
|
||||
logger.info("Switched to fractional scaling")
|
||||
get_tree().root.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_FRACTIONAL
|
||||
_: # Invalid value
|
||||
logger.error("Invalid content_scale_stretch value")
|
||||
# Presentation Manager
|
||||
## Fullscreen
|
||||
if pmana.config_allow_fullscreen and Input.is_action_just_pressed("fullscreen"):
|
||||
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_WINDOWED: # Window is windowed, set to fullscreen mode
|
||||
logger.info("Switched to fullscreen mode")
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
else: # Window is in fullscreen (or something else) mode, set to windowed mode
|
||||
logger.info("Switched to windowed mode")
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
## Navigation
|
||||
if pmana.registered and Input.is_action_pressed("slide_forwards") and Input.is_action_pressed("slide_backwards"): return
|
||||
else:
|
||||
if get_node_or_null("/root/Console") == null or !get_node("/root/Console").visible:
|
||||
if Input.is_action_just_pressed("slide_forwards"): # Increase current_slide by one
|
||||
logger.info("Navigated one slide forwards")
|
||||
pmana.change_slide(pmana.current_slide+1)
|
||||
elif Input.is_action_just_pressed("slide_backwards"): # Decrease current_slide by one
|
||||
logger.info("Navigated one slide backwards")
|
||||
pmana.change_slide(pmana.current_slide-1)
|
||||
# Console
|
||||
## Visibility toggle
|
||||
if Input.is_action_just_pressed("console"): console.toggle_console()
|
||||
# UI Engine
|
||||
## Switch resolution
|
||||
if ui_engine.initialized and Input.is_action_just_pressed("editor_switchres"):
|
||||
match(ui_engine.resolution):
|
||||
"960x540": ui_engine.update_resolution(Vector2i(1920, 1080))
|
||||
"1920x1080": ui_engine.update_resolution(Vector2i(2560, 1440))
|
||||
"2560x1440": ui_engine.update_resolution(Vector2i(3840, 2160))
|
||||
"3840x2160": ui_engine.update_resolution(Vector2i(960, 540))
|
||||
|
||||
# Change sizes
|
||||
func change_sizes() -> void:
|
||||
if !initialized: return
|
||||
# Loader
|
||||
loader.size = DisplayServer.window_get_size()
|
||||
if typeof(loader.logrtl) == TYPE_OBJECT:
|
||||
loader.logrtl.size = DisplayServer.window_get_size()
|
||||
# ClickOverlay
|
||||
if get_node_or_null("/root/Presencode/ClickOverlay") != null: get_node("/root/Presencode/ClickOverlay").size = DisplayServer.window_get_size()
|
||||
|
||||
# Makes dragging windows possible
|
||||
func update_dragging() -> void:
|
||||
if !initialized: return
|
||||
# Console
|
||||
if console.dragging:
|
||||
# Get new cursor position
|
||||
var cursor_position = get_tree().root.get_viewport().get_mouse_position()
|
||||
if console.cursor_origin != cursor_position: # If mouse didn't move, don't execute further
|
||||
# Calculate cursor offset
|
||||
var cursor_offset: Vector2 = Vector2(0, 0)
|
||||
cursor_offset.x = console.cursor_origin.x-cursor_position.x
|
||||
cursor_offset.y = console.cursor_origin.y-cursor_position.y
|
||||
# Change console position
|
||||
console.position.x = console.position.x-cursor_offset.x
|
||||
console.position.y = console.position.y-cursor_offset.y
|
||||
# Set new console.cursor_origin
|
||||
console.cursor_origin = cursor_position
|
||||
# Prevent console from going out of scope
|
||||
var position_new: Vector2 = await check_dragging_area_violation(DragNode.CONSOLE)
|
||||
if console.position != position_new:
|
||||
console.position = position_new
|
||||
|
||||
# Calculate drag area
|
||||
func update_dragging_area(dragnode: DragNode, area: Vector2i = DisplayServer.window_get_size()) -> void:
|
||||
while !initialized:
|
||||
logger.diag("Waiting for Processor to initialize")
|
||||
await get_tree().create_timer(0.25).timeout
|
||||
match(dragnode):
|
||||
DragNode.CONSOLE:
|
||||
logger.diag("Updating drag area for CONSOLE")
|
||||
console.drag_area.x = area.x-console.size.x
|
||||
console.drag_area.y = area.y-console.size.y
|
||||
_: await logger.error("Invalid DragNode \"" + str(dragnode) + "\"")
|
||||
|
||||
# Check against drag area violations
|
||||
func check_dragging_area_violation(dragnode: DragNode) -> Vector2:
|
||||
if !initialized: await logger.error("Processor is not initialized yet.")
|
||||
var new_position: Vector2 = Vector2(0, 0)
|
||||
match(dragnode):
|
||||
DragNode.CONSOLE:
|
||||
new_position = console.position
|
||||
if console.position.x <= 0:
|
||||
new_position.x = 0
|
||||
elif console.position.x >= console.drag_area.x:
|
||||
new_position.x = console.drag_area.x
|
||||
if console.position.y <= 0:
|
||||
new_position.y = 0
|
||||
elif console.position.y >= console.drag_area.y:
|
||||
new_position.y = console.drag_area.y
|
||||
_: await logger.error("Invalid DragNode \"" + str(dragnode) + "\"")
|
||||
return new_position
|
10
src/statemanager.gd
Normal file
10
src/statemanager.gd
Normal file
|
@ -0,0 +1,10 @@
|
|||
extends Node
|
||||
|
||||
@onready var core: Core = get_node("/root/CORE")
|
||||
@onready var logger: CoreLoggerInstance = core.logger.get_instance("src/statemanager.gd", self)
|
||||
|
||||
func _ready() -> void:
|
||||
# Register cleanup hook
|
||||
core.register_cleanup_hook(func() -> void: queue_free())
|
||||
|
||||
logger.verb("State manager is ready")
|
|
@ -1,185 +0,0 @@
|
|||
##############################################################################
|
||||
### PRESENCODE SOURCE FILE ###
|
||||
### Copyright (c) 2024 JeremyStarTM & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/ui/welcome.gd (Welcome UI) ###
|
||||
### ###
|
||||
### This source file controls the welcome user interface scene. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
func switch_mode() -> void:
|
||||
DisplayServer.window_set_title("Presencode » Welcome")
|
||||
update_splash()
|
||||
|
||||
@warning_ignore("integer_division")
|
||||
func update_resolution(new_resolution: Vector2i) -> void:
|
||||
var base: Button = get_node("Wallpaper/Welcome")
|
||||
var wallpaper_size: Vector2 = Vector2(7440, 4822)
|
||||
base.get_parent().size = Vector2(wallpaper_size.x*(new_resolution.x/wallpaper_size.x), wallpaper_size.y*(new_resolution.y/wallpaper_size.y))
|
||||
base.size = Vector2(new_resolution.x*0.9, new_resolution.y*0.9)
|
||||
base.position = Vector2(new_resolution.x*0.05, new_resolution.y*0.05)
|
||||
base.add_theme_stylebox_override("normal", get_stylebox_blur(new_resolution))
|
||||
base.add_theme_stylebox_override("hover", get_stylebox_blur(new_resolution))
|
||||
base.add_theme_stylebox_override("pressed", get_stylebox_blur(new_resolution))
|
||||
base.add_theme_stylebox_override("disabled", get_stylebox_blur(new_resolution))
|
||||
for child in base.get_children(true):
|
||||
for group in child.get_groups():
|
||||
match(group):
|
||||
"font":
|
||||
child.add_theme_font_override("normal_font", ResourceLoader.load("res://assets/fonts/Inter/Regular.ttf"))
|
||||
child.add_theme_font_override("bold_font", ResourceLoader.load("res://assets/fonts/Inter/Bold.ttf"))
|
||||
child.add_theme_font_override("italics_font", ResourceLoader.load("res://assets/fonts/Inter/Italic.ttf"))
|
||||
child.add_theme_font_override("bold_italics_font", ResourceLoader.load("res://assets/fonts/Inter/BoldItalic.ttf"))
|
||||
child.add_theme_font_override("mono_font", ResourceLoader.load("res://assets/fonts/FiraCode/Regular.ttf"))
|
||||
"font_normal":
|
||||
child.add_theme_font_size_override("normal_font_size", new_resolution.x/40)
|
||||
child.add_theme_font_size_override("bold_font_size", new_resolution.x/40)
|
||||
child.add_theme_font_size_override("italics_font_size", new_resolution.x/40)
|
||||
child.add_theme_font_size_override("bold_italics_font_size", new_resolution.x/40)
|
||||
child.add_theme_font_size_override("mono_font_size", new_resolution.x/41.73913043478261)
|
||||
"font_small":
|
||||
child.add_theme_font_size_override("normal_font_size", new_resolution.x/53.33333333333333)
|
||||
child.add_theme_font_size_override("bold_font_size", new_resolution.x/53.33333333333333)
|
||||
child.add_theme_font_size_override("italics_font_size", new_resolution.x/53.33333333333333)
|
||||
child.add_theme_font_size_override("bold_italics_font_size", new_resolution.x/53.33333333333333)
|
||||
child.add_theme_font_size_override("mono_font_size", new_resolution.x/53.33333333333333)
|
||||
"font_one": child.add_theme_font_override("font", ResourceLoader.load("res://assets/fonts/Inter/Regular.ttf"))
|
||||
"font_one_normal": child.add_theme_font_size_override("font_size", new_resolution.x/40)
|
||||
"font_one_small": child.add_theme_font_size_override("font_size", new_resolution.x/53.33333333333333)
|
||||
base.get_node("Icon").size = Vector2(new_resolution.x/1.5, new_resolution.y/4.5)
|
||||
base.get_node("Icon").position = Vector2(base.size.x/2-base.get_node("Icon").size.x/2, base.size.y*0.05)
|
||||
base.get_node("Splash").size = Vector2(new_resolution.x/1.5, new_resolution.y/15.88235294117647)
|
||||
base.get_node("Splash").position = Vector2(base.size.x/2-base.get_node("Splash").size.x/2, base.get_node("Icon").position.y+11*(new_resolution.y/49.09090909090909))
|
||||
base.get_node("OpenArchiveButton").size = Vector2(new_resolution.x/4.403669724770642, new_resolution.y/14.21052631578947)
|
||||
base.get_node("OpenArchiveButton").position = Vector2(base.size.x/16, base.size.y/2.410714285714286)
|
||||
base.get_node("OpenDirButton").size = Vector2(new_resolution.x/4.403669724770642, new_resolution.y/14.21052631578947)
|
||||
base.get_node("OpenDirButton").position = Vector2(base.size.x/16, base.get_node("OpenArchiveButton").position.y+base.get_node("OpenArchiveButton").size.y+base.size.y/108)
|
||||
base.get_node("EditorButton").size = Vector2(new_resolution.x/4.403669724770642, new_resolution.y/14.21052631578947)
|
||||
base.get_node("EditorButton").position = Vector2(base.size.x-base.get_node("OpenArchiveButton").position.x-base.get_node("EditorButton").size.x, base.size.y/2.410714285714286)
|
||||
base.get_node("AboutText").size = Vector2(new_resolution.x/1.5, new_resolution.y/7.5)
|
||||
base.get_node("AboutText").position = Vector2(base.size.x/2-base.get_node("AboutText").size.x/2, base.size.y-base.size.y/54-base.size.y/7.5)
|
||||
|
||||
@warning_ignore("integer_division")
|
||||
func get_stylebox_blur(resolution_: Vector2i) -> StyleBoxFlat:
|
||||
var stylebox: StyleBoxFlat = StyleBoxFlat.new()
|
||||
stylebox.bg_color = Color8(0, 0, 0, 180)
|
||||
stylebox.corner_radius_top_left = resolution_.x/30
|
||||
stylebox.corner_radius_top_right = resolution_.x/30
|
||||
stylebox.corner_radius_bottom_left = resolution_.x/30
|
||||
stylebox.corner_radius_bottom_right = resolution_.x/30
|
||||
return stylebox
|
||||
|
||||
func open_presentation_archive_picker() -> void:
|
||||
logger.info("Opening presentation")
|
||||
var fd: FileDialog = FileDialog.new()
|
||||
fd.access = FileDialog.ACCESS_FILESYSTEM
|
||||
fd.current_path = "user://"
|
||||
fd.file_mode = FileDialog.FILE_MODE_OPEN_FILE
|
||||
fd.add_filter("*.pcpa", "")
|
||||
fd.add_filter("*.zip", "")
|
||||
fd.mode_overrides_title = false
|
||||
fd.show_hidden_files = true
|
||||
fd.title = "Open a Presencode presentation archive"
|
||||
fd.use_native_dialog = true
|
||||
fd.cancel_button_text = "Cancel"
|
||||
fd.ok_button_text = "Present"
|
||||
fd.visible = true
|
||||
fd.connect("file_selected", func(path: String) -> void: open_presentation(path))
|
||||
add_child(fd)
|
||||
|
||||
func open_presentation_dir_picker() -> void:
|
||||
logger.info("Opening presentation")
|
||||
var fd: FileDialog = FileDialog.new()
|
||||
fd.access = FileDialog.ACCESS_FILESYSTEM
|
||||
fd.current_path = "user://"
|
||||
fd.file_mode = FileDialog.FILE_MODE_OPEN_DIR
|
||||
fd.mode_overrides_title = false
|
||||
fd.show_hidden_files = true
|
||||
fd.title = "Open a Presencode presentation directory"
|
||||
fd.use_native_dialog = true
|
||||
fd.cancel_button_text = "Cancel"
|
||||
fd.ok_button_text = "Present"
|
||||
fd.visible = true
|
||||
fd.connect("dir_selected", func(path: String) -> void: open_presentation(path))
|
||||
add_child(fd)
|
||||
|
||||
func open_presentation(path: String) -> void:
|
||||
if FileAccess.file_exists(path) and path.ends_with(".zip") or path.ends_with(".pcpa"): # .pcpa = presencode presentation archive
|
||||
logger.info("Opening presentation archive")
|
||||
preader.open_presentation(path, true)
|
||||
elif DirAccess.dir_exists_absolute(path):
|
||||
logger.info("Opening presentation directory")
|
||||
preader.open_presentation(path, false)
|
||||
else:
|
||||
await logger.error("Presentation file/directory \"" + path + "\" not found")
|
||||
# Read manifest & entrypoint files
|
||||
preader.read_manifest()
|
||||
preader.read_entrypoint()
|
||||
# Update window properties
|
||||
processor.update_dragging_area(processor.DragNode.CONSOLE, preader.get_ratio_resolution())
|
||||
DisplayServer.window_set_title("Presencode » Presenting \"" + preader.get_topic() + "\" by \"" + preader.get_authors() + "\"")
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
DisplayServer.window_set_size(preader.get_ratio_resolution())
|
||||
DisplayServer.window_set_min_size(preader.get_ratio_resolution())
|
||||
get_tree().root.content_scale_size = preader.get_ratio_resolution()
|
||||
get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_VIEWPORT
|
||||
get_tree().root.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_KEEP
|
||||
get_tree().root.content_scale_factor = 1.0
|
||||
await get_tree().process_frame
|
||||
DisplayServer.window_set_position(misc.get_center(DisplayServer.screen_get_size(), DisplayServer.window_get_size()))
|
||||
# Add entrypoint to SceneTree
|
||||
get_tree().root.add_child(preader.get_entrypoint())
|
||||
# Uninitialize UI Engine
|
||||
ui_engine.uninitialize()
|
||||
|
||||
func update_splash() -> void:
|
||||
var splash: String = ""
|
||||
var splash_ok: bool = false
|
||||
while !splash_ok:
|
||||
splash = [
|
||||
"The first native code-based presentation viewer.", # Tagline
|
||||
"Presenting your presentations since 2023!", # Inspired by LulzSec's "Laughing at your security since 2011!"
|
||||
"Made using Godot", # FACT
|
||||
"100% open source", # FACT
|
||||
"'s icons were made with figlet", # FACT
|
||||
"This text was inspired by Minecraft", # It is!
|
||||
"nice", # nice
|
||||
"[b]your mom[/b]", # idk why i put this in
|
||||
"Also try LibreOffice!", # Inspired by Minecraft's "Also play Terraria" and Terraria's "Also play Minecraft"
|
||||
"... exists.", # We finished the sentence.
|
||||
"making unprofessional presentations", # Indicating that Presencode shouldn't be used for professional presentations
|
||||
"hates you!", # why not lol
|
||||
"tysm <3", # thank you for using
|
||||
"I'd like to interject for a moment...", # Linux interjection
|
||||
"cock", # no comment.
|
||||
"sus ඞ", # Among Us reference
|
||||
"Crashing in 3... 2... 1...", # Crashing
|
||||
"Not by StarOpenSource!", # This software doesn't have any involvement with the StarOpenSource Project
|
||||
"Extra spicy!", # Where did I leave my chilli?
|
||||
"--- Debugging process stopped ---", # Godot message after stopping a debug build
|
||||
"/effect @s 16 99999 255 true", # Infinite (or rather, veeeery long) night vision command for Minecraft 1.12.2
|
||||
"In this update we made the app much better for you.", # Parody of mobile game/application developers simply putting "We made the app better for you" into their changelog without mentioning any of the changes they've made.
|
||||
"NVIDIA fuck you", # Reference to Linus Torvalds
|
||||
"is made by idiots.", # if you're working on Presencode or using it you're probably not the smartest person on earth
|
||||
"https://billgates.sex is real", # Reference to MattKC
|
||||
"happy :)", # happy :)
|
||||
"E" # E
|
||||
].pick_random()
|
||||
if splash == get_node("Wallpaper/Welcome/Splash").text.replace("[center]", "").replace("[/center]", ""): logger.warn("Got same splash text, picking another one")
|
||||
else: splash_ok = true
|
||||
get_node("Wallpaper/Welcome/Splash").text = "[center]" + splash + "[/center]"
|
|
@ -1,92 +0,0 @@
|
|||
extends Node
|
||||
|
||||
# Enums
|
||||
enum UIMode {
|
||||
UNKNOWN,
|
||||
WELCOME
|
||||
}
|
||||
|
||||
# Nodes
|
||||
var loader: Control = null
|
||||
var ui_mode_node: Control = null
|
||||
|
||||
# States
|
||||
var initialized: bool = false
|
||||
var ui_mode: UIMode = UIMode.UNKNOWN
|
||||
var resolution: String = "960x540"
|
||||
|
||||
# Initialize engine
|
||||
func initialize(loader_: Control) -> void:
|
||||
if initialized:
|
||||
logger.error("The UI Engine been initialized already")
|
||||
return
|
||||
logger.info("Initializing UI Engine")
|
||||
# Set variables
|
||||
loader = loader_
|
||||
initialized = true
|
||||
# Switch mode
|
||||
logger.diag("Switching to welcome mode")
|
||||
switch_mode(UIMode.WELCOME)
|
||||
# Update resolution to next best
|
||||
logger.diag("Updating resolution to next best resolution")
|
||||
update_resolution(misc.get_best_resolution())
|
||||
# Update window properties
|
||||
logger.diag("Updating window properties")
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
DisplayServer.window_set_min_size(Vector2i(960, 540))
|
||||
get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_VIEWPORT
|
||||
get_tree().root.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_KEEP
|
||||
get_tree().root.content_scale_factor = 1.0
|
||||
|
||||
# Uninitialize engine
|
||||
func uninitialize() -> void:
|
||||
if !initialized:
|
||||
logger.error("The UI Engine is not initialized.")
|
||||
return
|
||||
logger.info("Uninitializing UI Engine")
|
||||
# Reset variables
|
||||
loader = null
|
||||
initialized = false
|
||||
resolution = "960x540"
|
||||
ui_mode = UIMode.UNKNOWN
|
||||
logger.info("Unloading UI mode")
|
||||
# Unload current UI mode
|
||||
ui_mode_node.queue_free()
|
||||
ui_mode_node = null
|
||||
|
||||
# Switch UI mode
|
||||
func switch_mode(mode: UIMode) -> void:
|
||||
if !initialized:
|
||||
logger.error("The UI Engine hasn't been initialized yet")
|
||||
return
|
||||
if mode == UIMode.UNKNOWN: await logger.error("Invalid UI mode \"" + str(mode) + "\"")
|
||||
logger.info("Switching to mode " + str(mode))
|
||||
# Remove current UI mode node
|
||||
if ui_mode_node != null: loader.remove_child(ui_mode_node)
|
||||
# Load UI node into ui_mode_node and set ui_mode
|
||||
match(mode):
|
||||
UIMode.WELCOME:
|
||||
ui_mode_node = ResourceLoader.load("res://ui/Welcome.tscn").instantiate()
|
||||
ui_mode = UIMode.WELCOME
|
||||
# Add UI mode node to Loader
|
||||
loader.add_child(ui_mode_node)
|
||||
# UI mode node's switch_mode() takes over
|
||||
ui_mode_node.switch_mode()
|
||||
|
||||
# Updates the resolution
|
||||
func update_resolution(new_resolution: Vector2i) -> void:
|
||||
if !initialized:
|
||||
logger.error("The UI Engine hasn't been initialized yet")
|
||||
return
|
||||
# Update window properties
|
||||
DisplayServer.window_set_size(new_resolution)
|
||||
get_tree().root.content_scale_size = new_resolution
|
||||
# Calculate new console drag area
|
||||
processor.update_dragging_area(processor.DragNode.CONSOLE)
|
||||
# Update resolution variable
|
||||
resolution = str(new_resolution.x) + "x" + str(new_resolution.y)
|
||||
# Call current UI mode's update_resolution() function
|
||||
match(ui_mode):
|
||||
UIMode.UNKNOWN: return
|
||||
UIMode.WELCOME: ui_mode_node.update_resolution(new_resolution)
|
||||
logger.diag("Set resolution to " + str(new_resolution.x) + "x" + str(new_resolution.y))
|
90
src/userinterface.gd
Normal file
90
src/userinterface.gd
Normal file
|
@ -0,0 +1,90 @@
|
|||
extends NinePatchRect
|
||||
|
||||
# CORE
|
||||
var core_config: CoreConfiguration
|
||||
@onready var core: Core = get_node("/root/CORE")
|
||||
@onready var logger: CoreLoggerInstance = core.logger.get_instance("src/userinterface.gd", self)
|
||||
|
||||
# CORE-related
|
||||
var shutdown: bool = false
|
||||
var cleanup_hook: int
|
||||
|
||||
# Threads
|
||||
var thread_wallpaper: Thread = Thread.new()
|
||||
|
||||
# UI settings
|
||||
var ui_scale: float = 1.0
|
||||
|
||||
# +++ initialization +++
|
||||
func _ready() -> void:
|
||||
# Register cleanup hook
|
||||
cleanup_hook = core.register_cleanup_hook(Callable(self, "cleanup"))
|
||||
|
||||
# Call update methods
|
||||
update_scale()
|
||||
update_splash()
|
||||
|
||||
logger.info("User Interface is ready")
|
||||
|
||||
# Load higher quality wallpaper
|
||||
await get_tree().process_frame
|
||||
thread_wallpaper.start(func() -> void:
|
||||
# Skip loading a higher quality version of the wallpaper
|
||||
# if 'ui_scale' is under two (because it looks like shit)
|
||||
if ui_scale < 2.0:
|
||||
logger.warn.call_deferred("Not loading higher quality wallpaper")
|
||||
return
|
||||
|
||||
logger.info.call_deferred("Loading higher quality wallpaper")
|
||||
var path: String = "res://docs/static/assets/images/Wallpaper.png"
|
||||
|
||||
# Request threaded load
|
||||
var error: Error = ResourceLoader.load_threaded_request(path)
|
||||
|
||||
# Wait for loading to finish
|
||||
while ResourceLoader.load_threaded_get_status(path) == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_IN_PROGRESS:
|
||||
if shutdown: return
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
|
||||
# Check if loading failed
|
||||
if ResourceLoader.load_threaded_get_status(path) != ResourceLoader.ThreadLoadStatus.THREAD_LOAD_LOADED:
|
||||
logger.error.call_deferred(core.stringify_variables("Failed to load higher quality wallpaper: ResourceLoader reports load status %load_status% and error %error%", { "load_status": ResourceLoader.load_threaded_get_status(path), "error": error_string(error) }))
|
||||
return
|
||||
|
||||
if shutdown: return
|
||||
|
||||
# Load as texture
|
||||
texture = ResourceLoader.load_threaded_get(path)
|
||||
logger.info.call_deferred("Loaded higher quality wallpaper")
|
||||
)
|
||||
thread_wallpaper.wait_to_finish()
|
||||
|
||||
# +++ unload & cleanup +++
|
||||
func unload() -> void:
|
||||
logger.info("Unloading user interface")
|
||||
core.unregister_cleanup_hook_by_id(cleanup_hook)
|
||||
cleanup()
|
||||
|
||||
func cleanup() -> void:
|
||||
shutdown = true
|
||||
while thread_wallpaper.is_alive():
|
||||
logger.warn("Waiting for wallpaper thread to finish")
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
core_config.queue_free()
|
||||
get_parent().remove_child(self)
|
||||
queue_free()
|
||||
|
||||
# +++ update methods +++
|
||||
# Updates the scale of all UI elements
|
||||
func update_scale() -> void:
|
||||
logger.diag(core.misc.stringify_variables("Updating UI scale to %scale%x", { "scale": ui_scale }))
|
||||
size.x = 1440*ui_scale
|
||||
size.y = 810*ui_scale
|
||||
|
||||
logger.diag(core.misc.stringify_variables("Updating window size to %size%", { "size": Vector2i(size)}))
|
||||
DisplayServer.window_set_size(size)
|
||||
DisplayServer.window_set_position(core.misc.get_center(DisplayServer.screen_get_size(), Vector2i(size)))
|
||||
|
||||
# Updates the splash text
|
||||
func update_splash() -> void:
|
||||
return
|
138
ui/Welcome.tscn
138
ui/Welcome.tscn
|
@ -1,138 +0,0 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://b8byh8tp1kc6b"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cj1twbwvogrn0" path="res://assets/images/Wallpaper.png" id="1_3cfcw"]
|
||||
[ext_resource type="Script" path="res://src/ui/welcome.gd" id="1_rowat"]
|
||||
[ext_resource type="Texture2D" uid="uid://b3n83ee4723bw" path="res://assets/images/IconTextInverted.png" id="2_2w5c0"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0l23a"]
|
||||
bg_color = Color(0, 0, 0, 0.705882)
|
||||
corner_radius_top_left = 32
|
||||
corner_radius_top_right = 32
|
||||
corner_radius_bottom_right = 32
|
||||
corner_radius_bottom_left = 32
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sor5s"]
|
||||
|
||||
[node name="GUIWelcome" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_rowat")
|
||||
|
||||
[node name="Wallpaper" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 540.0
|
||||
texture = ExtResource("1_3cfcw")
|
||||
|
||||
[node name="Welcome" type="Button" parent="Wallpaper"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -432.0
|
||||
offset_top = -243.0
|
||||
offset_right = 432.0
|
||||
offset_bottom = 243.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_0l23a")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_0l23a")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_0l23a")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxFlat_0l23a")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_sor5s")
|
||||
|
||||
[node name="Icon" type="NinePatchRect" parent="Wallpaper/Welcome"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -320.0
|
||||
offset_top = 24.3
|
||||
offset_right = 320.0
|
||||
offset_bottom = 144.3
|
||||
grow_horizontal = 2
|
||||
texture = ExtResource("2_2w5c0")
|
||||
|
||||
[node name="Splash" type="RichTextLabel" parent="Wallpaper/Welcome" groups=["font", "font_normal"]]
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -320.0
|
||||
offset_top = 152.975
|
||||
offset_right = 320.0
|
||||
offset_bottom = 186.975
|
||||
grow_horizontal = 2
|
||||
mouse_filter = 2
|
||||
bbcode_enabled = true
|
||||
text = "[center]splash text[/center]"
|
||||
scroll_active = false
|
||||
|
||||
[node name="AboutText" type="RichTextLabel" parent="Wallpaper/Welcome" groups=["font", "font_small"]]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -320.0
|
||||
offset_top = -92.0
|
||||
offset_right = 320.0
|
||||
offset_bottom = -20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
mouse_filter = 2
|
||||
bbcode_enabled = true
|
||||
text = "[center][i]Copyright (c) 2024[/i] [b]JeremyStar™ & Contributors[/b]
|
||||
Licensed under the [b]GNU General Public License version 3[/b].
|
||||
Thank you for using Presencode <3[/center]"
|
||||
scroll_active = false
|
||||
|
||||
[node name="OpenArchiveButton" type="Button" parent="Wallpaper/Welcome" groups=["font_one", "font_one_normal"]]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 60.0
|
||||
offset_top = -19.0
|
||||
offset_right = 278.0
|
||||
offset_bottom = 19.0
|
||||
grow_vertical = 2
|
||||
text = "Open archive"
|
||||
|
||||
[node name="OpenDirButton" type="Button" parent="Wallpaper/Welcome" groups=["font_one", "font_one_normal"]]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 60.0
|
||||
offset_top = 24.0
|
||||
offset_right = 278.0
|
||||
offset_bottom = 62.0
|
||||
grow_vertical = 2
|
||||
text = "Open directory"
|
||||
|
||||
[node name="EditorButton" type="Button" parent="Wallpaper/Welcome" groups=["font_one", "font_one_normal"]]
|
||||
layout_mode = 1
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -278.0
|
||||
offset_top = -19.0
|
||||
offset_right = -60.0
|
||||
offset_bottom = 19.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
text = "Edit presentation"
|
||||
|
||||
[connection signal="pressed" from="Wallpaper/Welcome" to="." method="update_splash"]
|
||||
[connection signal="pressed" from="Wallpaper/Welcome/OpenArchiveButton" to="." method="open_presentation_archive_picker"]
|
||||
[connection signal="pressed" from="Wallpaper/Welcome/OpenDirButton" to="." method="open_presentation_dir_picker"]
|
Loading…
Reference in a new issue