summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/web-build.yml62
-rw-r--r--.gitignore7
-rw-r--r--CMakeLists.txt211
-rw-r--r--LICENSE674
-rw-r--r--assets/audio/sfx/.gitkeep0
-rw-r--r--assets/audio/sfx/buttonClick.wavbin0 -> 1432 bytes
-rw-r--r--assets/audio/sfx/death.wavbin0 -> 3096 bytes
-rw-r--r--assets/audio/sfx/shoot.wavbin0 -> 139 bytes
-rw-r--r--assets/font/font.otfbin0 -> 9084 bytes
-rw-r--r--assets/font/score.otfbin0 -> 1376 bytes
-rw-r--r--assets/img/.gitkeep0
-rw-r--r--assets/img/arrowhead.pngbin0 -> 1060 bytes
-rw-r--r--assets/img/cirno-hurt.pngbin0 -> 5649 bytes
-rw-r--r--assets/img/cirno-joy.pngbin0 -> 5521 bytes
-rw-r--r--assets/img/cirno-laugh.pngbin0 -> 6104 bytes
-rw-r--r--assets/img/cirno-neutral.pngbin0 -> 5978 bytes
-rw-r--r--assets/img/cirno-pissed.pngbin0 -> 6138 bytes
-rw-r--r--assets/img/cirno-relaxed.pngbin0 -> 6000 bytes
-rw-r--r--assets/img/cirno-tiered.pngbin0 -> 5998 bytes
-rw-r--r--assets/img/cirno-wow.pngbin0 -> 5972 bytes
-rw-r--r--assets/img/flower.pngbin0 -> 494 bytes
-rw-r--r--assets/img/forest.pngbin0 -> 3816 bytes
-rw-r--r--assets/img/forest2.pngbin0 -> 3777 bytes
-rw-r--r--assets/img/inside.pngbin0 -> 5764 bytes
-rw-r--r--assets/img/menu.pngbin0 -> 5091 bytes
-rw-r--r--assets/img/outside.pngbin0 -> 11672 bytes
-rw-r--r--assets/img/outside2.pngbin0 -> 11489 bytes
-rw-r--r--assets/img/talk.pngbin0 -> 1968 bytes
-rw-r--r--assets/shader/snow.fs49
-rw-r--r--game/CMakeLists.txt13
-rw-r--r--game/bounding.hpp21
-rw-r--r--game/graphics.hpp93
-rw-r--r--game/story.hpp176
-rw-r--r--lib/CMakeLists.txt13
-rw-r--r--lib/assetManager.cpp60
-rw-r--r--lib/assetManager.hpp18
-rw-r--r--lib/button.cpp149
-rw-r--r--lib/button.hpp32
-rw-r--r--lib/dialogue.cpp94
-rw-r--r--lib/dialogue.hpp11
-rw-r--r--lib/gameState.hpp110
-rw-r--r--lib/standard.cpp93
-rw-r--r--lib/standard.hpp14
-rw-r--r--main.cpp162
-rw-r--r--screen/gameplay.cpp38
-rw-r--r--screen/main_menu.cpp43
-rwxr-xr-xscripts/build.sh6
-rwxr-xr-xscripts/build_web.sh19
-rwxr-xr-xscripts/build_web_prod.sh13
-rw-r--r--test/probablity.cpp18
-rw-r--r--web/shell.html405
-rw-r--r--web/static/yinyang.svg4
52 files changed, 2608 insertions, 0 deletions
diff --git a/.github/workflows/web-build.yml b/.github/workflows/web-build.yml
new file mode 100644
index 0000000..5c2564e
--- /dev/null
+++ b/.github/workflows/web-build.yml
@@ -0,0 +1,62 @@
+name: Build WebAssembly
+
+on:
+ push:
+ branches: ["main", "master"]
+ pull_request:
+ branches: ["main", "master"]
+ workflow_dispatch:
+
+jobs:
+ build-web:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+
+ - name: Install System Dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y imagemagick ffmpeg
+
+ - name: Install Go Minify
+ run: |
+ go install github.com/tdewolff/minify/v2/cmd/minify@latest
+ echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
+
+ - name: Clone Raylib
+ run: |
+ mkdir -p temp
+ git clone --depth 1 https://github.com/raysan5/raylib.git temp/raylib_source
+
+ - name: Setup Emscripten
+ uses: mymindstorm/setup-emsdk@v14
+ with:
+ version: latest
+ actions-cache-folder: "emsdk-cache"
+
+ - name: Configure CMake
+ run: emcmake cmake -S . -B build-web -DCMAKE_BUILD_TYPE=Release
+
+ - name: Build Project
+ run: cmake --build build-web --parallel
+
+ - name: Prepare Distribution Folder
+ run: |
+ mkdir -p dist
+
+ cp build-web/cirno_day.html dist/index.html
+ cp build-web/cirno_day.js dist/
+ cp build-web/cirno_day.wasm dist/
+ cp build-web/cirno_day.data dist/
+
+ if [ -d "build-web/static" ]; then
+ cp -r build-web/static dist/
+ fi
+
+ - name: Upload Web Build Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: touhou-pride-jam-web
+ path: dist/
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b293ab4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+build/
+build-web/
+temp/
+test/a.out
+compile_commands.json
+.clangd
+.cache
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..8db7e54
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,211 @@
+cmake_minimum_required(VERSION 3.18)
+project(cirno_day LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD 23)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+add_executable(cirno_day
+ main.cpp
+)
+
+target_include_directories(cirno_day PRIVATE "${CMAKE_SOURCE_DIR}")
+
+add_subdirectory(lib)
+# add_subdirectory(screen)
+add_subdirectory(game)
+
+set(PROCESSED_ASSETS_DIR "${CMAKE_BINARY_DIR}/assets")
+file(GLOB_RECURSE ASSET_FILES RELATIVE "${CMAKE_SOURCE_DIR}/assets" "${CMAKE_SOURCE_DIR}/assets/*")
+
+find_program(MAGICK_TOOL NAMES magick)
+find_program(CONVERT_TOOL NAMES convert)
+find_program(FFMPEG_TOOL NAMES ffmpeg)
+find_program(MINIFY_TOOL NAMES minify)
+
+set(ASSET_OUTPUTS)
+foreach(ASSET_REL ${ASSET_FILES})
+ set(ASSET_SRC "${CMAKE_SOURCE_DIR}/assets/${ASSET_REL}")
+ set(ASSET_DST "${PROCESSED_ASSETS_DIR}/${ASSET_REL}")
+ get_filename_component(ASSET_DST_DIR "${ASSET_DST}" DIRECTORY)
+ string(TOLOWER "${ASSET_REL}" ASSET_REL_LOWER)
+
+ if(ASSET_REL_LOWER MATCHES "\\.(png|jpg|jpeg)$")
+ if(MAGICK_TOOL)
+ add_custom_command(
+ OUTPUT "${ASSET_DST}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${ASSET_DST_DIR}"
+ COMMAND "${MAGICK_TOOL}" convert "${ASSET_SRC}" -strip -quality 80 "${ASSET_DST}"
+ DEPENDS "${ASSET_SRC}"
+ COMMENT "Compressing image ${ASSET_REL}"
+ VERBATIM
+ )
+ elseif(CONVERT_TOOL)
+ add_custom_command(
+ OUTPUT "${ASSET_DST}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${ASSET_DST_DIR}"
+ COMMAND "${CONVERT_TOOL}" "${ASSET_SRC}" -strip -quality 80 "${ASSET_DST}"
+ DEPENDS "${ASSET_SRC}"
+ COMMENT "Compressing image ${ASSET_REL}"
+ VERBATIM
+ )
+ else()
+ add_custom_command(
+ OUTPUT "${ASSET_DST}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${ASSET_DST_DIR}"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ASSET_SRC}" "${ASSET_DST}"
+ DEPENDS "${ASSET_SRC}"
+ COMMENT "Image tool not found, copying ${ASSET_REL}"
+ VERBATIM
+ )
+ endif()
+#[[
+ elseif(ASSET_REL_LOWER MATCHES "\\.wav$")
+ if(FFMPEG_TOOL)
+ if(ASSET_REL_LOWER STREQUAL "audio/sfx/radio_static.wav")
+ # Raylib streaming is sensitive to this file with aggressive ADPCM compression.
+ # Keep a safer/light transform for stability on both native + web.
+ add_custom_command(
+ OUTPUT "${ASSET_DST}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${ASSET_DST_DIR}"
+ COMMAND "${FFMPEG_TOOL}" -y -loglevel error -i "${ASSET_SRC}" -ac 1 -ar 22050 -c:a pcm_s16le "${ASSET_DST}"
+ DEPENDS "${ASSET_SRC}"
+ COMMENT "Converting radio static with safe WAV settings ${ASSET_REL}"
+ VERBATIM
+ )
+ else()
+ add_custom_command(
+ OUTPUT "${ASSET_DST}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${ASSET_DST_DIR}"
+ COMMAND "${FFMPEG_TOOL}" -y -loglevel error -i "${ASSET_SRC}" -ac 1 -ar 22050 -c:a adpcm_ima_wav "${ASSET_DST}"
+ DEPENDS "${ASSET_SRC}"
+ COMMENT "Compressing audio ${ASSET_REL}"
+ VERBATIM
+ )
+ endif()
+
+ else()
+ add_custom_command(
+ OUTPUT "${ASSET_DST}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${ASSET_DST_DIR}"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ASSET_SRC}" "${ASSET_DST}"
+ DEPENDS "${ASSET_SRC}"
+ COMMENT "ffmpeg not found, copying ${ASSET_REL}"
+ VERBATIM
+ )
+ endif()
+]]
+
+ else()
+ add_custom_command(
+ OUTPUT "${ASSET_DST}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${ASSET_DST_DIR}"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ASSET_SRC}" "${ASSET_DST}"
+ DEPENDS "${ASSET_SRC}"
+ COMMENT "Copying asset ${ASSET_REL}"
+ VERBATIM
+ )
+ endif()
+
+ list(APPEND ASSET_OUTPUTS "${ASSET_DST}")
+endforeach()
+
+add_custom_target(prepare_assets ALL DEPENDS ${ASSET_OUTPUTS})
+add_dependencies(cirno_day prepare_assets)
+
+find_library(RAYLIB NAMES raylib HINTS "/usr/local/lib")
+
+if (EMSCRIPTEN)
+ set(BUILD_EXAMPLES OFF CACHE BOOL "Disable raylib examples" FORCE)
+ set(BUILD_GAMES OFF CACHE BOOL "Disable raylib games" FORCE)
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build raylib statically for web" FORCE)
+ set(BUILD_TESTING OFF CACHE BOOL "Disable raylib tests" FORCE)
+ set(PLATFORM_DESKTOP OFF CACHE BOOL "Disable desktop raylib platform" FORCE)
+ set(PLATFORM Web CACHE STRING "Platform to build for." FORCE)
+
+ add_subdirectory("${CMAKE_SOURCE_DIR}/temp/raylib_source" "${CMAKE_BINARY_DIR}/raylib" EXCLUDE_FROM_ALL)
+ target_compile_options(raylib PRIVATE
+ "$<$<CONFIG:Release>:-Oz>"
+ "$<$<CONFIG:Release>:-flto>"
+ )
+
+ # set_property(TARGET raylib PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
+
+ set_source_files_properties(
+ "${CMAKE_SOURCE_DIR}/temp/raylib_source/src/raudio.c"
+ TARGET_DIRECTORY raylib
+ PROPERTIES COMPILE_OPTIONS "-fno-lto;-fno-strict-aliasing"
+ )
+
+ set(WEB_SHELL_ASSET_SRC "${CMAKE_SOURCE_DIR}/web/static/yinyang.svg")
+ set(WEB_SHELL_ASSET_DST "${CMAKE_BINARY_DIR}/static/yinyang.svg")
+ if (NOT EXISTS "${WEB_SHELL_ASSET_SRC}")
+ message(FATAL_ERROR "Web shell asset not found: ${WEB_SHELL_ASSET_SRC}")
+ endif()
+
+ target_link_libraries(cirno_day PRIVATE raylib)
+ add_custom_command(
+ OUTPUT "${WEB_SHELL_ASSET_DST}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/assets"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${WEB_SHELL_ASSET_SRC}" "${WEB_SHELL_ASSET_DST}"
+ DEPENDS "${WEB_SHELL_ASSET_SRC}"
+ COMMENT "Copying web shell asset yinyang.svg"
+ VERBATIM
+ )
+ add_custom_target(prepare_web_shell_assets ALL DEPENDS "${WEB_SHELL_ASSET_DST}")
+ add_dependencies(cirno_day prepare_web_shell_assets)
+
+ set_target_properties(cirno_day PROPERTIES SUFFIX ".html")
+ set_property(TARGET cirno_day APPEND PROPERTY LINK_DEPENDS "${CMAKE_SOURCE_DIR}/web/shell.html")
+ target_link_options(cirno_day PRIVATE
+ "-sUSE_GLFW=3"
+ "--shell-file" "${CMAKE_SOURCE_DIR}/web/shell.html"
+ "--preload-file" "${PROCESSED_ASSETS_DIR}@/assets"
+ )
+ target_compile_options(cirno_day PRIVATE
+ "$<$<CONFIG:Release>:-Oz>"
+ "$<$<CONFIG:Release>:-flto>"
+ "$<$<CONFIG:Release>:-fno-exceptions>"
+ "$<$<CONFIG:Release>:-fno-rtti>"
+)
+
+ target_link_options(cirno_day PRIVATE
+ "$<$<CONFIG:Release>:-Oz>"
+ "$<$<CONFIG:Release>:-flto>"
+ "$<$<CONFIG:Release>:-ffast-math>"
+ "$<$<CONFIG:Release>:-sASSERTIONS=0>"
+ "$<$<CONFIG:Release>:-sSAFE_HEAP=0>"
+ "$<$<CONFIG:Release>:-sENVIRONMENT=web>"
+ "$<$<CONFIG:Release>:--closure=1>"
+
+ # remove webgl strings
+ "$<$<CONFIG:Release>:-sGL_TRACK_ERRORS=0>"
+ "$<$<CONFIG:Release>:-sDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1>"
+
+ # limit memory usage to 192mb
+ "$<$<CONFIG:Release>:-sALLOW_MEMORY_GROWTH=0>"
+ "$<$<CONFIG:Release>:-sINITIAL_MEMORY=201326592>"
+
+ "$<$<CONFIG:Release>:-sEXPORTED_RUNTIME_METHODS=ccall,cwrap,setCanvasSize>"
+
+ "$<$<CONFIG:Release>:-sEXPORTED_FUNCTIONS=_main>"
+)
+ if (MINIFY_TOOL)
+ add_custom_command(
+ TARGET cirno_day
+ POST_BUILD
+ COMMAND "${MINIFY_TOOL}" -q -i "${CMAKE_CURRENT_BINARY_DIR}/cirno_day.html"
+ COMMENT "Minifying Emscripten outputs"
+ VERBATIM
+ )
+ endif()
+elseif(RAYLIB)
+ target_link_libraries(cirno_day PRIVATE raylib)
+else()
+ find_package(raylib REQUIRED)
+ target_link_libraries(cirno_day PRIVATE raylib)
+endif()
+
+if (UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
+ target_link_libraries(cirno_day PRIVATE m pthread dl rt X11)
+endif()
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..e62ec04
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU 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.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU 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/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/assets/audio/sfx/.gitkeep b/assets/audio/sfx/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/assets/audio/sfx/.gitkeep
diff --git a/assets/audio/sfx/buttonClick.wav b/assets/audio/sfx/buttonClick.wav
new file mode 100644
index 0000000..68e8ef1
--- /dev/null
+++ b/assets/audio/sfx/buttonClick.wav
Binary files differ
diff --git a/assets/audio/sfx/death.wav b/assets/audio/sfx/death.wav
new file mode 100644
index 0000000..ed686c7
--- /dev/null
+++ b/assets/audio/sfx/death.wav
Binary files differ
diff --git a/assets/audio/sfx/shoot.wav b/assets/audio/sfx/shoot.wav
new file mode 100644
index 0000000..a3ecac6
--- /dev/null
+++ b/assets/audio/sfx/shoot.wav
Binary files differ
diff --git a/assets/font/font.otf b/assets/font/font.otf
new file mode 100644
index 0000000..ff5b2bd
--- /dev/null
+++ b/assets/font/font.otf
Binary files differ
diff --git a/assets/font/score.otf b/assets/font/score.otf
new file mode 100644
index 0000000..511350b
--- /dev/null
+++ b/assets/font/score.otf
Binary files differ
diff --git a/assets/img/.gitkeep b/assets/img/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/assets/img/.gitkeep
diff --git a/assets/img/arrowhead.png b/assets/img/arrowhead.png
new file mode 100644
index 0000000..a703863
--- /dev/null
+++ b/assets/img/arrowhead.png
Binary files differ
diff --git a/assets/img/cirno-hurt.png b/assets/img/cirno-hurt.png
new file mode 100644
index 0000000..867c182
--- /dev/null
+++ b/assets/img/cirno-hurt.png
Binary files differ
diff --git a/assets/img/cirno-joy.png b/assets/img/cirno-joy.png
new file mode 100644
index 0000000..ce11a33
--- /dev/null
+++ b/assets/img/cirno-joy.png
Binary files differ
diff --git a/assets/img/cirno-laugh.png b/assets/img/cirno-laugh.png
new file mode 100644
index 0000000..b35f83b
--- /dev/null
+++ b/assets/img/cirno-laugh.png
Binary files differ
diff --git a/assets/img/cirno-neutral.png b/assets/img/cirno-neutral.png
new file mode 100644
index 0000000..8a402e2
--- /dev/null
+++ b/assets/img/cirno-neutral.png
Binary files differ
diff --git a/assets/img/cirno-pissed.png b/assets/img/cirno-pissed.png
new file mode 100644
index 0000000..25ce6cb
--- /dev/null
+++ b/assets/img/cirno-pissed.png
Binary files differ
diff --git a/assets/img/cirno-relaxed.png b/assets/img/cirno-relaxed.png
new file mode 100644
index 0000000..d5342ff
--- /dev/null
+++ b/assets/img/cirno-relaxed.png
Binary files differ
diff --git a/assets/img/cirno-tiered.png b/assets/img/cirno-tiered.png
new file mode 100644
index 0000000..016216c
--- /dev/null
+++ b/assets/img/cirno-tiered.png
Binary files differ
diff --git a/assets/img/cirno-wow.png b/assets/img/cirno-wow.png
new file mode 100644
index 0000000..f3a9017
--- /dev/null
+++ b/assets/img/cirno-wow.png
Binary files differ
diff --git a/assets/img/flower.png b/assets/img/flower.png
new file mode 100644
index 0000000..619c32c
--- /dev/null
+++ b/assets/img/flower.png
Binary files differ
diff --git a/assets/img/forest.png b/assets/img/forest.png
new file mode 100644
index 0000000..b31366a
--- /dev/null
+++ b/assets/img/forest.png
Binary files differ
diff --git a/assets/img/forest2.png b/assets/img/forest2.png
new file mode 100644
index 0000000..83380f8
--- /dev/null
+++ b/assets/img/forest2.png
Binary files differ
diff --git a/assets/img/inside.png b/assets/img/inside.png
new file mode 100644
index 0000000..4cb4d4c
--- /dev/null
+++ b/assets/img/inside.png
Binary files differ
diff --git a/assets/img/menu.png b/assets/img/menu.png
new file mode 100644
index 0000000..56c6354
--- /dev/null
+++ b/assets/img/menu.png
Binary files differ
diff --git a/assets/img/outside.png b/assets/img/outside.png
new file mode 100644
index 0000000..056e4bf
--- /dev/null
+++ b/assets/img/outside.png
Binary files differ
diff --git a/assets/img/outside2.png b/assets/img/outside2.png
new file mode 100644
index 0000000..f741360
--- /dev/null
+++ b/assets/img/outside2.png
Binary files differ
diff --git a/assets/img/talk.png b/assets/img/talk.png
new file mode 100644
index 0000000..6585ea4
--- /dev/null
+++ b/assets/img/talk.png
Binary files differ
diff --git a/assets/shader/snow.fs b/assets/shader/snow.fs
new file mode 100644
index 0000000..acb4a59
--- /dev/null
+++ b/assets/shader/snow.fs
@@ -0,0 +1,49 @@
+// Copyright (c) 2013 Andrew Baldwin (twitter: baldand, www: http://thndl.com)
+// License = Attribution-NonCommercial-ShareAlike (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US)
+
+// "Just snow"
+// Simple (but not cheap) snow made from multiple parallax layers with randomly positioned
+// flakes and directions. Also includes a DoF effect. Pan around with mouse.
+
+#define LIGHT_SNOW // Comment this out for a blizzard
+
+#ifdef LIGHT_SNOW
+ #define LAYERS 50
+ #define DEPTH .5
+ #define WIDTH .3
+ #define SPEED .6
+#else // BLIZZARD
+ #define LAYERS 200
+ #define DEPTH .1
+ #define WIDTH .8
+ #define SPEED 1.5
+#endif
+
+precision mediump float;
+
+uniform float iTime;
+uniform vec2 iResolution;
+uniform vec2 iMouse;
+
+void main()
+{
+ const mat3 p = mat3(13.323122,23.5112,21.71123,21.1212,28.7312,11.9312,21.8112,14.7212,61.3934);
+ vec2 uv = iMouse.xy/iResolution.xy + vec2(1.,iResolution.y/iResolution.x)*gl_FragCoord.xy / iResolution.xy;
+ vec3 acc = vec3(0.0);
+ float dof = 5.*sin(iTime*.1);
+ for (int i=0;i<LAYERS;i++) {
+ float fi = float(i);
+ vec2 q = uv*(1.+fi*DEPTH);
+ q += vec2(q.y*(WIDTH*mod(fi*7.238917,1.)-WIDTH*.5),SPEED*iTime/(1.+fi*DEPTH*.03));
+ vec3 n = vec3(floor(q),31.189+fi);
+ vec3 m = floor(n)*.00001 + fract(n);
+ vec3 mp = (31415.9+m)/fract(p*m);
+ vec3 r = fract(mp);
+ vec2 s = abs(mod(q,1.)-.5+.9*r.xy-.45);
+ s += .01*abs(2.*fract(10.*q.yx)-1.);
+ float d = .6*max(s.x-s.y,s.x+s.y)+max(s.x,s.y)-.01;
+ float edge = .005+.05*min(.5*abs(fi-5.-dof),1.);
+ acc += vec3(smoothstep(edge,-edge,d)*(r.x/(1.+.02*fi*DEPTH)));
+ }
+ gl_FragColor = vec4(vec3(acc),1.0);
+}
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
new file mode 100644
index 0000000..ac6fc76
--- /dev/null
+++ b/game/CMakeLists.txt
@@ -0,0 +1,13 @@
+file(GLOB_RECURSE GAME_SOURCES CONFIGURE_DEPENDS
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.cc"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx"
+)
+
+file(GLOB_RECURSE GAME_HEADERS CONFIGURE_DEPENDS
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.hh"
+)
+
+target_sources(cirno_day PRIVATE ${GAME_SOURCES} ${GAME_HEADERS})
diff --git a/game/bounding.hpp b/game/bounding.hpp
new file mode 100644
index 0000000..012729a
--- /dev/null
+++ b/game/bounding.hpp
@@ -0,0 +1,21 @@
+#include <raylib.h>
+#include "../lib/gameState.hpp"
+#define UI_PADDING_BOTTOM 10
+#define UI_BUTTON_SIZE 32
+
+inline Rectangle Calendar = {170, 65, 40, 45};
+inline Rectangle Forehead = {80, 190, 58, 50};
+inline Rectangle Chest = {75, 130, 70, 50};
+inline Rectangle Futton = {145, 190, 80, 110};
+
+inline Rectangle YokaiMountain = {0, 0, 225, 128};
+inline Rectangle Igloo = {130, 160, 100, 90};
+inline Rectangle MistyLake = {0, 128, 225, 32};
+inline Rectangle Flower = {25, 350, 47, 47};
+
+inline Rectangle Frog = {32, 270, 55, 45};
+inline Rectangle RiceCake = {160, 180, 64, 100};
+
+// UI components
+inline Rectangle UI_arrowBtn = {(int)(VIRTUAL_SCREEN_W/3)*2 + UI_BUTTON_SIZE/2.0f ,VIRTUAL_SCREEN_H - UI_BUTTON_SIZE - UI_PADDING_BOTTOM, 32, 32};
+inline Rectangle UI_talkBtn = {(int)(VIRTUAL_SCREEN_W/2) - 88.0f/2,VIRTUAL_SCREEN_H - UI_BUTTON_SIZE - UI_PADDING_BOTTOM,88, 32};
diff --git a/game/graphics.hpp b/game/graphics.hpp
new file mode 100644
index 0000000..b4ff3b0
--- /dev/null
+++ b/game/graphics.hpp
@@ -0,0 +1,93 @@
+#include <raylib.h>
+#include <cmath>
+#include <raymath.h>
+
+#include "lib/gameState.hpp"
+
+#define CIRNO_SPRITE_POSITION {-26, 156}
+
+constexpr float TRANSITION_TIME = 1.5f; // in seconds
+
+inline void drawCirno(GameState &gs) {
+ switch (gs.curExp) {
+ case NEUTRAL:
+ DrawTextureV(gs.AssetManager.load("cirno-neutral"), CIRNO_SPRITE_POSITION, WHITE);
+ break;
+ case PISSED:
+ DrawTextureV(gs.AssetManager.load("cirno-pissed"), CIRNO_SPRITE_POSITION, WHITE);
+ break;
+ case HURT:
+ DrawTextureV(gs.AssetManager.load("cirno-hurt"), CIRNO_SPRITE_POSITION, WHITE);
+ break;
+ case JOY:
+ DrawTextureV(gs.AssetManager.load("cirno-joy"), CIRNO_SPRITE_POSITION, WHITE);
+ break;
+ case WOW:
+ DrawTextureV(gs.AssetManager.load("cirno-wow"), CIRNO_SPRITE_POSITION, WHITE);
+ break;
+ case TIERED:
+ DrawTextureV(gs.AssetManager.load("cirno-tiered"), CIRNO_SPRITE_POSITION, WHITE);
+ break;
+ case LAUGH:
+ DrawTextureV(gs.AssetManager.load("cirno-laugh"), CIRNO_SPRITE_POSITION, WHITE);
+ break;
+ case RELAXED:
+ DrawTextureV(gs.AssetManager.load("cirno-relaxed"), CIRNO_SPRITE_POSITION, WHITE);
+ break;
+ }
+}
+
+inline Texture2D getCurrentScene(GameState &gs) {
+ switch (gs.curPos) {
+ case INSIDE:
+ return gs.AssetManager.load("inside");
+ break;
+ case OUTSIDE:
+ return gs.AssetManager.load(gs.flowerOnHead ? "outside2" : "outside");
+ break;
+ case FOREST:
+ return gs.AssetManager.load(gs.riceCakeEaten ? "forest2" : "forest");
+ break;
+ case MENU:
+ return gs.AssetManager.load("menu");
+ }
+};
+
+inline Texture2D getCurrentScene(GameState &gs, POSITION scene) {
+ switch (scene) {
+ case INSIDE:
+ return gs.AssetManager.load("inside");
+ break;
+ case OUTSIDE:
+ return gs.AssetManager.load(gs.flowerOnHead ? "outside2" : "outside");
+ break;
+ case FOREST:
+ return gs.AssetManager.load(gs.riceCakeEaten ? "forest2" : "forest");
+ break;
+ case MENU:
+ return gs.AssetManager.load("menu");
+ }
+};
+
+inline void DrawSceneChange(GameState &gs) {
+ if (gs.timeSinceSceneChange < TRANSITION_TIME) {
+ float t = Clamp(gs.timeSinceSceneChange / TRANSITION_TIME, 0.0f, 1.0f);
+ float a = 0.5f - 0.5f * cosf(t * PI);
+ DrawTextureV(getCurrentScene(gs, gs.prevPos),
+ ZERO_VEC,
+ ColorAlpha(WHITE, 1.0f - a));
+
+ DrawTextureV(getCurrentScene(gs, gs.curPos),
+ ZERO_VEC,
+ ColorAlpha(WHITE, a));
+ gs.timeSinceSceneChange = gs.timeSinceSceneChange + GetFrameTime();
+ } else {
+ gs.timeSinceSceneChange = -1.0f;
+ }
+}
+
+inline void changeSceneTo(GameState &gs, POSITION scene) {
+ gs.timeSinceSceneChange = 0;
+ gs.prevPos = gs.curPos;
+ gs.curPos = scene;
+}
diff --git a/game/story.hpp b/game/story.hpp
new file mode 100644
index 0000000..ef06d13
--- /dev/null
+++ b/game/story.hpp
@@ -0,0 +1,176 @@
+#include "lib/gameState.hpp"
+#include "lib/dialogue.hpp"
+
+#include "bounding.hpp"
+#include "graphics.hpp"
+#include "raylib.h"
+
+#define CIRNO_DIALOG "Cirno",
+
+inline void ProcessClick(GameState &gs) {
+ if (CheckCollisionPointRec(gs.currentMousePos, Forehead)) {
+ if (gs.flickCount == 0) {
+ SayDialog(gs, std::vector<Dialogues>{
+ {CIRNO_DIALOG HURT, "owww"},
+ {CIRNO_DIALOG PISSED, "it hurts. You are mean!"},
+ {CIRNO_DIALOG PISSED, "Why did you do that?"}
+ });
+ } else if (gs.flickCount == 1) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG HURT, "You did it again!"},
+ {CIRNO_DIALOG PISSED, "Owww, it hurts.\nStop it!"},
+ });
+ } else if (gs.flickCount == 2) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG PISSED, "No, I won't let you\ndo it again"},
+ {CIRNO_DIALOG PISSED, "You meanie!!"},
+ });
+ gs.explored.insert(1);
+ }
+ gs.flickCount++;
+ }
+ else if (CheckCollisionPointRec(gs.currentMousePos, UI_arrowBtn)) {
+ if (gs.curPos == INSIDE) {
+ changeSceneTo(gs, OUTSIDE);
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "This is where I live"},
+ });
+ gs.explored.insert(2);
+ } else if (gs.curPos == OUTSIDE) {
+ changeSceneTo(gs, FOREST);
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG LAUGH, "Let's freeze some\nfrogs!"},
+ });
+ gs.explored.insert(3);
+ } else if (gs.curPos == FOREST) {
+ changeSceneTo(gs, INSIDE);
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG RELAXED, "Back in sweet cozy\nhome!"}
+ });
+ gs.explored.insert(4);
+ }
+ } else if (CheckCollisionPointRec(gs.currentMousePos, UI_talkBtn)) {
+ if (!gs.usedTalkButton) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG RELAXED, "Good Morning"},
+ });
+ gs.usedTalkButton = true;
+ } else {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG JOY, "Having lots of fun is\nwhat matters."},
+ {CIRNO_DIALOG RELAXED, "Imagine having no fun\nand being grumpy\nall the time."},
+ {CIRNO_DIALOG JOY, "Next time, when you come,\nwe can play together."},
+ {CIRNO_DIALOG JOY, "With Daiyousei and\nthe other fairies."},
+ {CIRNO_DIALOG RELAXED, "It would be nice if\nwinter comes soon."},
+ {CIRNO_DIALOG JOY, "I want to skate on the\nmisty lake with Letty."},
+ {CIRNO_DIALOG WOW, "I am the smartest\nin Gensokyo."},
+ {CIRNO_DIALOG WOW, "I can add and multiply\nfractions!"},
+ {CIRNO_DIALOG LAUGH, "Only a few could rival\nan intellect such\nas mine."}
+ });
+ gs.explored.insert(7);
+ }
+ }
+ else if (gs.curPos == INSIDE) {
+ if (CheckCollisionPointRec(gs.currentMousePos, Calendar)) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "its cirno day, todeh"},
+ {CIRNO_DIALOG JOY, "billions must celebrate"}
+ });
+ gs.explored.insert(5);
+ }
+ else if (CheckCollisionPointRec(gs.currentMousePos, Chest)) {
+ if (gs.chestCount == 0) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "Hey!! Don't snoop around\nthe chest"},
+ {CIRNO_DIALOG TIERED, "It's where I store all my\ntreasures"}
+ });
+ gs.chestCount++;
+ } else if (gs.chestCount == 1) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG PISSED, "No, I won't let you\nsee what's inside!!!"},
+ });
+ gs.explored.insert(6);
+ }
+ }
+ else if (CheckCollisionPointRec(gs.currentMousePos, Futton)) {
+ if (gs.explored.size() == 13) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "I am feeling sleepy\nI had lots of fun with you"},
+ {CIRNO_DIALOG TIERED, " I am gonna take a nap\nLet's see tommorow!!"}
+ });
+ } else {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "I just woke up before\nyou came"},
+ {CIRNO_DIALOG TIERED, "So, I am not sleepy now\nI want to play"}
+ });
+ }
+ }
+ } else if (gs.curPos == OUTSIDE){
+ if (CheckCollisionPointRec(gs.currentMousePos, YokaiMountain)) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "That's the Youkai Mountain\nThat's where Aya lives"},
+ {CIRNO_DIALOG JOY, "She is nosy and snitches\nme to people whenever\nI am up to no good"},
+ {CIRNO_DIALOG PISSED, "Bah!! She is annoying!"},
+ {CIRNO_DIALOG JOY, "The Moriya shrine is at\nthe very top of the\nYoukai Mountain"},
+ {CIRNO_DIALOG WOW, "The deities there,\nare very strong."},
+ {CIRNO_DIALOG LAUGH, "Not as strong as me,\nof course!"},
+ {CIRNO_DIALOG WOW, "But I like the Hakurei\nshrine more"},
+ {CIRNO_DIALOG RELAXED, "Reimu sometimes gives\nme some snacks\nwhen I go there"},
+ });
+ gs.explored.insert(8);
+ } else if (CheckCollisionPointRec(gs.currentMousePos, MistyLake)) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "Do you know? There is a\ngiant frog that lives"},
+ {CIRNO_DIALOG TIERED, "at the bottom of the lake.\nIt's very very big."},
+ {CIRNO_DIALOG PISSED, "It ate me one time!!"}
+ });
+ gs.explored.insert(9);
+ } else if (CheckCollisionPointRec(gs.currentMousePos, Igloo)) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "My house looks very cool,\nright?"},
+ {CIRNO_DIALOG JOY, "It was a lot of work,\nbullying the other fairies\ninto building my house"},
+ {CIRNO_DIALOG TIERED, "Though, sometimes they\nbarge into my home to\nplay"}
+ });
+ gs.explored.insert(10);
+ } else if (CheckCollisionPointRec(gs.currentMousePos, Flower) && !gs.flowerOnHead) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG JOY, "A flower!"},
+ });
+ gs.flowerOnHead = true;
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "Do I look cute with\nthis flower on me?"},
+ {CIRNO_DIALOG LAUGH, "I like it a lot"}
+ });
+ gs.explored.insert(11);
+ }
+ } else if (gs.curPos == FOREST) {
+ if (CheckCollisionPointRec(gs.currentMousePos, Frog)) {
+ if (!gs.frogDialogDone) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG WOW, "Suwako somehow always\ncatches me henever I bully\nfrogs here"},
+ {CIRNO_DIALOG JOY, "Let's leave it alone for now\nShe will beat me up"},
+ {CIRNO_DIALOG TIERED, "if I get caught red handed"}
+ });
+ gs.frogDialogDone = true;
+ gs.explored.insert(12);
+ } else {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG LAUGH, "Ribbit ribbit\nThe frogs make\nfunny noises."},
+ });
+ }
+ } else if (CheckCollisionPointRec(gs.currentMousePos, RiceCake) && !gs.riceCakeEaten) {
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG RELAXED, "It's a small shrine for the\nMoriya gods built by the Kappas"},
+ {CIRNO_DIALOG WOW, "The Miko called Sanae comes\nhere from time to time\nand takes care of it. "},
+ {CIRNO_DIALOG JOY, "Look! There is a rice cake here\nleft as an offering."}
+ });
+ gs.explored.insert(13);
+ gs.riceCakeEaten = true;
+ SayDialog(gs, std::vector<Dialogues> {
+ {CIRNO_DIALOG JOY, "The rice cake magically disappeared!"},
+ {CIRNO_DIALOG RELAXED, ". . .", 0.4f},
+ {CIRNO_DIALOG JOY, "*Burp*"},
+ });
+ }
+ }
+}
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644
index 0000000..3758ed0
--- /dev/null
+++ b/lib/CMakeLists.txt
@@ -0,0 +1,13 @@
+file(GLOB LIB_SOURCES CONFIGURE_DEPENDS
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.cc"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx"
+)
+
+file(GLOB LIB_HEADERS CONFIGURE_DEPENDS
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.hh"
+)
+
+target_sources(cirno_day PRIVATE ${LIB_SOURCES} ${LIB_HEADERS})
diff --git a/lib/assetManager.cpp b/lib/assetManager.cpp
new file mode 100644
index 0000000..9c60f9c
--- /dev/null
+++ b/lib/assetManager.cpp
@@ -0,0 +1,60 @@
+#include "assetManager.hpp"
+
+#include <filesystem>
+#include <iostream>
+
+assetManager::assetManager() = default;
+
+assetManager::~assetManager()
+{
+ cleanup();
+}
+
+void assetManager::init(const std::string& dirPath)
+{
+ if (!std::filesystem::exists(dirPath) || !std::filesystem::is_directory(dirPath)) {
+ std::cerr << "assetmanager: directory not found: " << dirPath << std::endl;
+ return;
+ }
+
+ for (const auto& entry : std::filesystem::recursive_directory_iterator(dirPath)) {
+ if (entry.is_regular_file()) {
+ std::string ext = entry.path().extension().string();
+
+ if (ext == ".png" || ext == ".jpg" || ext == ".jpeg") {
+ std::string key = entry.path().stem().string();
+ std::string fullPath = entry.path().string();
+
+ Texture2D tex = LoadTexture(fullPath.c_str());
+
+ if (tex.id != 0) {
+ textures[key] = tex;
+ std::cout << "success loading texture: " << key << std::endl;
+ } else {
+ std::cerr << "failed to load texture: " << key << std::endl;
+ }
+ }
+ }
+ }
+}
+
+Texture2D assetManager::load(const std::string& texName)
+{
+ const auto tex = textures.find(texName);
+ if (tex != textures.end()) {
+ return tex->second;
+ }
+
+ std::cerr << "asset not found: " << texName << std::endl;
+ return Texture2D{0};
+}
+
+void assetManager::cleanup()
+{
+ for (auto& pair : textures) {
+ if (pair.second.id != 0) {
+ UnloadTexture(pair.second);
+ }
+ }
+ textures.clear();
+}
diff --git a/lib/assetManager.hpp b/lib/assetManager.hpp
new file mode 100644
index 0000000..7b15f5a
--- /dev/null
+++ b/lib/assetManager.hpp
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <string>
+#include <unordered_map>
+#include <raylib.h>
+
+class assetManager
+{
+private:
+ std::unordered_map<std::string, Texture2D> textures;
+public:
+ assetManager();
+ ~assetManager();
+
+ void init(const std::string& dirPath = "../assets");
+ Texture2D load(const std::string& texName);
+ void cleanup();
+};
diff --git a/lib/button.cpp b/lib/button.cpp
new file mode 100644
index 0000000..9000b09
--- /dev/null
+++ b/lib/button.cpp
@@ -0,0 +1,149 @@
+#include "button.hpp"
+#include "raylib.h"
+#include <raymath.h>
+
+constexpr Color HOVER_COLOR = Color{140, 0, 23, 255};
+constexpr Color FILL_COLOR = Color{148, 35, 67, 255};
+constexpr Color BORDER_COLOR = Color{204, 0, 57, 255};
+
+namespace ui {
+namespace {
+
+constexpr const char* kUIFontPath = "../assets/font/font.otf";
+constexpr const char* kUIClickSfxPath = "../assets/audio/sfx/buttonClick.wav";
+
+bool g_initialized = false;
+bool g_loaded_font = false;
+Font g_ui_font = {};
+Sound g_ui_clickSfx ;
+
+} // namespace
+
+Font GetActiveFont() { return g_loaded_font ? g_ui_font : GetFontDefault(); }
+
+void Init() {
+ if (g_initialized) return;
+
+ if (FileExists(kUIFontPath)) {
+ g_ui_font = LoadFontEx(kUIFontPath, 256, nullptr, 0);
+ g_loaded_font = g_ui_font.texture.id != 0;
+ }
+ g_ui_clickSfx = LoadSound(kUIClickSfxPath);
+
+ g_initialized = true;
+}
+
+void Shutdown() {
+ if (!g_initialized) return;
+
+ if (g_loaded_font) {
+ UnloadFont(g_ui_font);
+ g_loaded_font = false;
+ }
+
+ g_initialized = false;
+}
+
+void DrawText(const char* text, int pos_x, int pos_y, int font_size,
+ Color color) {
+ if (g_loaded_font) {
+ DrawTextEx(g_ui_font, text, {static_cast<float>(pos_x), static_cast<float>(pos_y)},
+ static_cast<float>(font_size), 1.0f, color);
+ return;
+ }
+
+ ::DrawText(text, pos_x, pos_y, font_size, color);
+}
+
+void DrawTextV(const char* text, Vector2 position, int font_size,
+ Color color) {
+ if (g_loaded_font) {
+ DrawTextEx(g_ui_font, text, {static_cast<float>(position.x), static_cast<float>(position.y)},
+ static_cast<float>(font_size), 1.0f, color);
+ return;
+ }
+
+ ::DrawText(text, position.x, position.y, font_size, color);
+}
+
+void DrawTextRotationV(const char* text, Vector2 position, int font_size, float rotInDeg, Color color) {
+ if (g_loaded_font) {
+ DrawTextPro(g_ui_font, text, position, {0,0},rotInDeg,font_size,1.0f,color);
+ return;
+ }
+ DrawTextPro(GetFontDefault(), text, position, {0,0},rotInDeg,font_size,1.0f,color);
+}
+
+void DrawButton(float x, float y, float width, float height, const char* text,
+ int font_size, const ButtonCallback& on_click, Vector2 mousePos) {
+ Rectangle bounds = {x, y, width, height};
+ const bool is_hovered = CheckCollisionPointRec(mousePos, bounds);
+ const Color fill_color = is_hovered ? HOVER_COLOR : FILL_COLOR;
+
+ DrawRectangleRounded(bounds, 0.14f, 8, fill_color);
+ DrawRectangleRoundedLinesEx(bounds, 0.14f, 4, 4.0f, BORDER_COLOR);
+
+ const Font font = GetActiveFont();
+ const Vector2 text_size = MeasureTextEx(font, text, static_cast<float>(font_size), 1.0f);
+ const float text_x = x + (width - text_size.x) * 0.5f;
+ const float text_y = y + (height - text_size.y) * 0.5f;
+ ui::DrawText(text, static_cast<int>(text_x), static_cast<int>(text_y), font_size, BLACK);
+
+ if (is_hovered && IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
+ PlaySound(g_ui_clickSfx);
+ if (on_click) {
+ on_click();
+ }
+ }
+}
+
+void DrawButtonNoHover(float x, float y, float width, float height, const char* text,
+ int font_size, const ButtonCallback& on_click, Vector2 mousePos, Color fillColor) {
+ Rectangle bounds = {x, y, width, height};
+ const bool is_hovered = CheckCollisionPointRec(mousePos, bounds);
+
+ DrawRectangleRounded(bounds, 0.14f, 8, fillColor);
+ DrawRectangleRoundedLinesEx(bounds, 0.14f, 8, 2.0f, BORDER_COLOR);
+
+ const Font font = GetActiveFont();
+ const Vector2 text_size = MeasureTextEx(font, text, static_cast<float>(font_size), 1.0f);
+ const float text_x = x + (width - text_size.x) * 0.5f;
+ const float text_y = y + (height - text_size.y) * 0.5f;
+ ui::DrawText(text, static_cast<int>(text_x), static_cast<int>(text_y), font_size, BLACK);
+
+ if (is_hovered && IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
+ // auto& asset_manager = assets::AssetManager::Instance();
+ // PlaySound(asset_manager.SoundEffect("switch"));
+ if (on_click) {
+ on_click();
+ }
+ }
+}
+
+
+void DrawTextVClickable(const char* text, Vector2 position, int font_size,
+ const ButtonCallback& on_click, Vector2 mousePos) {
+ Vector2 text_size;
+ if (g_loaded_font) {
+ text_size = MeasureTextEx(g_ui_font, text, static_cast<float>(font_size), 1.0f);
+ } else {
+ // Default Raylib font measurement
+ text_size.x = static_cast<float>(MeasureText(text, font_size));
+ text_size.y = static_cast<float>(font_size);
+ }
+ Rectangle bounds = {position.x, position.y, text_size.x, text_size.y};
+ const bool is_hovered = CheckCollisionPointRec(mousePos, bounds);
+
+ // Apply hover colors
+ const Color text_color = is_hovered ? WHITE : YELLOW;
+
+ ui::DrawTextV(text, position, font_size, text_color);
+
+ if (is_hovered && IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
+ if (on_click) {
+ on_click();
+ }
+ }
+}
+
+} // namespace ui
diff --git a/lib/button.hpp b/lib/button.hpp
new file mode 100644
index 0000000..8459cdc
--- /dev/null
+++ b/lib/button.hpp
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <functional>
+
+#include "raylib.h"
+
+namespace ui {
+
+using ButtonCallback = std::function<void()>;
+
+void Init();
+void Shutdown();
+
+void DrawText(const char* text, int pos_x, int pos_y, int font_size,
+ Color color);
+
+void DrawTextV(const char* text, Vector2 position, int font_size,
+ Color color);
+
+void DrawTextVClickable(const char* text, Vector2 position, int font_size,
+ const ButtonCallback& on_click, Vector2 mousePos);
+
+void DrawTextRotationV(const char* text, Vector2 position, int font_size, float rotInDeg, Color color);
+
+void DrawButton(float x, float y, float width, float height, const char* text,
+ int font_size, const ButtonCallback& on_click, Vector2 mousePos);
+
+void DrawButtonNoHover(float x, float y, float width, float height, const char* text,
+ int font_size, const ButtonCallback& on_click, Vector2 mousePos, Color fillColor = RAYWHITE);
+
+Font GetActiveFont();
+} // namespace ui
diff --git a/lib/dialogue.cpp b/lib/dialogue.cpp
new file mode 100644
index 0000000..3c9735b
--- /dev/null
+++ b/lib/dialogue.cpp
@@ -0,0 +1,94 @@
+#include "dialogue.hpp"
+#include "button.hpp"
+#include "lib/gameState.hpp"
+#include <raylib.h>
+
+void SayDialog(GameState &gs, const std::vector<Dialogues> &conversation) {
+ gs.currentDialog = conversation;
+ gs.currentLineIndex = 0;
+ gs.visibleChar = 0;
+ gs.dialogueTimer = 0.0f;
+ gs.dialogState = gs.currentDialog.empty() ? DIALOGUE_OFF : DIALOGUE_SCROLLING;
+}
+
+// void wait_for(GameState &gs, float time) {
+// gs.timeUntilStory = time;
+// gs.inStory = false;
+// gs.storyPosition += 1;
+// }
+
+void UpdateDialog(GameState &gs) {
+ if (gs.dialogState == DIALOGUE_OFF || gs.currentDialog.empty()) {
+ return;
+ }
+
+ if (gs.dialogState == DIALOGUE_SCROLLING) {
+ gs.dialogueTimer += GetFrameTime();
+ const float speed = gs.currentDialog[gs.currentLineIndex].textSpeed;
+ if (gs.dialogueTimer >= speed) {
+ gs.dialogueTimer = 0.0f;
+ gs.visibleChar += 1;
+
+ if (gs.visibleChar >= (int)(gs.currentDialog[gs.currentLineIndex].text.length())) {
+ gs.dialogState = DIALOGUE_WAITING;
+ }
+ }
+
+ if (IsKeyPressed(KEY_Z) || IsKeyPressed(KEY_SPACE) || IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+ gs.visibleChar = (int)(gs.currentDialog[gs.currentLineIndex].text.length());
+ gs.dialogState = DIALOGUE_WAITING;
+ }
+ return;
+ }
+
+ if (gs.dialogState == DIALOGUE_WAITING && (IsKeyPressed(KEY_Z)) || IsKeyPressed(KEY_SPACE) || IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+ gs.currentLineIndex += 1;
+ gs.visibleChar = 0;
+ gs.dialogueTimer = 0.0f;
+ if (gs.currentLineIndex >= (int)(gs.currentDialog.size())) {
+ gs.dialogState = DIALOGUE_OFF;
+ gs.currentDialog.clear();
+ } else {
+ gs.dialogState = DIALOGUE_SCROLLING;
+ }
+ }
+}
+
+void DrawDialog(GameState &gs) {
+ gs.curExp = gs.currentDialog[gs.currentLineIndex].curExp;
+ if (gs.dialogState == DIALOGUE_OFF || gs.currentDialog.empty()) {
+ return;
+ }
+ if (gs.currentLineIndex < 0 || gs.currentLineIndex >= (int)(gs.currentDialog.size())) {
+ return;
+ }
+
+ const int screenWidth = VIRTUAL_SCREEN_W;
+ const int screenHeight =VIRTUAL_SCREEN_H;
+ Dialogues &currentLine = gs.currentDialog[gs.currentLineIndex];
+
+ const int padding = 10;
+ const int boxWidth = VIRTUAL_SCREEN_W-2*padding;
+ const int boxHeight = 90;
+ const int boxX = padding;
+ const int boxY = screenHeight - boxHeight - 30;
+
+ DrawRectangle(boxX, boxY, boxWidth, boxHeight, Fade(BLACK, 0.8f));
+ // DrawRectangleLinesEx({boxX, boxY, boxWidth, boxHeight}, 2, WHITE);
+
+ // DrawTexturePro(currentLine.portrait, srcRect, dstRect, {0.0f, 0.0f}, 0.0f, WHITE);
+ // DrawRectangleLinesEx(dstRect, 2, RAYWHITE);
+
+ // ui::DrawText(currentLine.characterName.c_str(), boxX + padding, boxY - 15, 18, YELLOW);
+
+ std::string displayString = currentLine.text.substr(0, gs.visibleChar);
+ ui::DrawText(displayString.c_str(), boxX + padding, boxY + 15, 14, RAYWHITE);
+
+ if (gs.dialogState == DIALOGUE_WAITING && ((int)(GetTime() * 3) % 2 == 0)) {
+ ui::DrawText(gs.touchScreenMode?"Touch anywhere to proceed":"Press 'Z' to proceed", boxX + padding, boxY + boxHeight - 2*padding, 8, WHITE);
+ }
+}
+
+bool IsDialogRunning(const GameState &gs) {
+ return gs.dialogState == DIALOGUE_SCROLLING || gs.dialogState == DIALOGUE_WAITING;
+}
diff --git a/lib/dialogue.hpp b/lib/dialogue.hpp
new file mode 100644
index 0000000..3b53aeb
--- /dev/null
+++ b/lib/dialogue.hpp
@@ -0,0 +1,11 @@
+#pragma once
+
+#include <raylib.h>
+#include <vector>
+#include "gameState.hpp"
+
+void SayDialog(GameState &gs, const std::vector<Dialogues> &conversation);
+// void wait_for(GameState &gs, float time);
+void UpdateDialog(GameState &gs);
+void DrawDialog(GameState &gs);
+bool IsDialogRunning(const GameState &gs);
diff --git a/lib/gameState.hpp b/lib/gameState.hpp
new file mode 100644
index 0000000..5c718f4
--- /dev/null
+++ b/lib/gameState.hpp
@@ -0,0 +1,110 @@
+#pragma once
+#include <raylib.h>
+#include <string>
+#include <vector>
+#include <set>
+
+#include "assetManager.hpp"
+
+constexpr int MAX_USERNAME_LENGTH = 16;
+constexpr int VIRTUAL_SCREEN_W = 225;
+constexpr int VIRTUAL_SCREEN_H = 400;
+constexpr float WEB_RENDER_SCALE = 2.0f;
+constexpr Vector2 ZERO_VEC = {0,0};
+
+inline Music g_bgMusic;
+
+enum DialogueState {
+ DIALOGUE_OFF,
+ DIALOGUE_SCROLLING,
+ DIALOGUE_WAITING,
+};
+
+enum screen {
+ MAIN_MENU,
+ GAMEPLAY,
+};
+
+
+enum EXPRESSION {
+ NEUTRAL,
+ PISSED,
+ HURT,
+ JOY,
+ LAUGH,
+ RELAXED,
+ TIERED,
+ WOW,
+};
+
+struct Dialogues
+{
+ // Texture2D portrait;
+ std::string characterName;
+ EXPRESSION curExp;
+ std::string text;
+ // Sound scrollSound;
+ float textSpeed;
+};
+
+enum POSITION {
+ INSIDE,
+ OUTSIDE,
+ FOREST,
+ MENU
+};
+
+
+struct GameState {
+ screen current_screen = MAIN_MENU; // TODO : Change before prod
+ int gameScore = 0;
+ int highScore = 0;
+ bool paused = false;
+ bool gameOver = false;
+ /*
+ * We use a cartesian system that is right handed
+ * right is posetive x and up is posetive y
+ * The origin is at the bottom left corner of the
+ * playable area.
+ * Max limit is 100, 100 (note that this scale is as percentage)
+ * x = y wont give a straight line with 45 degree angle
+ * ^ +y
+ * |
+ * |
+ * |_________ > +x
+ */
+
+ /* Dialogue specific */
+ DialogueState dialogState = DIALOGUE_OFF;
+ std::vector<Dialogues> currentDialog;
+ float dialogueTimer = 0.0f;
+ int currentLineIndex = 0;
+ int visibleChar = 0;
+
+ short storyStage = 1;
+
+ /* Asset Manager */
+ assetManager AssetManager;
+
+ float scale = 1.0f;
+ float renderScale = 1.0f;
+ Vector2 currentMousePos = {0,0};
+ Font numberFont;
+ RenderTexture screenTex;
+
+ bool touchScreenMode = false;
+
+ POSITION curPos = MENU;
+ EXPRESSION curExp = NEUTRAL;
+
+ float timeSinceSceneChange = -1;
+ POSITION prevPos = INSIDE;
+
+ short flickCount = 0;
+ short chestCount = 0;
+ bool flowerOnHead = false;
+ bool riceCakeEaten = false;
+ bool frogDialogDone = false;
+ bool usedTalkButton = false;
+ std::set<int> explored = {};
+};
diff --git a/lib/standard.cpp b/lib/standard.cpp
new file mode 100644
index 0000000..35dfa9f
--- /dev/null
+++ b/lib/standard.cpp
@@ -0,0 +1,93 @@
+#include "standard.hpp"
+#include "gameState.hpp"
+#include <cstdlib>
+#include <cmath>
+#include <raylib.h>
+#include <raymath.h>
+
+constexpr float CARTESIAN_MIN = 0.0f;
+constexpr float CARTESIAN_MAX = 100.0f;
+constexpr float CARTESIAN_SCALE = 100.0f;
+
+float maxOfTwo(float a, float b) {
+ if (a > b) {return a;}
+ else {return b;}
+}
+
+float minOfTwo(float a, float b) {
+ if (a < b) {return a;}
+ else {return b;}
+}
+
+float genRandBw(float min,float max) {
+ return (((float)rand()/RAND_MAX)*(max-min))+min;
+}
+
+Vector2 rotatePoint(Vector2 point, Vector2 pivot, float angleDegree) {
+ float rad = angleDegree * DEG2RAD;
+ float s = sinf(rad);
+ float c = cosf(rad);
+ point.x -= pivot.x;
+ point.y -= pivot.y;
+ float xNew = point.x * c - point.y * s;
+ float yNew = point.x * s + point.y * c;
+ return (Vector2){ xNew + pivot.x, yNew + pivot.y };
+}
+
+Vector2 C2SProj(Vector2 cartesian_cordinates, Vector4 rectangle_space, Vector2 object_size,
+ Vector2 absolute_deviation_bias,bool use_clamp) {
+ /*Cartesian to Screen Projection */
+ float y_axis_length = rectangle_space.w - rectangle_space.y;
+ float x_axis_length = rectangle_space.z - rectangle_space.x;
+ float usable_width = maxOfTwo(0.0f, x_axis_length - object_size.x);
+ float usable_height = maxOfTwo(0.0f, y_axis_length - object_size.y);
+ float normalized_x;
+ float normalized_y;
+ if (use_clamp) {
+ normalized_x = Clamp(cartesian_cordinates.x, CARTESIAN_MIN, CARTESIAN_MAX)/CARTESIAN_SCALE;
+ normalized_y = Clamp(cartesian_cordinates.y, CARTESIAN_MIN, CARTESIAN_MAX)/CARTESIAN_SCALE;
+ } else {
+ normalized_x = cartesian_cordinates.x/CARTESIAN_SCALE;
+ normalized_y = cartesian_cordinates.y/CARTESIAN_SCALE;
+ }
+ float y_pos = (1 - normalized_y)*usable_height;
+ float x_pos = normalized_x*usable_width;
+ return {rectangle_space.x + x_pos + absolute_deviation_bias.x,
+ rectangle_space.y + y_pos + absolute_deviation_bias.y};
+}
+
+float S2CYaxis(float yValue, Vector4 rectangle_space) {
+ float y_axis_length = rectangle_space.w - rectangle_space.y;
+ return ((yValue/y_axis_length) * 100);
+}
+
+float S2CXaxis(float xValue, Vector4 rectangle_space) {
+ float x_axis_length = rectangle_space.z - rectangle_space.x;
+ return ((xValue/x_axis_length)*100);
+}
+
+void newGame(GameState& gs){
+ gs.gameScore = 0;
+ gs.paused = false;
+ gs.gameOver = false;
+ gs.dialogState = DIALOGUE_OFF;
+ gs.dialogueTimer = 0.0f;
+ gs.currentLineIndex = 0;
+ gs.visibleChar = 0;
+}
+
+bool returnTrueProbPerc(float percentageTrue){
+ float i = genRandBw(0, 1);
+ if (i < (percentageTrue/100)) {
+ return true;
+ }
+ return false;
+}
+
+Vector2 ScreenToVirtual(Vector2 screenPos, Vector2 offset, float scale)
+{
+ return Vector2{
+ (screenPos.x - offset.x) / scale,
+ (screenPos.y - offset.y) / scale
+ };
+}
diff --git a/lib/standard.hpp b/lib/standard.hpp
new file mode 100644
index 0000000..dc2ec75
--- /dev/null
+++ b/lib/standard.hpp
@@ -0,0 +1,14 @@
+#pragma once
+#include "gameState.hpp"
+#include <raylib.h>
+
+float maxOfTwo(float a, float b);
+float minOfTwo(float a, float b);
+float genRandBw(float min, float max);
+Vector2 rotatePoint(Vector2 point, Vector2 pivot, float angleDegree);
+Vector2 C2SProj(Vector2 cartesian_cordinates, Vector4 rectangle_space, Vector2 object_size = {0, 0}, Vector2 absolute_deviation_bias={0,0},bool use_clamp = true);
+float S2CYaxis(float yValue, Vector4 rectangle_space);
+float S2CXaxis(float xValue, Vector4 rectangle_space);
+void newGame(GameState& gs);
+bool returnTrueProbPerc(float percentageTrue);
+Vector2 ScreenToVirtual(Vector2 screenPos, Vector2 offset, float scale);
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..138fbb7
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,162 @@
+#include <cstdlib>
+#include <algorithm>
+#include <raylib.h>
+
+#include "lib/button.hpp"
+#include "lib/dialogue.hpp"
+#include "lib/gameState.hpp"
+#include "screen/gameplay.cpp"
+#include "screen/main_menu.cpp"
+#include "lib/assetManager.hpp"
+#include "lib/standard.hpp"
+
+#if defined (__EMSCRIPTEN__)
+#include <emscripten.h>
+#include <emscripten/em_js.h>
+#endif
+// #include "lib/lbParser.hpp"
+
+namespace {
+
+void drawFrame(GameState& currentGameState) {
+ UpdateMusicStream(g_bgMusic);
+ // if (GetMusicTimePlayed(g_bgMusic) >= GetMusicTimeLength(g_bgMusic)) {
+ // SeekMusicStream(g_bgMusic, 0);
+ // }
+ RenderTexture screenTex = currentGameState.screenTex;
+ float screenW = GetScreenWidth();
+ float screenH = GetScreenHeight();
+ float renderScale = currentGameState.renderScale;
+
+ if (IsDialogRunning(currentGameState)) {
+ UpdateDialog(currentGameState);
+ }
+
+ BeginDrawing();
+ ClearBackground(BLACK);
+ if (true){ //screenW > screenH) {
+ float scaleX = screenW / (float)VIRTUAL_SCREEN_W;
+ float scaleY = screenH / (float)VIRTUAL_SCREEN_H;
+
+ currentGameState.scale = std::min(scaleX, scaleY);
+
+ float destW = VIRTUAL_SCREEN_W * currentGameState.scale;
+ float destH = VIRTUAL_SCREEN_H * currentGameState.scale;
+
+ float destX = (screenW - destW) * 0.5f;
+ float destY = (screenH - destH) * 0.5f;
+
+ Vector2 offset = { destX, destY };
+ currentGameState.currentMousePos = ScreenToVirtual(GetMousePosition(), offset, currentGameState.scale);
+
+ BeginTextureMode(screenTex);
+ Camera2D camera = {};
+ camera.target = {0.0f, 0.0f};
+ camera.offset = {0.0f, 0.0f};
+ camera.rotation = 0.0f;
+ camera.zoom = renderScale;
+ BeginMode2D(camera);
+ switch (currentGameState.current_screen) {
+ case MAIN_MENU:
+ drawMainMenu(currentGameState);
+ break;
+ case GAMEPLAY:
+ drawGameplay(currentGameState);
+ break;
+ }
+ EndMode2D();
+ EndTextureMode();
+
+ DrawTexturePro(
+ screenTex.texture,
+ {0, 0, (float)screenTex.texture.width, -(float)screenTex.texture.height},
+ {destX, destY, destW, destH},
+ {0, 0},
+ 0,
+ WHITE
+ );}
+ else {
+ ui::DrawTextV("Please Play in\nLandscape\nMode", {10,50}, 40, WHITE);
+ }
+ // DrawText(TextFormat("%d, %f", 1, GetTime()), 0, 0, 20, YELLOW);
+ EndDrawing();
+}
+}
+
+void updateDrawFrame(void * arg){
+ GameState* currentGameState = static_cast<GameState*>(arg);
+ drawFrame(*currentGameState);
+}
+#if defined (__EMSCRIPTEN__)
+EM_JS(int, isOnPhone, (), {
+ const ua = navigator.userAgent || "";
+ const mobileDetected =
+ /Android|iPhone|iPad|iPod|Mobile|webOS|BlackBerry|IEMobile|Opera Mini/i.test(
+ ua,
+ ) ||
+ (navigator.maxTouchPoints || 0) > 1 ||
+ (window.matchMedia && window.matchMedia("(pointer: coarse)").matches);
+ if (mobileDetected) {
+ return 1;
+ } else {
+ return 0;
+ }
+})
+#endif
+
+int main() {
+ SetConfigFlags(FLAG_WINDOW_RESIZABLE);
+ InitWindow(VIRTUAL_SCREEN_W, VIRTUAL_SCREEN_H, "Cirno Day");
+ // SetWindowOpacity(0.5f);
+ GameState currentGameState;
+ InitAudioDevice();
+ srand(111111);
+ ui::Init();
+ currentGameState.numberFont = LoadFont("../assets/font/score.otf");
+
+ // currentGameState.bulletList[0] = new Bullet{
+ // LoadTexture("assets/img/bullet/knife.png"),
+ // linear
+ // };
+ // TODO : Implement Asset Manager
+ // DisableCursor();
+ g_bgMusic = LoadMusicStream("../assets/audio/bgm/bg.ogg");
+ // PlayMusicStream(g_bgMusic);
+ SetMusicVolume(g_bgMusic, 0.5f);
+ currentGameState.AssetManager.init();
+ #if defined (__EMSCRIPTEN__)
+ currentGameState.touchScreenMode = (bool)isOnPhone();
+ #else
+ currentGameState.touchScreenMode = false;
+ #endif
+ currentGameState.renderScale = WEB_RENDER_SCALE;
+ currentGameState.screenTex = LoadRenderTexture(
+ (int)(VIRTUAL_SCREEN_W * currentGameState.renderScale),
+ (int)(VIRTUAL_SCREEN_H * currentGameState.renderScale)
+ );
+ SetTextureFilter(currentGameState.screenTex.texture, TEXTURE_FILTER_BILINEAR);
+ // int repeatInWidth = screenW/200;
+ // int repeatinHeight = screenH/200;
+
+ // BeginTextureMode(backgroundTex);
+ // for (int w = 0; w < repeatInWidth + 1; w++) {
+ // for (int h = 0; h < repeatinHeight + 1; h++) {
+ // DrawTextureV(currentGameState.AssetManager.load("hud_background"), {200.0f*w, 200.0f*h} , WHITE);
+ // }
+ // }
+ // EndTextureMode();
+ #if defined (__EMSCRIPTEN__)
+ emscripten_set_main_loop_arg(updateDrawFrame, &currentGameState, 0, 1);
+ #else
+ SetTargetFPS(60);
+ while(!WindowShouldClose()){
+ drawFrame(currentGameState);
+ }
+ #endif
+
+ currentGameState.AssetManager.cleanup();
+
+ ui::Shutdown();
+ CloseWindow();
+ return 0;
+}
diff --git a/screen/gameplay.cpp b/screen/gameplay.cpp
new file mode 100644
index 0000000..2f30c78
--- /dev/null
+++ b/screen/gameplay.cpp
@@ -0,0 +1,38 @@
+#define DEBUG false
+
+#include <raylib.h>
+#include <raymath.h>
+
+#include "../lib/gameState.hpp"
+#include "../lib/dialogue.hpp"
+#include "../game/story.hpp"
+#include "../lib/button.hpp"
+
+#define UI_PADDING_BOTTOM 10
+#define UI_BUTTON_SIZE 32
+
+
+void drawGameplay(GameState &gs){
+ if (gs.timeSinceSceneChange == -1) {
+ DrawTextureV(getCurrentScene(gs), ZERO_VEC, WHITE);
+ } else {
+ DrawSceneChange(gs);
+ }
+ if (gs.curExp != NEUTRAL && !IsDialogRunning(gs)) {
+ gs.curExp = NEUTRAL;
+ }
+ drawCirno(gs);
+ if (gs.curExp != HURT && gs.flowerOnHead) {
+ DrawTextureV(gs.AssetManager.load("flower"), ZERO_VEC, WHITE);
+ }
+ if (DEBUG) { DrawText(TextFormat("%d, %d", (int)gs.currentMousePos.x, (int)gs.currentMousePos.y), 0, 40, 20, YELLOW);}
+ ui::DrawText(TextFormat("Explored : %d/13", gs.explored.size()), 20, 10, 26, RED);
+ if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) and !IsDialogRunning(gs)) {
+ ProcessClick(gs);
+ }
+ DrawTextureV(gs.AssetManager.load("arrowhead"), {(int)(VIRTUAL_SCREEN_W/3)*2 + UI_BUTTON_SIZE/2.0f ,VIRTUAL_SCREEN_H - UI_BUTTON_SIZE - UI_PADDING_BOTTOM}, WHITE);
+ DrawTextureV(gs.AssetManager.load("talk"), {(int)(VIRTUAL_SCREEN_W/2) - 88.0f/2 ,VIRTUAL_SCREEN_H - UI_BUTTON_SIZE - UI_PADDING_BOTTOM}, WHITE);
+ if (IsDialogRunning(gs)) {
+ DrawDialog(gs);
+ }
+}
diff --git a/screen/main_menu.cpp b/screen/main_menu.cpp
new file mode 100644
index 0000000..09a136d
--- /dev/null
+++ b/screen/main_menu.cpp
@@ -0,0 +1,43 @@
+#include "../lib/gameState.hpp"
+#include "lib/button.hpp"
+#include "raylib.h"
+#include "raymath.h"
+#include "cmath"
+
+constexpr float SCENE_CHANGE = 6.0f;
+
+void drawMainMenu(GameState &gs){
+ ClearBackground(Color{91, 110, 225, 255});
+ // Vector2 i = MeasureTextEx(ui::GetActiveFont(), "Happy Cirno Day", 22, 1.0f);
+ // printf("%f, %f\n", i.x, i.y);
+ // Measure text and hard code the vector value below
+ if (gs.timeSinceSceneChange < SCENE_CHANGE) {
+ float t = Clamp(gs.timeSinceSceneChange / SCENE_CHANGE, 0.0f, 1.0f);
+ float e = 1.0f - powf(1.0f - t, 3.0f);
+ float y = VIRTUAL_SCREEN_H * (1.0f - e);
+ DrawTextureV(
+ gs.AssetManager.load("menu"),
+ {0, y},
+ WHITE
+ );
+ gs.timeSinceSceneChange += GetFrameTime();
+ if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+ gs.timeSinceSceneChange = SCENE_CHANGE;
+ }
+
+ } else {
+ DrawTextureV(
+ gs.AssetManager.load("menu"),
+ ZERO_VEC,
+ WHITE
+ );
+ ui::DrawTextV("Knock on her door to play!", {20, 380}, 14,ColorAlpha(RED, fabsf(sinf(3*GetTime()))));
+ if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) {
+ gs.timeSinceSceneChange = -1;
+ changeSceneTo(gs, INSIDE);
+ gs.current_screen = GAMEPLAY;
+ }
+ }
+ ui::DrawTextV("Happy Cirno Day", {22, 25}, 22, ColorAlpha(YELLOW, Clamp(gs.timeSinceSceneChange/(SCENE_CHANGE/2.0f), 0, 1)));
+ ui::DrawTextV("A short story by\nsamosagaming69\n& silli_chilli", {22, 60}, 14, ColorAlpha(WHITE, Clamp(gs.timeSinceSceneChange/(SCENE_CHANGE/2.0f), 0, 1)));
+}
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755
index 0000000..9c0542e
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+mkdir build/
+cd build/
+cmake ..
+cmake --build . --parallel
diff --git a/scripts/build_web.sh b/scripts/build_web.sh
new file mode 100755
index 0000000..4d46656
--- /dev/null
+++ b/scripts/build_web.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+EMSDK_DIR="/home/ritabrata/Documents/emsdk"
+
+if [[ ! -f "$EMSDK_DIR/emsdk_env.sh" ]]; then
+ echo "emsdk_env.sh not found at: $EMSDK_DIR" >&2
+ exit 1
+fi
+
+# shellcheck disable=SC1090
+source "$EMSDK_DIR/emsdk_env.sh"
+
+export EM_CACHE="$(pwd)/temp/emcache"
+mkdir -p "$EM_CACHE"
+
+mkdir -p build-web
+emcmake cmake -S . -B build-web -DCMAKE_BUILD_TYPE=Release
+cmake --build build-web --parallel
diff --git a/scripts/build_web_prod.sh b/scripts/build_web_prod.sh
new file mode 100755
index 0000000..0d866f4
--- /dev/null
+++ b/scripts/build_web_prod.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+cd build-web/
+mkdir dist/
+
+mv script.js dist/
+mv index.html dist/
+mv asset.data dist/
+mv main.wasm dist/
+mkdir dist/assets/
+cp assets/yinyang.svg dist/assets/
+
+echo "Done!"
diff --git a/test/probablity.cpp b/test/probablity.cpp
new file mode 100644
index 0000000..510c714
--- /dev/null
+++ b/test/probablity.cpp
@@ -0,0 +1,18 @@
+#include <cstdlib>
+#include <stdio.h>
+
+#include "../lib/standard.cpp"
+
+#define SAMPLE_SIZE 10000000
+
+int main () {
+ int trueCount = 0;
+ srand(111111);
+ for (int i = 0; i < SAMPLE_SIZE; i++) {
+ bool result = returnTrueProbPerc(30);
+ if (result) {trueCount++;}
+ }
+ float percentage = ((float)trueCount/SAMPLE_SIZE)*100;
+ printf("%f\n", percentage);
+ return 0;
+}
diff --git a/web/shell.html b/web/shell.html
new file mode 100644
index 0000000..fce889f
--- /dev/null
+++ b/web/shell.html
@@ -0,0 +1,405 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" >
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" >
+ <title>Cirno Day</title>
+ <style>
+ * {
+ box-sizing: border-box;
+ }
+ html,
+ body {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ background: #5b6ee1;
+ color: #e0e0e0;
+ font-family: Georgia, "Times New Roman", Times, serif;
+ font-size: 17px;
+ }
+ body {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ #canvas {
+ box-shadow: 0 0 16px rgba(0, 0, 0, 0.35);
+ border: none;
+ transition: opacity 0.5s ease-in-out;
+ opacity: 0;
+ background-color: #000;
+ }
+
+ /* --- MOBILE-ONLY WALL ---
+ #mobile-wall {
+ position: fixed; top: 0; left: 0; width: 100%; height: 100%;
+ z-index: 1000;
+ background-color: #1a1a1a;
+ display: none;
+ flex-direction: column; align-items: center; justify-content: center;
+ text-align: center; padding: 20px;
+ }
+ .mobile-wall-content h1 { font-size: 1.5em; color: #00b8d4; }
+ .mobile-wall-content p { color: #ccc; max-width: 400px; line-height: 1.6; } */
+
+ /* --- LOADING OVERLAY --- */
+ #loader {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 999;
+ background: #5b6ee1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ transition: opacity 0.8s ease-out;
+ }
+ #loader.hidden {
+ opacity: 0;
+ pointer-events: none;
+ }
+ .loader-content {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ text-align: center;
+ }
+ .loader-content > img {
+ width: 128px;
+ height: 128px;
+ margin-bottom: 20px;
+ }
+ .powered-by {
+ color: darkslategray;
+ margin-top: 5px;
+ font-size: 1.15em;
+ }
+ .progress-bar-container {
+ width: 300px;
+ height: 10px;
+ background-color: #5b6ee1;
+ border-radius: 5px;
+ margin: 20px 0 12px;
+ overflow: hidden;
+ }
+ #progress-bar {
+ width: 0%;
+ height: 100%;
+ background: black;
+ transition: width 0.2s linear;
+ }
+ #status-text {
+ color: black;
+ margin: 0 0 8px;
+ font-size: 1.03rem;
+ }
+ .loading-lore {
+ margin: 0;
+ color: black;
+ letter-spacing: 0.02em;
+ animation: lore-pulse 1.8s ease-in-out infinite;
+ font-size: 1.1rem;
+ }
+ #lore-placeholder {
+ min-height: 1.2em;
+ margin: 4px 0 0;
+ color: yellow;
+ font-size: 1.5rem;
+ }
+ #loading-yinyang {
+ position: fixed;
+ right: -14vmin;
+ bottom: -14vmin;
+ width: 90vmin;
+ height: 90vmin;
+ max-width: none;
+ max-height: none;
+ display: block;
+ opacity: 0.34;
+ transform-origin: 50% 50%;
+ filter: invert(1) sepia(85%) saturate(520%) hue-rotate(312deg) brightness(0.42)
+ contrast(1.08);
+ animation:
+ yinyang-rotate 5.6s linear infinite,
+ yinyang-pulse 1.8s ease-in-out infinite;
+ pointer-events: none;
+ }
+ /* #loading-yinyang.steady { animation: yinyang-rotate 5.6s linear infinite; } */
+ @keyframes yinyang-rotate {
+ from {
+ transform: rotate(0deg);
+ }
+ to {
+ transform: rotate(360deg);
+ }
+ }
+ @keyframes yinyang-pulse {
+ 0%,
+ 100% {
+ opacity: 0.22;
+ }
+ 50% {
+ opacity: 0.46;
+ }
+ }
+ @keyframes lore-pulse {
+ 0%,
+ 100% {
+ opacity: 0.6;
+ }
+ 50% {
+ opacity: 1;
+ }
+ }
+ .loader-footer {
+ position: absolute;
+ bottom: 20px;
+ width: 100%;
+ text-align: center;
+ color: black;
+ font-size: 0.9em;
+ line-height: 1.5;
+ }
+ .loader-footer p {
+ margin: 2px 0;
+ }
+ .loader-footer a {
+ color: #0097a7;
+ text-decoration: none;
+ }
+ .loader-footer a:hover {
+ text-decoration: underline;
+ }
+
+ .ui-overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ pointer-events: none;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ }
+ .ui-overlay > * {
+ pointer-events: auto;
+ }
+ .controls {
+ padding: 10px;
+ text-align: right;
+ }
+ /* #toggle-console-btn { background-color: rgba(30, 30, 30, 0.8); border: 1px solid #555; color: #ccc; padding: 8px 16px; border-radius: 5px; cursor: pointer; font-size: 0.95rem; } */
+ /* .console-container { width: 100%; height: 35vh; background-color: rgba(26, 26, 26, 0.9); border-top: 1px solid #444; display: flex; flex-direction: column; padding: 10px; transform: translateY(100%); transition: transform 0.3s ease-in-out; }
+ .console-container.visible { transform: translateY(0); } */
+ h3 {
+ margin: 0 0 10px 0;
+ font-size: 0.9em;
+ text-transform: uppercase;
+ color: #999;
+ }
+ /* #dev-console { width: 100%; flex-grow: 1; background-color: #252525; border: 1px solid #444; color: #00ddff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95rem; padding: 10px; resize: none; overflow-y: auto; }
+ */
+ </style>
+ </head>
+ <body>
+ <canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
+
+ <!-- <div id="mobile-wall"> -->
+ <!-- <div class="mobile-wall-content"> -->
+ <!-- <h1>Unsupported Device</h1> -->
+ <!-- <p> -->
+ <!-- Cirno's Math Class is designed for a PC experience with keyboard controls. -->
+ <!-- <br><br> -->
+ <!-- Please visit on a desktop or laptop computer to play. -->
+ <!-- </p> -->
+ <!-- </div> -->
+ <!-- </div> -->
+
+ <div id="loader">
+ <div class="loader-content">
+ <!-- <img src="raylib_logo.png" alt="Raylib Logo" /> -->
+ <h1 class="powered-by">Powered by Raylib, C++ and Emscripten &lt;3</h1>
+ <br >
+ <p class="loading-lore">Please wait warmly. The girls are now praying.</p>
+ <div class="progress-bar-container">
+ <div id="progress-bar"></div>
+ </div>
+ <p id="status-text">Initializing...</p>
+ <br >
+ <p id="lore-placeholder">
+ Happy Cirno Day 2026!
+ </p>
+ </div>
+ <img id="loading-yinyang" src="static/yinyang.svg" alt="" aria-hidden="true" >
+ <div class="loader-footer">
+ <p>Touhou Project is a copyright of Team Shanghai Alice (ZUN)</p>
+ <p>What is presented in this game is fan-made and fictional</p>
+ </div>
+ </div>
+
+ <!-- The UI Overlay (for console) -->
+ <div class="ui-overlay">
+ <!-- <div class="controls"><button id="toggle-console-btn">Show Console</button></div> -->
+ <!-- <div class="console-container" id="console-container"> -->
+ <!-- <h3>DEV CONSOLE</h3><textarea id="dev-console" readonly></textarea> -->
+ <!-- </div> -->
+ </div>
+
+ <script type="text/javascript">
+ (function () {
+ const canvas = document.getElementById("canvas");
+ const loader = document.getElementById("loader");
+ const progressBar = document.getElementById("progress-bar");
+ const statusText = document.getElementById("status-text");
+ const yinyang = document.getElementById("loading-yinyang");
+ // const consoleContainer = document.getElementById('console-container');
+ // const toggleBtn = document.getElementById('toggle-console-btn');
+ // const devConsole = document.getElementById('dev-console');
+ const ua = navigator.userAgent || "";
+ const mobileDetected =
+ /Android|iPhone|iPad|iPod|Mobile|webOS|BlackBerry|IEMobile|Opera Mini/i.test(
+ ua,
+ ) ||
+ (navigator.maxTouchPoints || 0) > 1 ||
+ (window.matchMedia && window.matchMedia("(pointer: coarse)").matches);
+
+ let resizeInFlight = false;
+ let lastCanvasW = -1;
+ let lastCanvasH = -1;
+ function resizeCanvas() {
+ if (resizeInFlight) return;
+ const screenWidth = window.innerWidth;
+ const screenHeight = window.innerHeight;
+ if (screenWidth === lastCanvasW && screenHeight === lastCanvasH) return;
+ resizeInFlight = true;
+ canvas.style.width = screenWidth + "px";
+ canvas.style.height = screenHeight + "px";
+ if (window.Module && typeof window.Module.setCanvasSize === "function") {
+ window.Module.setCanvasSize(screenWidth, screenHeight);
+ }
+ lastCanvasW = screenWidth;
+ lastCanvasH = screenHeight;
+ resizeInFlight = false;
+ }
+ window.addEventListener("resize", resizeCanvas);
+
+ //toggleBtn.addEventListener('click', () => {
+ // consoleContainer.classList.toggle('visible');
+ // toggleBtn.textContent = consoleContainer.classList.contains('visible') ? 'Hide Console' : 'Show Console';
+ //});
+
+ //setTimeout(() => { yinyang.classList.add('steady'); }, 4200);
+
+ window.Module = {
+ canvas: (() => canvas)(),
+ mobileDetected: mobileDetected,
+ postRun: [resizeCanvas],
+ setStatus: function (text) {
+ if (!Module.setStatus.last)
+ Module.setStatus.last = { time: Date.now(), text: "" };
+ if (text === Module.setStatus.last.text) return;
+ const m = text.match(/([^(]+)\(([^/]+)\/([^)]+)\)/);
+ if (m) {
+ const label = m[1].trim();
+ const loaded = Number(String(m[2]).replace(/[^\d.]/g, ""));
+ const total = Number(String(m[3]).replace(/[^\d.]/g, ""));
+ if (Number.isFinite(loaded) && Number.isFinite(total) && total > 0) {
+ progressBar.style.width = (loaded / total) * 100 + "%";
+ if (
+ total >= 1024 * 1024 ||
+ /download|data|wasm|file/i.test(label)
+ ) {
+ const loadedMB = (loaded / (1024 * 1024)).toFixed(2);
+ const totalMB = (total / (1024 * 1024)).toFixed(2);
+ statusText.textContent = `${label} ${loadedMB} MB / ${totalMB} MB`;
+ } else {
+ statusText.textContent = `${label} ${loaded} of ${total}`;
+ }
+ } else {
+ statusText.textContent = text;
+ }
+ } else {
+ statusText.textContent = text;
+ }
+ },
+ totalDependencies: 0,
+ monitorRunDependencies: function (left) {
+ this.totalDependencies = Math.max(this.totalDependencies, left);
+ Module.setStatus(
+ left
+ ? "Preparing... (" +
+ (this.totalDependencies - left) +
+ "/" +
+ this.totalDependencies +
+ ")"
+ : "All downloads complete.",
+ );
+ },
+ onRuntimeInitialized: function () {
+ progressBar.style.width = "100%";
+ statusText.textContent = "Ready!";
+
+ setTimeout(() => {
+ loader.classList.add("hidden");
+ canvas.style.opacity = 1;
+ resizeCanvas();
+ if (typeof mobileDetected !== "undefined" && mobileDetected) {
+ const enterFullscreen = () => {
+ // Don't try if we are already in fullscreen
+ if (document.fullscreenElement) return;
+
+ if (canvas.requestFullscreen) {
+ canvas.requestFullscreen().catch(() => {});
+ } else if (document.documentElement.requestFullscreen) {
+ document.documentElement
+ .requestFullscreen()
+ .catch(() => {});
+ }
+ };
+
+ const keepTryingFullscreen = () => {
+ enterFullscreen();
+ };
+ window.addEventListener("pointerdown", keepTryingFullscreen, {
+ passive: true,
+ });
+ window.addEventListener("mousedown", keepTryingFullscreen, {
+ passive: true,
+ });
+ window.addEventListener("touchstart", keepTryingFullscreen, {
+ passive: true,
+ });
+ }
+ }, 2500);
+ },
+ //print: (text) => {
+ // console.log(text);
+ // if (devConsole) {
+ // devConsole.value += text + '\n';
+ // devConsole.scrollTop = devConsole.scrollHeight;
+ // }
+ //},
+ //printErr: (text) => {
+ // console.error(text);
+ // if (devConsole) {
+ // devConsole.value += `[ERROR] ${text}\n`;
+ // devConsole.scrollTop = devConsole.scrollHeight;
+ // }
+ //},
+ };
+ Module.setStatus("Downloading...");
+ })();
+ </script>
+ <script data-goatcounter="https://theindiandev.goatcounter.com/count"
+ async src="//gc.zgo.at/count.js"></script>
+ {{{ SCRIPT }}}
+ </body>
+</html>
diff --git a/web/static/yinyang.svg b/web/static/yinyang.svg
new file mode 100644
index 0000000..cff15e8
--- /dev/null
+++ b/web/static/yinyang.svg
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<svg viewBox="0 0 78 78" xmlns="http://www.w3.org/2000/svg">
+ <path d="M39 0a39 39,0 0 0,0 78a39 39,0 0 0,0 -78m0 1a19 19,0 0 1,0 38a19 19,0 0 0,0 38a38 38,0 0 1,0 -76m0 13.5a5 5,0 0 0,0 10a5 5,0 0 0,0 -10m0 39a5 5,0 0 1,0 10a5 5,0 0 1,0 -10"/>
+</svg>