commit cfc6b7d1b2ef56d3bd0b526df4c4da97dd160c92 Author: David J. Allen Date: Sat Jul 16 09:01:36 2022 -0500 Re-add project files with LICENSE/Readme diff --git a/.import/.gdignore b/.import/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.import/.gdignore @@ -0,0 +1 @@ + diff --git a/.import/btn_32x32_01.png-6fc46b3518650f2f3d680fd9b96bcf97.md5 b/.import/btn_32x32_01.png-6fc46b3518650f2f3d680fd9b96bcf97.md5 new file mode 100644 index 0000000..22e460d --- /dev/null +++ b/.import/btn_32x32_01.png-6fc46b3518650f2f3d680fd9b96bcf97.md5 @@ -0,0 +1,3 @@ +source_md5="2de721d625eab5711f405ede4febd65d" +dest_md5="0a1f0682e85c566130c686b20645c6c4" + diff --git a/.import/btn_32x32_01.png-6fc46b3518650f2f3d680fd9b96bcf97.stex b/.import/btn_32x32_01.png-6fc46b3518650f2f3d680fd9b96bcf97.stex new file mode 100644 index 0000000..1f506b1 Binary files /dev/null and b/.import/btn_32x32_01.png-6fc46b3518650f2f3d680fd9b96bcf97.stex differ diff --git a/.import/btn_32x32_01.png-79cbd90f22f1ab244008a919061d4f65.md5 b/.import/btn_32x32_01.png-79cbd90f22f1ab244008a919061d4f65.md5 new file mode 100644 index 0000000..22e460d --- /dev/null +++ b/.import/btn_32x32_01.png-79cbd90f22f1ab244008a919061d4f65.md5 @@ -0,0 +1,3 @@ +source_md5="2de721d625eab5711f405ede4febd65d" +dest_md5="0a1f0682e85c566130c686b20645c6c4" + diff --git a/.import/btn_32x32_01.png-79cbd90f22f1ab244008a919061d4f65.stex b/.import/btn_32x32_01.png-79cbd90f22f1ab244008a919061d4f65.stex new file mode 100644 index 0000000..1f506b1 Binary files /dev/null and b/.import/btn_32x32_01.png-79cbd90f22f1ab244008a919061d4f65.stex differ diff --git a/.import/btn_32x32_02.png-2f6195ca0f07c65d93abd1f340cd6564.md5 b/.import/btn_32x32_02.png-2f6195ca0f07c65d93abd1f340cd6564.md5 new file mode 100644 index 0000000..3809ce7 --- /dev/null +++ b/.import/btn_32x32_02.png-2f6195ca0f07c65d93abd1f340cd6564.md5 @@ -0,0 +1,3 @@ +source_md5="2d5d656d0211f39365bf70cfb211c07b" +dest_md5="8db4f4a77eedbd49c55fec9a07d0c609" + diff --git a/.import/btn_32x32_02.png-2f6195ca0f07c65d93abd1f340cd6564.stex b/.import/btn_32x32_02.png-2f6195ca0f07c65d93abd1f340cd6564.stex new file mode 100644 index 0000000..c32d750 Binary files /dev/null and b/.import/btn_32x32_02.png-2f6195ca0f07c65d93abd1f340cd6564.stex differ diff --git a/.import/btn_32x32_02.png-98962de4de6f6dd2f13ef1ce71445783.md5 b/.import/btn_32x32_02.png-98962de4de6f6dd2f13ef1ce71445783.md5 new file mode 100644 index 0000000..3809ce7 --- /dev/null +++ b/.import/btn_32x32_02.png-98962de4de6f6dd2f13ef1ce71445783.md5 @@ -0,0 +1,3 @@ +source_md5="2d5d656d0211f39365bf70cfb211c07b" +dest_md5="8db4f4a77eedbd49c55fec9a07d0c609" + diff --git a/.import/btn_32x32_02.png-98962de4de6f6dd2f13ef1ce71445783.stex b/.import/btn_32x32_02.png-98962de4de6f6dd2f13ef1ce71445783.stex new file mode 100644 index 0000000..c32d750 Binary files /dev/null and b/.import/btn_32x32_02.png-98962de4de6f6dd2f13ef1ce71445783.stex differ diff --git a/.import/btn_32x32_03.png-4fb3885f19b9ead059896a757681e305.md5 b/.import/btn_32x32_03.png-4fb3885f19b9ead059896a757681e305.md5 new file mode 100644 index 0000000..9e18106 --- /dev/null +++ b/.import/btn_32x32_03.png-4fb3885f19b9ead059896a757681e305.md5 @@ -0,0 +1,3 @@ +source_md5="46ee73135106dc54fb583a046a8442bf" +dest_md5="cef9934fa8508382309d137fbc659919" + diff --git a/.import/btn_32x32_03.png-4fb3885f19b9ead059896a757681e305.stex b/.import/btn_32x32_03.png-4fb3885f19b9ead059896a757681e305.stex new file mode 100644 index 0000000..04d4455 Binary files /dev/null and b/.import/btn_32x32_03.png-4fb3885f19b9ead059896a757681e305.stex differ diff --git a/.import/btn_32x32_03.png-ff2921f7e03c63bfbb2e1c953da931f8.md5 b/.import/btn_32x32_03.png-ff2921f7e03c63bfbb2e1c953da931f8.md5 new file mode 100644 index 0000000..9e18106 --- /dev/null +++ b/.import/btn_32x32_03.png-ff2921f7e03c63bfbb2e1c953da931f8.md5 @@ -0,0 +1,3 @@ +source_md5="46ee73135106dc54fb583a046a8442bf" +dest_md5="cef9934fa8508382309d137fbc659919" + diff --git a/.import/btn_32x32_03.png-ff2921f7e03c63bfbb2e1c953da931f8.stex b/.import/btn_32x32_03.png-ff2921f7e03c63bfbb2e1c953da931f8.stex new file mode 100644 index 0000000..04d4455 Binary files /dev/null and b/.import/btn_32x32_03.png-ff2921f7e03c63bfbb2e1c953da931f8.stex differ diff --git a/.import/btn_32x32_04.png-2ea1b94f4c4d8ccd184c302908f79a0a.md5 b/.import/btn_32x32_04.png-2ea1b94f4c4d8ccd184c302908f79a0a.md5 new file mode 100644 index 0000000..7b20157 --- /dev/null +++ b/.import/btn_32x32_04.png-2ea1b94f4c4d8ccd184c302908f79a0a.md5 @@ -0,0 +1,3 @@ +source_md5="d1180bd0d190c3867126406d218f42b6" +dest_md5="51b6598fbcd3194d5a75b0bfc651a2a0" + diff --git a/.import/btn_32x32_04.png-2ea1b94f4c4d8ccd184c302908f79a0a.stex b/.import/btn_32x32_04.png-2ea1b94f4c4d8ccd184c302908f79a0a.stex new file mode 100644 index 0000000..4ada465 Binary files /dev/null and b/.import/btn_32x32_04.png-2ea1b94f4c4d8ccd184c302908f79a0a.stex differ diff --git a/.import/btn_32x32_04.png-70322dd2cb806cacec5fc6fad85cdcf7.md5 b/.import/btn_32x32_04.png-70322dd2cb806cacec5fc6fad85cdcf7.md5 new file mode 100644 index 0000000..7b20157 --- /dev/null +++ b/.import/btn_32x32_04.png-70322dd2cb806cacec5fc6fad85cdcf7.md5 @@ -0,0 +1,3 @@ +source_md5="d1180bd0d190c3867126406d218f42b6" +dest_md5="51b6598fbcd3194d5a75b0bfc651a2a0" + diff --git a/.import/btn_32x32_04.png-70322dd2cb806cacec5fc6fad85cdcf7.stex b/.import/btn_32x32_04.png-70322dd2cb806cacec5fc6fad85cdcf7.stex new file mode 100644 index 0000000..4ada465 Binary files /dev/null and b/.import/btn_32x32_04.png-70322dd2cb806cacec5fc6fad85cdcf7.stex differ diff --git a/.import/btn_64x64_01.png-4a5dcdc4ebc9d73c2165462f317264fa.md5 b/.import/btn_64x64_01.png-4a5dcdc4ebc9d73c2165462f317264fa.md5 new file mode 100644 index 0000000..ef3877f --- /dev/null +++ b/.import/btn_64x64_01.png-4a5dcdc4ebc9d73c2165462f317264fa.md5 @@ -0,0 +1,3 @@ +source_md5="84a0ecae90fd489efc76e3cc8784a832" +dest_md5="da8238fc36c973cdee950cac023f756c" + diff --git a/.import/btn_64x64_01.png-4a5dcdc4ebc9d73c2165462f317264fa.stex b/.import/btn_64x64_01.png-4a5dcdc4ebc9d73c2165462f317264fa.stex new file mode 100644 index 0000000..b02e02c Binary files /dev/null and b/.import/btn_64x64_01.png-4a5dcdc4ebc9d73c2165462f317264fa.stex differ diff --git a/.import/btn_64x64_01.png-f11b9ca534b464b50224f9c18e86f97b.md5 b/.import/btn_64x64_01.png-f11b9ca534b464b50224f9c18e86f97b.md5 new file mode 100644 index 0000000..ef3877f --- /dev/null +++ b/.import/btn_64x64_01.png-f11b9ca534b464b50224f9c18e86f97b.md5 @@ -0,0 +1,3 @@ +source_md5="84a0ecae90fd489efc76e3cc8784a832" +dest_md5="da8238fc36c973cdee950cac023f756c" + diff --git a/.import/btn_64x64_01.png-f11b9ca534b464b50224f9c18e86f97b.stex b/.import/btn_64x64_01.png-f11b9ca534b464b50224f9c18e86f97b.stex new file mode 100644 index 0000000..b02e02c Binary files /dev/null and b/.import/btn_64x64_01.png-f11b9ca534b464b50224f9c18e86f97b.stex differ diff --git a/.import/btn_64x64_02.png-003d8f8ca6bc5531e3aac5ac13733473.md5 b/.import/btn_64x64_02.png-003d8f8ca6bc5531e3aac5ac13733473.md5 new file mode 100644 index 0000000..a9e8d9a --- /dev/null +++ b/.import/btn_64x64_02.png-003d8f8ca6bc5531e3aac5ac13733473.md5 @@ -0,0 +1,3 @@ +source_md5="adf1db510488227bf21e83fcc664c2e4" +dest_md5="085317847a577293accd137e86600821" + diff --git a/.import/btn_64x64_02.png-003d8f8ca6bc5531e3aac5ac13733473.stex b/.import/btn_64x64_02.png-003d8f8ca6bc5531e3aac5ac13733473.stex new file mode 100644 index 0000000..4c0ec0f Binary files /dev/null and b/.import/btn_64x64_02.png-003d8f8ca6bc5531e3aac5ac13733473.stex differ diff --git a/.import/btn_64x64_02.png-05ad88b8d82e22a24c3fc59bc660150b.md5 b/.import/btn_64x64_02.png-05ad88b8d82e22a24c3fc59bc660150b.md5 new file mode 100644 index 0000000..a9e8d9a --- /dev/null +++ b/.import/btn_64x64_02.png-05ad88b8d82e22a24c3fc59bc660150b.md5 @@ -0,0 +1,3 @@ +source_md5="adf1db510488227bf21e83fcc664c2e4" +dest_md5="085317847a577293accd137e86600821" + diff --git a/.import/btn_64x64_02.png-05ad88b8d82e22a24c3fc59bc660150b.stex b/.import/btn_64x64_02.png-05ad88b8d82e22a24c3fc59bc660150b.stex new file mode 100644 index 0000000..4c0ec0f Binary files /dev/null and b/.import/btn_64x64_02.png-05ad88b8d82e22a24c3fc59bc660150b.stex differ diff --git a/.import/btn_64x64_03.png-23b73d910e5721506fac33d7618a1ddc.md5 b/.import/btn_64x64_03.png-23b73d910e5721506fac33d7618a1ddc.md5 new file mode 100644 index 0000000..8141fb1 --- /dev/null +++ b/.import/btn_64x64_03.png-23b73d910e5721506fac33d7618a1ddc.md5 @@ -0,0 +1,3 @@ +source_md5="a01042dbc0036dc0c89b053d6bd5ad64" +dest_md5="5a2a270868576941d1078e051e9feff7" + diff --git a/.import/btn_64x64_03.png-23b73d910e5721506fac33d7618a1ddc.stex b/.import/btn_64x64_03.png-23b73d910e5721506fac33d7618a1ddc.stex new file mode 100644 index 0000000..023952c Binary files /dev/null and b/.import/btn_64x64_03.png-23b73d910e5721506fac33d7618a1ddc.stex differ diff --git a/.import/btn_64x64_03.png-65f6ef775b20d9f1144e2d4077b69661.md5 b/.import/btn_64x64_03.png-65f6ef775b20d9f1144e2d4077b69661.md5 new file mode 100644 index 0000000..8141fb1 --- /dev/null +++ b/.import/btn_64x64_03.png-65f6ef775b20d9f1144e2d4077b69661.md5 @@ -0,0 +1,3 @@ +source_md5="a01042dbc0036dc0c89b053d6bd5ad64" +dest_md5="5a2a270868576941d1078e051e9feff7" + diff --git a/.import/btn_64x64_03.png-65f6ef775b20d9f1144e2d4077b69661.stex b/.import/btn_64x64_03.png-65f6ef775b20d9f1144e2d4077b69661.stex new file mode 100644 index 0000000..023952c Binary files /dev/null and b/.import/btn_64x64_03.png-65f6ef775b20d9f1144e2d4077b69661.stex differ diff --git a/.import/btn_64x64_04.png-3239b3bc362af8c7ec2416f4461b4e4e.md5 b/.import/btn_64x64_04.png-3239b3bc362af8c7ec2416f4461b4e4e.md5 new file mode 100644 index 0000000..592b60d --- /dev/null +++ b/.import/btn_64x64_04.png-3239b3bc362af8c7ec2416f4461b4e4e.md5 @@ -0,0 +1,3 @@ +source_md5="ce84ab9d92ac720a98ab936d19864283" +dest_md5="a5843bea3f6f521f69f48b5e6d26fbdb" + diff --git a/.import/btn_64x64_04.png-3239b3bc362af8c7ec2416f4461b4e4e.stex b/.import/btn_64x64_04.png-3239b3bc362af8c7ec2416f4461b4e4e.stex new file mode 100644 index 0000000..c66d217 Binary files /dev/null and b/.import/btn_64x64_04.png-3239b3bc362af8c7ec2416f4461b4e4e.stex differ diff --git a/.import/btn_64x64_04.png-f782924dc1ddc3abfe90c985d62cc139.md5 b/.import/btn_64x64_04.png-f782924dc1ddc3abfe90c985d62cc139.md5 new file mode 100644 index 0000000..592b60d --- /dev/null +++ b/.import/btn_64x64_04.png-f782924dc1ddc3abfe90c985d62cc139.md5 @@ -0,0 +1,3 @@ +source_md5="ce84ab9d92ac720a98ab936d19864283" +dest_md5="a5843bea3f6f521f69f48b5e6d26fbdb" + diff --git a/.import/btn_64x64_04.png-f782924dc1ddc3abfe90c985d62cc139.stex b/.import/btn_64x64_04.png-f782924dc1ddc3abfe90c985d62cc139.stex new file mode 100644 index 0000000..c66d217 Binary files /dev/null and b/.import/btn_64x64_04.png-f782924dc1ddc3abfe90c985d62cc139.stex differ diff --git a/.import/btn_64x64_05.png-c8d3cdf69700363c7fe7e6983113e024.md5 b/.import/btn_64x64_05.png-c8d3cdf69700363c7fe7e6983113e024.md5 new file mode 100644 index 0000000..27e8bfe --- /dev/null +++ b/.import/btn_64x64_05.png-c8d3cdf69700363c7fe7e6983113e024.md5 @@ -0,0 +1,3 @@ +source_md5="35ec506acd39131b7f77d40dd85806f3" +dest_md5="bfdc9aca38e56388de14b01f9352f48e" + diff --git a/.import/btn_64x64_05.png-c8d3cdf69700363c7fe7e6983113e024.stex b/.import/btn_64x64_05.png-c8d3cdf69700363c7fe7e6983113e024.stex new file mode 100644 index 0000000..6981a1d Binary files /dev/null and b/.import/btn_64x64_05.png-c8d3cdf69700363c7fe7e6983113e024.stex differ diff --git a/.import/btn_64x64_05.png-fb487771760326d9ed4e42ccc257d4fc.md5 b/.import/btn_64x64_05.png-fb487771760326d9ed4e42ccc257d4fc.md5 new file mode 100644 index 0000000..27e8bfe --- /dev/null +++ b/.import/btn_64x64_05.png-fb487771760326d9ed4e42ccc257d4fc.md5 @@ -0,0 +1,3 @@ +source_md5="35ec506acd39131b7f77d40dd85806f3" +dest_md5="bfdc9aca38e56388de14b01f9352f48e" + diff --git a/.import/btn_64x64_05.png-fb487771760326d9ed4e42ccc257d4fc.stex b/.import/btn_64x64_05.png-fb487771760326d9ed4e42ccc257d4fc.stex new file mode 100644 index 0000000..6981a1d Binary files /dev/null and b/.import/btn_64x64_05.png-fb487771760326d9ed4e42ccc257d4fc.stex differ diff --git a/.import/fastBackwards.png-23e3b875391285f6e1867ad4307c8e31.md5 b/.import/fastBackwards.png-23e3b875391285f6e1867ad4307c8e31.md5 new file mode 100644 index 0000000..bdc6031 --- /dev/null +++ b/.import/fastBackwards.png-23e3b875391285f6e1867ad4307c8e31.md5 @@ -0,0 +1,3 @@ +source_md5="4fac229ce7f651b732a5a1e39fac97c3" +dest_md5="d9fea4e4f788ecee6cca2d826d807f69" + diff --git a/.import/fastBackwards.png-23e3b875391285f6e1867ad4307c8e31.stex b/.import/fastBackwards.png-23e3b875391285f6e1867ad4307c8e31.stex new file mode 100644 index 0000000..cc97d12 Binary files /dev/null and b/.import/fastBackwards.png-23e3b875391285f6e1867ad4307c8e31.stex differ diff --git a/.import/fastForward.png-5dc9dc1dd0f314414d0e8358c405e79f.md5 b/.import/fastForward.png-5dc9dc1dd0f314414d0e8358c405e79f.md5 new file mode 100644 index 0000000..aa8b240 --- /dev/null +++ b/.import/fastForward.png-5dc9dc1dd0f314414d0e8358c405e79f.md5 @@ -0,0 +1,3 @@ +source_md5="7b299c9d6e3ccef5c3ae8e19cce06770" +dest_md5="d6bf7005fe96fe5cc52158a318eb3564" + diff --git a/.import/fastForward.png-5dc9dc1dd0f314414d0e8358c405e79f.stex b/.import/fastForward.png-5dc9dc1dd0f314414d0e8358c405e79f.stex new file mode 100644 index 0000000..0cbef33 Binary files /dev/null and b/.import/fastForward.png-5dc9dc1dd0f314414d0e8358c405e79f.stex differ diff --git a/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 new file mode 100644 index 0000000..5328bc7 --- /dev/null +++ b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 @@ -0,0 +1,3 @@ +source_md5="47313fa4c47a9963fddd764e1ec6e4a8" +dest_md5="26ea799ea0a3da9e753b3ebe822e0570" + diff --git a/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex new file mode 100644 index 0000000..71f6913 Binary files /dev/null and b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex differ diff --git a/.import/left.png-bd97b939cfc653e64b2698a809562f8d.md5 b/.import/left.png-bd97b939cfc653e64b2698a809562f8d.md5 new file mode 100644 index 0000000..c9aa420 --- /dev/null +++ b/.import/left.png-bd97b939cfc653e64b2698a809562f8d.md5 @@ -0,0 +1,3 @@ +source_md5="a94b86e2de6b4616b4730799041ea34f" +dest_md5="0f2affa46f46a4645982cf7d33f930f6" + diff --git a/.import/left.png-bd97b939cfc653e64b2698a809562f8d.stex b/.import/left.png-bd97b939cfc653e64b2698a809562f8d.stex new file mode 100644 index 0000000..4f66dd3 Binary files /dev/null and b/.import/left.png-bd97b939cfc653e64b2698a809562f8d.stex differ diff --git a/.import/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.md5 b/.import/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.md5 new file mode 100644 index 0000000..fd92f2c --- /dev/null +++ b/.import/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.md5 @@ -0,0 +1,3 @@ +source_md5="deeebc374373527df61bb94de9a4f719" +dest_md5="ed4807339cc84d269500be36a8f9a9cb" + diff --git a/.import/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.stex b/.import/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.stex new file mode 100644 index 0000000..11857c1 Binary files /dev/null and b/.import/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.stex differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c6087dd --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License (MIT) + +Copyright (c) 2022 David J. Allen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..904e3f5 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Godot Calendar + +A simple calendar with VERY basic functionality to select day, month, and year. + +![screenshot](assets/screenshots/ss1.png) + +## How to Use + +Simply clone the repository and add the scene to your project. The calendar only has a single signal that returns the date (day, month, and year) as a dictionary. + +```gdscript +onready var calendar = $Calendar + +func _ready(): + calendar.connect("date_selected", self, "print_date") + +func print_date(date): + print("date selected: ", date) + print("weekday: ", calendar.get_weekday(date)) +``` + + + +## TODO + +- [ ] Better define popup/hide behavior. + +- [ ] Add dates for before and after current month. + +- [ ] Add method to get daylight savings for selected date. + +- [ ] Make more customizable?? diff --git a/assets/screenshots/ss1.png b/assets/screenshots/ss1.png new file mode 100644 index 0000000..d7df49d Binary files /dev/null and b/assets/screenshots/ss1.png differ diff --git a/assets/textures/btn_32x32_01.png b/assets/textures/btn_32x32_01.png new file mode 100644 index 0000000..eaf8b71 Binary files /dev/null and b/assets/textures/btn_32x32_01.png differ diff --git a/assets/textures/btn_32x32_01.png.import b/assets/textures/btn_32x32_01.png.import new file mode 100644 index 0000000..1108f91 --- /dev/null +++ b/assets/textures/btn_32x32_01.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_32x32_01.png-79cbd90f22f1ab244008a919061d4f65.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_32x32_01.png" +dest_files=[ "res://.import/btn_32x32_01.png-79cbd90f22f1ab244008a919061d4f65.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/btn_32x32_02.png b/assets/textures/btn_32x32_02.png new file mode 100644 index 0000000..f24007c Binary files /dev/null and b/assets/textures/btn_32x32_02.png differ diff --git a/assets/textures/btn_32x32_02.png.import b/assets/textures/btn_32x32_02.png.import new file mode 100644 index 0000000..e9541cf --- /dev/null +++ b/assets/textures/btn_32x32_02.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_32x32_02.png-2f6195ca0f07c65d93abd1f340cd6564.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_32x32_02.png" +dest_files=[ "res://.import/btn_32x32_02.png-2f6195ca0f07c65d93abd1f340cd6564.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/btn_32x32_03.png b/assets/textures/btn_32x32_03.png new file mode 100644 index 0000000..59f432c Binary files /dev/null and b/assets/textures/btn_32x32_03.png differ diff --git a/assets/textures/btn_32x32_03.png.import b/assets/textures/btn_32x32_03.png.import new file mode 100644 index 0000000..abc5a96 --- /dev/null +++ b/assets/textures/btn_32x32_03.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_32x32_03.png-ff2921f7e03c63bfbb2e1c953da931f8.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_32x32_03.png" +dest_files=[ "res://.import/btn_32x32_03.png-ff2921f7e03c63bfbb2e1c953da931f8.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/btn_32x32_04.png b/assets/textures/btn_32x32_04.png new file mode 100644 index 0000000..c1c3e8b Binary files /dev/null and b/assets/textures/btn_32x32_04.png differ diff --git a/assets/textures/btn_32x32_04.png.import b/assets/textures/btn_32x32_04.png.import new file mode 100644 index 0000000..5a9dbcf --- /dev/null +++ b/assets/textures/btn_32x32_04.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_32x32_04.png-2ea1b94f4c4d8ccd184c302908f79a0a.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_32x32_04.png" +dest_files=[ "res://.import/btn_32x32_04.png-2ea1b94f4c4d8ccd184c302908f79a0a.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/btn_64x64_01.png b/assets/textures/btn_64x64_01.png new file mode 100644 index 0000000..7fdcb56 Binary files /dev/null and b/assets/textures/btn_64x64_01.png differ diff --git a/assets/textures/btn_64x64_01.png.import b/assets/textures/btn_64x64_01.png.import new file mode 100644 index 0000000..75d72e8 --- /dev/null +++ b/assets/textures/btn_64x64_01.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_64x64_01.png-4a5dcdc4ebc9d73c2165462f317264fa.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_64x64_01.png" +dest_files=[ "res://.import/btn_64x64_01.png-4a5dcdc4ebc9d73c2165462f317264fa.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/btn_64x64_02.png b/assets/textures/btn_64x64_02.png new file mode 100644 index 0000000..636a6bf Binary files /dev/null and b/assets/textures/btn_64x64_02.png differ diff --git a/assets/textures/btn_64x64_02.png.import b/assets/textures/btn_64x64_02.png.import new file mode 100644 index 0000000..7dfd96c --- /dev/null +++ b/assets/textures/btn_64x64_02.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_64x64_02.png-05ad88b8d82e22a24c3fc59bc660150b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_64x64_02.png" +dest_files=[ "res://.import/btn_64x64_02.png-05ad88b8d82e22a24c3fc59bc660150b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/btn_64x64_03.png b/assets/textures/btn_64x64_03.png new file mode 100644 index 0000000..0a36f08 Binary files /dev/null and b/assets/textures/btn_64x64_03.png differ diff --git a/assets/textures/btn_64x64_03.png.import b/assets/textures/btn_64x64_03.png.import new file mode 100644 index 0000000..c866601 --- /dev/null +++ b/assets/textures/btn_64x64_03.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_64x64_03.png-23b73d910e5721506fac33d7618a1ddc.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_64x64_03.png" +dest_files=[ "res://.import/btn_64x64_03.png-23b73d910e5721506fac33d7618a1ddc.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/btn_64x64_04.png b/assets/textures/btn_64x64_04.png new file mode 100644 index 0000000..165df95 Binary files /dev/null and b/assets/textures/btn_64x64_04.png differ diff --git a/assets/textures/btn_64x64_04.png.import b/assets/textures/btn_64x64_04.png.import new file mode 100644 index 0000000..0f606b8 --- /dev/null +++ b/assets/textures/btn_64x64_04.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_64x64_04.png-f782924dc1ddc3abfe90c985d62cc139.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_64x64_04.png" +dest_files=[ "res://.import/btn_64x64_04.png-f782924dc1ddc3abfe90c985d62cc139.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/btn_64x64_05.png b/assets/textures/btn_64x64_05.png new file mode 100644 index 0000000..ff304ce Binary files /dev/null and b/assets/textures/btn_64x64_05.png differ diff --git a/assets/textures/btn_64x64_05.png.import b/assets/textures/btn_64x64_05.png.import new file mode 100644 index 0000000..07e73e0 --- /dev/null +++ b/assets/textures/btn_64x64_05.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/btn_64x64_05.png-c8d3cdf69700363c7fe7e6983113e024.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/btn_64x64_05.png" +dest_files=[ "res://.import/btn_64x64_05.png-c8d3cdf69700363c7fe7e6983113e024.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/fastBackwards.png b/assets/textures/fastBackwards.png new file mode 100644 index 0000000..8eaee1a Binary files /dev/null and b/assets/textures/fastBackwards.png differ diff --git a/assets/textures/fastBackwards.png.import b/assets/textures/fastBackwards.png.import new file mode 100644 index 0000000..8764295 --- /dev/null +++ b/assets/textures/fastBackwards.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/fastBackwards.png-23e3b875391285f6e1867ad4307c8e31.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/fastBackwards.png" +dest_files=[ "res://.import/fastBackwards.png-23e3b875391285f6e1867ad4307c8e31.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/fastForward.png b/assets/textures/fastForward.png new file mode 100644 index 0000000..6500b10 Binary files /dev/null and b/assets/textures/fastForward.png differ diff --git a/assets/textures/fastForward.png.import b/assets/textures/fastForward.png.import new file mode 100644 index 0000000..8c4477a --- /dev/null +++ b/assets/textures/fastForward.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/fastForward.png-5dc9dc1dd0f314414d0e8358c405e79f.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/fastForward.png" +dest_files=[ "res://.import/fastForward.png-5dc9dc1dd0f314414d0e8358c405e79f.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/left.png b/assets/textures/left.png new file mode 100644 index 0000000..ebfb42a Binary files /dev/null and b/assets/textures/left.png differ diff --git a/assets/textures/left.png.import b/assets/textures/left.png.import new file mode 100644 index 0000000..adaeb1a --- /dev/null +++ b/assets/textures/left.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/left.png-bd97b939cfc653e64b2698a809562f8d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/left.png" +dest_files=[ "res://.import/left.png-bd97b939cfc653e64b2698a809562f8d.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/textures/readme.txt b/assets/textures/readme.txt new file mode 100644 index 0000000..8e60e86 --- /dev/null +++ b/assets/textures/readme.txt @@ -0,0 +1,6 @@ +All of these images are taken from 100% royalty free sites, +and have afterwards been edited. + +Although you might want to add your own calendar button image. + +Have fun! \ No newline at end of file diff --git a/assets/textures/right.png b/assets/textures/right.png new file mode 100644 index 0000000..d0a2528 Binary files /dev/null and b/assets/textures/right.png differ diff --git a/assets/textures/right.png.import b/assets/textures/right.png.import new file mode 100644 index 0000000..d7f861e --- /dev/null +++ b/assets/textures/right.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/right.png" +dest_files=[ "res://.import/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/default_env.tres b/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..c98fbb6 Binary files /dev/null and b/icon.png differ diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..a4c02e6 --- /dev/null +++ b/icon.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..8246000 --- /dev/null +++ b/project.godot @@ -0,0 +1,23 @@ +; 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=4 + +[application] + +config/name="Calendar" +run/main_scene="res://src/Calendar.tscn" +config/icon="res://icon.png" + +[physics] + +common/enable_pause_aware_picking=true + +[rendering] + +environment/default_environment="res://default_env.tres" diff --git a/src/Calendar.gd b/src/Calendar.gd new file mode 100644 index 0000000..e58e240 --- /dev/null +++ b/src/Calendar.gd @@ -0,0 +1,160 @@ +extends TextureButton + +signal date_selected(date) + +enum Month { JAN = 1, FEB = 2, MAR = 3, APR = 4, MAY = 5, JUN = 6, JUL = 7, + AUG = 8, SEP = 9, OCT = 10, NOV = 11, DEC = 12 } + + +const MONTH_NAME = [ + "January", "February", "March", "April", + "May", "June", "July", "August", + "September", "October", "November", "December" +] + +const MONTH_DAYS = [ + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +] + +const WEEKDAY_NAME = [ + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday" +] + +const MAX_YEAR = 9999 +const MIN_YEAR = 1970 +onready var popup = $popup +onready var label_month = $popup/form/bg/header/labels/month +onready var label_year = $popup/form/bg/header/labels/year +onready var button_month_prev = $popup/form/bg/header/prev_month +onready var button_month_next = $popup/form/bg/header/next_month +onready var button_year_prev = $popup/form/bg/header/prev_year +onready var button_year_next = $popup/form/bg/header/next_year +onready var days = $popup/form/days + +var day = 1 +var month = 1 +var year = 1970 +var weekday = 0 +var dst = 0 +var is_open = false + + +func _ready(): + # Set to today's date + var date = OS.get_date() + month = date["month"] + year = date["year"] + day = date["day"] + dst = date["dst"] + weekday = date["weekday"] + connect("pressed", self, "_show_popup") + button_month_prev.connect("pressed", self, "_goto_prev_month") + button_month_next.connect("pressed", self, "_goto_next_month") + button_year_prev.connect("pressed", self, "_goto_prev_year") + button_year_next.connect("pressed", self, "_goto_next_year") + popup.connect("popup_hide", self, "set_open", [false]) + setup_day_buttons() + + +func set_open(value): + is_open = value + + +func _show_popup(): + if is_open: + popup.hide() + is_open = false + return + + label_month.set_text(MONTH_NAME[month-1]) + label_year.set_text(str(year)) + popup.set_position(get_global_position()+Vector2(40, 40)) + popup.popup() + is_open = true + + +func set_year(value): + year = value + + +func _goto_next_month(): + if month < 12: + month += 1 + weekday = MONTH_DAYS[month-1] % 7 + else: + if year >= MAX_YEAR: + return + month = 1 + year += 1 + label_month.set_text(MONTH_NAME[month-1]) + label_year.set_text(str(year)) + setup_day_buttons() + + +func _goto_prev_month(): + if month > 1: + month -= 1 + weekday = MONTH_DAYS[month-1] % 7 + else: + if year <= MIN_YEAR: + return + month = 12 + year -= 1 + label_month.set_text(MONTH_NAME[month-1]) + label_year.set_text(str(year)) + setup_day_buttons() + + +func _goto_next_year(): + year = clamp(year+1, MIN_YEAR, MAX_YEAR) + label_year.set_text(str(year)) + setup_day_buttons() + + +func _goto_prev_year(): + year = clamp(year-1, MIN_YEAR, MAX_YEAR) + label_year.set_text(str(year)) + setup_day_buttons() + + +func get_weekday(date): + # See ref for details: https://artofmemory.com/blog/how-to-calculate-the-day-of-the-week/ + # Only works for Gregorian calendar + var day = date["day"] + var month = date["month"] + var year = date["year"] + var is_leap_year = false + if year % 4 == 0: + is_leap_year = year % 400 == 0 or year % 100 == 0 + var yy = int(str(year).right(2)) # get last 2 digits in year + var year_code = fmod((yy + floor(yy / 4)), 7.0) + var month_code = [0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5][month-1] + var century_code = [4, 2, 0, 6, 4, 2, 0][floor(year/100)-17] # -17 because start with 1700 + var leap_year_code = -1 if is_leap_year and month < 2 else 0 +# print("year code: ", year_code, "\nmonth code: ", month_code, "\ncentury_code: ", century_code, "\nleap code: ", leap_year_code, "\nday: ", day) + return fmod((year_code + month_code + century_code + day + leap_year_code), 7) + + +func setup_day_buttons(): + var days_in_month = MONTH_DAYS[month-1] + var date = {"day": 1, "month": month, "year": year} + var first_weekday_month = get_weekday(date) +# print("weekday for {month}/{day}/{year}: ".format(date), get_weekday(date)) + clear_buttons() + var iter = 1 + for i in range(first_weekday_month, first_weekday_month+days_in_month): + var button = days.get_child(7+i) # +7 for labels + button.set_text(str(iter)) + if button.is_connected("pressed", self, "emit_signal"): + button.disconnect("pressed", self, "emit_signal") + button.connect("pressed", self, "emit_signal", ["date_selected", {"day": iter, "month": month, "year": year}]) + if i == day: + button.set_pressed(true) + iter += 1 + + +func clear_buttons(): + for i in range(7, days.get_child_count()): + var button = days.get_child(i) + button.set_text("") diff --git a/src/Calendar.tscn b/src/Calendar.tscn new file mode 100644 index 0000000..09453de --- /dev/null +++ b/src/Calendar.tscn @@ -0,0 +1,580 @@ +[gd_scene load_steps=12 format=2] + +[ext_resource path="res://src/Calendar.gd" type="Script" id=1] +[ext_resource path="res://assets/textures/btn_32x32_04.png" type="Texture" id=2] +[ext_resource path="res://assets/textures/btn_32x32_03.png" type="Texture" id=3] +[ext_resource path="res://src/calendar_days.tres" type="ButtonGroup" id=4] +[ext_resource path="res://assets/textures/right.png" type="Texture" id=5] +[ext_resource path="res://assets/textures/left.png" type="Texture" id=6] +[ext_resource path="res://assets/textures/fastBackwards.png" type="Texture" id=7] +[ext_resource path="res://assets/textures/fastForward.png" type="Texture" id=8] + +[sub_resource type="StyleBoxFlat" id=1] +bg_color = Color( 0.819608, 0.8, 0.8, 1 ) +border_width_left = 4 +border_width_top = 4 +border_width_right = 4 +border_width_bottom = 4 +border_color = Color( 0.376471, 0.376471, 0.376471, 0.784314 ) +border_blend = true +corner_radius_top_left = 8 +corner_radius_top_right = 8 +corner_radius_bottom_right = 8 +corner_radius_bottom_left = 8 +expand_margin_left = 16.0 +expand_margin_right = 16.0 +expand_margin_top = 16.0 +expand_margin_bottom = 16.0 +shadow_color = Color( 0, 0, 0, 0.235294 ) +shadow_size = 16 + +[sub_resource type="StyleBoxFlat" id=3] +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_blend = true +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 +shadow_color = Color( 0, 0, 0, 0.352941 ) +shadow_size = 6 + +[sub_resource type="StyleBoxEmpty" id=2] + +[node name="Calendar" type="TextureButton"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = -1024.0 +margin_bottom = -600.0 +rect_min_size = Vector2( 32, 32 ) +texture_normal = ExtResource( 3 ) +texture_pressed = ExtResource( 2 ) +script = ExtResource( 1 ) + +[node name="popup" type="PopupPanel" parent="."] +visible = true +margin_left = 43.0 +margin_top = 43.0 +margin_right = 354.0 +margin_bottom = 341.0 +rect_min_size = Vector2( 350, 325 ) +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_styles/panel = SubResource( 1 ) + +[node name="form" type="VBoxContainer" parent="popup"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 350.0 +margin_bottom = 321.0 + +[node name="bg" type="PanelContainer" parent="popup/form"] +self_modulate = Color( 0.54902, 0.54902, 0.54902, 0.431373 ) +margin_right = 346.0 +margin_bottom = 16.0 +custom_styles/panel = SubResource( 3 ) + +[node name="header" type="HBoxContainer" parent="popup/form/bg"] +margin_left = 1.0 +margin_top = 1.0 +margin_right = 345.0 +margin_bottom = 15.0 + +[node name="prev_year" type="TextureButton" parent="popup/form/bg/header"] +modulate = Color( 0, 0, 0, 1 ) +margin_right = 32.0 +margin_bottom = 14.0 +rect_min_size = Vector2( 32, 0 ) +texture_normal = ExtResource( 7 ) +expand = true + +[node name="prev_month" type="TextureButton" parent="popup/form/bg/header"] +modulate = Color( 0, 0, 0, 1 ) +margin_left = 36.0 +margin_right = 68.0 +margin_bottom = 14.0 +rect_min_size = Vector2( 32, 0 ) +texture_normal = ExtResource( 6 ) +expand = true + +[node name="labels" type="HBoxContainer" parent="popup/form/bg/header"] +margin_left = 72.0 +margin_right = 272.0 +margin_bottom = 14.0 +rect_min_size = Vector2( 200, 0 ) +alignment = 1 + +[node name="month" type="Label" parent="popup/form/bg/header/labels"] +margin_left = 59.0 +margin_right = 104.0 +margin_bottom = 14.0 +text = "January" +align = 2 +valign = 1 +max_lines_visible = 1 + +[node name="year" type="Label" parent="popup/form/bg/header/labels"] +margin_left = 108.0 +margin_right = 140.0 +margin_bottom = 14.0 +size_flags_horizontal = 4 +size_flags_vertical = 5 +custom_styles/normal = SubResource( 2 ) +text = "2022" +valign = 1 +max_lines_visible = 1 + +[node name="next_month" type="TextureButton" parent="popup/form/bg/header"] +modulate = Color( 0, 0, 0, 1 ) +margin_left = 276.0 +margin_right = 308.0 +margin_bottom = 14.0 +rect_min_size = Vector2( 32, 0 ) +texture_normal = ExtResource( 5 ) +expand = true + +[node name="next_year" type="TextureButton" parent="popup/form/bg/header"] +modulate = Color( 0, 0, 0, 1 ) +margin_left = 312.0 +margin_right = 344.0 +margin_bottom = 14.0 +rect_min_size = Vector2( 32, 0 ) +texture_normal = ExtResource( 8 ) +expand = true + +[node name="spacer" type="Control" parent="popup/form"] +margin_top = 20.0 +margin_right = 346.0 +margin_bottom = 35.0 +rect_min_size = Vector2( 0, 15 ) + +[node name="days" type="GridContainer" parent="popup/form"] +margin_top = 39.0 +margin_right = 346.0 +margin_bottom = 197.0 +size_flags_horizontal = 3 +columns = 7 + +[node name="sunday" type="Label" parent="popup/form/days"] +margin_right = 46.0 +margin_bottom = 14.0 +text = "Sun" +align = 1 + +[node name="monday" type="Label" parent="popup/form/days"] +margin_left = 50.0 +margin_right = 96.0 +margin_bottom = 14.0 +text = "Mon" +align = 1 + +[node name="tuesday" type="Label" parent="popup/form/days"] +margin_left = 100.0 +margin_right = 146.0 +margin_bottom = 14.0 +text = "Tue" +align = 1 + +[node name="wednesday" type="Label" parent="popup/form/days"] +margin_left = 150.0 +margin_right = 196.0 +margin_bottom = 14.0 +text = "Wed" +align = 1 + +[node name="thursday" type="Label" parent="popup/form/days"] +margin_left = 200.0 +margin_right = 246.0 +margin_bottom = 14.0 +text = "Thu" +align = 1 + +[node name="friday" type="Label" parent="popup/form/days"] +margin_left = 250.0 +margin_right = 296.0 +margin_bottom = 14.0 +text = "Fri" +align = 1 + +[node name="saturday" type="Label" parent="popup/form/days"] +margin_left = 300.0 +margin_right = 346.0 +margin_bottom = 14.0 +text = "Sat" +align = 1 + +[node name="0" type="Button" parent="popup/form/days"] +margin_top = 18.0 +margin_right = 46.0 +margin_bottom = 38.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="1" type="Button" parent="popup/form/days"] +margin_left = 50.0 +margin_top = 18.0 +margin_right = 96.0 +margin_bottom = 38.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="2" type="Button" parent="popup/form/days"] +margin_left = 100.0 +margin_top = 18.0 +margin_right = 146.0 +margin_bottom = 38.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="3" type="Button" parent="popup/form/days"] +margin_left = 150.0 +margin_top = 18.0 +margin_right = 196.0 +margin_bottom = 38.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="4" type="Button" parent="popup/form/days"] +margin_left = 200.0 +margin_top = 18.0 +margin_right = 246.0 +margin_bottom = 38.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="5" type="Button" parent="popup/form/days"] +margin_left = 250.0 +margin_top = 18.0 +margin_right = 296.0 +margin_bottom = 38.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="6" type="Button" parent="popup/form/days"] +margin_left = 300.0 +margin_top = 18.0 +margin_right = 346.0 +margin_bottom = 38.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="7" type="Button" parent="popup/form/days"] +margin_top = 42.0 +margin_right = 46.0 +margin_bottom = 62.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="8" type="Button" parent="popup/form/days"] +margin_left = 50.0 +margin_top = 42.0 +margin_right = 96.0 +margin_bottom = 62.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="9" type="Button" parent="popup/form/days"] +margin_left = 100.0 +margin_top = 42.0 +margin_right = 146.0 +margin_bottom = 62.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="10" type="Button" parent="popup/form/days"] +margin_left = 150.0 +margin_top = 42.0 +margin_right = 196.0 +margin_bottom = 62.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="11" type="Button" parent="popup/form/days"] +margin_left = 200.0 +margin_top = 42.0 +margin_right = 246.0 +margin_bottom = 62.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="12" type="Button" parent="popup/form/days"] +margin_left = 250.0 +margin_top = 42.0 +margin_right = 296.0 +margin_bottom = 62.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="13" type="Button" parent="popup/form/days"] +margin_left = 300.0 +margin_top = 42.0 +margin_right = 346.0 +margin_bottom = 62.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="14" type="Button" parent="popup/form/days"] +margin_top = 66.0 +margin_right = 46.0 +margin_bottom = 86.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="15" type="Button" parent="popup/form/days"] +margin_left = 50.0 +margin_top = 66.0 +margin_right = 96.0 +margin_bottom = 86.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="16" type="Button" parent="popup/form/days"] +margin_left = 100.0 +margin_top = 66.0 +margin_right = 146.0 +margin_bottom = 86.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="17" type="Button" parent="popup/form/days"] +margin_left = 150.0 +margin_top = 66.0 +margin_right = 196.0 +margin_bottom = 86.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="18" type="Button" parent="popup/form/days"] +margin_left = 200.0 +margin_top = 66.0 +margin_right = 246.0 +margin_bottom = 86.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="19" type="Button" parent="popup/form/days"] +margin_left = 250.0 +margin_top = 66.0 +margin_right = 296.0 +margin_bottom = 86.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="20" type="Button" parent="popup/form/days"] +margin_left = 300.0 +margin_top = 66.0 +margin_right = 346.0 +margin_bottom = 86.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="21" type="Button" parent="popup/form/days"] +margin_top = 90.0 +margin_right = 46.0 +margin_bottom = 110.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="22" type="Button" parent="popup/form/days"] +margin_left = 50.0 +margin_top = 90.0 +margin_right = 96.0 +margin_bottom = 110.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="23" type="Button" parent="popup/form/days"] +margin_left = 100.0 +margin_top = 90.0 +margin_right = 146.0 +margin_bottom = 110.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="24" type="Button" parent="popup/form/days"] +margin_left = 150.0 +margin_top = 90.0 +margin_right = 196.0 +margin_bottom = 110.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="25" type="Button" parent="popup/form/days"] +margin_left = 200.0 +margin_top = 90.0 +margin_right = 246.0 +margin_bottom = 110.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="26" type="Button" parent="popup/form/days"] +margin_left = 250.0 +margin_top = 90.0 +margin_right = 296.0 +margin_bottom = 110.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="27" type="Button" parent="popup/form/days"] +margin_left = 300.0 +margin_top = 90.0 +margin_right = 346.0 +margin_bottom = 110.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="28" type="Button" parent="popup/form/days"] +margin_top = 114.0 +margin_right = 46.0 +margin_bottom = 134.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="29" type="Button" parent="popup/form/days"] +margin_left = 50.0 +margin_top = 114.0 +margin_right = 96.0 +margin_bottom = 134.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="30" type="Button" parent="popup/form/days"] +margin_left = 100.0 +margin_top = 114.0 +margin_right = 146.0 +margin_bottom = 134.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="31" type="Button" parent="popup/form/days"] +margin_left = 150.0 +margin_top = 114.0 +margin_right = 196.0 +margin_bottom = 134.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="32" type="Button" parent="popup/form/days"] +margin_left = 200.0 +margin_top = 114.0 +margin_right = 246.0 +margin_bottom = 134.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="33" type="Button" parent="popup/form/days"] +margin_left = 250.0 +margin_top = 114.0 +margin_right = 296.0 +margin_bottom = 134.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="34" type="Button" parent="popup/form/days"] +margin_left = 300.0 +margin_top = 114.0 +margin_right = 346.0 +margin_bottom = 134.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="35" type="Button" parent="popup/form/days"] +margin_top = 138.0 +margin_right = 46.0 +margin_bottom = 158.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="36" type="Button" parent="popup/form/days"] +margin_left = 50.0 +margin_top = 138.0 +margin_right = 96.0 +margin_bottom = 158.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="37" type="Button" parent="popup/form/days"] +margin_left = 100.0 +margin_top = 138.0 +margin_right = 146.0 +margin_bottom = 158.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="38" type="Button" parent="popup/form/days"] +margin_left = 150.0 +margin_top = 138.0 +margin_right = 196.0 +margin_bottom = 158.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="39" type="Button" parent="popup/form/days"] +margin_left = 200.0 +margin_top = 138.0 +margin_right = 246.0 +margin_bottom = 158.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="40" type="Button" parent="popup/form/days"] +margin_left = 250.0 +margin_top = 138.0 +margin_right = 296.0 +margin_bottom = 158.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="41" type="Button" parent="popup/form/days"] +margin_left = 300.0 +margin_top = 138.0 +margin_right = 346.0 +margin_bottom = 158.0 +size_flags_horizontal = 3 +toggle_mode = true +group = ExtResource( 4 ) + +[node name="Tween" type="Tween" parent="."] diff --git a/src/Date.gd b/src/Date.gd new file mode 100644 index 0000000..9e31d4b --- /dev/null +++ b/src/Date.gd @@ -0,0 +1,54 @@ + + +# Supported Date Formats: +# DD : Two digit day of month +# MM : Two digit month +# YY : Two digit year +# YYYY : Four digit year +func date(date_format = "DD-MM-YY") -> String: + if("DD".is_subsequence_of(date_format)): + date_format = date_format.replace("DD", str(day()).pad_zeros(2)) + if("MM".is_subsequence_of(date_format)): + date_format = date_format.replace("MM", str(month()).pad_zeros(2)) + if("YYYY".is_subsequence_of(date_format)): + date_format = date_format.replace("YYYY", str(year())) + elif("YY".is_subsequence_of(date_format)): + date_format = date_format.replace("YY", str(year()).substr(2,3)) + return date_format + + +enum Month { JAN = 1, FEB = 2, MAR = 3, APR = 4, MAY = 5, JUN = 6, JUL = 7, + AUG = 8, SEP = 9, OCT = 10, NOV = 11, DEC = 12 } + + +const MONTH_NAME = [ + "Jan", "Feb", "Mar", "Apr", + "May", "Jun", "Jul", "Aug", + "Sep", "Oct", "Nov", "Dec" ] + +const WEEKDAY_NAME = [ + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday" ] + +func get_days_in_month(month : int, year : int) -> int: + var number_of_days : int + if(month == Month.APR || month == Month.JUN || month == Month.SEP + || month == Month.NOV): + number_of_days = 30 + elif(month == Month.FEB): + var is_leap_year = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0) + if(is_leap_year): + number_of_days = 29 + else: + number_of_days = 28 + else: + number_of_days = 31 + + return number_of_days + +func get_weekday(day : int, month : int, year : int) -> int: + var t : Array = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4] + if(month < 3): + year -= 1 + return (year + year/4 - year/100 + year/400 + t[month - 1] + day) % 7 + diff --git a/src/calendar_days.tres b/src/calendar_days.tres new file mode 100644 index 0000000..0e55d74 --- /dev/null +++ b/src/calendar_days.tres @@ -0,0 +1,3 @@ +[gd_resource type="ButtonGroup" format=2] + +[resource]