Initial commit

This commit is contained in:
JeremyStar™ 2024-01-14 05:58:43 +01:00
commit 6f9bea644c
72 changed files with 17702 additions and 0 deletions

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

187
LICENSE Normal file
View file

@ -0,0 +1,187 @@
GNU GENERAL PUBLIC LICENSE
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.

50
Loader.tscn Normal file
View file

@ -0,0 +1,50 @@
[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")
[node name="WindowSizeSupport" type="Control" parent="."]
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="EndPixel" type="ColorRect" parent="WindowSizeSupport"]
layout_mode = 0
offset_left = 1920.0
offset_top = 1080.0
offset_right = 1921.0
offset_bottom = 1081.0
[node name="1920+" type="ColorRect" parent="WindowSizeSupport"]
layout_mode = 0
offset_right = 9999.0
offset_bottom = 30.0
[node name="1920" type="ColorRect" parent="WindowSizeSupport"]
layout_mode = 0
offset_right = 1920.0
offset_bottom = 30.0
color = Color(0, 0, 1, 1)
[node name="1441" type="ColorRect" parent="WindowSizeSupport"]
layout_mode = 0
offset_right = 30.0
offset_bottom = 9999.0
[node name="1440" type="ColorRect" parent="WindowSizeSupport"]
layout_mode = 0
offset_right = 30.0
offset_bottom = 1440.0
color = Color(1, 1, 0, 1)
[node name="1080" type="ColorRect" parent="WindowSizeSupport"]
layout_mode = 0
offset_right = 30.0
offset_bottom = 1080.0
color = Color(1, 0, 1, 1)

15
README.md Normal file
View file

@ -0,0 +1,15 @@
<div align="center">
<a href="https://presencode.jstm.staropensource.de">
<img src="https://git.staropensource.de/JeremyStarTM/Presencode/raw/branch/develop/assets/images/IconText.png" alt="Presencode" style="border-radius:50%" width="400"/>
</a>
**The first *native* code-based presentation viewer.**
<br/>
***THIS SOFTWARE IS NOT PRODUCTION READY***
---
<a href="https://presencode.jstm.staropensource.de">Documentation</a>
---
</div>

Binary file not shown.

View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://b5qsng8gpvos3"
path="res://.godot/imported/FiraCode-Bold.ttf-85308023e4b3887c42a87bcac392d375.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Bold.ttf"
dest_files=["res://.godot/imported/FiraCode-Bold.ttf-85308023e4b3887c42a87bcac392d375.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={}

Binary file not shown.

View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://4q4lsmuimus1"
path="res://.godot/imported/FiraCode-Light.ttf-c09448311f89f98ee7f002def57567d8.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Light.ttf"
dest_files=["res://.godot/imported/FiraCode-Light.ttf-c09448311f89f98ee7f002def57567d8.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={}

Binary file not shown.

View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://c5jkbqx10tj8e"
path="res://.godot/imported/FiraCode-Medium.ttf-0db7f1fcf0ebd067a2e7f37f0ec7247d.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Medium.ttf"
dest_files=["res://.godot/imported/FiraCode-Medium.ttf-0db7f1fcf0ebd067a2e7f37f0ec7247d.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={}

Binary file not shown.

View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bl4vgye7bg8kf"
path="res://.godot/imported/FiraCode-Regular.ttf-5fbe404b04fc56529c18062b38f4ba3d.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Regular.ttf"
dest_files=["res://.godot/imported/FiraCode-Regular.ttf-5fbe404b04fc56529c18062b38f4ba3d.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={}

Binary file not shown.

View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://btpllsnn0t030"
path="res://.godot/imported/FiraCode-Retina.ttf-3af65c1aa12af660768f353167f5ab00.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Retina.ttf"
dest_files=["res://.godot/imported/FiraCode-Retina.ttf-3af65c1aa12af660768f353167f5ab00.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/images/Icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bqf0yuaaxgrdr"
path="res://.godot/imported/Icon.png-93ca016a3d581ee8be85859272221470.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/images/Icon.png"
dest_files=["res://.godot/imported/Icon.png-93ca016a3d581ee8be85859272221470.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

BIN
assets/images/Icon.xcf Normal file

Binary file not shown.

BIN
assets/images/IconRound.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://btrjvej7kesqp"
path="res://.godot/imported/IconRound.png-1afd952ea59d10fc5e3b0a78c073f524.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://docs/static/assets/images/IconRound.png"
dest_files=["res://.godot/imported/IconRound.png-1afd952ea59d10fc5e3b0a78c073f524.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

BIN
assets/images/IconText.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cvhgvybvn011m"
path="res://.godot/imported/IconText.png-ba84e8aaca79c24529b5915da9118cd4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/images/IconText.png"
dest_files=["res://.godot/imported/IconText.png-ba84e8aaca79c24529b5915da9118cd4.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

BIN
assets/images/IconText.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dt4kldhfyob1h"
path="res://.godot/imported/IconRound_192x192.png-35fb3db21886e26e465df99404de1b9b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/images/web/IconRound_192x192.png"
dest_files=["res://.godot/imported/IconRound_192x192.png-35fb3db21886e26e465df99404de1b9b.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.

After

Width:  |  Height:  |  Size: 112 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dgeydjomrd7nt"
path="res://.godot/imported/IconRound_512x512.png-5a9260cdeed5622a5196eddf4da6277a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/images/web/IconRound_512x512.png"
dest_files=["res://.godot/imported/IconRound_512x512.png-5a9260cdeed5622a5196eddf4da6277a.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

15
docs/.gitignore vendored Normal file
View file

@ -0,0 +1,15 @@
/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*

24
docs/Makefile Normal file
View file

@ -0,0 +1,24 @@
.PHONY: dist help
dist: help
help:
@echo "make install-deps -> Install all dependencies"
@echo " test -> Start a web server for development"
@echo " build -> Build static files"
@echo " clean -> Clean directory"
@echo " clean-extra -> Clean directory with extra directories/files"
install-deps:
pnpm install
test:
pnpm run start --hot-only --no-open
build:
pnpm run build --out-dir out
clean:
pnpm run clear
rm -rf "out" ".docusaurus" ".cache-loader"
clean-extra: clean
rm -rf "node_modules" "pnpm-lock.yaml"
# The nuclear option. Why is it here you might ask? I made it while creating the documentation README.md
clean-ultra: clean clean-extra
rm -rf "~/.cache/pnpm" "~/.local/share/pnpm" "~/.local/state/pnpm"

116
docs/README.md Normal file
View file

@ -0,0 +1,116 @@
# Presencode documentation
The Presencode documentation uses [Docusaurus](https://docusaurus.io).
# Commands
We use [make](https://www.gnu.org/software/make/).
## Installing dependencies
```plain
$ make install-deps
pnpm install
Downloading registry.npmjs.org/typescript/5.2.2: 7,23 MB/7,23 MB, done
WARN 1 deprecated subdependencies found: stable@0.1.8
Packages: +1088
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1089, reused 0, downloaded 1088, added 1088, done
node_modules/.pnpm/core-js-pure@3.35.0/node_modules/core-js-pure: Running postinstall script, done in 92ms
node_modules/.pnpm/core-js@3.35.0/node_modules/core-js: Running postinstall script, done in 92ms
dependencies:
+ @docusaurus/core 3.1.0
+ @docusaurus/plugin-content-docs 3.1.0
+ @docusaurus/plugin-sitemap 3.1.0
+ @docusaurus/preset-classic 3.1.0
+ @mdx-js/react 3.0.0
+ clsx 2.1.0
+ prism-react-renderer 2.3.1
+ react 18.2.0
+ react-dom 18.2.0
devDependencies:
+ @docusaurus/module-type-aliases 3.1.0
+ @docusaurus/tsconfig 3.1.0
+ @docusaurus/types 3.1.0
+ typescript 5.2.2 (5.3.3 is available)
Done in 18.1s
```
## Development web server
This will start [a development server](http://localhost:3000) that supports hot reloading.
```plain
$ make test
pnpm run start --hot-only --no-open
> docs@0.0.0 start /home/jeremystartm/Code/JeremyStarTM/Presencode/docs
> docusaurus start "--hot-only" "--no-open"
(node:138150) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/
✔ Client
Compiled successfully in 4.40s
client (webpack 5.89.0) compiled successfully
```
## Building the documentation
This will output the built documentation to `out/`. Simply point a web server to it and you're done.
```plain
$ make build
pnpm run build --out-dir out
> docs@0.0.0 build /home/jeremystartm/Code/JeremyStarTM/Presencode/docs
> docusaurus build "--out-dir" "out"
(node:139592) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[INFO] [en] Creating an optimized production build...
✔ Client
✔ Server
Compiled successfully in 11.36s
✔ Client
● Server █████████████████████████ cache (99%) shutdown IdleFileCachePlugin
stored
[SUCCESS] Generated static files in "out".
[INFO] Use `npm run serve` command to test your build locally
```
## Cleaning the directory
This will remove the `out/` directory containing the built website aswell as Docusaurus files.
```plain
$ make clean
pnpm run clear
> docs@0.0.0 clear /home/jeremystartm/Code/JeremyStarTM/Presencode/docs
> docusaurus clear
(node:140318) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[SUCCESS] Removed the generated folder at "/home/jeremystartm/Code/JeremyStarTM/Presencode/docs/.docusaurus".
[SUCCESS] Removed the Webpack persistent cache folder at "/home/jeremystartm/Code/JeremyStarTM/Presencode/docs/node_modules/.cache".
rm -rf "out" ".docusaurus" ".cache-loader"
```
### More cleaning
This will remove the `node_modules/` and `pnpm-lock.yaml` directory aswell.
```plain
$ make clean-extra
pnpm run clear
> docs@0.0.0 clear /home/jeremystartm/Code/JeremyStarTM/Presencode/docs
> docusaurus clear
(node:141571) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[SUCCESS] Removed the generated folder at "/home/jeremystartm/Code/JeremyStarTM/Presencode/docs/.docusaurus".
[SUCCESS] Removed the Webpack persistent cache folder at "/home/jeremystartm/Code/JeremyStarTM/Presencode/docs/node_modules/.cache".
rm -rf "out" ".docusaurus" ".cache-loader"
rm -rf "node_modules" "pnpm-lock.yaml"
```

3
docs/babel.config.js Normal file
View file

@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

70
docs/docs/about.md Normal file
View file

@ -0,0 +1,70 @@
---
sidebar_position: 1
---
# About Presencode
Presencode is a code-based presentation program written in [Godot 4](https://godotengine.org).
## Why does it exist?
- compatibility issues between *Microsoft Office* and *LibreOffice*/*OpenOffice*
- having images that don't load/are broken most of the time is bad
- presentation designs don't display correctly sometimes
- text colors are always missing/set to black
- coding is fun
- fonts may not be present on another system
- i ([JeremyStarTM](https://jstm.staropensource.de)) had nothing to do
## What it does
- load presentations from [.zip archives](https://en.wikipedia.org/wiki/ZIP_(file_format)) and directories
- execute a so called "entrypoint file"
- manage slide navigation
- etc
## What it doesn't
- create presentations
## Comparing to normal office programs
### Microsoft Office (PowerPoint)
- expensive
- proprietary
- tracks you
- all-in-one package (creator, editor, presenter)
- simple and intuitive
- easy to understand
- doesn't require coding skills
- compatible with OpenDocument presentaions and Microsoft Office presentations *(duh!)*
### LibreOffice
- free
- open source
- all-in-one package (creator, editor, presenter)
- a bit hard
- requires little learning
- doesn't require coding skills
- compatible with OpenDocument presentations and mostly compatible with Microsoft Office presentations
### OpenOffice
- free
- open source
- all-in-one package (creator, editor, presenter)
- a bit hard
- requires little learning
- doesn't require coding skills
- compatible with OpenDocument presentations and is somewhat compatible with Microsoft Office presentations
- doesn't seem to recieve updates that often
## Is it for you?
### Pro
If you want something like this:
- developing using GDScript (a Python-like programming language)
- code-controlled presentations
- full control over your presentations
- access to your computer
... then Presencode is something for you!
### Cons
If you however like somthing like this:
- visual editor
- fast and easy editing
- not coding
- working in a business
... then you probably shouldn't use Presencode. Use [some of the alternatives listed above](#comparing-to-normal-office-programs)

View file

@ -0,0 +1,8 @@
{
"label": "Getting started",
"position": 2,
"link": {
"type": "generated-index",
"description": "A quick guide on how to create your first code-based presentation"
}
}

View file

@ -0,0 +1,95 @@
---
sidebar_position: 3
---
# The example presentation
Setting the presentation up.
## The manifest file
The manifest file is located at `res://example/manifest.json` and contains information about the presentation.
To learn more about the manifest file and it's specification, visit [it's reference page](/reference/manifest-specification).
### Default content
```json
{
"version": 1,
"program": "Presencode",
"topic": "Example presentation",
"authors": [
"JeremyStarTM",
"Contributors"
],
"ratio": "16:9",
"entrypoint": "test.gd"
}
```
### Editing the manifest
Simply edit the `manifest.json` file to your hearts content. Just don't touch `version`, `program` or `entrypoint`. Change `ratio` to `4:3` if you want or leave it at `16:9`.
## The entrypoint script
The entrypoint script is located at `res://example/test.gd` and serves as the presentation controller and... well as the presentation entrypoint. It is responsible for loading all the assets such as images or audio the presentation needs, playing animations, switching slides, etc..
### What it contains
The default entrypoint script contains five functions and three variables.
#### Variable `viewport`
The `viewport` variable holds a reference to the area the presentation controller can use and is set by the function `presentation_start()`
#### Variable `resources_files`
The `resources_files` array holds resource names that will be loaded in `_ready()`. It supports loading `.png` and `.jpg` files by default.
#### Variable `resources`
The `resources` dictionary holds all loaded resources in memory and is empty by default as `_ready()` fills it during runtime.
#### Function `_ready`
This function is called after the entrypoint script has been injected into Presencode. Only use it for stuff you absolutely need to do before registering the presentation controller (such as loading resources). \
Default actions (in order):
- loads all resources from `resource_files` into `resources`
- registers the presentation controller by calling pmana.register() with the following settings:
- entrypoint version: 1
- amount of slides: 3
- animations: disabled
- quit on last slide: no
- presentation controller: itself
#### Function `presentation_start`
This function is called after the Presentation Manager (pmana) has registered the presentation controller and is ready. In this function you can change the presentation settings, switch slides and do anything you couldn't do in `_ready` before. \
Default actions (in order):
- set the `viewport` variable to it's first argument `viewport_`
- hide the background log
- change the slide internally to *slide 0*
#### Function `presentation_end`
This function is called before shutting down Presencode. You can use this function to cleanup temporary files, close opened FileAccess, etc.. \
This function does nothing by default.
#### Function `change_slide`
This function is called by the Presentation Manager to inform the presentation controller to switch it's slide. Do not implement animations here! \
Default actions (in order):
- check for slide number
- slide 0:
- clear the viewport
- create a new NinePatchRect
- set the name of the newly created NinePatchRect to **Educational Meme**
- set the texture of the NinePatchRect to `meme.jpg` from the `resources` array
- set the size to **680x453**
- set the position to **100x50**
- add the NinePatchRect to the viewport
- slide 1:
- clear the viewport
- create a new NinePatchRect
- set the name of the newly created NinePatchRect to **Fox**
- set the texture of the NinePatchRect to `foxxo.jpg` from the `resources` array
- set the size to **400x400**
- set the position to the viewport center (by using `misc.get_center_float()`)
- add the NinePatchRect to the viewport
- slide 2:
- clear the viewport
- invalid slide:
- print error
#### Function `display_end_slide`
This function is called by the Presentation Manager if the `quit_last_slide` argument passed to `pmana.register()` is `false` and the current slide exceeds the maximum amount of slides by one. This function is very similar to what `change_slide` does.\
Default actions (in order):
- clear the viewport
- create a new RichTextLabel
- set the name of the newly created RichTextLabel to **End**
- set the text of the RichTextLabel to **THE END**
- disable scrolling
- set the size of the RichTextLabel to **69x22**
- set the position to the viewport center (by using `misc.get_center_float()`)
- add the RichTextLabel to the viewport
#### Function `animation_switch_away`
This function is not included in the example presentation, but you can visit [it's reference](/reference/controller#animation_switch_away)
#### Function `animation_switch_to`
This function is not included in the example presentation, but you can visit [it's reference](/reference/controller#animation_switch_to)

View file

@ -0,0 +1,21 @@
---
sidebar_position: 1
---
# Prerequisites
To create a presentation using Presencode, you'll need to meet these requirements first:
## Skills
You should have programmed something in Godot before and should have at least basic knowledge on how the Engine, GDScript and the node-based system works. If not, learn that first or use [other office programs instead](/about#comparing-to-normal-office-programs).
## Hardware
You will need a PC or Laptop running either a Linux distribution with graphical support (either X11 or Wayland with XWayland) or Windows. macOS is not supported. Phone/tablet operating systems will never be.
## Software
You need the following tools installed on your machine:
- git (version control system)
- Godot 4.2.1 (engine)
- a web browser (to read the documentation)
## Continuing
If you think you've met all of these requirements, [continue on with the guide](/getting-started/setting-up-presencode).

View file

@ -0,0 +1,29 @@
---
sidebar_position: 2
---
# Setting up Presencode
Before we can use Presencode, we need to set it up first.
## Cloning the repository
We need the Presencode source code first. Run this in [bash](https://www.gnu.org/software/bash/) to get the latest release:
```bash
cd "/path/to/project/dir/or/something"
mkdir YOUR_PRESENTATION_NAME_HERE
cd YOUR_PRESENTATION_NAME_HERE
git clone "https://git.staropensource.de/JeremyStarTM/Presencode.git" .
# Don't run this command if you want to live on the edge:
git checkout "$(git tags | grep '^v[0-9.]*$' | sort -V | tail -n 1)"
```
Don't forget to replace `YOUR_PRESENTATION_NAME_HERE` with the name of your presentation!
## Testing
Launch Godot and import the project. Wait for everything to import and do stuff.
If the editor startup process is done, press the **Launch** button (or press `F5`).
If everything went successful, you should see this screen after waiting a few seconds:
![Reference image](/docassets/setup-testing.png)
<small><center>Awww! What a cute duck! (just don't read/translate the text)</center></small>
You can now close the running Presencode instance (but not the Godot editor!).
## Continuing
After cloning Presencode and verifying that it is working, you can [continue with the guide](/getting-started/example-presentation).

View file

@ -0,0 +1,8 @@
{
"label": "Reference",
"position": 3,
"link": {
"type": "generated-index",
"description": "References to the Presencode API, Manifest Specification and Presentation Controller"
}
}

View file

@ -0,0 +1,8 @@
{
"label": "API",
"position": 1,
"link": {
"type": "generated-index",
"description": "References to the Presencode API"
}
}

View file

@ -0,0 +1,40 @@
---
sidebar_position: 2
---
# Logger
A very basic logger implementation.
## Functions
### `diag`
- return type `void`
- description `Print a diagnostic message, if diagnostic log messages are enabled`
- arguments
- `message`
- type `string`
- mandatory `yes`
- description `The log message`
### `info`
- return type `void`
- description `Print a informational message`
- arguments
- `message`
- type `string`
- mandatory `yes`
- description `The log message`
### `warn`
- return type `void`
- description `Print a warning message`
- arguments
- `message`
- type `string`
- mandatory `yes`
- description `The log message`
### `error`
- return type `void`
- description `Print a error message`
- arguments
- `message`
- type `string`
- mandatory `yes`
- description `The log message`

View file

@ -0,0 +1,60 @@
---
sidebar_position: 4
---
# Miscellaneous (misc)
Miscellaneous functions that do not fit into other scripts.
## Variables
### `config_shutdown_invisible`
- type `bool`
- description `Hides the main window on shutdown if true, displays a white texture on shutdown if false`
## Functions
### `shutdown`
- return type `void`
- description `Registers a new presentation controller`
- arguments
- `exitcode`
- type `int`
- mandatory `no`
- description `The exitcode`
### `get_temporary_dir`
- return type `String`
- description `Return the temporary directory`
- arguments `none`
### `get_center`
- return type `Vector2i`
- description `Calculates the center of a child inside its parent (Vector2i)`
- arguments
- `parent_size`
- type `Vector2i`
- mandatory `yes`
- description `The size of the parent object`
- `child_size`
- type `Vector2i`
- mandatory `yes`
- description `The size of the child object`
### `get_center_float`
- return type `Vector2`
- description `Calculates the center of a child inside its parent (Vector2)`
- arguments
- `parent_size`
- type `Vector2`
- mandatory `yes`
- description `The size of the parent object`
- `child_size`
- type `Vector2`
- mandatory `yes`
- description `The size of the child object`
### `clear_viewport`
- return type `void`
- description `Convenience function: Clears the presentation viewport for you.`
- arguments `none`
### `hide_log`
- return type `void`
- description `Hides the log output in the background`
- arguments `none`
### `show_log`
- return type `void`
- description `Unhides the log output in the background`
- arguments `none`

View file

@ -0,0 +1,64 @@
---
sidebar_position: 1
---
# Presentation Manager (pmana)
Handles interactions between Presencode and the active presentation file.
## Variables
### `config_allow_fullscreen`
- type `bool`
- description `If switching window modes should be allowed`
## Functions
### `register`
- return type `void`
- description `Registers a new presentation controller`
- arguments
- `version`
- type `int`
- mandatory `yes`
- description `The controller version. Should be set to the number 1.`
- `slides`
- type `int`
- mandatory `yes`
- description `The amount of slides your presentation has`
- `animations`
- type `bool`
- mandatory `yes`
- description `Set to true if you want to display slide switch animations`
- `quit_last_slide`
- type `bool`
- mandatory `yes`
- description `If Presencode should shutdown once you surpass "slides" (your amount of slides), set to false if you want to display a end slide instead`
- `controller`
- type `NodePath`
- mandatory `yes`
- description `NodePath to the presentation controller. Use "self.get_path()" for the script executing that line or NodePath("/root/YOUR_CONTROLLER")`
### `unregister`
- return type `void`
- description `Unregisters the current presentation controller`
- arguments `none`
### `change_slide`
- return type `void`
- description `Changes the current slide to some other slide`
- arguments
- `slide`
- type `int`
- mandatory `yes`
- description `The id of the new slide`
- `no_animations`
- type `bool`
- mandatory `no`
- description `Used internally, do not overwrite manually!`
### `clear_viewport`
- return type `void`
- description `Convenience function: Clears the presentation viewport for you.`
- arguments `none`
### `hide_log`
- return type `void`
- description `Hides the log output in the background`
- arguments `none`
### `show_log`
- return type `void`
- description `Unhides the log output in the background`
- arguments `none`

View file

@ -0,0 +1,32 @@
---
sidebar_position: 3
---
# Presentation Reader (preader)
Reads Presencode presentation archives and directories
## Functions
### `read_file`
- return type `PackedByteArray`
- description `Reads a file from the presentation archive/directory. Returns an empty PackedByteArray if the file could not be read.`
- arguments
- `path`
- type `string`
- mandatory `yes`
- description `The path to a file`
### `get_topic`
- return type `String`
- description `Get the presentation topic`
- arguments `none`
### `get_authors`
- return type `String`
- description `Get the presentation authors`
- arguments `none`
### `get_ratio`
- return type `String`
- description `Get the presentation display ratio`
- arguments `none`
### `get_ratio_resolution`
- return type `Vector2i`
- description `Get the presentation resolution`
- arguments `none`

View file

@ -0,0 +1,132 @@
---
sidebar_position: 2
---
# Presentation Controller
The presentation controller controls the presentation and is required for a working presentation.
## Required functions
### Base
Every presentation controller needs to have these functions:
- `_ready`
- return type `void`
- description `Called by the Godot engine after injection. Use this function for controller registration and early loading`
- arguments `none`
- `presentation_start`
- return type `void`
- description `Called after controller registration`
- arguments
- `viewport`
- type `Control`
- mandatory `yes`
- description `Direct access to the viewport your controller should be operating in`
- `presentation_end`
- return type `void`
- description `Called before shutdown`
- arguments `none`
- `change_slide`
- return type `void`
- description `Called on slide change by the Presentation Manager`
- arguments `none`
### Quit on last slide
You need to have these functions if you pass `quit_last_slide` to [`pmana.register()`](/reference/api/pmana#register) as `false`:
- `display_end_slide`
- return type `void`
- description `Called if the end slide should be shown. Should operate very similar to change_slide()`
- arguments `none`
### Animations
You need to have these functions if you pass `animations` to [`pmana.register()`](/reference/api/pmana#register) as `true`:
- `animation_switch_away`
- return type `void`
- description `Called before change_slide(), should be used (as the name suggests) for a switch away animation`
- arguments
- `new_slide`
- type `int`
- mandatory `yes`
- description `The id of the slide that should be shown next`
- `old_slide`
- type `int`
- mandatory `yes`
- description `The id of the slide that was shown previously`
- `animation_switch_to`
- return type `void`
- description `Called after change_slide(), should be used (as the name suggests) for a switch to animation`
- arguments
- `new_slide`
- type `int`
- mandatory `yes`
- description `The id of the slide that is now shown`
- `old_slide`
- type `int`
- mandatory `yes`
- description `The id of the slide that was shown previously`
## Registering a controller
Registering a presentation controller is easy, just call [`pmana.register()`](/reference/api/pmana#register):
```gdscript
pmana.register(version, slides, animations, quit_last_slide, controller)
| | | | |
| | | | -> NodePath to the presentation controller. Use "self.get_path()" for the script executing that line or NodePath("/root/YOUR_CONTROLLER").
| | | ------------> If Presencode should shutdown once you surpass "slides" (your amount of slides), set to false if you want to display a end slide instead.
| | ----------------------------> Set to true if you want to display slide switch animations.
| ---------------------------------------> The amount of slides you want to display.
----------------------------------------------> The presentation controller version. Set it to the number "1".
```
## Unregistering a controller
Just call [`pmana.unregister()`](/reference/api/pmana#unregister).
## Animations
If you want to implement animations, you'll need to know how the Presentation Manager calls functions.
Lets say that we are at slide 0 the first slide and the user navigates to the next slide slide 1.
Inside [`pmana.change_slide(1)`](/reference/api/pmana#change_slide) the following happens:
- Run a few checks
- Call `controller.animation_switch_away(new_slide: 1, old_slide: 0)` and wait for it to finish
- Call `controller.change_slide(new_slide: 1)` and wait for it to finish
- Call `controller.animation_switch_to(new_slide: 1, old_slide: 0)` and wait for it to finish
- Set `current_slide` to new_slide (1)
With this execution order ***for example*** pull off these animations:
1. `animation_switch_away()` hides the old slide, `change_slide()` unloads the old slide and loads in a new one (invisible), `animation_switch_to()` shows the new slide. The best example for this approch is **fading** in and out.
2. `animation_switch_away()` does nothing, `change_slide()` loads the new slide (invisible), `animations_switch_to()` hides the old one while showing the new one at the same time. One of the best examples of this is a **slide up** animation.
3. These are only examples, you can use your own imagination here!
## Basic controller example
This controller is VERY basic and does almost nothing. Add something to `change_slide()` to make it at least interesting.
```gdscript
extends Node
var viewport: Control = null
func _ready() -> void:
pmana.register(1, 2, false, false, self.get_path())
func presentation_start(viewport_: Control) -> void:
viewport = viewport_
pmana.hide_log()
change_slide(0)
func presentation_end() -> void: pass
func change_slide(new_slide: int) -> void:
match(new_slide):
0:
logger.info("Displaying slide one")
1:
logger.info("Displaying slide two")
2:
logger.info("Displaying slide three")
_:
logger.error("Invalid slide")
func display_end_slide() -> void:
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)
```

View file

@ -0,0 +1,80 @@
---
sidebar_position: 1
---
# Presencode Manifest Specification
The Presencode Manifest Specification specifies how presentation manifests should be constructed.
## Version 1
### Properties
- filename `manifest.json`
- location (zip) `<YOUR_PRESENTATION_ARCHIVE>.zip/manifest.json`
- location (dir) `<YOUR_PRESENTATION_DIRECTORY>/manifest.json`
- filetype `JSON`
- json root type `object`
### `version`
- type `integer`
- mandatory `yes`
- description: `The manifest version`
- value `1`
### `program`
- type `string`
- mandatory `yes`
- description `Manifest detection`
- value `Presencode`
### `topic`
- type `string`
- mandatory `yes`
- description `The presentation topic/name`
- may be empty `no`
### `authors`
- type `array`
- mandatory `yes`
- description `A list of presentation authors`
- minimum amount `1`
- contains:
- type `string`
- may be empty `no`
- mandatory `yes`
- description `One presentation author`
### `ratio`
- type `string`
- mandatory `yes`
- description `The display ratio the presentation should be displayed in`
- value `16:9` or `4:3`
#### Resolutions
<table>
<tr>
<th>Ratio</th>
<th>Resolution</th>
</tr>
<tr>
<td>16:9</td>
<td>1920x1080</td>
</tr>
<tr>
<td>4:3</td>
<td>1920x1440</td>
</tr>
</table>
### `entrypoint`
- type `string`
- mandatory `yes`
- description `Path to the entrypoint script`
- suggested value `entrypoint.gd`
### Example
```json
{
"version": 1,
"program": "Presencode",
"topic": "Presentation topic",
"authors": [
"Author A",
"Author B",
"Author C"
],
"ratio": "16:9",
"entrypoint": "entrypoint.gd"
}
```

127
docs/docusaurus.config.ts Normal file
View file

@ -0,0 +1,127 @@
import {themes as prismThemes} from "prism-react-renderer";
import type {Config} from "@docusaurus/types";
import type * as Preset from "@docusaurus/preset-classic";
const config: Config = {
title: "Presencode",
url: "https://presencode.jstm.staropensource.de",
baseUrl: "/",
favicon: "assets/images/IconRound.ico",
trailingSlash: true,
i18n: {
defaultLocale: "en",
locales: ["en"],
},
noIndex: false,
/*
onBrokenLinks: "throw",
onBrokenAnchors: "throw",
onBrokenMarkdownLinks: "throw",
onDuplicateRoutes: "warn",
*/
onBrokenLinks: "ignore",
onBrokenAnchors: "ignore",
onBrokenMarkdownLinks: "ignore",
onDuplicateRoutes: "ignore",
tagline: "The Presencode documentation",
themeConfig: {
docs: {
sidebar: {
hideable: false,
autoCollapseCategories: true,
}
},
navbar: {
title: "Presencode",
logo: {
alt: "Presencode",
src: "assets/images/IconRound.png",
},
items: [
{
type: "docSidebar",
sidebarId: "sidebar",
position: "left",
label: "Documentation",
},
{
href: "https://git.staropensource.de/JeremyStarTM/Presencode",
label: "Source code",
position: "right",
},
],
},
footer: {
style: "dark",
copyright: `Copyright (c) ${new Date().getFullYear()} JeremyStarTM & Contributors<br/>Licensed under the GNU General Public License version 3`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
presets: [
[
"classic",
{
debug: false,
docs: {
path:
"docs",
editUrl: "https://git.staropensource.de/JeremyStarTM/Presencode/_edit/develop/docs/",
editLocalizedFiles: false,
editCurrentVersion: true,
routeBasePath: "",
tagsBasePath: 'tags',
sidebarPath: "./sidebars.ts",
sidebarCollapsible: false,
sidebarCollapsed: false,
showLastUpdateAuthor: true,
showLastUpdateTime: true,
breadcrumbs: true,
includeCurrentVersion: true,
},
sitemap: {
changefreq: "monthly",
priority: 0.5,
filename: "sitemap.xml"
},
theme: {
customCss: "./src/css/custom.css",
},
} satisfies Preset.Options,
],
],
plugins: [
[
"@docusaurus/plugin-client-redirects",
{
fromExtensions: ["html", "htm", "php"],
redirects: [
{
from: ["/", "/index"],
to: "/about",
},
],
}
],
],
markdown: {
format: "md",
mermaid: false,
},
staticDirectories: ["static"],
titleDelimiter: "»",
baseUrlIssueBanner: true,
};
export default config;

14636
docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

51
docs/package.json Normal file
View file

@ -0,0 +1,51 @@
{
"name": "docs",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "3.1.0",
"@docusaurus/plugin-client-redirects": "^3.1.0",
"@docusaurus/plugin-content-docs": "^3.1.0",
"@docusaurus/plugin-sitemap": "^3.1.0",
"@docusaurus/preset-classic": "3.1.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.1.0",
"@docusaurus/tsconfig": "3.1.0",
"@docusaurus/types": "3.1.0",
"@types/node": "^20.11.0",
"typescript": "~5.2.2"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 3 chrome version",
"last 3 firefox version",
"last 5 safari version"
]
},
"engines": {
"node": ">=18.0"
}
}

20
docs/sidebars.ts Normal file
View file

@ -0,0 +1,20 @@
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
const sidebars: SidebarsConfig = {
sidebar: [{type: 'autogenerated', dirName: '.'}],
// But you can create a sidebar manually
/*
tutorialSidebar: [
'intro',
'hello',
{
type: 'category',
label: 'Tutorial',
items: ['tutorial-basics/create-a-document'],
},
],
*/
};
export default sidebars;

24
docs/src/css/custom.css Normal file
View file

@ -0,0 +1,24 @@
:root {
--ifm-color-primary: #d60532;
--ifm-color-primary-dark: #c4052e;
--ifm-color-primary-darker: #af072b;
--ifm-color-primary-darkest: #990525;
--ifm-color-primary-light: #db1943;
--ifm-color-primary-lighter: #ec2c56;
--ifm-color-primary-lightest: #fa3e67;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}
/* For readability concerns, you should choose a lighter palette in dark mode.
Note from JeremyStarTM: Readability concerns? It looks beautiful! */
[data-theme='dark'] {
--ifm-color-primary: #d60532;
--ifm-color-primary-dark: #c4052e;
--ifm-color-primary-darker: #af072b;
--ifm-color-primary-darkest: #990525;
--ifm-color-primary-light: #db1943;
--ifm-color-primary-lighter: #ec2c56;
--ifm-color-primary-lightest: #fa3e67;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}

View file

@ -0,0 +1,23 @@
/**
* CSS files with the .module.css suffix will be treated as CSS modules
* and scoped locally.
*/
.heroBanner {
padding: 4rem 0;
text-align: center;
position: relative;
overflow: hidden;
}
@media screen and (max-width: 996px) {
.heroBanner {
padding: 2rem;
}
}
.buttons {
display: flex;
align-items: center;
justify-content: center;
}

27
docs/src/pages/index.tsx Normal file
View file

@ -0,0 +1,27 @@
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import Heading from '@theme/Heading';
import styles from './index.module.css';
export default function Home(): JSX.Element {
const {siteConfig} = useDocusaurusContext();
return (
<Layout
title={``}
description="The Presencode documentation">
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<Heading as="h1" className="hero__title">You shouldn't see this.</Heading>
<p className="hero__subtitle">You should have been redirected to the <b>About</b> page.</p>
<div className={styles.buttons}>
<Link className="button button--secondary button--lg" to="/about">Click here to get there
</Link>
</div>
</div>
</header>
</Layout>
);
}

0
docs/static/.nojekyll vendored Normal file
View file

1
docs/static/assets vendored Symbolic link
View file

@ -0,0 +1 @@
../../assets/

BIN
docs/static/docassets/setup-testing.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bi82nj2u5dceu"
path="res://.godot/imported/setup-testing.png-acdb97ce4878893a8d4e6632d69a4a9b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://docs/static/docassets/setup-testing.png"
dest_files=["res://.godot/imported/setup-testing.png-acdb97ce4878893a8d4e6632d69a4a9b.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

8
docs/tsconfig.json Normal file
View file

@ -0,0 +1,8 @@
{
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"jsx": "react",
"baseUrl": "."
}
}

BIN
example/images/foxxo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dp6kkiretv01v"
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

BIN
example/images/mario.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

View file

@ -0,0 +1,15 @@
[remap]
importer="import_gif_to_sprite_frames"
type="SpriteFrames"
uid="uid://bghv86mpnhh6"
path="res://.godot/imported/mario.gif-f119460dcfd983f3b74edf3b7b56592c.tres"
[deps]
source_file="res://example/images/mario.gif"
dest_files=["res://.godot/imported/mario.gif-f119460dcfd983f3b74edf3b7b56592c.tres"]
[params]
frames_per_second=30

BIN
example/images/meme.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://jwvaqrhaf1t"
path="res://.godot/imported/meme.jpg-9a7233508d56192f29bdb233352ed64b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://example/images/meme.jpg"
dest_files=["res://.godot/imported/meme.jpg-9a7233508d56192f29bdb233352ed64b.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

11
example/manifest.json Normal file
View file

@ -0,0 +1,11 @@
{
"version": 1,
"program": "Presencode",
"topic": "Example presentation",
"authors": [
"JeremyStarTM",
"Contributors"
],
"ratio": "16:9",
"entrypoint": "test.gd"
}

128
example/test.gd Normal file
View file

@ -0,0 +1,128 @@
##############################################################################
### 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")
# 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)

102
export_presets.cfg Normal file
View file

@ -0,0 +1,102 @@
[preset.0]
name="Windows"
platform="Windows Desktop"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="bin/Presencode.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version="1.0.0.0"
application/product_version="1.0.0.0"
application/company_name="JeremyStarTM & Contributors"
application/product_name="Presencode"
application/file_description="A simple presentation program for developers."
application/copyright="Copyright (c) 2023 JeremyStarTM & Contributors"
application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"
[preset.1]
name="Linux"
platform="Linux/X11"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="bin/Presencode.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.1.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""

76
project.godot Normal file
View file

@ -0,0 +1,76 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="Presencode"
run/main_scene="res://Loader.tscn"
config/use_custom_user_dir=true
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"
[display]
window/size/viewport_width=960
window/size/viewport_height=540
[editor]
run/main_run_args="%command% ++ example"
export/convert_text_resources_to_binary=false
[editor_plugins]
enabled=PackedStringArray()
[filesystem]
import/blender/enabled=false
[input]
fullscreen={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":70,"unicode":102,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":70,"physical_keycode":70,"key_label":70,"unicode":102,"echo":false,"script":null)
]
}
slide_backwards={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194319,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
slide_forwards={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194321,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
content_scale_switch={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":71,"unicode":103,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":71,"physical_keycode":0,"key_label":0,"unicode":103,"echo":false,"script":null)
]
}
[rendering]
renderer/rendering_method="mobile"

52
src/clickoverlay.gd Normal file
View file

@ -0,0 +1,52 @@
##############################################################################
### 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
# Setup clickoverlay
func _ready() -> void:
# Set 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 to function "clicked"
connect("pressed", Callable(self, "clicked"))
# Simple fix for a bug
await get_tree().process_frame
clicked()
func clicked() -> void:
# Increase current_slide by one
logger.info("Navigating one slide forwards (click)")
pmana.change_slide(pmana.current_slide+1, true)
func _process(_delta: float) -> void:
# Move button to top
get_tree().root.move_child(self, get_tree().root.get_child_count(true))
# Scale clickoverlay to window size
size = DisplayServer.window_get_size()

212
src/loader.gd Normal file
View file

@ -0,0 +1,212 @@
##############################################################################
### 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
# Loader configuration
## Skip malicious scripts warning if running as debug build
var config_skipwarning: bool = true
## Window size support
### This is/was used for configuring scaling
var config_window_size_support: bool = false
## Slow init
### I don't know why I put this here lol
var config_slow_init: bool = false
var logrtl: RichTextLabel = null
func _ready() -> void:
logger.info("Updating configuration")
update_configuration()
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", Callable(self, "append_log"))
## 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())
## Window size support
if config_window_size_support:
$WindowSizeSupport.modulate = Color8(255, 255, 255, 255)
else:
$WindowSizeSupport.modulate = Color8(255, 255, 255, 0)
## Update process_mode
logger.process_mode = Node.PROCESS_MODE_ALWAYS
misc.process_mode = Node.PROCESS_MODE_ALWAYS
## Initialize Presencode
initialize()
func initialize() -> void:
# Print banner
logger.info("""Initializing Presencode
____ __
/\\ _`\\ /\\ \\
\\ \\ \\L\\ \\_ __ __ ____ __ ___ ___ ___ \\_\\ \\ __
\\ \\ ,__/\\`'__\\/'__`\\ /',__\\ /'__`\\/' _ `\\ /'___\\ / __`\\ /'_` \\ /'__`\\
\\ \\ \\/\\ \\ \\//\\ __//\\__, `\\/\\ __//\\ \\/\\ \\/\\ \\__//\\ \\L\\ \\/\\ \\L\\ \\/\\ __/
\\ \\_\\ \\ \\_\\\\ \\____\\/\\____/\\ \\____\\ \\_\\ \\_\\ \\____\\ \\____/\\ \\___,_\\ \\____\\
\\/_/ \\/_/ \\/____/\\/___/ \\/____/\\/_/\\/_/\\/____/\\/___/ \\/__,_ /\\/____/
Copyright (c) 2024 JeremyStarTM & Contributers
Licensed under the GNU General Public License version 3
""")
if config_slow_init: await get_tree().create_timer(randf_range(0.2, 0.6)).timeout
# Check for platform
misc.check_platform()
# Create temporary directory
DirAccess.make_dir_recursive_absolute(misc.get_temporary_dir())
# Print warning
if !config_skipwarning and OS.is_debug_build():
logger.warn("""Displaying warning
###################################################
##### !!! WARNING !!! WARNING !!! WARNING !!! #####
###################################################
Presentations made with Presencode perform
malicious actions such as collect your passwords,
encrypt your files, display you unwanted ads,
install other malware, etc..
ONLY VIEW PRESENCODE PRESENTATIONS IF YOU TRUST THE
AUTHOR AND HAVE VERIFIED THE PRESENTATION SCRIPT!
YOU HAVE 5 SECONDS TO EXIT PRESENCODE
YOU HAVE BEEN WARNED.
###################################################
##### !!! WARNING !!! WARNING !!! WARNING !!! #####
###################################################
""")
await get_tree().create_timer(5).timeout
if config_slow_init: await get_tree().create_timer(randf_range(0.1, 0.15)).timeout
# Open presentation archive/directory
var path: String = "".join(OS.get_cmdline_user_args())
if OS.get_cmdline_user_args().size() == 0:
logger.error("No presentation was passed to Presencode")
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:
logger.error("Presentation file/directory \"" + path + "\" not found")
if config_slow_init: await get_tree().create_timer(randf_range(0.6, 1)).timeout
# Read manifest & entrypoint files
preader.read_manifest()
preader.read_entrypoint()
# Update window properties
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())
if config_slow_init: await get_tree().create_timer(randf_range(0.1, 0.3)).timeout
if config_window_size_support: $WindowSizeSupport/EndPixel.position = Vector2(preader.get_ratio_resolution().x-1, preader.get_ratio_resolution().y-1)
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()))
if config_slow_init: await get_tree().create_timer(randf_range(1, 1.5)).timeout
# Add entrypoint to SceneTree
get_tree().root.add_child(preader.get_entrypoint())
# seeeeeeeeeeeeelf explanitory
func _process(_delta: float) -> void:
# Move to top
get_tree().root.move_child(self, get_tree().root.get_child_count(true)-1)
# Change sizes
size = DisplayServer.window_get_size()
if typeof(logrtl) == TYPE_OBJECT:
logrtl.size = DisplayServer.window_get_size()
if config_window_size_support: move_child($WindowSizeSupport, get_child_count(true))
# Append log output to logrtl.text
func append_log(_type: logger.Types, _message: String, log_str: String) -> void:
logrtl.text = $Log.text + log_str + "\n"
# Update all config_ variables
func update_configuration() -> void:
match(OS.get_environment("CONFIG_LOADER_SKIPWARNING")):
"true": config_skipwarning = true
"false": config_skipwarning = false
_: pass
match(OS.get_environment("CONFIG_LOADER_WINDOW_SIZE_SUPPORT")):
"true": config_window_size_support = true
"false": config_window_size_support = false
_:
logger.diag("CONFIG_LOADER_WINDOW_SIZE_SUPPORT=\"" + OS.get_environment("CONFIG_LOADER_WINDOW_SIZE_SUPPORT") + "\"")
pass
match(OS.get_environment("CONFIG_LOADER_SLOW_INIT")):
"true": config_slow_init = true
"false": config_slow_init = false
_: pass
match(OS.get_environment("CONFIG_LOGGER_ENABLED")):
"true": logger.config_enabled = true
"false": logger.config_enabled = false
_: pass
match(OS.get_environment("CONFIG_LOGGER_DIAGNOSTIC")):
"true": logger.config_diagnostic = true
"false": logger.config_diagnostic = false
_: pass
match(OS.get_environment("CONFIG_LOGGER_COLORED")):
"true": logger.config_colored = true
"false": logger.config_colored = false
_: pass
match(OS.get_environment("CONFIG_LOGGER_HARDFAIL")):
"true": logger.config_hardfail = true
"false": logger.config_hardfail = false
_: pass
if OS.get_environment("CONFIG_LOGGER_LOGSTRING") != "":
logger.config_logstring = OS.get_environment("CONFIG_LOGGER_LOGSTRING")
match(OS.get_environment("CONFIG_MISC_SHUTDOWN_INVISIBLE")):
"true": misc.config_shutdown_invisible = true
"false": misc.config_shutdown_invisible = false
_: pass

101
src/logger.gd Normal file
View file

@ -0,0 +1,101 @@
##############################################################################
### 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
## Exit Presencode on error? (don't set this to false)
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

173
src/misc.gd Normal file
View file

@ -0,0 +1,173 @@
##############################################################################
### 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
}
# Manifest specification
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 = true
# 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"]}
# Shutdown Presencode safely
func shutdown(exitcode: int = 0) -> void:
logger.info("Shutting down")
get_tree().paused = true
# 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))
# Window stuff
if config_shutdown_invisible:
# Make window invisible
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_RESIZE_DISABLED, true)
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_NO_FOCUS, true)
DisplayServer.window_set_min_size(Vector2i(1, 1))
DisplayServer.window_set_size(Vector2i(1, 1))
DisplayServer.window_set_position(Vector2i(0, 0))
logger.diag("Removing temporary directory")
# Remove tempdir
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 as Godot executes code further even while it's exiting
await get_tree().create_timer(999, true).timeout
# 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)
# 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 ""
# 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.")
# Check 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

225
src/pmana.gd Normal file
View file

@ -0,0 +1,225 @@
##############################################################################
### 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
# 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 clickoverlay: Button = null
var viewport: Control = null
# 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")
# Set controller information
slides = slides_
animations = animations_
quit_last_slide = quit_last_slide_
controller = get_node(controller_)
# Check for essential 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.")
# Create clickoverlay
clickoverlay = Button.new()
clickoverlay.name = "ClickOverlay"
clickoverlay.set_script(ResourceLoader.load("res://src/clickoverlay.gd"))
get_tree().root.add_child(clickoverlay)
# Create 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)
# Did you know that every big galaxy contains a massive black hole in it's center?
registered = true
# Invoke 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")
# Reset to default values
registered = false
current_slide = -1
animation_active = false
config_allow_fullscreen = true
# Remove clickoverlay
get_tree().root.remove_child(clickoverlay)
clickoverlay = null
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 controller.presentation_end()
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 controller.presentation_end()
await misc.shutdown(0)
return
# Slide is not over max slides, continue slide change
# 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.warn("The current presentation controller has been unregistered during execution, aborting")
return
# Change slide
await controller.change_slide(slide)
# Check if controller has unregistered during animation
if !registered:
logger.warn("The current presentation controller has been unregistered during execution, aborting")
return
# 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
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
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
get_node("/root/Presencode/Log").modulate = Color8(255, 255, 255, 255)
# Runs every frame (duh)
func _process(_delta: float) -> void:
# Fullscreen key combo
if 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 key combos
if Input.is_action_pressed("slide_forwards") and Input.is_action_pressed("slide_backwards"):
# slide_forwards and slide_backwards shouldn't be pressed at the same time
logger.warn("slide_forwards and slide_backwards are both pressed, aborting")
return
else:
if Input.is_action_just_pressed("slide_forwards"):
# Increase current_slide by one
logger.info("Navigating one slide forwards (key)")
change_slide(current_slide+1)
elif Input.is_action_just_pressed("slide_backwards"):
# Decrease current_slide by one
logger.info("Navigating one slide backwards (key)")
change_slide(current_slide-1)
# Content scale switch combo
if Input.is_action_just_pressed("content_scale_switch"):
match(get_tree().root.content_scale_stretch):
Window.CONTENT_SCALE_STRETCH_FRACTIONAL:
logger.info("Switching to fractional scaling")
get_tree().root.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_INTEGER
Window.CONTENT_SCALE_STRETCH_INTEGER:
logger.info("Switching to integer scaling")
get_tree().root.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_FRACTIONAL
_:
logger.error("Invalid content_scale_stretch value")

192
src/preader.gd Normal file
View file

@ -0,0 +1,192 @@
##############################################################################
### 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
# Reading
var directorypath: String = ""
var ziphandler: ZIPReader = ZIPReader.new()
# Manifest & entrypoint
var manifest: Dictionary = {}
var entrypoint: Node = null
# States
var is_open: bool = false
# Opening a presentation
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 the currently open presentation
func close_presentation() -> Error:
if !is_open:
logger.error("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.error("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.error("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.error("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.error("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
# Reads the manifest.json file
func read_manifest() -> misc.Error:
if !is_open:
logger.error("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.error("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")
# Create empty script variable
var script: Script
if directorypath == "":
# Read entrypoint script from .zip file
if !ziphandler.file_exists(manifest["entrypoint"]):
logger.error("Entrypoint file does not exist")
# Store entrypoint script to temporary directory as we can't load a "Script" from memory :/
var file = FileAccess.open(misc.get_temporary_dir() + "/entrypoint.gd", FileAccess.WRITE)
file.store_string(ziphandler.read_file(manifest["entrypoint"]).get_string_from_utf8())
file.close()
# Load entrypoint from tempdir
script = ResourceLoader.load(misc.get_temporary_dir() + "/entrypoint.gd")
else:
# Load entrypoint script from directory
if !FileAccess.file_exists(directorypath + "/" + manifest["entrypoint"]):
logger.error("Entrypoint file does not exist")
script = ResourceLoader.load(directorypath + "/" + 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.error("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 presentation topic
func get_topic() -> String:
return manifest["topic"]
# Return presentation authors
func get_authors() -> String:
var authors: String = ""
for author in manifest["authors"]:
authors = authors + ", " + author
return authors
# Return display ratio
func get_ratio() -> String:
return manifest["ratio"]
# Return display resolution from display ratio
func get_ratio_resolution() -> Vector2i:
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)