From b2f0190f6b2a227a21dd4909476171f7cc371a2d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 19 Mar 2022 16:46:19 -0400 Subject: menu! --- .gitignore | 1 + CMakeLists.txt | 1 + res/fmod/.cache/fsbcache/Desktop/1FE16EE9.fobj | Bin 0 -> 2507 bytes res/fmod/.cache/fsbcache/Desktop/3C7FCD0D.fobj | Bin 0 -> 1426 bytes res/fmod/.cache/fsbcache/Desktop/5A3FB1CD.fobj | Bin 0 -> 2113 bytes res/fmod/.cache/fsbcache/Desktop/7FBDFDEC.fobj | Bin 0 -> 1779 bytes .../{223fc849-8f5c-4825-96ab-eab1343156dc}.pdc | Bin 0 -> 904 bytes .../{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.pdc | Bin 0 -> 800 bytes .../{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.pdc | Bin 0 -> 480 bytes .../{6ada1ede-de39-422a-b62a-f46d14ae1868}.pdc | Bin 0 -> 912 bytes ...{071a4502-d1f7-464c-a3fb-57a183c4cab4}.user.xml | 37 ++++++ ...{5073fd94-9286-4fa1-87de-fee49c7ef309}.user.xml | 37 ++++++ ...{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.user.xml | 37 ++++++ ...{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.user.xml | 34 ++++++ res/fmod/Assets/Jump01.wav | Bin 0 -> 18796 bytes res/fmod/Assets/Jump02.wav | Bin 0 -> 21636 bytes res/fmod/Assets/MenuCursor01.wav | Bin 0 -> 10684 bytes res/fmod/Assets/MenuValid01.wav | Bin 0 -> 21440 bytes .../{223fc849-8f5c-4825-96ab-eab1343156dc}.xml | 20 ++++ .../{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.xml | 20 ++++ .../{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.xml | 20 ++++ .../{6ada1ede-de39-422a-b62a-f46d14ae1868}.xml | 20 ++++ .../{071a4502-d1f7-464c-a3fb-57a183c4cab4}.xml | 128 ++++++++++++++++++++ .../{5073fd94-9286-4fa1-87de-fee49c7ef309}.xml | 128 ++++++++++++++++++++ .../{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.xml | 128 ++++++++++++++++++++ .../{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.xml | 128 ++++++++++++++++++++ res/menu.png | Bin 0 -> 9764 bytes res/menu.psd | Bin 0 -> 124876 bytes src/consts.h | 2 + src/game.cpp | 34 ++++-- src/game.h | 8 +- src/main.cpp | 15 ++- src/menu.cpp | 109 +++++++++++++++++ src/menu.h | 42 +++++++ src/renderer.cpp | 133 ++++++++++++++++++++- src/renderer.h | 12 ++ 36 files changed, 1073 insertions(+), 21 deletions(-) create mode 100644 res/fmod/.cache/fsbcache/Desktop/1FE16EE9.fobj create mode 100644 res/fmod/.cache/fsbcache/Desktop/3C7FCD0D.fobj create mode 100644 res/fmod/.cache/fsbcache/Desktop/5A3FB1CD.fobj create mode 100644 res/fmod/.cache/fsbcache/Desktop/7FBDFDEC.fobj create mode 100644 res/fmod/.cache/{223fc849-8f5c-4825-96ab-eab1343156dc}.pdc create mode 100644 res/fmod/.cache/{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.pdc create mode 100644 res/fmod/.cache/{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.pdc create mode 100644 res/fmod/.cache/{6ada1ede-de39-422a-b62a-f46d14ae1868}.pdc create mode 100644 res/fmod/.user/Metadata/Event/{071a4502-d1f7-464c-a3fb-57a183c4cab4}.user.xml create mode 100644 res/fmod/.user/Metadata/Event/{5073fd94-9286-4fa1-87de-fee49c7ef309}.user.xml create mode 100644 res/fmod/.user/Metadata/Event/{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.user.xml create mode 100644 res/fmod/.user/Metadata/Event/{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.user.xml create mode 100644 res/fmod/Assets/Jump01.wav create mode 100644 res/fmod/Assets/Jump02.wav create mode 100644 res/fmod/Assets/MenuCursor01.wav create mode 100644 res/fmod/Assets/MenuValid01.wav create mode 100644 res/fmod/Metadata/AudioFile/{223fc849-8f5c-4825-96ab-eab1343156dc}.xml create mode 100644 res/fmod/Metadata/AudioFile/{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.xml create mode 100644 res/fmod/Metadata/AudioFile/{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.xml create mode 100644 res/fmod/Metadata/AudioFile/{6ada1ede-de39-422a-b62a-f46d14ae1868}.xml create mode 100644 res/fmod/Metadata/Event/{071a4502-d1f7-464c-a3fb-57a183c4cab4}.xml create mode 100644 res/fmod/Metadata/Event/{5073fd94-9286-4fa1-87de-fee49c7ef309}.xml create mode 100644 res/fmod/Metadata/Event/{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.xml create mode 100644 res/fmod/Metadata/Event/{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.xml create mode 100644 res/menu.png create mode 100644 res/menu.psd create mode 100644 src/menu.cpp create mode 100644 src/menu.h diff --git a/.gitignore b/.gitignore index 643dc82..44653cd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build-intrinsic .DS_Store build-new fade.png +.unsaved diff --git a/CMakeLists.txt b/CMakeLists.txt index a40e14f..9f6d26c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,7 @@ add_executable(Ether src/animation.cpp src/game.cpp src/sign.cpp + src/menu.cpp vendor/fov.c ) diff --git a/res/fmod/.cache/fsbcache/Desktop/1FE16EE9.fobj b/res/fmod/.cache/fsbcache/Desktop/1FE16EE9.fobj new file mode 100644 index 0000000..32ffbc7 Binary files /dev/null and b/res/fmod/.cache/fsbcache/Desktop/1FE16EE9.fobj differ diff --git a/res/fmod/.cache/fsbcache/Desktop/3C7FCD0D.fobj b/res/fmod/.cache/fsbcache/Desktop/3C7FCD0D.fobj new file mode 100644 index 0000000..3cc9fd7 Binary files /dev/null and b/res/fmod/.cache/fsbcache/Desktop/3C7FCD0D.fobj differ diff --git a/res/fmod/.cache/fsbcache/Desktop/5A3FB1CD.fobj b/res/fmod/.cache/fsbcache/Desktop/5A3FB1CD.fobj new file mode 100644 index 0000000..48acbe0 Binary files /dev/null and b/res/fmod/.cache/fsbcache/Desktop/5A3FB1CD.fobj differ diff --git a/res/fmod/.cache/fsbcache/Desktop/7FBDFDEC.fobj b/res/fmod/.cache/fsbcache/Desktop/7FBDFDEC.fobj new file mode 100644 index 0000000..9420705 Binary files /dev/null and b/res/fmod/.cache/fsbcache/Desktop/7FBDFDEC.fobj differ diff --git a/res/fmod/.cache/{223fc849-8f5c-4825-96ab-eab1343156dc}.pdc b/res/fmod/.cache/{223fc849-8f5c-4825-96ab-eab1343156dc}.pdc new file mode 100644 index 0000000..93078d9 Binary files /dev/null and b/res/fmod/.cache/{223fc849-8f5c-4825-96ab-eab1343156dc}.pdc differ diff --git a/res/fmod/.cache/{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.pdc b/res/fmod/.cache/{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.pdc new file mode 100644 index 0000000..dbd598f Binary files /dev/null and b/res/fmod/.cache/{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.pdc differ diff --git a/res/fmod/.cache/{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.pdc b/res/fmod/.cache/{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.pdc new file mode 100644 index 0000000..316a4b9 Binary files /dev/null and b/res/fmod/.cache/{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.pdc differ diff --git a/res/fmod/.cache/{6ada1ede-de39-422a-b62a-f46d14ae1868}.pdc b/res/fmod/.cache/{6ada1ede-de39-422a-b62a-f46d14ae1868}.pdc new file mode 100644 index 0000000..9ed5e36 Binary files /dev/null and b/res/fmod/.cache/{6ada1ede-de39-422a-b62a-f46d14ae1868}.pdc differ diff --git a/res/fmod/.user/Metadata/Event/{071a4502-d1f7-464c-a3fb-57a183c4cab4}.user.xml b/res/fmod/.user/Metadata/Event/{071a4502-d1f7-464c-a3fb-57a183c4cab4}.user.xml new file mode 100644 index 0000000..ea6f59b --- /dev/null +++ b/res/fmod/.user/Metadata/Event/{071a4502-d1f7-464c-a3fb-57a183c4cab4}.user.xml @@ -0,0 +1,37 @@ + + + + + {53bb2b11-3105-47b3-aa6e-1faa64319499} + + + {8cff8eab-2c2e-4785-b92f-458b4a1e4bff} + + + + + + + + + + 0.016137708445400752 + + + + + {8f0fdc50-c37e-4cbd-b7e5-c28b36cf933d} + + + + + + + + + + + + + + diff --git a/res/fmod/.user/Metadata/Event/{5073fd94-9286-4fa1-87de-fee49c7ef309}.user.xml b/res/fmod/.user/Metadata/Event/{5073fd94-9286-4fa1-87de-fee49c7ef309}.user.xml new file mode 100644 index 0000000..f109bee --- /dev/null +++ b/res/fmod/.user/Metadata/Event/{5073fd94-9286-4fa1-87de-fee49c7ef309}.user.xml @@ -0,0 +1,37 @@ + + + + + {b115edd2-8123-4808-9b3b-15c52e92487a} + + + {97841c1e-47f6-4ada-bfc9-c92c4919ece2} + + + + + + + + + + 0.016137708445400752 + + + + + {7cb7e8f7-cf3f-40de-a22e-da0bfde92db9} + + + + + + + + + + + + + + diff --git a/res/fmod/.user/Metadata/Event/{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.user.xml b/res/fmod/.user/Metadata/Event/{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.user.xml new file mode 100644 index 0000000..db69e7a --- /dev/null +++ b/res/fmod/.user/Metadata/Event/{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.user.xml @@ -0,0 +1,37 @@ + + + + + {e3066025-fe5d-4921-9797-8eb3e71ad669} + + + {7ea9470c-55bc-4ae5-ae64-f0ac6c761a8f} + + + + + + + + + + 0.00015144074484733824 + + + + + {af1977d5-3653-437c-a168-bc604872d523} + + + + + + + + + + + + + + diff --git a/res/fmod/.user/Metadata/Event/{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.user.xml b/res/fmod/.user/Metadata/Event/{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.user.xml new file mode 100644 index 0000000..b765220 --- /dev/null +++ b/res/fmod/.user/Metadata/Event/{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.user.xml @@ -0,0 +1,34 @@ + + + + + {8d77dd4e-88a6-4f40-a4da-0ff9b399d764} + + + + + + + + + + 0.016137708445400752 + + + + + {c8122b59-45a7-4756-94f6-625ed9e16820} + + + + + + + + + + + + + + diff --git a/res/fmod/Assets/Jump01.wav b/res/fmod/Assets/Jump01.wav new file mode 100644 index 0000000..3122bcc Binary files /dev/null and b/res/fmod/Assets/Jump01.wav differ diff --git a/res/fmod/Assets/Jump02.wav b/res/fmod/Assets/Jump02.wav new file mode 100644 index 0000000..5c45ebc Binary files /dev/null and b/res/fmod/Assets/Jump02.wav differ diff --git a/res/fmod/Assets/MenuCursor01.wav b/res/fmod/Assets/MenuCursor01.wav new file mode 100644 index 0000000..27823ee Binary files /dev/null and b/res/fmod/Assets/MenuCursor01.wav differ diff --git a/res/fmod/Assets/MenuValid01.wav b/res/fmod/Assets/MenuValid01.wav new file mode 100644 index 0000000..dc622d7 Binary files /dev/null and b/res/fmod/Assets/MenuValid01.wav differ diff --git a/res/fmod/Metadata/AudioFile/{223fc849-8f5c-4825-96ab-eab1343156dc}.xml b/res/fmod/Metadata/AudioFile/{223fc849-8f5c-4825-96ab-eab1343156dc}.xml new file mode 100644 index 0000000..2f96c53 --- /dev/null +++ b/res/fmod/Metadata/AudioFile/{223fc849-8f5c-4825-96ab-eab1343156dc}.xml @@ -0,0 +1,20 @@ + + + + + MenuValid01.wav + + + 44.0999985 + + + 1 + + + 0.24258503401360546 + + + {4c4e21c6-cc51-4a2c-b05e-fb67da4f7ed1} + + + diff --git a/res/fmod/Metadata/AudioFile/{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.xml b/res/fmod/Metadata/AudioFile/{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.xml new file mode 100644 index 0000000..c9d19d8 --- /dev/null +++ b/res/fmod/Metadata/AudioFile/{3e43e5bc-3c70-4234-87c4-9767fa6d2499}.xml @@ -0,0 +1,20 @@ + + + + + Jump01.wav + + + 44.0999985 + + + 1 + + + 0.21260770975056689 + + + {4c4e21c6-cc51-4a2c-b05e-fb67da4f7ed1} + + + diff --git a/res/fmod/Metadata/AudioFile/{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.xml b/res/fmod/Metadata/AudioFile/{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.xml new file mode 100644 index 0000000..7be2a55 --- /dev/null +++ b/res/fmod/Metadata/AudioFile/{5f809022-d9c3-4209-8dbf-dfb648b9f1c4}.xml @@ -0,0 +1,20 @@ + + + + + MenuCursor01.wav + + + 44.0999985 + + + 1 + + + 0.12063492063492064 + + + {4c4e21c6-cc51-4a2c-b05e-fb67da4f7ed1} + + + diff --git a/res/fmod/Metadata/AudioFile/{6ada1ede-de39-422a-b62a-f46d14ae1868}.xml b/res/fmod/Metadata/AudioFile/{6ada1ede-de39-422a-b62a-f46d14ae1868}.xml new file mode 100644 index 0000000..7b53bec --- /dev/null +++ b/res/fmod/Metadata/AudioFile/{6ada1ede-de39-422a-b62a-f46d14ae1868}.xml @@ -0,0 +1,20 @@ + + + + + Jump02.wav + + + 44.0999985 + + + 1 + + + 0.24480725623582766 + + + {4c4e21c6-cc51-4a2c-b05e-fb67da4f7ed1} + + + diff --git a/res/fmod/Metadata/Event/{071a4502-d1f7-464c-a3fb-57a183c4cab4}.xml b/res/fmod/Metadata/Event/{071a4502-d1f7-464c-a3fb-57a183c4cab4}.xml new file mode 100644 index 0000000..5ed523b --- /dev/null +++ b/res/fmod/Metadata/Event/{071a4502-d1f7-464c-a3fb-57a183c4cab4}.xml @@ -0,0 +1,128 @@ + + + + + menuselect + + + 0 + + + {b10a4c1b-72f0-4676-bbef-b450aaa46cb6} + + + {6cc21ffd-1cc7-4fba-8b25-dc22d527bf45} + + + {7df0f75b-07e3-48c0-9526-2749b20383da} + + + {3b5fbaa2-de8d-498d-8836-0deee6f90a0a} + + + {7f798dbf-9d7d-4674-965e-a7c4808dd1fa} + + + {3e120955-c4a9-478e-b784-01cba5d795af} + + + {7e91b1fb-b466-40b4-bf1d-d9452b46dfc8} + + + {8cff8eab-2c2e-4785-b92f-458b4a1e4bff} + + + {a23d2b1c-914e-48d4-8df9-80f6edad6c28} + + + + + {67243c44-2abc-462e-987a-6b7a4dc27f60} + + + + + {67243c44-2abc-462e-987a-6b7a4dc27f60} + + + + + {467ad434-80de-483a-a9d0-c2fa25032a8e} + + + {391753b5-2e2d-4eca-bd37-63113397e478} + + + {a028aeaa-4166-48ea-881f-bb967c81e6f1} + + + + + + + {53bb2b11-3105-47b3-aa6e-1faa64319499} + + + {8f0fdc50-c37e-4cbd-b7e5-c28b36cf933d} + + + + + {53bb2b11-3105-47b3-aa6e-1faa64319499} + + + + + {7281c837-7855-4c6a-884d-897653c130bd} + + + {46025233-27df-4800-aab1-be680116febc} + + + {6cc21ffd-1cc7-4fba-8b25-dc22d527bf45} + + + + + {ed5431d0-defa-48d8-acf6-b297d9e30ac6} + + + + + + 0.24258503401360546 + + + {223fc849-8f5c-4825-96ab-eab1343156dc} + + + + + Audio 1 + + + {bc06958b-c6c7-4537-b4a0-9e2815e5e700} + + + {4a645903-54ae-4daf-b2c7-137a239890e7} + + + {67243c44-2abc-462e-987a-6b7a4dc27f60} + + + + + {7c18ed28-8396-442c-aae5-730a95c6af74} + + + + + + + {a252672d-d5c2-439f-8a61-d109a56345bf} + + + + + + diff --git a/res/fmod/Metadata/Event/{5073fd94-9286-4fa1-87de-fee49c7ef309}.xml b/res/fmod/Metadata/Event/{5073fd94-9286-4fa1-87de-fee49c7ef309}.xml new file mode 100644 index 0000000..40b70ec --- /dev/null +++ b/res/fmod/Metadata/Event/{5073fd94-9286-4fa1-87de-fee49c7ef309}.xml @@ -0,0 +1,128 @@ + + + + + menucursor + + + 0 + + + {b10a4c1b-72f0-4676-bbef-b450aaa46cb6} + + + {421d31e7-396d-4632-b69a-86a16d53acc1} + + + {00de9fab-ae1a-4071-a0ba-3c9dd8a8a1e8} + + + {7af27bd4-4588-4bb0-9bda-8ec8a5a13d82} + + + {18f21bef-57b4-43aa-a263-f83a8c0c3dab} + + + {61e6ba1d-31af-4385-b4e8-023e06d11401} + + + {c6841aa9-f288-44ae-8a47-c57680c856f8} + + + {97841c1e-47f6-4ada-bfc9-c92c4919ece2} + + + {a23d2b1c-914e-48d4-8df9-80f6edad6c28} + + + + + {6fed7a7a-b346-4cfd-9aba-375538342920} + + + + + {6fed7a7a-b346-4cfd-9aba-375538342920} + + + + + {28ce5d18-6ca1-4fc2-960a-529fc119e355} + + + {31e4157d-3386-4c0b-b9d5-dc14323979e9} + + + {a028aeaa-4166-48ea-881f-bb967c81e6f1} + + + + + + + {b115edd2-8123-4808-9b3b-15c52e92487a} + + + {7cb7e8f7-cf3f-40de-a22e-da0bfde92db9} + + + + + {b115edd2-8123-4808-9b3b-15c52e92487a} + + + + + {738cb9ff-7057-40bd-91ce-5e276d59a2b6} + + + {2183e01c-f308-4b16-96fb-eb9adec3c7b1} + + + {421d31e7-396d-4632-b69a-86a16d53acc1} + + + + + {350925ce-e002-4afe-b90b-1de2378d3f35} + + + + + + 0.12063492063492064 + + + {5f809022-d9c3-4209-8dbf-dfb648b9f1c4} + + + + + Audio 1 + + + {896752b5-9837-4dcd-be3d-ed2bfc2c6f59} + + + {e975f6e7-699a-463c-8de1-d8f7ace49749} + + + {6fed7a7a-b346-4cfd-9aba-375538342920} + + + + + {31400021-665c-48cf-9f01-0efa8c006fe6} + + + + + + + {cb9a9e93-2d8a-4f9b-a145-b8e28ca5aaeb} + + + + + + diff --git a/res/fmod/Metadata/Event/{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.xml b/res/fmod/Metadata/Event/{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.xml new file mode 100644 index 0000000..c934a6e --- /dev/null +++ b/res/fmod/Metadata/Event/{c18dc3c5-456c-42a6-ae23-cfd1b5f22fd8}.xml @@ -0,0 +1,128 @@ + + + + + closemenu + + + 0 + + + {b10a4c1b-72f0-4676-bbef-b450aaa46cb6} + + + {1e4a6906-6e14-4727-a4f0-9067ffde0927} + + + {49f21566-c529-493b-86d7-377c39683fae} + + + {dd5c7b9d-f25e-451a-8a06-b601d57e0a38} + + + {3553fbf8-0f0a-4ca6-bfba-77c9a7ab8a68} + + + {d713641e-63f6-4fb7-a010-61b8a7a7d868} + + + {8899c655-b89a-48d9-88ca-1bb879cf23a1} + + + {7ea9470c-55bc-4ae5-ae64-f0ac6c761a8f} + + + {a23d2b1c-914e-48d4-8df9-80f6edad6c28} + + + + + {0d2a061b-3e5e-471b-acc3-af3b5857a9e5} + + + + + {0d2a061b-3e5e-471b-acc3-af3b5857a9e5} + + + + + {aa21513a-88e3-4bf2-be50-274ec99beeb2} + + + {8fbdb1af-f78c-43f0-8d25-c1d4011f1dbb} + + + {a028aeaa-4166-48ea-881f-bb967c81e6f1} + + + + + + + {e3066025-fe5d-4921-9797-8eb3e71ad669} + + + {af1977d5-3653-437c-a168-bc604872d523} + + + + + {e3066025-fe5d-4921-9797-8eb3e71ad669} + + + + + {3b190cad-1fe4-44b3-8e24-5e5a982501cd} + + + {777fe7cc-628a-4c48-b5f0-5abc306db8d1} + + + {1e4a6906-6e14-4727-a4f0-9067ffde0927} + + + + + {557b5a12-c5d7-47c8-85ca-af36564599eb} + + + + + + 0.24480725623582766 + + + {6ada1ede-de39-422a-b62a-f46d14ae1868} + + + + + Audio 1 + + + {a32eda5f-c555-47fb-a1d5-4f26384f0726} + + + {4243319e-568c-417a-b28c-eccbbce1988d} + + + {0d2a061b-3e5e-471b-acc3-af3b5857a9e5} + + + + + {0235c01a-09bd-4cfb-ae68-3bf1e7a1dcc5} + + + + + + + {9ab07a58-67bf-4842-bada-47ae28c93e65} + + + + + + diff --git a/res/fmod/Metadata/Event/{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.xml b/res/fmod/Metadata/Event/{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.xml new file mode 100644 index 0000000..fc045f9 --- /dev/null +++ b/res/fmod/Metadata/Event/{fea336e4-2204-45a2-9ee0-af4cb70b4f27}.xml @@ -0,0 +1,128 @@ + + + + + openmenu + + + 0 + + + {b10a4c1b-72f0-4676-bbef-b450aaa46cb6} + + + {9f3f5bfb-9650-4579-b4b8-0ee6e9e4ca7f} + + + {220ab1d3-7e25-4714-8dce-6b4f48822c2f} + + + {b0f5fa87-790e-43cd-b0d6-30bc9b025ae5} + + + {d0e3ae2c-5c7c-4f4c-bbbc-d9235ffa8a8c} + + + {d4d04dfd-a20c-4ce0-b81f-55411cc6ba8f} + + + {21a0b61a-8256-4ff8-bf47-9d8b438f0bb9} + + + {8d77dd4e-88a6-4f40-a4da-0ff9b399d764} + + + {a23d2b1c-914e-48d4-8df9-80f6edad6c28} + + + + + {a4878bca-1f26-4f04-a1a7-efce8de54795} + + + + + {a4878bca-1f26-4f04-a1a7-efce8de54795} + + + + + {c384d94c-b6a0-43bb-916d-590bb50bacc2} + + + {aa76d6d2-be9b-400c-9fac-0d0d99713186} + + + {a028aeaa-4166-48ea-881f-bb967c81e6f1} + + + + + + + {c58d6fbf-0455-439c-af4e-a15abfc5435f} + + + {c8122b59-45a7-4756-94f6-625ed9e16820} + + + + + {c58d6fbf-0455-439c-af4e-a15abfc5435f} + + + + + {4563e900-85b8-4646-818e-e1a495113068} + + + {98797e74-c137-480a-b038-f9a1c8285bd7} + + + {9f3f5bfb-9650-4579-b4b8-0ee6e9e4ca7f} + + + + + {72fe2bc3-a853-4fa0-bccb-f792e1f42949} + + + + + + 0.21260770975056689 + + + {3e43e5bc-3c70-4234-87c4-9767fa6d2499} + + + + + Audio 1 + + + {b24c9fb1-b17a-4bd3-868b-32862e8eabec} + + + {81a22f13-b8af-4980-b16b-566fcc07d513} + + + {a4878bca-1f26-4f04-a1a7-efce8de54795} + + + + + {b5af2eea-dd50-4603-95fa-d47f29935355} + + + + + + + {c22cf442-67f9-4ee3-b0d7-ebbb485c6934} + + + + + + diff --git a/res/menu.png b/res/menu.png new file mode 100644 index 0000000..4b6a7b9 Binary files /dev/null and b/res/menu.png differ diff --git a/res/menu.psd b/res/menu.psd new file mode 100644 index 0000000..0f588e8 Binary files /dev/null and b/res/menu.psd differ diff --git a/src/consts.h b/src/consts.h index ecb2306..4c69a58 100644 --- a/src/consts.h +++ b/src/consts.h @@ -15,5 +15,7 @@ constexpr int NUM_TITLES = 1; constexpr int MESSAGE_MARGIN = 64; constexpr int MESSAGE_TEXT_WIDTH = GAME_WIDTH - MESSAGE_MARGIN * 2; constexpr int CHARS_PER_BEEP = 8; +constexpr int MENU_PADDING = 40; +constexpr int MENU_BORDER = 2; #endif /* end of include guard: CONSTS_H_152EBF56 */ diff --git a/src/game.cpp b/src/game.cpp index f8508c2..501722d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -12,6 +12,7 @@ Game::Game(std::mt19937& rng, Muxer& muxer, Renderer& renderer) : rng(rng), muxer(muxer), + renderer(renderer), sign(renderer.getFont()) { losePopLampTimer.accumulate(losePopLampTimer.getDt()); @@ -740,13 +741,7 @@ void Game::updatePlaying(size_t frameTime) { { if (e.type == SDL_QUIT) { - if (losing != LoseState::None) - { - quit = true; - } else { - losing = LoseState::PoppingLamps; - muxer.stopMusic(); - } + quit = true; } else if (e.type == SDL_KEYDOWN) { switch (e.key.keysym.sym) @@ -755,10 +750,13 @@ void Game::updatePlaying(size_t frameTime) { { if (losing != LoseState::None) { - quit = true; + if (quitting) { + quit = true; + } else { + losing = LoseState::Done; + } } else { - losing = LoseState::PoppingLamps; - muxer.stopMusic(); + menu.open(*this); } break; @@ -922,11 +920,21 @@ void Game::updatePlaying(size_t frameTime) { { if (numDust == 0) { - quit = true; + if (quitting) { + quit = true; + } else { + losing = LoseState::Done; + } } break; } + + case LoseState::Done: + { + // Do nothing. + break; + } } switch (signInstructionState) { @@ -1035,7 +1043,9 @@ void Game::updatePlaying(size_t frameTime) { } void Game::update(size_t frameTime) { - if (sign.signDisplayState != SignInstructionState::Hidden) { + if (menu.menuState != MenuState::Closed) { + menu.update(frameTime, *this); + } else if (sign.signDisplayState != SignInstructionState::Hidden) { sign.update(frameTime, *this); } else { updatePlaying(frameTime); diff --git a/src/game.h b/src/game.h index 5f13672..839be67 100644 --- a/src/game.h +++ b/src/game.h @@ -12,6 +12,7 @@ #include "interpolation.h" #include "consts.h" #include "sign.h" +#include "menu.h" class Renderer; @@ -23,7 +24,8 @@ enum class LoseState { None, PoppingLamps, PoppingPlayer, - Outro + Outro, + Done }; struct Input { @@ -60,8 +62,10 @@ public: std::mt19937& rng; Muxer& muxer; + Renderer& renderer; bool quit = false; + bool quitting = false; // <- whether we will quit after losing, vs starting a new game LoseState losing = LoseState::None; Map map; @@ -110,6 +114,8 @@ public: Interpolation signFade; Sign sign; + Menu menu; + private: void tickDirty(bool onlyDark); diff --git a/src/main.cpp b/src/main.cpp index 2bd8f3c..ae64079 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "util.h" #include "game.h" #include "renderer.h" @@ -21,7 +22,7 @@ int main(int, char**) Renderer renderer; Muxer muxer; - Game game(rng, muxer, renderer); + std::unique_ptr game = std::make_unique(rng, muxer, renderer); constexpr int titleFadeLen = 2000; bool doneTitles = false; @@ -32,22 +33,26 @@ int main(int, char**) titleFade.start(titleFadeLen); size_t lastTime = SDL_GetTicks(); - while (!game.quit) + while (!game->quit) { size_t currentTime = SDL_GetTicks(); size_t frameTime = currentTime - lastTime; lastTime = currentTime; if (doneTitles) { - game.update(frameTime); - renderer.renderGame(game, true); + game->update(frameTime); + renderer.renderGame(*game, true); muxer.update(); + + if (game->losing == LoseState::Done) { + game = std::make_unique(rng, muxer, renderer); + } } else { SDL_Event e; while (SDL_PollEvent(&e)) { if (e.type == SDL_QUIT) { - game.quit = true; + game->quit = true; } } diff --git a/src/menu.cpp b/src/menu.cpp new file mode 100644 index 0000000..b9a3ace --- /dev/null +++ b/src/menu.cpp @@ -0,0 +1,109 @@ +#include "menu.h" +#include "game.h" +#include "renderer.h" + +Menu::Menu() { + items.push_back({.text = "New Game", .activationFunction = [this] (Game& game) { + close(); + game.losing = LoseState::PoppingLamps; + game.muxer.stopMusic(); + }}); + items.push_back({.text = "Toggle Fullscreen", .activationFunction = [] (Game& game) { + game.renderer.toggleFullscreen(); + }}); + items.push_back({.text = "Quit", .activationFunction = [this] (Game& game) { + close(); + game.losing = LoseState::PoppingLamps; + game.quitting = true; + game.muxer.stopMusic(); + }}); +} + +void Menu::open(Game& game) { + menuState = MenuState::Opening; + menuDisplayProgress.start(200); + game.muxer.playSound("openmenu"); +} + +void Menu::close() { + menuState = MenuState::Closing; + menuDisplayProgress.start(200); +} + +void Menu::update(size_t dt, Game& game) { + if (menuState != MenuState::Open) { + SDL_Event e; + + while (SDL_PollEvent(&e)) { + if (e.type == SDL_QUIT) { + game.quit = true; + } + } + } + + switch (menuState) { + case MenuState::Closed: { + // Shouldn't happen. + break; + } + case MenuState::Opening: { + menuDisplayProgress.tick(dt); + if (menuDisplayProgress.isComplete()) { + menuState = MenuState::Open; + } + + break; + } + case MenuState::Closing: { + menuDisplayProgress.tick(dt); + if (menuDisplayProgress.isComplete()) { + menuState = MenuState::Closed; + } + + break; + } + case MenuState::Open: { + SDL_Event e; + + while (SDL_PollEvent(&e)) { + if (e.type == SDL_QUIT) { + game.quit = true; + } else if (e.type == SDL_KEYDOWN) { + switch (e.key.keysym.sym) + { + case SDLK_ESCAPE: { + close(); + game.muxer.playSound("closemenu"); + break; + } + case SDLK_SPACE: { + items[cursor].activationFunction(game); + game.muxer.playSound("menuselect"); + break; + } + case SDLK_UP: + case SDLK_w: { + cursor--; + if (cursor < 0) { + cursor = items.size() - 1; + } + game.muxer.playSound("menucursor"); + break; + } + case SDLK_DOWN: + case SDLK_s: { + cursor++; + if (cursor >= items.size()) { + cursor = 0; + } + game.muxer.playSound("menucursor"); + break; + } + } + } + } + + break; + } + } +} diff --git a/src/menu.h b/src/menu.h new file mode 100644 index 0000000..ac72999 --- /dev/null +++ b/src/menu.h @@ -0,0 +1,42 @@ +#ifndef MENU_H_61DBBF6A +#define MENU_H_61DBBF6A + +#include +#include +#include +#include "interpolation.h" + +class Game; + +enum class MenuState { + Closed, + Opening, + Open, + Closing +}; + +struct MenuItem { + std::string text; + std::function activationFunction; +}; + +class Menu { +public: + + Menu(); + + void update(size_t dt, Game& game); + + void open(Game& game); + + MenuState menuState = MenuState::Closed; + Interpolation menuDisplayProgress; + std::vector items; + int cursor = 0; + +private: + + void close(); +}; + +#endif /* end of include guard: MENU_H_61DBBF6A */ diff --git a/src/renderer.cpp b/src/renderer.cpp index b90372e..1aa5cbf 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -16,8 +16,6 @@ Renderer::Renderer() GAME_HEIGHT, SDL_WINDOW_SHOWN)); - //SDL_SetWindowFullscreen(win_.get(), SDL_WINDOW_FULLSCREEN_DESKTOP); - if (!win_) { throw sdl_error(); @@ -111,6 +109,7 @@ Renderer::Renderer() loadTextureFromFile("../res/runninbloods.png", tileset_); loadTextureFromFile("../res/lamp.png", lamp_); loadTextureFromFile("../res/read_instruction.png", readInstruction_); + loadTextureFromFile("../res/menu.png", menuBg_); loadTextureFromFile("../res/title0.png", titles_[0]); SDL_QueryTexture(titles_[0].get(), nullptr, nullptr, &titleWidths_[0], &titleHeights_[0]); @@ -394,6 +393,20 @@ void Renderer::renderGame( SDL_RenderCopy(ren_.get(), canvas.get(), &zoomRect, nullptr); + texture_ptr overlays( + SDL_CreateTexture( + ren_.get(), + SDL_PIXELFORMAT_RGBA8888, + SDL_TEXTUREACCESS_TARGET, + GAME_WIDTH, + GAME_HEIGHT)); + + SDL_SetTextureBlendMode(overlays.get(), SDL_BLENDMODE_BLEND); + SDL_SetRenderTarget(ren_.get(), overlays.get()); + SDL_SetRenderDrawBlendMode(ren_.get(), SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawColor(ren_.get(), 0, 0, 0, 0); + SDL_RenderClear(ren_.get()); + if (game.signInstructionState != SignInstructionState::Hidden) { int instOpacity = 255; if (game.signInstructionState == SignInstructionState::FadingIn) { @@ -444,7 +457,7 @@ void Renderer::renderGame( srcRect.w, srcRect.h }; - SDL_SetRenderTarget(ren_.get(), nullptr); + SDL_SetRenderTarget(ren_.get(), overlays.get()); SDL_RenderCopy(ren_.get(), messageLines_[lineIndex].renderedTex.get(), &srcRect, &destRect); //std::cout << line.charsRevealed << " (" << messageLines_[lineIndex].charIndexToWidth[line.charsRevealed] << "): " << messageLines_[lineIndex].line.substr(0,line.charsRevealed) << std::endl; } @@ -455,6 +468,34 @@ void Renderer::renderGame( } } + if (game.menu.menuState != MenuState::Closed) { + if (!menu_ || menuSelected_ != game.menu.cursor) { + renderMenu(game); + } + + SDL_Rect rect { + 0, 0, GAME_WIDTH, GAME_HEIGHT + }; + + int opacity = 128; + if (game.menu.menuState == MenuState::Opening) { + opacity = game.menu.menuDisplayProgress.getProgress(0, 128); + rect.y = game.menu.menuDisplayProgress.getProgress(-GAME_HEIGHT, 0); + } else if (game.menu.menuState == MenuState::Closing) { + opacity = game.menu.menuDisplayProgress.getProgress(128, 0); + rect.y = game.menu.menuDisplayProgress.getProgress(0, -GAME_HEIGHT); + } + + SDL_SetRenderTarget(ren_.get(), overlays.get()); + SDL_SetRenderDrawBlendMode(ren_.get(), SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawColor(ren_.get(), 0, 0, 0, opacity); + SDL_RenderFillRect(ren_.get(), nullptr); + + SDL_RenderCopy(ren_.get(), menu_.get(), nullptr, &rect); + } + + SDL_SetRenderTarget(ren_.get(), nullptr); + SDL_RenderCopy(ren_.get(), overlays.get(), nullptr, nullptr); SDL_RenderPresent(ren_.get()); } @@ -550,3 +591,89 @@ void Renderer::renderMessageLine(MessageCache& line, const std::string& text, co SDL_RenderCopy(ren_.get(), lineTex.get(), nullptr, &rect); } +void Renderer::renderMenu(const Game& game) { + int maxTextWidth = 0; + for (const MenuItem& item : game.menu.items) { + int width = 0; + TTF_SizeText(font_.get(), item.text.c_str(), &width, nullptr); + if (width > maxTextWidth) { + maxTextWidth = width; + } + } + + menuWidth_ = maxTextWidth + MENU_PADDING * 2; + menuHeight_ = (TTF_FontHeight(font_.get()) + 1) * game.menu.items.size() - 1 + MENU_PADDING * 2; + + menu_.reset(SDL_CreateTexture( + ren_.get(), + SDL_PIXELFORMAT_RGBA8888, + SDL_TEXTUREACCESS_TARGET, + GAME_WIDTH, + GAME_HEIGHT)); + + SDL_SetRenderTarget(ren_.get(), menu_.get()); + SDL_SetTextureBlendMode(menu_.get(), SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawBlendMode(ren_.get(), SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawColor(ren_.get(), 0, 0, 0, 0); + SDL_RenderClear(ren_.get()); + + SDL_Color bgColor {.r = 55, .g = 55, .b = 87, .a = 255}; + SDL_Color fgColor {.r = 146, .g = 146, .b = 146, .a = 255}; + SDL_Color selectedColor {.r = 255, .g = 255, .b = 255, .a = 255}; + + /*{ + SDL_Rect drawRect { + (GAME_WIDTH - menuWidth_) / 2 - MENU_BORDER, + (GAME_HEIGHT - menuHeight_) / 2 - MENU_BORDER, + menuWidth_ + MENU_BORDER * 2, + menuHeight_ + MENU_BORDER * 2 + }; + + SDL_SetRenderDrawColor(ren_.get(), 200, 200, 200, 255); + SDL_RenderFillRect(ren_.get(), &drawRect); + } + + { + SDL_Rect drawRect { + (GAME_WIDTH - menuWidth_) / 2, + (GAME_HEIGHT - menuHeight_) / 2, + menuWidth_, + menuHeight_ + }; + + SDL_SetRenderDrawColor(ren_.get(), bgColor.r, bgColor.g, bgColor.b, 255); + SDL_RenderFillRect(ren_.get(), &drawRect); + + std::cout << "(" << drawRect.x << "," << drawRect.y << "),(" << drawRect.w << "," << drawRect.h << ")" << std::endl; + }*/ + + SDL_RenderCopy(ren_.get(), menuBg_.get(), nullptr, nullptr); + + for (int i=0; i < game.menu.items.size(); i++) { + const MenuItem& item = game.menu.items.at(i); + int width = 0; + TTF_SizeText(font_.get(), item.text.c_str(), &width, nullptr); + + surface_ptr lineSurf = surface_ptr(TTF_RenderText_Shaded(font_.get(), item.text.c_str(), game.menu.cursor == i ? selectedColor : fgColor, bgColor)); + texture_ptr lineTex = texture_ptr(SDL_CreateTextureFromSurface(ren_.get(), lineSurf.get())); + + SDL_Rect drawRect { + (GAME_WIDTH - width) / 2, + (GAME_HEIGHT - menuHeight_) / 2 + MENU_PADDING + (TTF_FontHeight(font_.get()) + 1) * i, + width, + TTF_FontHeight(font_.get()) + }; + SDL_RenderCopy(ren_.get(), lineTex.get(), nullptr, &drawRect); + } + + menuSelected_ = game.menu.cursor; +} + +void Renderer::toggleFullscreen() { + isFullscreen = !isFullscreen; + if (isFullscreen) { + SDL_SetWindowFullscreen(win_.get(), SDL_WINDOW_FULLSCREEN_DESKTOP); + } else { + SDL_SetWindowFullscreen(win_.get(), 0); + } +} diff --git a/src/renderer.h b/src/renderer.h index ce2e7e1..8a74c3c 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -165,6 +165,8 @@ public: TTF_Font* getFont() { return font_.get(); } + void toggleFullscreen(); + private: void loadTextureFromFile(std::string_view path, texture_ptr& texture); @@ -183,6 +185,7 @@ private: texture_ptr tileset_; texture_ptr lamp_; texture_ptr readInstruction_; + texture_ptr menuBg_; std::array titles_; std::array titleWidths_; @@ -199,6 +202,15 @@ private: void renderMessageLine(MessageCache& line, const std::string& text, const Game& game); MessageCache messageLines_[2]; + + bool isFullscreen = false; + + void renderMenu(const Game& game); + + texture_ptr menu_; + int menuWidth_ = 0; + int menuHeight_ = 0; + int menuSelected_ = 0; }; #endif /* end of include guard: RENDERER_H_6A58EC30 */ -- cgit 1.4.1