├── ext ├── soloud │ ├── doc │ │ ├── title.txt │ │ ├── css │ │ │ ├── logo.png │ │ │ ├── vs.css │ │ │ └── soloud.css │ │ ├── images │ │ │ ├── file.pdf │ │ │ ├── file.png │ │ │ ├── sfxr.pdf │ │ │ ├── sfxr.png │ │ │ ├── time.pdf │ │ │ ├── time.png │ │ │ ├── codegen.pdf │ │ │ ├── codegen.png │ │ │ ├── cover.png │ │ │ ├── doppler.pdf │ │ │ ├── doppler.png │ │ │ ├── mixbus.pdf │ │ │ ├── mixbus.png │ │ │ ├── clipping.pdf │ │ │ ├── clipping.png │ │ │ ├── clocked_1.pdf │ │ │ ├── clocked_1.png │ │ │ ├── clocked_2.pdf │ │ │ ├── clocked_2.png │ │ │ ├── clocked_3.pdf │ │ │ ├── clocked_3.png │ │ │ ├── concepts.pdf │ │ │ ├── concepts.png │ │ │ ├── demo_env.pdf │ │ │ ├── demo_env.png │ │ │ ├── dirstruct.pdf │ │ │ ├── dirstruct.png │ │ │ ├── pianokeys.pdf │ │ │ ├── pianokeys.png │ │ │ ├── resampler.pdf │ │ │ ├── resampler.png │ │ │ ├── SoLoudLogo.pdf │ │ │ ├── att_exp_max.pdf │ │ │ ├── att_exp_max.png │ │ │ ├── att_exp_min.pdf │ │ │ ├── att_exp_min.png │ │ │ ├── att_inv_max.pdf │ │ │ ├── att_inv_max.png │ │ │ ├── att_inv_min.pdf │ │ │ ├── att_inv_min.png │ │ │ ├── att_lin_max.pdf │ │ │ ├── att_lin_max.png │ │ │ ├── att_lin_min.pdf │ │ │ ├── att_lin_min.png │ │ │ ├── demo_3dtest.pdf │ │ │ ├── demo_3dtest.png │ │ │ ├── demo_pewpew.pdf │ │ │ ├── demo_pewpew.png │ │ │ ├── demo_piano.pdf │ │ │ ├── demo_piano.png │ │ │ ├── demo_space.pdf │ │ │ ├── demo_space.png │ │ │ ├── demo_tedsid.pdf │ │ │ ├── demo_tedsid.png │ │ │ ├── demo_welcome.pdf │ │ │ ├── demo_welcome.png │ │ │ ├── milestones.png │ │ │ ├── speaker_dot.pdf │ │ │ ├── speaker_dot.png │ │ │ ├── voicegroups.pdf │ │ │ ├── voicegroups.png │ │ │ ├── demo_mixbusses.pdf │ │ │ ├── demo_mixbusses.png │ │ │ ├── demo_monotone.pdf │ │ │ ├── demo_monotone.png │ │ │ ├── demo_simplest.pdf │ │ │ ├── demo_simplest.png │ │ │ ├── source_backend.pdf │ │ │ ├── source_backend.png │ │ │ ├── virtualvoices.pdf │ │ │ ├── virtualvoices.png │ │ │ ├── att_exp_rolloff.pdf │ │ │ ├── att_exp_rolloff.png │ │ │ ├── att_inv_rolloff.pdf │ │ │ ├── att_inv_rolloff.png │ │ │ ├── att_lin_rolloff.pdf │ │ │ ├── att_lin_rolloff.png │ │ │ ├── demo_multimusic.pdf │ │ │ ├── demo_multimusic.png │ │ │ ├── demo_virtualvoices.pdf │ │ │ └── demo_virtualvoices.png │ │ ├── html.pandoc │ │ ├── singlehtml_body.txt │ │ ├── fftfilter.mmd │ │ ├── htmlpost.txt │ │ ├── foreign_interface.mmd │ │ ├── bassboostfilter.mmd │ │ ├── echofilter.mmd │ │ ├── singlehtml_head.txt │ │ ├── dcremovalfilter.mmd │ │ ├── codegen.mmd │ │ ├── flangerfilter.mmd │ │ ├── lofifilter.mmd │ │ ├── attenuator.mmd │ │ ├── d_api.mmd │ │ ├── cs_api.mmd │ │ ├── ruby_api.mmd │ │ ├── rpgmaker_api.mmd │ │ └── bmx_api.mmd │ ├── demos │ │ ├── android │ │ │ ├── jni │ │ │ │ ├── Application.mk │ │ │ │ └── Android.mk │ │ │ └── default.properties │ │ ├── emscripten │ │ │ ├── build_pewpew │ │ │ ├── build_virtualvoices │ │ │ ├── build_piano │ │ │ ├── build_monotone │ │ │ └── build_tedsid │ │ ├── glue │ │ │ ├── gamemaker │ │ │ │ └── hello.txt │ │ │ ├── ruby │ │ │ │ └── test_ruby.rb │ │ │ ├── python │ │ │ │ ├── test_python.py │ │ │ │ └── test_gfx.py │ │ │ ├── rpgmaker │ │ │ │ ├── simplest.rb │ │ │ │ ├── c_test.rb │ │ │ │ └── space.rb │ │ │ └── cs │ │ │ │ └── hello.cs │ │ ├── common │ │ │ ├── glew │ │ │ │ └── GL │ │ │ │ │ └── README.txt │ │ │ ├── imgui │ │ │ │ └── LICENSE │ │ │ └── soloud_demo_framework.h │ │ ├── piano │ │ │ └── soloud_basicwave.h │ │ └── simplest │ │ │ └── main.cpp │ ├── soloud.png │ ├── src │ │ ├── audiosource │ │ │ ├── wav │ │ │ │ └── stb_vorbis.h │ │ │ ├── speech │ │ │ │ ├── tts.h │ │ │ │ ├── darray.h │ │ │ │ ├── legal_readme.txt │ │ │ │ ├── darray.cpp │ │ │ │ └── resonator.h │ │ │ └── tedsid │ │ │ │ ├── ted.cpp │ │ │ │ ├── readme.txt │ │ │ │ └── ted.h │ │ └── tools │ │ │ ├── resamplerlab │ │ │ └── stb_image_write.c │ │ │ └── tedsid2dump │ │ │ ├── tedmem.cpp │ │ │ ├── tedmem.h │ │ │ ├── cpu7501asm.h │ │ │ ├── tedsound.cpp │ │ │ ├── readme.txt │ │ │ ├── mem.h │ │ │ ├── types.h │ │ │ └── tedplay.h │ ├── .gitmodules │ ├── glue │ │ └── readme.txt │ ├── scripts │ │ ├── makeglue.py │ │ ├── compile_gamemaker_dll.bat │ │ ├── make_gmez.bat │ │ ├── readme.txt │ │ ├── checkapidoc.py │ │ └── gen_autoit.py │ ├── README.md │ ├── .gitignore │ ├── CMakeLists.txt │ ├── AUTHORS │ ├── LICENSE │ ├── include │ │ ├── soloud_file_hack_off.h │ │ ├── soloud_fft.h │ │ ├── soloud_error.h │ │ ├── soloud_dcremovalfilter.h │ │ ├── soloud_echofilter.h │ │ └── soloud_openmpt.h │ └── CONTRIBUTING ├── lua │ ├── doc │ │ ├── logo.gif │ │ ├── osi-certified-72x60.png │ │ ├── index.css │ │ └── manual.css │ ├── README │ ├── src │ │ ├── lua.hpp │ │ ├── lapi.h │ │ ├── lundump.h │ │ ├── lprefix.h │ │ ├── lualib.h │ │ ├── ldebug.h │ │ ├── lstring.h │ │ ├── lzio.c │ │ ├── lzio.h │ │ └── lfunc.h │ └── CMakeLists.txt ├── msdfgen │ ├── icon.ico │ ├── Msdfgen.rc │ ├── resource.h │ ├── bin │ │ ├── zlib1.dll │ │ ├── freetype6.dll │ │ └── example.bat │ ├── .gitignore │ ├── core │ │ ├── equation-solver.h │ │ ├── save-bmp.h │ │ ├── EdgeColor.h │ │ ├── shape-description.h │ │ ├── edge-coloring.h │ │ ├── SignedDistance.h │ │ ├── render-sdf.h │ │ ├── Contour.h │ │ ├── Bitmap.h │ │ ├── Shape.h │ │ ├── SignedDistance.cpp │ │ ├── EdgeHolder.h │ │ ├── arithmetics.hpp │ │ ├── Contour.cpp │ │ ├── Bitmap.cpp │ │ └── equation-solver.cpp │ ├── ext │ │ ├── save-png.h │ │ ├── import-svg.h │ │ ├── import-font.h │ │ └── save-png.cpp │ ├── msdfgen-ext.h │ ├── Msdfgen.sln │ ├── LICENSE.txt │ └── CMakeLists.txt ├── lodepng │ └── CMakeLists.txt └── sol2 │ └── CMakeLists.txt ├── src ├── ember │ ├── sdl.hpp │ ├── display.hpp │ ├── lua_gui.hpp │ ├── math.hpp │ ├── net_id.hpp │ ├── vdom.hpp │ ├── engine_lua_types.cpp │ ├── json_lua.hpp │ ├── config.hpp │ ├── box2d_helpers.hpp │ ├── scene.hpp │ ├── vdom.cpp │ ├── reflection_end.hpp │ ├── component_common.hpp │ ├── ez3d.hpp │ ├── box2d_helpers.cpp │ ├── font.hpp │ ├── lerpable.hpp │ ├── scripting.hpp │ ├── render_queue.hpp │ ├── ez3d.cpp │ ├── camera.hpp │ ├── lua_gui.cpp │ ├── sushi_renderer.hpp │ ├── json_serializers.hpp │ ├── reflection.hpp │ ├── camera.cpp │ └── shaders.hpp ├── meshes.hpp ├── components.cpp ├── scene_mainmenu.hpp ├── physics.hpp ├── scene_mainmenu.cpp ├── components.hpp └── scene_gameplay.hpp ├── static ├── favicon.png ├── scripts │ └── config.js ├── index.html └── css │ └── style.css ├── data ├── textures │ └── sprites.png ├── fonts │ └── LiberationSans-Regular.ttf └── scripts │ ├── actors │ ├── brick.lua │ ├── paddle.lua │ └── ball.lua │ ├── gui │ ├── controls │ │ ├── fps_counter.lua │ │ ├── version_stamp.lua │ │ └── textbox.lua │ ├── all_states.lua │ ├── scene_mainmenu │ │ └── root.lua │ └── scene_gameplay │ │ └── root.lua │ ├── bind.lua │ ├── systems │ ├── physics.lua │ └── scripting.lua │ ├── visitor.lua │ ├── init_gui.lua │ └── archetypes │ ├── brick.lua │ ├── paddle.lua │ └── ball.lua ├── serve.sh ├── .gitignore ├── launch_vscode.ps1 ├── setup_cmake-kits.json ├── Makefile.nginx ├── platform ├── emscripten │ └── data │ │ └── shaders │ │ ├── msdf.vert │ │ ├── msdf.frag │ │ ├── basic.vert │ │ └── basic.frag └── x86_64 │ └── data │ └── shaders │ ├── msdf.vert │ ├── msdf.frag │ ├── basic.vert │ └── basic.frag ├── configure_all.sh ├── .gitmodules ├── setup_c_cpp_properties.json ├── cmake └── Modules │ ├── FindCereal.cmake │ ├── BlenderExports.cmake │ └── FindBlender.cmake ├── nginx.conf ├── LICENSE ├── doc └── scripting.md └── setup.ps1 /ext/soloud/doc/title.txt: -------------------------------------------------------------------------------- 1 | % SoLoud Audio Engine 2 | % Jari Komppa 3 | -------------------------------------------------------------------------------- /src/ember/sdl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /ext/soloud/demos/android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | APP_PLATFORM := android-10 3 | -------------------------------------------------------------------------------- /static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/static/favicon.png -------------------------------------------------------------------------------- /ext/lua/doc/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/lua/doc/logo.gif -------------------------------------------------------------------------------- /ext/msdfgen/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/msdfgen/icon.ico -------------------------------------------------------------------------------- /ext/msdfgen/Msdfgen.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/msdfgen/Msdfgen.rc -------------------------------------------------------------------------------- /ext/msdfgen/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/msdfgen/resource.h -------------------------------------------------------------------------------- /ext/soloud/soloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/soloud.png -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/wav/stb_vorbis.h: -------------------------------------------------------------------------------- 1 | #define STB_VORBIS_HEADER_ONLY 2 | #include "stb_vorbis.c" -------------------------------------------------------------------------------- /data/textures/sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/data/textures/sprites.png -------------------------------------------------------------------------------- /ext/msdfgen/bin/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/msdfgen/bin/zlib1.dll -------------------------------------------------------------------------------- /ext/soloud/doc/css/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/css/logo.png -------------------------------------------------------------------------------- /ext/msdfgen/bin/freetype6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/msdfgen/bin/freetype6.dll -------------------------------------------------------------------------------- /ext/soloud/doc/images/file.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/file.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/file.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/sfxr.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/sfxr.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/sfxr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/sfxr.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/time.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/time.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/time.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/codegen.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/codegen.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/codegen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/codegen.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/cover.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/doppler.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/doppler.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/doppler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/doppler.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/mixbus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/mixbus.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/mixbus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/mixbus.png -------------------------------------------------------------------------------- /ext/lua/doc/osi-certified-72x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/lua/doc/osi-certified-72x60.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/clipping.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/clipping.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/clipping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/clipping.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/clocked_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/clocked_1.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/clocked_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/clocked_1.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/clocked_2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/clocked_2.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/clocked_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/clocked_2.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/clocked_3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/clocked_3.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/clocked_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/clocked_3.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/concepts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/concepts.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/concepts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/concepts.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_env.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_env.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_env.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/dirstruct.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/dirstruct.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/dirstruct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/dirstruct.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/pianokeys.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/pianokeys.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/pianokeys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/pianokeys.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/resampler.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/resampler.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/resampler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/resampler.png -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/speech/tts.h: -------------------------------------------------------------------------------- 1 | 2 | extern int xlate_string (const char *string,darray *phone); 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ext/soloud/src/tools/resamplerlab/stb_image_write.c: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_WRITE_IMPLEMENTATION 2 | #include "stb_image_write.h" 3 | -------------------------------------------------------------------------------- /data/fonts/LiberationSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/data/fonts/LiberationSans-Regular.ttf -------------------------------------------------------------------------------- /ext/soloud/doc/images/SoLoudLogo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/SoLoudLogo.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_exp_max.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_exp_max.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_exp_max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_exp_max.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_exp_min.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_exp_min.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_exp_min.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_exp_min.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_inv_max.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_inv_max.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_inv_max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_inv_max.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_inv_min.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_inv_min.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_inv_min.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_inv_min.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_lin_max.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_lin_max.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_lin_max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_lin_max.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_lin_min.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_lin_min.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_lin_min.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_lin_min.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_3dtest.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_3dtest.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_3dtest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_3dtest.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_pewpew.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_pewpew.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_pewpew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_pewpew.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_piano.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_piano.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_piano.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_piano.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_space.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_space.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_space.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_tedsid.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_tedsid.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_tedsid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_tedsid.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_welcome.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_welcome.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_welcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_welcome.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/milestones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/milestones.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/speaker_dot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/speaker_dot.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/speaker_dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/speaker_dot.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/voicegroups.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/voicegroups.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/voicegroups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/voicegroups.png -------------------------------------------------------------------------------- /ext/soloud/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ext/libmodplug"] 2 | path = ext/libmodplug 3 | url = https://github.com/jarikomppa/libmodplug.git 4 | -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_mixbusses.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_mixbusses.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_mixbusses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_mixbusses.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_monotone.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_monotone.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_monotone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_monotone.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_simplest.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_simplest.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_simplest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_simplest.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/source_backend.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/source_backend.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/source_backend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/source_backend.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/virtualvoices.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/virtualvoices.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/virtualvoices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/virtualvoices.png -------------------------------------------------------------------------------- /ext/soloud/glue/readme.txt: -------------------------------------------------------------------------------- 1 | In this directory you can find generated glue files 2 | for various environments (python, ruby, cs, d...) 3 | -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_exp_rolloff.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_exp_rolloff.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_exp_rolloff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_exp_rolloff.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_inv_rolloff.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_inv_rolloff.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_inv_rolloff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_inv_rolloff.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_lin_rolloff.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_lin_rolloff.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/att_lin_rolloff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/att_lin_rolloff.png -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_multimusic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_multimusic.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_multimusic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_multimusic.png -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/tedsid/ted.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/src/audiosource/tedsid/ted.cpp -------------------------------------------------------------------------------- /ext/soloud/src/tools/tedsid2dump/tedmem.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/src/tools/tedsid2dump/tedmem.cpp -------------------------------------------------------------------------------- /ext/soloud/src/tools/tedsid2dump/tedmem.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/src/tools/tedsid2dump/tedmem.h -------------------------------------------------------------------------------- /src/ember/display.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct display_info { 4 | int width; 5 | int height; 6 | float aspect_ratio; 7 | }; 8 | -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_virtualvoices.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_virtualvoices.pdf -------------------------------------------------------------------------------- /ext/soloud/doc/images/demo_virtualvoices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/doc/images/demo_virtualvoices.png -------------------------------------------------------------------------------- /ext/soloud/src/tools/tedsid2dump/cpu7501asm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/src/tools/tedsid2dump/cpu7501asm.h -------------------------------------------------------------------------------- /ext/soloud/src/tools/tedsid2dump/tedsound.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apples/ember_engine/master/ext/soloud/src/tools/tedsid2dump/tedsound.cpp -------------------------------------------------------------------------------- /ext/soloud/doc/html.pandoc: -------------------------------------------------------------------------------- 1 | $for(include-before)$ 2 | $include-before$ 3 | $endfor$ 4 | $body$ 5 | $for(include-after)$ 6 | $include-after$ 7 | $endfor$ 8 | -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/tedsid/readme.txt: -------------------------------------------------------------------------------- 1 | The TED / SID support is based on tedplay (c) 2012 Attila Grosz, used under Unlicense http://unlicense.org/ 2 | -------------------------------------------------------------------------------- /ext/soloud/src/tools/tedsid2dump/readme.txt: -------------------------------------------------------------------------------- 1 | The TED / SID support is based on tedplay (c) 2012 Attila Grosz, used under Unlicense http://unlicense.org/ 2 | -------------------------------------------------------------------------------- /ext/soloud/scripts/makeglue.py: -------------------------------------------------------------------------------- 1 | import glob 2 | import subprocess 3 | 4 | for file in glob.glob("gen_*.py"): 5 | subprocess.call(["python",file]) 6 | 7 | -------------------------------------------------------------------------------- /ext/soloud/scripts/compile_gamemaker_dll.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | call vcvars32.bat 3 | cl /LD /Ox /nologo soloud_gamemaker_dll.c soloud_gamemaker_dll.def user32.lib 4 | -------------------------------------------------------------------------------- /src/meshes.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | auto get_sprite_mesh() -> sushi::mesh_group; 6 | 7 | auto get_tilemap_mesh() -> sushi::mesh_group; 8 | -------------------------------------------------------------------------------- /ext/lua/README: -------------------------------------------------------------------------------- 1 | 2 | This is Lua 5.3.4, released on 12 Jan 2017. 3 | 4 | For installation instructions, license details, and 5 | further information about Lua, see doc/readme.html. 6 | 7 | -------------------------------------------------------------------------------- /serve.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | make -f Makefile.nginx 5 | 6 | start http://localhost:4242/release 7 | 8 | echo "Starting Nginx..." 9 | cd .nginx 10 | ./nginx.exe 11 | -------------------------------------------------------------------------------- /src/ember/lua_gui.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace ember::lua_gui { 6 | 7 | void register_types(sol::table& lua); 8 | 9 | } // namespace ember::lua_gui 10 | -------------------------------------------------------------------------------- /ext/msdfgen/.gitignore: -------------------------------------------------------------------------------- 1 | Debug/ 2 | Release/ 3 | *.exe 4 | *.user 5 | *.sdf 6 | *.pdb 7 | *.ipdb 8 | *.iobj 9 | *.suo 10 | *.VC.opendb 11 | output.png 12 | render.png 13 | out/ 14 | build_xcode/ 15 | -------------------------------------------------------------------------------- /ext/soloud/scripts/make_gmez.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | del soloud.gmez 3 | cd gm_temp 4 | 7z a -r -y ../../glue/soloud.gmez * 5 | cd .. 6 | rd /s /q gm_temp 7 | del soloud_gamemaker_dll.* 8 | del soloud.extension.gmx 9 | -------------------------------------------------------------------------------- /src/components.cpp: -------------------------------------------------------------------------------- 1 | #include "components.hpp" 2 | 3 | #include "ember/component_scripting.hpp" 4 | 5 | namespace component { 6 | 7 | EMBER_REGISTER_ALL_COMPONENTS 8 | 9 | } // namespace component 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Common 2 | /.nginx 3 | /.pkg 4 | /.tmp 5 | /.vs 6 | /.vscode 7 | /build 8 | node_modules 9 | 10 | # Secrets 11 | .env 12 | 13 | # Temporary files 14 | *.blend[0-9] 15 | *.kra[~] 16 | *.swp 17 | -------------------------------------------------------------------------------- /ext/soloud/doc/singlehtml_body.txt: -------------------------------------------------------------------------------- 1 |

SoLoud Audio Engine

2 |

Copyright © Jari Komppa

3 |

http://soloud.audio.com

4 |

Table of Contents

5 | -------------------------------------------------------------------------------- /ext/msdfgen/bin/example.bat: -------------------------------------------------------------------------------- 1 | msdfgen.exe -defineshape "{ 1471,0; 1149,0; 1021,333; 435,333; 314,0; 0,0; 571,1466; 884,1466; # }{ 926,580; 724,1124; 526,580; # }" -size 16 16 -autoframe -testrender render.png 1024 1024 2 | -------------------------------------------------------------------------------- /ext/soloud/scripts/readme.txt: -------------------------------------------------------------------------------- 1 | The 'codegen' tool can be used to parse SoLoud headers and generate the 2 | soloud_codegen.py file. 3 | 4 | This file can then be used to generate various "glue" code for non-c 5 | environments. 6 | -------------------------------------------------------------------------------- /launch_vscode.ps1: -------------------------------------------------------------------------------- 1 | $PKG = "$PSScriptRoot\.pkg" 2 | $EMSDK = "$PSScriptRoot\.pkg\emsdk" 3 | 4 | & "$PKG\msys64\msys2_shell.cmd" -mingw64 -c "source '$EMSDK\emsdk_env.sh'; '/c/Program Files/Microsoft VS Code/Code.exe' '$PSScriptRoot' &" 5 | -------------------------------------------------------------------------------- /ext/lua/src/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /static/scripts/config.js: -------------------------------------------------------------------------------- 1 | var EmberConfig = (function(){ 2 | var params = new URL(location).searchParams; 3 | return { 4 | display: { 5 | width: 1280, 6 | height: 720 7 | } 8 | }; 9 | })(); 10 | -------------------------------------------------------------------------------- /data/scripts/actors/brick.lua: -------------------------------------------------------------------------------- 1 | 2 | local brick = {} 3 | 4 | function brick.physics_post_collide(eid, other) 5 | if entities:has_component(other, component.tag_brick_breaker) then 6 | queue_destroy(eid) 7 | end 8 | end 9 | 10 | return brick 11 | 12 | -------------------------------------------------------------------------------- /ext/lodepng/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(lodepng) 3 | 4 | add_library(lodepng EXCLUDE_FROM_ALL 5 | lodepng.h lodepng.cpp 6 | ) 7 | set_property(TARGET lodepng PROPERTY CXX_STANDARD 14) 8 | target_include_directories(lodepng PUBLIC ./) 9 | -------------------------------------------------------------------------------- /ext/msdfgen/core/equation-solver.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | namespace msdfgen { 5 | 6 | // ax^2 + bx + c = 0 7 | int solveQuadratic(double x[2], double a, double b, double c); 8 | 9 | // ax^3 + bx^2 + cx + d = 0 10 | int solveCubic(double x[3], double a, double b, double c, double d); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /ext/msdfgen/core/save-bmp.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Bitmap.h" 5 | 6 | namespace msdfgen { 7 | 8 | /// Saves the bitmap as a BMP file. 9 | bool saveBmp(const Bitmap &bitmap, const char *filename); 10 | bool saveBmp(const Bitmap &bitmap, const char *filename); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /ext/msdfgen/ext/save-png.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "../core/Bitmap.h" 5 | 6 | namespace msdfgen { 7 | 8 | /// Saves the bitmap as a PNG file. 9 | bool savePng(const Bitmap &bitmap, const char *filename); 10 | bool savePng(const Bitmap &bitmap, const char *filename); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/ember/math.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace ember::math { 8 | 9 | void register_types(sol::table& lua); 10 | 11 | inline auto imod(double x, double y) -> int { 12 | return x - y * std::floor(x / y); 13 | } 14 | 15 | } // namespace ember::math 16 | -------------------------------------------------------------------------------- /src/ember/net_id.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | /** Canonical never-recycled ID for any entity, useful for serialization */ 6 | namespace ember { 7 | 8 | struct net_id { 9 | using id_type = std::int64_t; 10 | id_type id; /** Canonical ID */ 11 | }; 12 | 13 | } // namespace ember 14 | -------------------------------------------------------------------------------- /ext/soloud/README.md: -------------------------------------------------------------------------------- 1 | SoLoud 2 | ====== 3 | 4 | SoLoud is an easy to use, free, portable c/c++ audio engine for games. 5 | 6 | ![ScreenShot](https://raw.github.com/jarikomppa/soloud/master/soloud.png) 7 | 8 | Zlib/LibPng licensed. Portable. Easy. 9 | 10 | Official site with documentation can be found at: 11 | http://soloud-audio.com 12 | -------------------------------------------------------------------------------- /src/ember/vdom.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace ember::vdom { 9 | 10 | auto create_element( 11 | sol::state& lua, const std::string& module_name, const sol::table& props, const sol::table& children) -> sol::table; 12 | 13 | } // namespace ember::vdom 14 | -------------------------------------------------------------------------------- /ext/sol2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.0) 2 | project(Sol2) 3 | 4 | file(GLOB_RECURSE sol2_SOURCES CONFIGURE_DEPENDS include/*) 5 | add_library(sol2 INTERFACE) 6 | set_property(TARGET sol2 PROPERTY INTERFACE_SOURCES ${sol2_SOURCES}) 7 | target_include_directories(sol2 INTERFACE include) 8 | target_link_libraries(sol2 INTERFACE lua) 9 | -------------------------------------------------------------------------------- /ext/msdfgen/core/EdgeColor.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | namespace msdfgen { 5 | 6 | /// Edge color specifies which color channels an edge belongs to. 7 | enum EdgeColor { 8 | BLACK = 0, 9 | RED = 1, 10 | GREEN = 2, 11 | YELLOW = 3, 12 | BLUE = 4, 13 | MAGENTA = 5, 14 | CYAN = 6, 15 | WHITE = 7 16 | }; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /ext/lua/doc/index.css: -------------------------------------------------------------------------------- 1 | ul { 2 | list-style-type: none ; 3 | } 4 | 5 | ul.contents { 6 | padding: 0 ; 7 | } 8 | 9 | table { 10 | border: none ; 11 | border-spacing: 0 ; 12 | border-collapse: collapse ; 13 | } 14 | 15 | td { 16 | vertical-align: top ; 17 | padding: 0 ; 18 | text-align: left ; 19 | line-height: 1.25 ; 20 | width: 15% ; 21 | } 22 | -------------------------------------------------------------------------------- /ext/msdfgen/ext/import-svg.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../core/Shape.h" 6 | 7 | namespace msdfgen { 8 | 9 | /// Reads the first path found in the specified SVG file and stores it as a Shape in output. 10 | bool loadSvgShape(Shape &output, const char *filename, int pathIndex = 0, Vector2 *dimensions = NULL); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/ember/engine_lua_types.cpp: -------------------------------------------------------------------------------- 1 | #include "engine.hpp" 2 | 3 | #include "math.hpp" 4 | #include "scripting.hpp" 5 | 6 | #include 7 | 8 | namespace ember { 9 | 10 | void engine::register_engine_module() { 11 | auto engine_table = lua.create_table(); 12 | lua["package"]["loaded"]["engine"] = engine_table; 13 | } 14 | 15 | } // namespace ember 16 | -------------------------------------------------------------------------------- /ext/lua/doc/manual.css: -------------------------------------------------------------------------------- 1 | h3 code { 2 | font-family: inherit ; 3 | font-size: inherit ; 4 | } 5 | 6 | pre, code { 7 | font-size: 12pt ; 8 | } 9 | 10 | span.apii { 11 | color: gray ; 12 | float: right ; 13 | font-family: inherit ; 14 | font-style: normal ; 15 | font-size: small ; 16 | } 17 | 18 | h2:before { 19 | content: "" ; 20 | padding-right: 0em ; 21 | } 22 | -------------------------------------------------------------------------------- /ext/soloud/doc/fftfilter.mmd: -------------------------------------------------------------------------------- 1 | ## SoLoud::FFTFilter 2 | 3 | The FFT filter is a short-time Fourier transform filter which can 4 | be used as basis for FFT-based effects. The base implementation 5 | does a simple tone downshifting. 6 | 7 | The filter exists mainly to adjust the speech synthesizer's voice in 8 | strange ways. It can also be used as basis for other FFT-based filters. 9 | -------------------------------------------------------------------------------- /ext/soloud/src/tools/tedsid2dump/mem.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEM_H 2 | #define _MEM_H 3 | 4 | // Abstract Memory handler superclass for all memory handler objects 5 | class MemoryHandler { 6 | public: 7 | virtual void Write(unsigned int addr, unsigned char data) = 0; 8 | virtual unsigned char Read(unsigned int addr) = 0; 9 | virtual void Reset() = 0; 10 | }; 11 | 12 | #endif // _MEM_H 13 | -------------------------------------------------------------------------------- /data/scripts/gui/controls/fps_counter.lua: -------------------------------------------------------------------------------- 1 | local vdom = require('vdom') 2 | 3 | return function(props) 4 | return vdom.create_element( 5 | 'label', 6 | { 7 | halign='right', 8 | valign='top', 9 | top = 24, 10 | height = 24, 11 | text = props.fps, 12 | color = '#f0f', 13 | } 14 | ) 15 | end 16 | -------------------------------------------------------------------------------- /ext/soloud/demos/emscripten/build_pewpew: -------------------------------------------------------------------------------- 1 | emcc -o pewpew.html ../pewpew/main.cpp ../common/*.cpp ../common/imgui/imgui.cpp ../../src/core/*.cpp ../../src/filter/*.cpp ../../src/backend/sdl2_static/*.cpp ../../src/audiosource/sfxr/*.cpp -I ../common -I ../common/imgui -I ../../include --preload-file "../../bin/graphics/soloud_bg.png"@"graphics/soloud_bg.png" -s USE_SDL=2 -O2 -D WITH_SDL2_STATIC -s FULL_ES2=1 2 | -------------------------------------------------------------------------------- /data/scripts/gui/controls/version_stamp.lua: -------------------------------------------------------------------------------- 1 | local vdom = require('vdom') 2 | 3 | return function(props) 4 | return vdom.create_element( 5 | 'label', 6 | { 7 | halign='right', 8 | valign='top', 9 | top=0, 10 | height = 24, 11 | text = props.version, 12 | color = '#f0f' 13 | } 14 | ) 15 | end 16 | 17 | -------------------------------------------------------------------------------- /setup_cmake-kits.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Emscripten (.pkg)", 4 | "toolchainFile": "${workspaceFolder}\\.pkg\\emsdk\\upstream\\emscripten\\cmake\\Modules\\Platform\\Emscripten.cmake", 5 | "compilers": { 6 | "C": "${workspaceFolder}\\.pkg\\emsdk\\upstream\\emscripten\\emcc.bat", 7 | "CXX": "${workspaceFolder}\\.pkg\\emsdk\\upstream\\emscripten\\em++.bat" 8 | } 9 | } 10 | ] -------------------------------------------------------------------------------- /ext/soloud/demos/emscripten/build_virtualvoices: -------------------------------------------------------------------------------- 1 | emcc -o virtualvoices.html ../virtualvoices/main.cpp ../common/*.cpp ../common/imgui/imgui.cpp ../../src/core/*.cpp ../../src/filter/*.cpp ../../src/backend/sdl2_static/*.cpp ../../src/audiosource/sfxr/*.cpp -I ../common -I ../common/imgui -I ../../include --preload-file "../../bin/graphics/soloud_bg.png"@"graphics/soloud_bg.png" -s USE_SDL=2 -O2 -D WITH_SDL2_STATIC -s FULL_ES2=1 2 | -------------------------------------------------------------------------------- /ext/soloud/demos/glue/gamemaker/hello.txt: -------------------------------------------------------------------------------- 1 | soloud = Soloud_create(); 2 | speech = Speech_create(); 3 | flanger = FlangerFilter_create(); 4 | Soloud_init(soloud); 5 | Soloud_setGlobalVolume(soloud, 10); 6 | Speech_setText(speech, "Hello gamemaker studio world!"); 7 | Speech_setFilter(speech, 0, flanger); 8 | Soloud_play(soloud, speech); 9 | 10 | show_message("We should hear something now"); 11 | 12 | Soloud_destroy(soloud); -------------------------------------------------------------------------------- /Makefile.nginx: -------------------------------------------------------------------------------- 1 | 2 | NGINX_ZIP=https://nginx.org/download/nginx-1.19.0.zip 3 | NGINX_DIR=nginx-1.19.0 4 | 5 | .PHONY: all 6 | all: .nginx .nginx/conf/nginx.conf 7 | 8 | .nginx: 9 | echo "Downloading Nginx..." 10 | curl $(NGINX_ZIP) -o nginx.zip 11 | unzip nginx.zip 12 | rm nginx.zip 13 | mv $(NGINX_DIR) .nginx 14 | rm .nginx/conf/nginx.conf 15 | 16 | .nginx/conf/nginx.conf: nginx.conf .nginx 17 | cp nginx.conf .nginx/conf/nginx.conf 18 | -------------------------------------------------------------------------------- /ext/soloud/demos/android/default.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-10 12 | -------------------------------------------------------------------------------- /platform/emscripten/data/shaders/msdf.vert: -------------------------------------------------------------------------------- 1 | attribute vec3 VertexPosition; 2 | attribute vec2 VertexTexCoord; 3 | attribute vec3 VertexNormal; 4 | 5 | varying vec2 v_texcoord; 6 | varying vec3 v_normal; 7 | 8 | uniform mat4 MVP; 9 | uniform mat4 normal_mat; 10 | 11 | void main() 12 | { 13 | v_texcoord = VertexTexCoord; 14 | v_normal = vec3(normal_mat * vec4(VertexNormal, 0.0)); 15 | gl_Position = MVP * vec4(VertexPosition, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/speech/darray.h: -------------------------------------------------------------------------------- 1 | #if !defined(DARRAY_H) 2 | #define DARRAY_H 3 | 4 | class darray 5 | { 6 | protected: 7 | char *mData; 8 | int mUsed; 9 | int mAllocated; 10 | int mAllocChunk; 11 | public: 12 | darray(); 13 | ~darray(); 14 | void clear(); 15 | char *getDataInPos(int aPosition); 16 | void put(int aData); 17 | int getSize() const { return mUsed; } 18 | char *getData() { return mData; } 19 | }; 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /src/ember/json_lua.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "json.hpp" 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace ember::json_lua { 10 | 11 | auto json_to_lua(const nlohmann::json& json, sol::this_state state) -> sol::object; 12 | 13 | auto lua_to_json(const sol::object& obj) -> nlohmann::json; 14 | 15 | auto load_file(const std::string& filename, sol::this_state state) -> sol::object; 16 | 17 | } // namespace ember::json_lua 18 | -------------------------------------------------------------------------------- /configure_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | COMMON="-G Ninja" 5 | EMSCRIPTEN="-DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" 6 | RELEASE="-DCMAKE_BUILD_TYPE=Release" 7 | DEBUG="-DCMAKE_BUILD_TYPE=Debug" 8 | 9 | function mkdircd () { mkdir -p $1 && cd $1; } 10 | 11 | (mkdircd build/release && cmake ../.. $COMMON $EMSCRIPTEN $RELEASE) 12 | (mkdircd build/debug && cmake ../.. $COMMON $EMSCRIPTEN $DEBUG) 13 | -------------------------------------------------------------------------------- /ext/soloud/demos/glue/ruby/test_ruby.rb: -------------------------------------------------------------------------------- 1 | load 'soloud.rb' 2 | 3 | begin 4 | soloud=Soloud.new("") 5 | speech=Speech.new("") 6 | soloud.init() 7 | speech.set_text("Hello ruby world!") 8 | soloud.play(speech) 9 | x = 0 10 | while (soloud.get_active_voice_count() > 0) 11 | print x, "\r" 12 | x += 1 13 | end 14 | 15 | 16 | ensure 17 | soloud.deinit() 18 | speech.destroy() 19 | soloud.destroy() 20 | end -------------------------------------------------------------------------------- /data/scripts/bind.lua: -------------------------------------------------------------------------------- 1 | return function (func, ...) 2 | local n = select('#', ...) 3 | local bound = {...} 4 | return function (...) 5 | local args = {} 6 | local vn = select('#', ...) 7 | for i = 1, n do 8 | args[i] = bound[i] 9 | end 10 | for i = 1, vn do 11 | local e = select(i, ...) 12 | args[n + i] = e 13 | end 14 | return func(table.unpack(args, 1, n + vn)) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ext/sushi"] 2 | path = ext/sushi 3 | url = https://github.com/apples/sushi 4 | [submodule "ext/ginseng"] 5 | path = ext/ginseng 6 | url = https://github.com/apples/ginseng 7 | [submodule "ext/glm"] 8 | path = ext/glm 9 | url = https://github.com/g-truc/glm 10 | [submodule "ext/box2d"] 11 | path = ext/box2d 12 | url = https://github.com/erincatto/box2d 13 | [submodule "ext/freetype2"] 14 | path = ext/freetype2 15 | url = git://git.sv.nongnu.org/freetype/freetype2.git 16 | -------------------------------------------------------------------------------- /data/scripts/gui/all_states.lua: -------------------------------------------------------------------------------- 1 | local vdom = require('vdom') 2 | local version_stamp = require('gui.controls.version_stamp') 3 | local fps_counter = require('gui.controls.fps_counter') 4 | 5 | -- version: string 6 | -- fps: string 7 | return function(props) 8 | return vdom.create_element('widget', { width = '100%', height = '100%' }, 9 | vdom.create_element(version_stamp, { version = props.version }), 10 | vdom.create_element(fps_counter, { fps = props.fps }) 11 | ) 12 | end 13 | -------------------------------------------------------------------------------- /ext/soloud/demos/emscripten/build_piano: -------------------------------------------------------------------------------- 1 | emcc -o piano.html ../piano/*.cpp ../common/*.cpp ../common/imgui/imgui.cpp ../../src/core/*.cpp ../../src/filter/*.cpp ../../src/backend/sdl2_static/*.cpp ../../src/audiosource/speech/*.c* ../../src/audiosource/wav/*.c* -I ../common -I ../common/imgui -I ../../include --preload-file "../../bin/graphics/soloud_bg.png"@"graphics/soloud_bg.png" --preload-file "../../bin/audio/AKWF_c604_0024.wav"@"audio/AKWF_c604_0024.wav" -s USE_SDL=2 -O2 -D WITH_SDL2_STATIC -s FULL_ES2=1 2 | -------------------------------------------------------------------------------- /platform/x86_64/data/shaders/msdf.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout(location = 0) in vec3 VertexPosition; 4 | layout(location = 1) in vec2 VertexTexCoord; 5 | layout(location = 2) in vec3 VertexNormal; 6 | 7 | out vec2 v_texcoord; 8 | out vec3 v_normal; 9 | 10 | uniform mat4 MVP; 11 | uniform mat4 normal_mat; 12 | 13 | void main() 14 | { 15 | v_texcoord = VertexTexCoord; 16 | v_normal = vec3(normal_mat * vec4(VertexNormal, 0.0)); 17 | gl_Position = MVP * vec4(VertexPosition, 1.0); 18 | } 19 | -------------------------------------------------------------------------------- /data/scripts/systems/physics.lua: -------------------------------------------------------------------------------- 1 | 2 | local physics = {} 3 | 4 | function physics.pre_collide(script_name, a, b) 5 | local script = require(script_name) 6 | if script.physics_pre_collide then 7 | script.physics_pre_collide(a, b) 8 | end 9 | end 10 | 11 | function physics.post_collide(script_name, a, b) 12 | local script = require(script_name) 13 | if script.physics_post_collide then 14 | script.physics_post_collide(a, b) 15 | end 16 | end 17 | 18 | return physics 19 | -------------------------------------------------------------------------------- /ext/soloud/demos/emscripten/build_monotone: -------------------------------------------------------------------------------- 1 | emcc -o monotone.html ../monotone/main.cpp ../common/*.cpp ../common/imgui/imgui.cpp ../../src/core/*.cpp ../../src/filter/*.cpp ../../src/backend/sdl2_static/*.cpp ../../src/audiosource/monotone/*.cpp -I ../common -I ../common/imgui -I ../../include --preload-file "../../bin/audio/Jakim - Aboriginal Derivatives.mon"@"audio/Jakim - Aboriginal Derivatives.mon" --preload-file "../../bin/graphics/soloud_bg.png"@"graphics/soloud_bg.png" -s USE_SDL=2 -O2 -D WITH_SDL2_STATIC -s FULL_ES2=1 2 | -------------------------------------------------------------------------------- /ext/soloud/doc/htmlpost.txt: -------------------------------------------------------------------------------- 1 |

Copyright©2013-2015 Jari Komppa

2 | 3 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ext/msdfgen/core/shape-description.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "Shape.h" 7 | 8 | namespace msdfgen { 9 | 10 | /// Deserializes a text description of a vector shape into output. 11 | bool readShapeDescription(FILE *input, Shape &output, bool *colorsSpecified = NULL); 12 | bool readShapeDescription(const char *input, Shape &output, bool *colorsSpecified = NULL); 13 | /// Serializes a shape object into a text description. 14 | bool writeShapeDescription(FILE *output, const Shape &shape); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ext/soloud/demos/emscripten/build_tedsid: -------------------------------------------------------------------------------- 1 | emcc -o tedsid.html ../tedsid/main.cpp ../common/*.cpp ../common/imgui/imgui.cpp ../../src/core/*.cpp ../../src/filter/*.cpp ../../src/backend/sdl2_static/*.cpp ../../src/audiosource/tedsid/*.cpp -I ../common -I ../common/imgui -I ../../include --preload-file "../../bin/audio/Modulation.sid.dump"@"audio/Modulation.sid.dump" --preload-file "../../bin/audio/ted_storm.prg.dump"@"audio/ted_storm.prg.dump" --preload-file "../../bin/graphics/soloud_bg.png"@"graphics/soloud_bg.png" -s USE_SDL=2 -O2 -D WITH_SDL2_STATIC -s FULL_ES2=1 2 | -------------------------------------------------------------------------------- /ext/msdfgen/core/edge-coloring.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Shape.h" 5 | 6 | namespace msdfgen { 7 | 8 | /** Assigns colors to edges of the shape in accordance to the multi-channel distance field technique. 9 | * May split some edges if necessary. 10 | * angleThreshold specifies the maximum angle (in radians) to be considered a corner, for example 3 (~172 degrees). 11 | * Values below 1/2 PI will be treated as the external angle. 12 | */ 13 | void edgeColoringSimple(Shape &shape, double angleThreshold, unsigned long long seed = 0); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /ext/soloud/.gitignore: -------------------------------------------------------------------------------- 1 | Debug/ 2 | *.XML 3 | _UpgradeReport_Files/ 4 | *.ipch 5 | *.opensdf 6 | *.sdf 7 | *.old 8 | *.filters 9 | build/ 10 | *.aux 11 | *.out 12 | *.gz 13 | *.toc 14 | *.o 15 | incoming/ 16 | experiments/ 17 | doc/*.html 18 | doc/*.tex 19 | doc/*.css 20 | doc/*.pdf 21 | doc/*.mobi 22 | doc/*.epub 23 | bin/audio/ 24 | bin/ 25 | lib/*.ilk 26 | lib/*.lib 27 | lib/*.dll 28 | out/ 29 | *.pyc 30 | *.exp 31 | doc/xelatex_output.txt 32 | doc/kindlegen_output.txt 33 | *.idb 34 | *.pdb 35 | doc/20* 36 | glue/soloud* 37 | scripts/soloud_codegen.py 38 | glue/rpgmaker_soloud.rb 39 | -------------------------------------------------------------------------------- /src/ember/config.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "json.hpp" 4 | #include "json_serializers.hpp" 5 | 6 | #include 7 | 8 | #include "reflection_start.hpp" 9 | 10 | namespace ember::config { 11 | 12 | using json_serializers::basic::from_json; 13 | using json_serializers::basic::to_json; 14 | 15 | struct display_t { 16 | int width; 17 | int height; 18 | }; 19 | REFLECT(display_t, (width)(height)) 20 | 21 | struct config { 22 | display_t display; 23 | }; 24 | REFLECT(config, (display)) 25 | 26 | } // namespace ember::config 27 | 28 | #include "reflection_end.hpp" 29 | -------------------------------------------------------------------------------- /ext/soloud/demos/glue/python/test_python.py: -------------------------------------------------------------------------------- 1 | from soloud import * 2 | 3 | with Soloud() as audiolib: 4 | audiolib.init() 5 | audiolib.set_global_volume(10) 6 | 7 | speech = Speech() 8 | 9 | flanger = FlangerFilter() 10 | speech.set_filter(0, flanger) 11 | 12 | t = "Hello Python (OOP) World!" 13 | speech.set_text(t) 14 | 15 | print(t) 16 | audiolib.play(speech) 17 | 18 | print "Enter text to speak (empty string quits)" 19 | while t != "": 20 | t = raw_input(": ") 21 | 22 | speech.set_text(t); 23 | audiolib.play(speech); 24 | 25 | speech.close() 26 | 27 | print "Bye" 28 | -------------------------------------------------------------------------------- /src/scene_mainmenu.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ember/scene.hpp" 4 | 5 | #include 6 | 7 | class scene_mainmenu final : public ember::scene { 8 | public: 9 | scene_mainmenu(ember::engine& eng, ember::scene* prev); 10 | 11 | virtual void init() override; 12 | virtual void tick(float delta) override; 13 | virtual void render() override; 14 | virtual auto handle_game_input(const SDL_Event& event) -> bool override; 15 | virtual auto render_gui() -> sol::table override; 16 | 17 | private: 18 | void start_game(); 19 | 20 | sol::table gui_state; 21 | }; 22 | -------------------------------------------------------------------------------- /ext/lua/src/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lstate.h" 13 | 14 | #define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ 15 | "stack overflow");} 16 | 17 | #define adjustresults(L,nres) \ 18 | { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } 19 | 20 | #define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ 21 | "not enough elements in the stack") 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/ember/box2d_helpers.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace ember { 8 | 9 | void box2d_lua_enable(sol::state& tab); 10 | 11 | class box2d_fixed_timestep { 12 | public: 13 | box2d_fixed_timestep(); 14 | 15 | explicit box2d_fixed_timestep(float timeStep); 16 | 17 | box2d_fixed_timestep(float timeStep, int velocityIterations, int positionIterations); 18 | 19 | auto step(b2World& world, float delta) -> bool; 20 | 21 | private: 22 | float timeStep; 23 | int velocityIterations; 24 | int positionIterations; 25 | float accum; 26 | }; 27 | 28 | } // namespace ember 29 | -------------------------------------------------------------------------------- /data/scripts/systems/scripting.lua: -------------------------------------------------------------------------------- 1 | local visitor = require('visitor') 2 | 3 | local scripting = {} 4 | 5 | function scripting.visit(delta) 6 | visitor.visit( 7 | entities, 8 | {component.script}, 9 | function (eid, script) 10 | local script_impl = require('actors.' .. script.name) 11 | if script_impl.update then 12 | local success, ret = pcall(script_impl.update, eid, delta) 13 | if not success then 14 | print('ERROR: systems.scripting: actors.'..script.name..': '..ret) 15 | end 16 | end 17 | end 18 | ) 19 | end 20 | 21 | return scripting 22 | -------------------------------------------------------------------------------- /src/ember/scene.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "sdl.hpp" 4 | 5 | #include 6 | 7 | #include 8 | 9 | struct SDL_MouseButtonEvent; 10 | 11 | namespace ember { 12 | 13 | class engine; 14 | 15 | class scene { 16 | public: 17 | scene(engine& eng) : engine(&eng) {} 18 | virtual ~scene() = 0; 19 | 20 | virtual void init() = 0; 21 | virtual void tick(float delta) = 0; 22 | virtual void render() = 0; 23 | virtual auto handle_game_input(const SDL_Event& event) -> bool = 0; 24 | virtual auto render_gui() -> sol::table = 0; 25 | 26 | engine* engine; 27 | }; 28 | 29 | inline scene::~scene() = default; 30 | 31 | } // namespace ember 32 | -------------------------------------------------------------------------------- /ext/soloud/demos/glue/rpgmaker/simplest.rb: -------------------------------------------------------------------------------- 1 | # Define a couple of variables 2 | soloud = SoLoud::Soloud.new # SoLoud engine core 3 | speech = SoLoud::Speech.new # A sound source (speech, in this case) 4 | 5 | # Configure sound source 6 | speech.setText("1 2 3 1 2 3 Hello world. Welcome to So-Loud."); 7 | 8 | # initialize SoLoud. 9 | soloud.init() 10 | 11 | # Play the sound source (we could do this several times if we wanted) 12 | soloud.play(speech); 13 | 14 | # Wait until sounds have finished 15 | while (soloud.getActiveVoiceCount() > 0) 16 | # Still going, sleep for a bit 17 | Graphics.wait(100) 18 | end 19 | 20 | # Clean up SoLoud 21 | soloud.deinit(); 22 | 23 | # All done. 24 | -------------------------------------------------------------------------------- /src/ember/vdom.cpp: -------------------------------------------------------------------------------- 1 | #include "vdom.hpp" 2 | 3 | namespace ember::vdom { 4 | 5 | auto create_element( 6 | sol::state& lua, const std::string& module_name, const sol::table& props, const sol::table& children) 7 | -> sol::table { 8 | auto module_path = module_name; 9 | std::replace(begin(module_path), end(module_path), '.', '/'); 10 | auto file_name = "data/scripts/" + module_path + ".lua"; 11 | auto component = lua.require_file(module_name, file_name); 12 | auto element = lua.create_table(); 13 | element["type"] = component; 14 | element["props"] = props; 15 | element["children"] = children; 16 | return element; 17 | } 18 | 19 | } // namespace ember::vdom 20 | -------------------------------------------------------------------------------- /setup_c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Emscripten", 5 | "defines": [ 6 | "_DEBUG", 7 | "UNICODE", 8 | "_UNICODE" 9 | ], 10 | "includePath": [ 11 | "${env:USERPROFILE}/.emscripten_cache/wasm-obj/include" 12 | ], 13 | "compilerPath": "${workspaceFolder}/.pkg/emsdk/upstream/emscripten/em++.bat", 14 | "cStandard": "c11", 15 | "cppStandard": "c++17", 16 | "intelliSenseMode": "clang-x64", 17 | "configurationProvider": "ms-vscode.cmake-tools" 18 | } 19 | ], 20 | "version": 4 21 | } -------------------------------------------------------------------------------- /data/scripts/visitor.lua: -------------------------------------------------------------------------------- 1 | local linq = require('linq') 2 | 3 | local visitor = {} 4 | 5 | function visitor.visit(entities, coms, func) 6 | entities:visit( 7 | function (eid) 8 | local first_missing = linq(coms) 9 | :where(function (com) return not entities:has_component(eid, com) end) 10 | :first() 11 | 12 | if first_missing then 13 | return 14 | end 15 | 16 | local com_vals = linq(coms) 17 | :select(function (com) return entities:get_component(eid, com) end) 18 | :tolist() 19 | 20 | func(eid, table.unpack(com_vals)) 21 | end 22 | ) 23 | end 24 | 25 | return visitor 26 | -------------------------------------------------------------------------------- /ext/msdfgen/core/SignedDistance.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | namespace msdfgen { 5 | 6 | /// Represents a signed distance and alignment, which together can be compared to uniquely determine the closest edge segment. 7 | class SignedDistance { 8 | 9 | public: 10 | static const SignedDistance INFINITE; 11 | 12 | double distance; 13 | double dot; 14 | 15 | SignedDistance(); 16 | SignedDistance(double dist, double d); 17 | 18 | friend bool operator<(SignedDistance a, SignedDistance b); 19 | friend bool operator>(SignedDistance a, SignedDistance b); 20 | friend bool operator<=(SignedDistance a, SignedDistance b); 21 | friend bool operator>=(SignedDistance a, SignedDistance b); 22 | 23 | }; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /platform/x86_64/data/shaders/msdf.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | in vec2 v_texcoord; 4 | in vec3 v_normal; 5 | 6 | uniform sampler2D msdf; 7 | uniform float pxRange; 8 | uniform vec2 texSize; 9 | uniform vec4 fgColor; 10 | 11 | layout(location = 0) out vec4 outColor; 12 | 13 | float median(float r, float g, float b) { 14 | return max(min(r, g), min(max(r, g), b)); 15 | } 16 | 17 | void main() { 18 | vec2 msdfUnit = pxRange/texSize; 19 | vec3 values = texture(msdf, v_texcoord).rgb; 20 | float sigDist = median(values.r, values.g, values.b) - 0.5; 21 | sigDist *= dot(msdfUnit, 0.5/fwidth(v_texcoord)); 22 | float opacity = clamp(sigDist + 0.5, 0.0, 1.0); 23 | outColor = vec4(fgColor.rgb, fgColor.a*opacity); 24 | } 25 | -------------------------------------------------------------------------------- /src/ember/reflection_end.hpp: -------------------------------------------------------------------------------- 1 | 2 | #undef EMBER_REFLECTION_COMMA 3 | #undef EMBER_REFLECTION_EMPTY 4 | #undef EMBER_REFLECTION_DEFER 5 | #undef EMBER_REFLECTION_CAT_ 6 | #undef EMBER_REFLECTION_CAT 7 | 8 | #undef EMBER_REFLECTION_MEMBER 9 | #undef EMBER_REFLECTION_MEMBERS_0 10 | #undef EMBER_REFLECTION_MEMBERS_1 11 | #undef EMBER_REFLECTION_MEMBERS_2 12 | #undef EMBER_REFLECTION_MEMBERS_0_END 13 | #undef EMBER_REFLECTION_MEMBERS_1_END 14 | #undef EMBER_REFLECTION_MEMBERS_2_END 15 | #undef EMBER_REFLECTION_MEMBERS 16 | 17 | #undef EMBER_REFLECTION_GET_REGISTERED_TYPES 18 | #undef EMBER_REFLECTION_REGISTER_TYPE 19 | 20 | #undef REFLECT 21 | 22 | #ifdef EMBER_REFLECTION_ENABLE_REGISRTY 23 | #undef EMBER_REFLECTION_ENABLE_REGISRTY 24 | #endif 25 | -------------------------------------------------------------------------------- /src/physics.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ember/engine.hpp" 4 | #include "ember/entities.hpp" 5 | 6 | class physics_system { 7 | public: 8 | struct body { 9 | enum type_t { 10 | STATIC, 11 | KINEMATIC, 12 | DYNAMIC 13 | }; 14 | 15 | enum layer_t { 16 | BALL, 17 | PADDLE, 18 | BRICK, 19 | N_TYPES, 20 | }; 21 | 22 | type_t type; 23 | layer_t layer; 24 | std::array collides_with = {}; 25 | glm::vec2 size = {0, 0}; 26 | glm::vec2 vel = {0, 0}; 27 | }; 28 | 29 | void step(ember::engine& engine, ember::database& entities, float delta); 30 | private: 31 | float time = 0; 32 | }; 33 | -------------------------------------------------------------------------------- /ext/lua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.0) 2 | project(Lua) 3 | 4 | file(GLOB_RECURSE ginseng_SOURCES include/ginseng/*) 5 | add_library(lua 6 | src/lapi.c src/lcode.c src/lctype.c src/ldebug.c src/ldo.c src/ldump.c src/lfunc.c src/lgc.c src/llex.c 7 | src/lmem.c src/lobject.c src/lopcodes.c src/lparser.c src/lstate.c src/lstring.c src/ltable.c src/ltm.c 8 | src/lundump.c src/lvm.c src/lzio.c src/lauxlib.c src/lbaselib.c src/lbitlib.c src/lcorolib.c src/ldblib.c 9 | src/liolib.c src/lmathlib.c src/loslib.c src/lstrlib.c src/ltablib.c src/lutf8lib.c src/loadlib.c src/linit.c) 10 | set_property(TARGET lua PROPERTY C_STANDARD 99) 11 | target_include_directories(lua INTERFACE src) 12 | target_compile_definitions(lua PUBLIC "LUA_COMPAT_5_2") 13 | -------------------------------------------------------------------------------- /ext/msdfgen/msdfgen-ext.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | /* 5 | * MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR v1.5 (2017-07-23) - extensions 6 | * ---------------------------------------------------------------------------- 7 | * A utility by Viktor Chlumsky, (c) 2014 - 2017 8 | * 9 | * The extension module provides ways to easily load input and save output using popular formats. 10 | * 11 | * Third party dependencies in extension module: 12 | * - FreeType 2 13 | * (to load input font files) 14 | * - TinyXML 2 by Lee Thomason 15 | * (to aid in parsing input SVG files) 16 | * - LodePNG by Lode Vandevenne 17 | * (to save output PNG images) 18 | * 19 | */ 20 | 21 | #include "ext/save-png.h" 22 | #include "ext/import-svg.h" 23 | #include "ext/import-font.h" 24 | -------------------------------------------------------------------------------- /platform/emscripten/data/shaders/msdf.frag: -------------------------------------------------------------------------------- 1 | #extension GL_OES_standard_derivatives : enable 2 | precision mediump float; 3 | 4 | varying vec2 v_texcoord; 5 | varying vec3 v_normal; 6 | 7 | uniform sampler2D msdf; 8 | uniform float pxRange; 9 | uniform vec2 texSize; 10 | uniform vec4 fgColor; 11 | 12 | float median(float r, float g, float b) { 13 | return max(min(r, g), min(max(r, g), b)); 14 | } 15 | 16 | void main() { 17 | vec2 msdfUnit = pxRange/texSize; 18 | vec3 sample = texture2D(msdf, v_texcoord).rgb; 19 | float sigDist = median(sample.r, sample.g, sample.b) - 0.5; 20 | sigDist *= dot(msdfUnit, 0.5/fwidth(v_texcoord)); 21 | float opacity = clamp(sigDist + 0.5, 0.0, 1.0); 22 | gl_FragColor = vec4(fgColor.rgb, fgColor.a*opacity); 23 | } 24 | -------------------------------------------------------------------------------- /data/scripts/actors/paddle.lua: -------------------------------------------------------------------------------- 1 | 2 | local paddle = {} 3 | 4 | function paddle.update(eid, delta) 5 | local controller = entities:get_component(eid, component.controller) 6 | local body = entities:get_component(eid, component.rigid_body).body 7 | 8 | local target_vel = 0 9 | 10 | if controller.left then 11 | target_vel = -15 12 | elseif controller.right then 13 | target_vel = 15 14 | end 15 | 16 | local ix = (target_vel - body:GetLinearVelocity().x) * body:GetMass(); 17 | local iy = (-body:GetLinearVelocity().y) * body:GetMass(); 18 | body:ApplyLinearImpulseToCenter(b2Vec2.new(ix, iy), true) 19 | 20 | local t = body:GetTransform() 21 | body:SetTransform(b2Vec2.new(t.p.x, -14.5), t.q:GetAngle()) 22 | end 23 | 24 | return paddle 25 | -------------------------------------------------------------------------------- /cmake/Modules/FindCereal.cmake: -------------------------------------------------------------------------------- 1 | set(CEREAL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/ext/cereal/include") 2 | 3 | file(READ "${CEREAL_INCLUDE_DIR}/cereal/version.hpp" VERSION_HPP) 4 | 5 | string(REGEX MATCH "CEREAL_VERSION_MAJOR ([0-9]+)" _ ${VERSION_HPP}) 6 | set(VERSION_MAJOR ${CMAKE_MATCH_1}) 7 | 8 | string(REGEX MATCH "CEREAL_VERSION_MINOR ([0-9]+)" _ ${VERSION_HPP}) 9 | set(VERSION_MINOR ${CMAKE_MATCH_1}) 10 | 11 | string(REGEX MATCH "CEREAL_VERSION_PATCH ([0-9]+)" _ ${VERSION_HPP}) 12 | set(VERSION_PATCH ${CMAKE_MATCH_1}) 13 | 14 | set(CEREAL_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") 15 | 16 | include(FindPackageHandleStandardArgs) 17 | 18 | find_package_handle_standard_args(CEREAL 19 | REQUIRED_VARS 20 | CEREAL_INCLUDE_DIR 21 | VERSION_VAR CEREAL_VERSION) 22 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | error_log logs/error.log warn; 2 | 3 | events { 4 | worker_connections 128; 5 | } 6 | 7 | http { 8 | # MIME types 9 | include mime.types; 10 | types { 11 | application/wasm wasm; 12 | } 13 | default_type application/octet-stream; 14 | 15 | # HTTP Keep-Alive 16 | keepalive_timeout 65; 17 | 18 | # Site 19 | server { 20 | listen 4242 default_server; 21 | server_name localhost; 22 | 23 | # Release 24 | location /release { 25 | alias "../build/Emscripten (upstream)-Release/www"; 26 | index index.html; 27 | } 28 | 29 | # Debug 30 | location /debug { 31 | alias ../build/debug/www; 32 | index index.html; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ext/msdfgen/core/render-sdf.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Vector2.h" 5 | #include "Bitmap.h" 6 | 7 | namespace msdfgen { 8 | 9 | /// Reconstructs the shape's appearance into output from the distance field sdf. 10 | void renderSDF(Bitmap &output, const Bitmap &sdf, double pxRange = 0); 11 | void renderSDF(Bitmap &output, const Bitmap &sdf, double pxRange = 0); 12 | void renderSDF(Bitmap &output, const Bitmap &sdf, double pxRange = 0); 13 | void renderSDF(Bitmap &output, const Bitmap &sdf, double pxRange = 0); 14 | 15 | /// Snaps the values of the floating-point bitmaps into one of the 256 values representable in a standard 8-bit bitmap. 16 | void simulate8bit(Bitmap &bitmap); 17 | void simulate8bit(Bitmap &bitmap); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/ember/component_common.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "json_serializers.hpp" 4 | 5 | #include 6 | 7 | #include 8 | 9 | #ifndef EMBER_REFLECTION_MAX_TYPES 10 | #define EMBER_REFLECTION_MAX_TYPES 32 11 | #endif 12 | 13 | namespace component { 14 | 15 | using ember::json_serializers::basic::from_json; 16 | using ember::json_serializers::basic::to_json; 17 | 18 | void register_all_components(sol::table& table); 19 | 20 | // Type registry 21 | template 22 | struct _type_registry_index : _type_registry_index {}; 23 | template <> 24 | struct _type_registry_index<0> {}; 25 | inline std::tuple<> _type_registry(_type_registry_index<0>) { return {}; } 26 | inline void _type_registry(_type_registry_index) = delete; 27 | 28 | } // namespace component 29 | -------------------------------------------------------------------------------- /ext/soloud/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.6) 2 | project(SoLoud) 3 | 4 | file(GLOB_RECURSE soloud_SOURCES src/audiosource/* src/filter/* src/core/*) 5 | file(GLOB_RECURSE soloud_PLATFORM_SOURCES src/backend/sdl2_static/*) 6 | 7 | add_library(soloud ${soloud_SOURCES} ${soloud_PLATFORM_SOURCES}) 8 | target_include_directories(soloud PUBLIC include) 9 | target_compile_definitions(soloud PUBLIC "WITH_SDL2_STATIC") 10 | 11 | if (EMSCRIPTEN) 12 | set_target_properties(soloud PROPERTIES 13 | COMPILE_FLAGS "-s USE_SDL=2" 14 | LINK_FLAGS "-s USE_SDL=2") 15 | else() 16 | find_package(PkgConfig REQUIRED) 17 | pkg_search_module(SDL2 REQUIRED sdl2) 18 | 19 | target_link_libraries(soloud ${SDL2_LIBRARIES}) 20 | target_include_directories(soloud PUBLIC ${SDL2_INCLUDE_DIRS}) 21 | endif() 22 | -------------------------------------------------------------------------------- /src/ember/ez3d.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "camera.hpp" 4 | #include "engine.hpp" 5 | #include "render_queue.hpp" 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace ember::ez3d { 13 | 14 | /** Model used for rendering */ 15 | struct model { 16 | std::shared_ptr mesh; 17 | std::shared_ptr texture; 18 | std::shared_ptr skeleton; 19 | std::optional anim_index; 20 | float anim_time; 21 | }; 22 | 23 | class renderer { 24 | public: 25 | void begin(engine* eng, const camera::perspective& cam); 26 | 27 | void add(const model& model, const sushi::transform& transform); 28 | 29 | void finish(); 30 | 31 | private: 32 | render_queue renderq; 33 | }; 34 | 35 | } // namespace ember::ez3d 36 | -------------------------------------------------------------------------------- /data/scripts/actors/ball.lua: -------------------------------------------------------------------------------- 1 | local new_ball = require('archetypes.ball') 2 | 3 | local ball = {} 4 | 5 | function ball.update(eid, delta) 6 | local transform = entities:get_component(eid, component.transform) 7 | local body = entities:get_component(eid, component.rigid_body) 8 | 9 | local vy = body.body:GetLinearVelocity().y 10 | if vy ~= 0 then 11 | local iy = (math.abs(vy)/vy * delta) * body.body:GetMass() 12 | body.body:ApplyLinearImpulseToCenter(b2Vec2.new(0, iy), true) 13 | end 14 | 15 | if transform.pos.y < -16 then 16 | lose_life() 17 | queue_destroy(eid) 18 | new_ball() 19 | elseif transform.pos.y > 16 or transform.pos.x < -16 or transform.pos.x > 16 then 20 | queue_destroy(eid) 21 | new_ball() 22 | end 23 | end 24 | 25 | return ball 26 | 27 | -------------------------------------------------------------------------------- /src/ember/box2d_helpers.cpp: -------------------------------------------------------------------------------- 1 | #include "box2d_helpers.hpp" 2 | 3 | namespace ember { 4 | 5 | box2d_fixed_timestep::box2d_fixed_timestep() : box2d_fixed_timestep(1.f / 60.f) {} 6 | 7 | box2d_fixed_timestep::box2d_fixed_timestep(float timeStep) : box2d_fixed_timestep(timeStep, 10, 8) {} 8 | 9 | box2d_fixed_timestep::box2d_fixed_timestep(float timeStep, int velocityIterations, int positionIterations) 10 | : timeStep(timeStep), velocityIterations(velocityIterations), positionIterations(positionIterations), accum(0) {} 11 | 12 | auto box2d_fixed_timestep::step(b2World& world, float delta) -> bool { 13 | accum += delta; 14 | if (accum >= timeStep) { 15 | accum -= timeStep; 16 | world.Step(timeStep, velocityIterations, positionIterations); 17 | return true; 18 | } 19 | return false; 20 | } 21 | 22 | } // namespace ember 23 | -------------------------------------------------------------------------------- /ext/msdfgen/core/Contour.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "EdgeHolder.h" 6 | 7 | namespace msdfgen { 8 | 9 | /// A single closed contour of a shape. 10 | class Contour { 11 | 12 | public: 13 | /// The sequence of edges that make up the contour. 14 | std::vector edges; 15 | 16 | /// Adds an edge to the contour. 17 | void addEdge(const EdgeHolder &edge); 18 | #ifdef MSDFGEN_USE_CPP11 19 | void addEdge(EdgeHolder &&edge); 20 | #endif 21 | /// Creates a new edge in the contour and returns its reference. 22 | EdgeHolder & addEdge(); 23 | /// Computes the bounding box of the contour. 24 | void bounds(double &l, double &b, double &r, double &t) const; 25 | /// Computes the winding of the contour. Returns 1 if positive, -1 if negative. 26 | int winding() const; 27 | 28 | }; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/ember/font.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace ember { 13 | 14 | struct FontDeleter { 15 | void operator()(msdfgen::FontHandle* ptr) { 16 | msdfgen::destroyFont(ptr); 17 | } 18 | }; 19 | 20 | class msdf_font { 21 | public: 22 | struct glyph { 23 | sushi::mesh_group mesh; 24 | sushi::texture_2d texture; 25 | float advance; 26 | }; 27 | 28 | msdf_font() = default; 29 | msdf_font(const std::string& filename); 30 | 31 | const glyph& get_glyph(int unicode) const; 32 | 33 | private: 34 | std::unique_ptr font; 35 | mutable std::unordered_map glyphs; 36 | }; 37 | 38 | } // namespace ember 39 | -------------------------------------------------------------------------------- /data/scripts/gui/scene_mainmenu/root.lua: -------------------------------------------------------------------------------- 1 | local vdom = require('vdom') 2 | 3 | -- start_game: () => () 4 | return function(props) 5 | return vdom.create_element('widget', { width = '100%', height = '100%' }, 6 | vdom.create_element( 7 | 'label', 8 | { 9 | halign = 'center', 10 | bottom = 720/2 + 80, 11 | color = '#fff', 12 | text = 'Sample Game', 13 | height = 24, 14 | } 15 | ), 16 | vdom.create_element( 17 | 'label', 18 | { 19 | halign = 'center', 20 | bottom = 720/2 - 20, 21 | color = '#fff', 22 | text = '[NEW GAME]', 23 | height = 24, 24 | on_click = props.start_game, 25 | } 26 | ) 27 | ) 28 | end 29 | -------------------------------------------------------------------------------- /ext/msdfgen/core/Bitmap.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | namespace msdfgen { 5 | 6 | /// A floating-point RGB pixel. 7 | struct FloatRGB { 8 | float r, g, b; 9 | }; 10 | 11 | /// A 2D image bitmap. 12 | template 13 | class Bitmap { 14 | 15 | public: 16 | Bitmap(); 17 | Bitmap(int width, int height); 18 | Bitmap(const Bitmap &orig); 19 | #ifdef MSDFGEN_USE_CPP11 20 | Bitmap(Bitmap &&orig); 21 | #endif 22 | ~Bitmap(); 23 | Bitmap & operator=(const Bitmap &orig); 24 | #ifdef MSDFGEN_USE_CPP11 25 | Bitmap & operator=(Bitmap &&orig); 26 | #endif 27 | /// Bitmap width in pixels. 28 | int width() const; 29 | /// Bitmap height in pixels. 30 | int height() const; 31 | T & operator()(int x, int y); 32 | const T & operator()(int x, int y) const; 33 | 34 | private: 35 | T *content; 36 | int w, h; 37 | 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ext/soloud/AUTHORS: -------------------------------------------------------------------------------- 1 | If you wish to contribute code to SoLoud, add your name to 2 | this list when sending a pull request. All code must be 3 | either public domain, CC0, wtfpl, zlib/libpng licensed, or 4 | similarly free to use (without attribution, or (l)gpl-like 5 | limitations. 6 | 7 | Jari Komppa http://iki.fi/sol/ 8 | Tom V�h�-Salo tomvahasalo@gmail.com 9 | Trygve Vea trygve.vea@gmail.com 10 | dorgonman dorgonman@hotmail.com 11 | Gabriel Teles Bastos http://mundorpgmaker.com.br 12 | r-lyeh https://github.com/r-lyeh 13 | Colden Cullen https://github.com/ColdenCullen 14 | Cosku Bas cosku.bas@gmail.com 15 | Neil Richardson https://github.com/neilogd 16 | Petri Häkkinen 17 | Omar Cornut 18 | amir ramezani http://shaberoshan.ir 19 | Luke San Antonio Bialecki lukesanantonio@gmail.com 20 | Eduardo Doria Lima https://github.com/eduardodoria 21 | Ilya Zhuravlev https://github.com/xyzz 22 | -------------------------------------------------------------------------------- /src/scene_mainmenu.cpp: -------------------------------------------------------------------------------- 1 | #include "scene_mainmenu.hpp" 2 | 3 | #include "scene_gameplay.hpp" 4 | 5 | #include "ember/engine.hpp" 6 | #include "ember/vdom.hpp" 7 | 8 | scene_mainmenu::scene_mainmenu(ember::engine& engine, ember::scene* prev) 9 | : scene(engine), gui_state{engine.lua.create_table()} { 10 | gui_state["start_game"] = [this]{ start_game(); }; 11 | } 12 | 13 | void scene_mainmenu::init() {} 14 | 15 | void scene_mainmenu::tick(float delta) {} 16 | 17 | void scene_mainmenu::render() {} 18 | 19 | auto scene_mainmenu::handle_game_input(const SDL_Event& event) -> bool { 20 | return false; 21 | } 22 | 23 | auto scene_mainmenu::render_gui() -> sol::table { 24 | return ember::vdom::create_element(engine->lua, "gui.scene_mainmenu.root", gui_state, engine->lua.create_table()); 25 | } 26 | 27 | void scene_mainmenu::start_game() { 28 | engine->queue_transition(); 29 | } 30 | -------------------------------------------------------------------------------- /ext/soloud/doc/foreign_interface.mmd: -------------------------------------------------------------------------------- 1 | # Foreign Interfaces 2 | 3 | SoLoud can be used from various environments through a "C" API DLL. 4 | 5 | In order to use SoLoud from a different environment, such as Python or BlitzMax, 6 | you need the SoLoud DLL and a wrapper. The wrappers for SoLoud are not made 7 | by hand, but instead generated through Python scripts. This minimizes hassle 8 | when SoLoud gets new features, as the new wrappers can simply be generated via 9 | the scripts. 10 | 11 | Some foreign interfaces may be more complex, such as the GameMaker:Studio, which 12 | only supports variable types double and char*. For such, we generate a glue DLL 13 | to act as translator between GameMaker:Studio and the SoLoud "C" API DLL. 14 | 15 | All of the glue libraries, and scripts to generate them, can be found under the 16 | "glue" directory. The only exception to this rule is the C api, which is located 17 | under "src/c_api". 18 | -------------------------------------------------------------------------------- /ext/soloud/src/tools/tedsid2dump/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _TYPES_H 2 | #define _TYPES_H 3 | 4 | #ifdef HAVE_SDL 5 | #include 6 | #else 7 | //#include 8 | #endif 9 | 10 | #include 11 | 12 | typedef struct _MEM_PATCH { 13 | unsigned int addr; 14 | unsigned char byte; 15 | } mem_patch; 16 | 17 | #ifdef __GNUC__ /*__GNUC__*/ 18 | typedef unsigned long long ClockCycle; 19 | #define TSTATE_T_MID (((long long) -1LL)/2ULL) 20 | #define TSTATE_T_LEN "Lu" 21 | #else 22 | typedef unsigned __int64 ClockCycle; 23 | #define TSTATE_T_MID (((__int64) -1L)/2UL) 24 | #define TSTATE_T_LEN "lu" 25 | #endif 26 | 27 | #ifndef TRUE 28 | #define TRUE 1 29 | #endif 30 | 31 | #ifndef FALSE 32 | #define FALSE 0 33 | #endif 34 | 35 | #if ( defined(_MSC_VER) && (_MSC_VER == 1200) && defined(_MSC_EXTENSIONS) ) 36 | #define inline __forceinline // For MSVC++ 6.0 with Microsoft extensions. 37 | #endif 38 | 39 | #endif // _TYPES_H 40 | -------------------------------------------------------------------------------- /ext/lua/src/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.45 2015/09/08 15:41:05 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | #define MYINT(s) (s[0]-'0') 22 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) 23 | #define LUAC_FORMAT 0 /* this is the official format */ 24 | 25 | /* load one chunk; from lundump.c */ 26 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); 27 | 28 | /* dump one chunk; from ldump.c */ 29 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 30 | void* data, int strip); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /ext/soloud/demos/glue/cs/hello.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace hello 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | 10 | SoLoud.Soloud soloud = new SoLoud.Soloud(); // SoLoud engine core 11 | SoLoud.Speech speech = new SoLoud.Speech(); // A sound source (speech, in this case) 12 | 13 | // Configure sound source 14 | speech.setText("Hello c sharp world!"); 15 | 16 | // initialize SoLoud. 17 | soloud.init(); 18 | 19 | // Play the sound source (we could do this several times if we wanted) 20 | soloud.play(speech); 21 | 22 | // Wait until sounds have finished 23 | while (soloud.getActiveVoiceCount() > 0) 24 | { 25 | // Still going, sleep for a bit 26 | Console.Write("."); 27 | } 28 | 29 | // Clean up SoLoud 30 | soloud.deinit(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ext/soloud/LICENSE: -------------------------------------------------------------------------------- 1 | SoLoud audio engine 2 | Copyright (c) 2013-2014 Jari Komppa 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would be 15 | appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | -------------------------------------------------------------------------------- /ext/soloud/doc/bassboostfilter.mmd: -------------------------------------------------------------------------------- 1 | ## SoLoud::BassboostFilter 2 | 3 | The bassboost filter is a proof of concept FFT filter. 4 | It simply multiplies the first few bands of the FFT by 5 | the boost value. 6 | 7 | There is one parameter - how strong the boost effect is. 8 | 9 | // Set up bass boost filter 10 | gBassboost.setParams(0.1f); 11 | // Set the filter as the first filter of the bus 12 | gBus.setFilter(0, &gBassboost); 13 | 14 | ### BassboostFilter.setParams() 15 | 16 | Set the parameters of the filter. 17 | 18 | gBassboost.setParams(11); // ours goes to 11 19 | 20 | Changing the parameters via setParams() does not affect "live" sounds. Live parameters 21 | can be set, faded or oscillated: 22 | 23 | gSoloud.fadeFilterParameter( 24 | gMusicHandle, // Sound handle 25 | 0, // First filter 26 | SoLoud::BassboostFilter::BOOST, // What to adjust 27 | 0, // Target value 28 | 3); // Time in seconds 29 | -------------------------------------------------------------------------------- /data/scripts/init_gui.lua: -------------------------------------------------------------------------------- 1 | local vdom = require('vdom') 2 | 3 | local all_states = require('gui.all_states') 4 | 5 | -- state_element: vdom.element 6 | -- version: string 7 | -- fps: string 8 | local function root_component(props) 9 | local state_element = props.state_element; 10 | 11 | return vdom.create_element('widget', { width='100%', height='100%' }, 12 | state_element, 13 | vdom.create_element(all_states, { version=props.version, fps=props.fps }) 14 | ) 15 | end 16 | 17 | local vdom_root = vdom.render(vdom.create_element(root_component, gui_state), root_widget) 18 | 19 | function update_gui_state(state_element) 20 | vdom.render( 21 | vdom.create_element( 22 | root_component, 23 | { 24 | state_element=state_element, 25 | version=gui_state.version, 26 | fps=gui_state.fps 27 | } 28 | ), 29 | root_widget, 30 | vdom_root) 31 | 32 | vdom.flush_updates() 33 | end 34 | -------------------------------------------------------------------------------- /ext/msdfgen/Msdfgen.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Msdfgen", "Msdfgen.vcxproj", "{84BE2D91-F071-4151-BE12-61460464C494}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {84BE2D91-F071-4151-BE12-61460464C494}.Debug|x86.ActiveCfg = Debug|Win32 15 | {84BE2D91-F071-4151-BE12-61460464C494}.Debug|x86.Build.0 = Debug|Win32 16 | {84BE2D91-F071-4151-BE12-61460464C494}.Release|x86.ActiveCfg = Release|Win32 17 | {84BE2D91-F071-4151-BE12-61460464C494}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Ember Game 9 | 10 | 11 |
12 |
13 |
14 |
15 |
16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ext/soloud/demos/glue/python/test_gfx.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import pygame 3 | from soloud import * 4 | 5 | pygame.init() 6 | screen = pygame.display.set_mode((640,480), 0, 32) 7 | 8 | audiolib = Soloud() 9 | audiolib.initEx(3) 10 | audiolib.setGlobalVolume(10) 11 | speech = Speech() 12 | lofi = LofiFilter() 13 | speech.setFilter(0, lofi) 14 | 15 | t = "Wheeeeeeeeeeeeeeeeeee Python and Pygame and visualizations and stuff" 16 | speech.setText(t) 17 | for x in range(0, 15): 18 | sph = audiolib.play(speech) 19 | audiolib.setRelativePlaySpeed(sph, float(x + 10) / (15-x)) 20 | 21 | while audiolib.getActiveVoiceCount() > 0: 22 | 23 | for event in pygame.event.get(): 24 | if event.type == pygame.QUIT: 25 | speech.close() 26 | audiolib.close() 27 | sys.exit() 28 | 29 | # Redraw the background 30 | screen.fill((0,0,0,0)) 31 | 32 | vob = audiolib.getWave() 33 | h = 0 34 | for x in vob: 35 | screen.set_at((h*2, int(240 + 200 * x)), (255, 255, 255)) 36 | h += 1 37 | pygame.display.flip() 38 | 39 | pygame.quit() 40 | -------------------------------------------------------------------------------- /ext/soloud/demos/common/glew/GL/README.txt: -------------------------------------------------------------------------------- 1 | GLEW - The OpenGL Extension Wrangler Library 2 | 3 | http://glew.sourceforge.net/ 4 | https://github.com/nigels-com/glew 5 | 6 | See doc/index.html for more information. 7 | 8 | If you downloaded the tarball from the GLEW website, you just need to: 9 | 10 | Unix: 11 | 12 | make 13 | 14 | sudo -s 15 | 16 | make install 17 | 18 | make clean 19 | 20 | Windows: 21 | 22 | use the project file in build/vc12/ 23 | 24 | If you wish to build GLEW from scratch (update the extension data from 25 | the net or add your own extension information), you need a Unix 26 | environment (including wget, perl, and GNU make). The extension data 27 | is regenerated from the top level source directory with: 28 | 29 | make extensions 30 | 31 | An alternative to generating the GLEW sources from scratch is to 32 | download a pre-generated (unsupported) snapshot: 33 | 34 | https://sourceforge.net/projects/glew/files/glew/snapshots/ 35 | -------------------------------------------------------------------------------- /ext/soloud/demos/glue/rpgmaker/c_test.rb: -------------------------------------------------------------------------------- 1 | soloud = SoLoud::Soloud.new 2 | speech = SoLoud::Speech.new 3 | 4 | speech.setText("1 2 3 A B C Doooooo Reeeeee Miiiiii Faaaaaa Soooooo Laaaaaa Tiiiiii Doooooo!"); 5 | soloud.init( 6 | SoLoud::Soloud::CLIP_ROUNDOFF | SoLoud::Soloud::ENABLE_VISUALIZATION, 7 | SoLoud::Soloud::AUTO, 8 | SoLoud::Soloud::AUTO, 9 | SoLoud::Soloud::AUTO 10 | ); 11 | 12 | soloud.setGlobalVolume(4); 13 | soloud.play(speech); 14 | 15 | printf("Playing..\n"); 16 | 17 | sprite = Sprite.new 18 | sprite.bitmap = Bitmap.new(544, 416) 19 | halfWidth = 544 / 2.0 20 | i = 0 21 | while (soloud.getActiveVoiceCount > 0) 22 | v = soloud.calcFFT 23 | z = (v[10] * halfWidth).to_i 24 | z = 544 if z > 544 25 | 26 | sprite.bitmap.clear 27 | sprite.bitmap.fill_rect(0, 0, z, 40, Color.new(0, 255, 0)) 28 | 29 | Graphics.update 30 | end 31 | 32 | printf("\nFinished.\n"); 33 | 34 | soloud.deinit 35 | 36 | speech.destroy 37 | soloud.destroy 38 | 39 | printf("Cleanup done.\n"); 40 | -------------------------------------------------------------------------------- /ext/soloud/doc/echofilter.mmd: -------------------------------------------------------------------------------- 1 | ## SoLoud::EchoFilter 2 | 3 | The echo filter in SoLoud is a very simple one. When the sound starts to 4 | play, the echo filter allocates a buffer to contain the echo samples, 5 | and loops through this until the sound ends. 6 | 7 | The filter does not support changing of parameters on the fly, nor does 8 | it take changing of relative play speed into account. 9 | 10 | There are two parameters - delay and decay. Delay is the time in seconds 11 | until the echo, and decay is multiplier for the echo. If the multiplier 12 | is outside the [0..1[ range, the results are unpredictable. 13 | 14 | // Set up echo filter 15 | gEchoFilter.setParams(0.5f, 0.5f); 16 | // Set the filter as the first filter of the bus 17 | gBus.setFilter(0, &gEchoFilter); 18 | 19 | ### EchoFilter.setParams() 20 | 21 | Set the parameters of the filter. 22 | 23 | gEchoFilter.setParams(0.5f, 0.5f); 24 | 25 | Changing the parameters does not affect "live" sounds. If invalid parameters are 26 | given, the function will return error. 27 | -------------------------------------------------------------------------------- /ext/msdfgen/core/Shape.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Contour.h" 6 | 7 | namespace msdfgen { 8 | 9 | /// Vector shape representation. 10 | class Shape { 11 | 12 | public: 13 | /// The list of contours the shape consists of. 14 | std::vector contours; 15 | /// Specifies whether the shape uses bottom-to-top (false) or top-to-bottom (true) Y coordinates. 16 | bool inverseYAxis; 17 | 18 | Shape(); 19 | /// Adds a contour. 20 | void addContour(const Contour &contour); 21 | #ifdef MSDFGEN_USE_CPP11 22 | void addContour(Contour &&contour); 23 | #endif 24 | /// Adds a blank contour and returns its reference. 25 | Contour & addContour(); 26 | /// Normalizes the shape geometry for distance field generation. 27 | void normalize(); 28 | /// Performs basic checks to determine if the object represents a valid shape. 29 | bool validate() const; 30 | /// Computes the shape's bounding box. 31 | void bounds(double &l, double &b, double &r, double &t) const; 32 | 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /data/scripts/gui/scene_gameplay/root.lua: -------------------------------------------------------------------------------- 1 | local vdom = require('vdom') 2 | 3 | -- filled: boolean 4 | -- left: number 5 | local function heart(props) 6 | return vdom.create_element('label', { 7 | color = '#f00', 8 | text = props.filled and '[#]' or '[ ]', 9 | height = 32, 10 | left = props.left, 11 | valign = 'top', 12 | halign = 'left', 13 | }) 14 | end 15 | 16 | -- health: number 17 | -- max_health: number 18 | -- score: number 19 | return function(props) 20 | -- Make hearts 21 | local hearts = {} 22 | for i = 1, props.health do 23 | hearts[i] = vdom.create_element(heart, { filled = true, left = i * 32 }) 24 | end 25 | for i = props.health + 1, props.max_health do 26 | hearts[i] = vdom.create_element(heart, { filled = false, left = i * 32 }) 27 | end 28 | 29 | return vdom.create_element('widget', { width = '100%', height = '100%' }, 30 | hearts, 31 | vdom.create_element('label', { text = score, valign = 'top', halign = 'right', size = 32 }) 32 | ) 33 | end 34 | -------------------------------------------------------------------------------- /ext/lua/src/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /platform/emscripten/data/shaders/basic.vert: -------------------------------------------------------------------------------- 1 | attribute vec3 VertexPosition; 2 | attribute vec2 VertexTexCoord; 3 | attribute vec3 VertexNormal; 4 | attribute vec4 VertexBlendIndices; 5 | attribute vec4 VertexBlendWeights; 6 | 7 | varying vec2 v_texcoord; 8 | varying vec3 v_normal; 9 | 10 | uniform mat4 MVP; 11 | uniform mat4 normal_mat; 12 | uniform mat3 uvmat; 13 | uniform bool Animated; 14 | uniform mat4 Bones[32]; 15 | 16 | void main() { 17 | mat4 transform = MVP; 18 | 19 | if (Animated) { 20 | transform = 21 | MVP * ( 22 | Bones[int(VertexBlendIndices[0])] * VertexBlendWeights[0] + 23 | Bones[int(VertexBlendIndices[1])] * VertexBlendWeights[1] + 24 | Bones[int(VertexBlendIndices[2])] * VertexBlendWeights[2] + 25 | Bones[int(VertexBlendIndices[3])] * VertexBlendWeights[3]); 26 | } 27 | 28 | v_texcoord = vec2(uvmat * vec3(VertexTexCoord, 1.0)); 29 | v_normal = normalize(vec3(normal_mat * vec4(VertexNormal, 0.0))); 30 | gl_Position = transform * vec4(VertexPosition, 1.0); 31 | } 32 | -------------------------------------------------------------------------------- /ext/msdfgen/core/SignedDistance.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "SignedDistance.h" 3 | 4 | #include 5 | 6 | namespace msdfgen { 7 | 8 | const SignedDistance SignedDistance::INFINITE(-1e240, 1); 9 | 10 | SignedDistance::SignedDistance() : distance(-1e240), dot(1) { } 11 | 12 | SignedDistance::SignedDistance(double dist, double d) : distance(dist), dot(d) { } 13 | 14 | bool operator<(SignedDistance a, SignedDistance b) { 15 | return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot < b.dot); 16 | } 17 | 18 | bool operator>(SignedDistance a, SignedDistance b) { 19 | return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot > b.dot); 20 | } 21 | 22 | bool operator<=(SignedDistance a, SignedDistance b) { 23 | return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot <= b.dot); 24 | } 25 | 26 | bool operator>=(SignedDistance a, SignedDistance b) { 27 | return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot >= b.dot); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /ext/soloud/doc/singlehtml_head.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/scripts/archetypes/brick.lua: -------------------------------------------------------------------------------- 1 | return function(x, y) 2 | local eid = entities:create_entity() 3 | 4 | local sprite = component.sprite.new() 5 | sprite.texture = "sprites"; 6 | sprite.size.y = 1/4 7 | sprite.size.x = 1/2 8 | sprite.frames:add(4) 9 | 10 | local transform = component.transform.new() 11 | transform.pos.x = x 12 | transform.pos.y = y 13 | transform.scl.x = 2 14 | 15 | local bodyDef = b2BodyDef.new() 16 | bodyDef.userData = entities:to_ptr(eid) 17 | bodyDef.fixedRotation = true 18 | bodyDef.position:Set(transform.pos.x, transform.pos.y) 19 | 20 | local shape = b2PolygonShape.new() 21 | shape:SetAsBox(1, 0.5) 22 | 23 | local body = component.rigid_body.new() 24 | body.body = world:CreateBody(bodyDef) 25 | body.body:CreateFixture(shape, 1) 26 | 27 | local script = component.script.new() 28 | script.name = 'brick' 29 | 30 | entities:add_component(eid, sprite) 31 | entities:add_component(eid, transform) 32 | entities:add_component(eid, body) 33 | entities:add_component(eid, script) 34 | end 35 | -------------------------------------------------------------------------------- /cmake/Modules/BlenderExports.cmake: -------------------------------------------------------------------------------- 1 | find_package(Blender 2.80 REQUIRED) 2 | 3 | function(blender_export_file OUTPUT BLEND_FILE FILETYPE BASE_DIR MODEL_DIR TEXTURE_DIR) 4 | get_filename_component(BASE_NAME "${BLEND_FILE}" NAME_WLE) 5 | file(RELATIVE_PATH RELATIVE_PATH "${BASE_DIR}" "${BLEND_FILE}") 6 | string(REGEX REPLACE "[.]blend$" "" PATH_NAME "${RELATIVE_PATH}") 7 | 8 | set(MODEL_FILE ${MODEL_DIR}/${PATH_NAME}.${FILETYPE}) 9 | set(TEXTURE_FILE ${TEXTURE_DIR}/${PATH_NAME}.png) 10 | 11 | add_custom_command( 12 | OUTPUT "${MODEL_FILE}" "${TEXTURE_FILE}" 13 | COMMAND "${BLENDER_EXECUTABLE}" 14 | "${BLEND_FILE}" 15 | --background 16 | --python-exit-code 1 17 | --python "${BLENDER_EXPORT_PY}" 18 | -- 19 | "${BASE_NAME}" 20 | "${MODEL_FILE}" 21 | "${TEXTURE_FILE}" 22 | COMMENT "Exporting model ${BLEND_FILE} (${FILETYPE})" 23 | DEPENDS "${BLEND_FILE}" "${BLENDER_EXPORT_PY}") 24 | 25 | set(${OUTPUT} "${MODEL_FILE}" "${TEXTURE_FILE}" PARENT_SCOPE) 26 | endfunction() 27 | -------------------------------------------------------------------------------- /data/scripts/gui/controls/textbox.lua: -------------------------------------------------------------------------------- 1 | local vdom = require('vdom') 2 | 3 | function pick(src, ...) 4 | local rv = {} 5 | for _,k in ipairs({...}) do 6 | rv[k] = src[k] 7 | end 8 | return rv 9 | end 10 | 11 | return function(props) 12 | local panelprops = pick(props, 'height', 'width', 'left', 'right', 'bottom', 'top', 'halign', 'valign') 13 | 14 | panelprops.on_click = vdom.useCallback(function(widget, pos) focus_widget(widget) end, {}) 15 | 16 | panelprops.on_textinput = vdom.useCallback(function(widget, text) 17 | props.on_change(props.value .. text) 18 | end, { props.on_change, props.value }) 19 | 20 | panelprops.on_keydown = vdom.useCallback(function(widget, keyname) 21 | if keyname == 'Backspace' then 22 | props.on_change(string.sub(props.value, 1, -2)) 23 | return true 24 | end 25 | return false 26 | end, { props.on_change, props.value }) 27 | 28 | return vdom.create_element('panel', panelprops, 29 | vdom.create_element('label', { height=props.height, text=props.value }) 30 | ) 31 | end 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Apples 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ext/msdfgen/core/EdgeHolder.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "edge-segments.h" 5 | 6 | namespace msdfgen { 7 | 8 | /// Container for a single edge of dynamic type. 9 | class EdgeHolder { 10 | 11 | public: 12 | EdgeHolder(); 13 | EdgeHolder(EdgeSegment *segment); 14 | EdgeHolder(Point2 p0, Point2 p1, EdgeColor edgeColor = WHITE); 15 | EdgeHolder(Point2 p0, Point2 p1, Point2 p2, EdgeColor edgeColor = WHITE); 16 | EdgeHolder(Point2 p0, Point2 p1, Point2 p2, Point2 p3, EdgeColor edgeColor = WHITE); 17 | EdgeHolder(const EdgeHolder &orig); 18 | #ifdef MSDFGEN_USE_CPP11 19 | EdgeHolder(EdgeHolder &&orig); 20 | #endif 21 | ~EdgeHolder(); 22 | EdgeHolder & operator=(const EdgeHolder &orig); 23 | #ifdef MSDFGEN_USE_CPP11 24 | EdgeHolder & operator=(EdgeHolder &&orig); 25 | #endif 26 | EdgeSegment & operator*(); 27 | const EdgeSegment & operator*() const; 28 | EdgeSegment * operator->(); 29 | const EdgeSegment * operator->() const; 30 | operator EdgeSegment *(); 31 | operator const EdgeSegment *() const; 32 | 33 | private: 34 | EdgeSegment *edgeSegment; 35 | 36 | }; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /ext/soloud/doc/dcremovalfilter.mmd: -------------------------------------------------------------------------------- 1 | ## SoLoud::DCRemovalFilter 2 | 3 | This filter tries to remove DC signal from the audio. In other words, 4 | it tries to center the waveform around 0. This can be useful if some 5 | of the input waveforms gets stuck on non-zero values for a long time. 6 | 7 | The filter does not support changing of parameters on the fly, nor does 8 | it take changing of relative play speed into account. 9 | 10 | The DC removal is performed by calculating the average sample value over 11 | a relatively long period of time, and subtracting this from the output. 12 | 13 | There is one parameter - how long the averaging buffer should be. The 14 | time is in seconds. 15 | 16 | // Set up DC removal filter 17 | gDCRemovalFilter.setParams(0.1f); 18 | // Set the filter as the first filter of the bus 19 | gBus.setFilter(0, &gDCRemovalFilter); 20 | 21 | ### DCRemovalFilter.setParams() 22 | 23 | Set the parameters of the filter. 24 | 25 | gDCRemovalFilter.setParams(0.1f); 26 | 27 | Changing the parameters does not affect "live" sounds. If invalid parameters are 28 | given, the function will return error. 29 | -------------------------------------------------------------------------------- /src/ember/lerpable.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ember { 4 | 5 | template 6 | class lerpable { 7 | public: 8 | lerpable() = default; 9 | 10 | explicit lerpable(const T& t) : current_value(t), target_value(t), rem_time(0) {} 11 | 12 | void set_target(const T& t, float dur) { 13 | target_value = t; 14 | rem_time = dur; 15 | } 16 | 17 | void add_target(const T& t, float dur) { 18 | target_value += t; 19 | rem_time += dur; 20 | } 21 | 22 | void step(float delta) { 23 | if (delta < rem_time) { 24 | current_value += (target_value - current_value) * (delta / rem_time); 25 | rem_time -= delta; 26 | } else { 27 | current_value = target_value; 28 | rem_time = 0.f; 29 | } 30 | } 31 | 32 | const T& get_current() const { return current_value; } 33 | 34 | const T& get_target() const { return target_value; } 35 | 36 | private: 37 | T current_value = static_cast(0); 38 | T target_value = static_cast(0); 39 | float rem_time = 0.f; 40 | }; 41 | 42 | } // namespace ember 43 | -------------------------------------------------------------------------------- /ext/msdfgen/ext/import-font.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../core/Shape.h" 6 | 7 | namespace msdfgen { 8 | 9 | class FreetypeHandle; 10 | class FontHandle; 11 | 12 | /// Initializes the FreeType library 13 | FreetypeHandle * initializeFreetype(); 14 | /// Deinitializes the FreeType library 15 | void deinitializeFreetype(FreetypeHandle *library); 16 | /// Loads a font file and returns its handle 17 | FontHandle * loadFont(FreetypeHandle *library, const char *filename); 18 | /// Unloads a font file 19 | void destroyFont(FontHandle *font); 20 | /// Returns the size of one EM in the font's coordinate system 21 | bool getFontScale(double &output, FontHandle *font); 22 | /// Returns the width of space and tab 23 | bool getFontWhitespaceWidth(double &spaceAdvance, double &tabAdvance, FontHandle *font); 24 | /// Loads the shape prototype of a glyph from font file 25 | bool loadGlyph(Shape &output, FontHandle *font, int unicode, double *advance = NULL); 26 | /// Returns the kerning distance adjustment between two specific glyphs. 27 | bool getKerning(double &output, FontHandle *font, int unicode1, int unicode2); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/ember/scripting.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "reflection.hpp" 4 | 5 | #include 6 | 7 | namespace ember::scripting { 8 | 9 | template 10 | struct token {}; 11 | 12 | template 13 | struct has_register : std::false_type {}; 14 | 15 | template 16 | struct has_register{}, std::declval&>()))>> 17 | : std::true_type {}; 18 | 19 | /** Registers the type T with Lua, calling register_usertype(token) if available. */ 20 | template 21 | void register_type(sol::table& lua) { 22 | auto usertype = lua.new_usertype(reflect().name); 23 | 24 | std::apply( 25 | [&](auto&&... members) { 26 | if constexpr (has_register::value) { 27 | register_usertype(token{}, usertype); 28 | } else { 29 | usertype["new"] = sol::constructors{}; 30 | } 31 | 32 | ((usertype[members.name()] = members.ptr()), ...); 33 | }, 34 | reflect().members); 35 | } 36 | 37 | } // namespace ember::scripting 38 | -------------------------------------------------------------------------------- /ext/msdfgen/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Viktor Chlumsky 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /platform/x86_64/data/shaders/basic.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout(location = 0) in vec3 VertexPosition; 4 | layout(location = 1) in vec2 VertexTexCoord; 5 | layout(location = 2) in vec3 VertexNormal; 6 | layout(location = 3) in vec4 VertexBlendIndices; 7 | layout(location = 4) in vec4 VertexBlendWeights; 8 | 9 | out vec2 v_texcoord; 10 | out vec3 v_normal; 11 | 12 | uniform mat4 MVP; 13 | uniform mat4 normal_mat; 14 | uniform mat3 uvmat; 15 | uniform bool Animated; 16 | uniform mat4 Bones[32]; 17 | 18 | void main() { 19 | mat4 transform = MVP; 20 | 21 | if (Animated) { 22 | transform = 23 | MVP * ( 24 | Bones[int(VertexBlendIndices[0])] * VertexBlendWeights[0] + 25 | Bones[int(VertexBlendIndices[1])] * VertexBlendWeights[1] + 26 | Bones[int(VertexBlendIndices[2])] * VertexBlendWeights[2] + 27 | Bones[int(VertexBlendIndices[3])] * VertexBlendWeights[3]); 28 | } 29 | 30 | v_texcoord = vec2(uvmat * vec3(VertexTexCoord, 1.0)); 31 | v_normal = normalize(vec3(normal_mat * vec4(VertexNormal, 0.0))); 32 | gl_Position = transform * vec4(VertexPosition, 1.0); 33 | } 34 | -------------------------------------------------------------------------------- /ext/msdfgen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | project(msdfgen) 3 | 4 | function(msdfgen_link_pkgconfig TARGETNAME LIBNAME) 5 | string(TOUPPER ${LIBNAME} LIBPREFIX) 6 | pkg_search_module(${LIBPREFIX} REQUIRED ${LIBNAME}) 7 | target_link_libraries(${TARGETNAME} ${${LIBPREFIX}_LIBRARIES}) 8 | target_include_directories(${TARGETNAME} PUBLIC ${${LIBPREFIX}_INCLUDE_DIRS}) 9 | target_compile_options(${TARGETNAME} PUBLIC ${${LIBPREFIX}_CFLAGS_OTHER}) 10 | endfunction() 11 | 12 | file(GLOB_RECURSE msdfgen_HEADERS 13 | "core/*.h" 14 | "lib/*.h" 15 | "ext/*.h" 16 | "include/*.h" 17 | ) 18 | 19 | file(GLOB_RECURSE msdfgen_SOURCES 20 | "core/*.cpp" 21 | "lib/*.cpp" 22 | "ext/*.cpp" 23 | ) 24 | 25 | add_library(msdfgen ${msdfgen_SOURCES} ${msdfgen_HEADERS}) 26 | target_include_directories(msdfgen PUBLIC "include") 27 | target_include_directories(msdfgen INTERFACE ".") 28 | 29 | if(EMSCRIPTEN) 30 | set_target_properties(msdfgen PROPERTIES 31 | COMPILE_FLAGS "-s USE_FREETYPE=1" 32 | LINK_FLAGS "-s USE_FREETYPE=1") 33 | else() 34 | find_package(PkgConfig) 35 | target_link_libraries(msdfgen freetype) 36 | endif() 37 | 38 | -------------------------------------------------------------------------------- /ext/soloud/doc/codegen.mmd: -------------------------------------------------------------------------------- 1 | ## Codegen 2 | 3 | In order for SoLoud to be usable from other languages than C++, 4 | glue code needs to be written. Most environments are able to 5 | use "C" DLL:s, and this is one of the things SoLoud has. 6 | 7 | For most cases, you won't need to care about the codegen. Here's 8 | some information, however, if should you be curious. 9 | 10 | Writing and maintaining glue code is, however, tedious and prone 11 | to bugs, so the glue code for SoLoud is generated. 12 | 13 | The "C" API is automatically generated from the c++ sources via the 14 | codegen tool that is part of the SoLoud sources. In most cases you 15 | won't need to use the codegen yourself. 16 | 17 | ![Code generation path](images/codegen)\ 18 | 19 | The codegen tool parses the SoLoud headers and generates the needed 20 | headers and wrapper cpp code, as well as the DLL .def file, and a 21 | Python file which can be used to generate glue libraries for other 22 | environments (such as Python itself). 23 | 24 | The generated Python file also turned out to be useful in writing 25 | of this documentation, as it was pretty easy to write a script that 26 | checks whether a function has been documented or not. 27 | 28 | -------------------------------------------------------------------------------- /ext/soloud/include/soloud_file_hack_off.h: -------------------------------------------------------------------------------- 1 | /* 2 | SoLoud audio engine 3 | Copyright (c) 2013-2015 Jari Komppa 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | /* 26 | See soloud_file_hack_on.h 27 | */ 28 | 29 | #undef FILE 30 | #undef fgetc 31 | #undef fread 32 | #undef fseek 33 | #undef ftell 34 | #undef fclose 35 | #undef fopen 36 | -------------------------------------------------------------------------------- /ext/soloud/demos/common/imgui/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2015 Omar Cornut and ImGui contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/scripts/archetypes/paddle.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local eid = entities:create_entity() 3 | 4 | local sprite = component.sprite.new() 5 | sprite.texture = "sprites"; 6 | sprite.size.y = 1/4 7 | sprite.frames:add(1) 8 | 9 | local transform = component.transform.new() 10 | transform.pos.y = -14.5 11 | transform.scl.x = 4 12 | 13 | local bodyDef = b2BodyDef.new() 14 | bodyDef.userData = entities:to_ptr(eid) 15 | bodyDef.type = b2BodyType.b2_dynamicBody 16 | bodyDef.fixedRotation = true 17 | bodyDef.position:Set(transform.pos.x, transform.pos.y) 18 | bodyDef.linearDamping = 1 19 | 20 | local shape = b2PolygonShape.new() 21 | shape:SetAsBox(2, 0.5) 22 | 23 | local body = component.rigid_body.new() 24 | body.body = world:CreateBody(bodyDef) 25 | body.body:CreateFixture(shape, 1) 26 | 27 | local controller = component.controller.new() 28 | 29 | local script = component.script.new() 30 | script.name = 'paddle' 31 | 32 | entities:add_component(eid, sprite) 33 | entities:add_component(eid, transform) 34 | entities:add_component(eid, body) 35 | entities:add_component(eid, controller) 36 | entities:add_component(eid, script) 37 | end 38 | -------------------------------------------------------------------------------- /cmake/Modules/FindBlender.cmake: -------------------------------------------------------------------------------- 1 | # - Find blender 2 | # This module attempts to find Blender software 3 | # FindBlender provides the following variables: 4 | # 5 | # BLENDER_FOUND - has Blender been found 6 | # BLENDER_EXECUTABLE - Path to Blender executable 7 | # BLENDER_VERSION - Version of Blender 8 | 9 | find_program(BLENDER_EXECUTABLE blender 10 | PATHS "C:\\Program Files\\Blender Foundation\\Blender 2.83\\") 11 | 12 | if(BLENDER_EXECUTABLE) 13 | # Get the python path and version from blender 14 | execute_process(COMMAND ${BLENDER_EXECUTABLE} --version 15 | RESULT_VARIABLE RESULT 16 | OUTPUT_VARIABLE OUTPUT 17 | ERROR_VARIABLE ERROR) 18 | 19 | if(RESULT MATCHES 0) 20 | string(REGEX MATCH "Blender ([0-9]+\\.[0-9]+)" BLENDER_VERSION ${OUTPUT}) 21 | set(BLENDER_VERSION ${CMAKE_MATCH_1}) 22 | elseif(NOT blender_FIND_QUIETLY) 23 | message(WARNING "Blender config failure:\n${ERROR_VALUE}") 24 | endif() 25 | endif() 26 | 27 | include(FindPackageHandleStandardArgs) 28 | 29 | find_package_handle_standard_args(Blender 30 | REQUIRED_VARS 31 | BLENDER_EXECUTABLE 32 | BLENDER_VERSION 33 | VERSION_VAR BLENDER_VERSION 34 | HANDLE_COMPONENTS) -------------------------------------------------------------------------------- /ext/msdfgen/ext/save-png.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "save-png.h" 3 | 4 | #include "../core/arithmetics.hpp" 5 | #include 6 | 7 | namespace msdfgen { 8 | 9 | bool savePng(const Bitmap &bitmap, const char *filename) { 10 | std::vector pixels(bitmap.width()*bitmap.height()); 11 | std::vector::iterator it = pixels.begin(); 12 | for (int y = bitmap.height()-1; y >= 0; --y) 13 | for (int x = 0; x < bitmap.width(); ++x) 14 | *it++ = clamp(int(bitmap(x, y)*0x100), 0xff); 15 | return !lodepng::encode(filename, pixels, bitmap.width(), bitmap.height(), LCT_GREY); 16 | } 17 | 18 | bool savePng(const Bitmap &bitmap, const char *filename) { 19 | std::vector pixels(3*bitmap.width()*bitmap.height()); 20 | std::vector::iterator it = pixels.begin(); 21 | for (int y = bitmap.height()-1; y >= 0; --y) 22 | for (int x = 0; x < bitmap.width(); ++x) { 23 | *it++ = clamp(int(bitmap(x, y).r*0x100), 0xff); 24 | *it++ = clamp(int(bitmap(x, y).g*0x100), 0xff); 25 | *it++ = clamp(int(bitmap(x, y).b*0x100), 0xff); 26 | } 27 | return !lodepng::encode(filename, pixels, bitmap.width(), bitmap.height(), LCT_RGB); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /ext/soloud/doc/flangerfilter.mmd: -------------------------------------------------------------------------------- 1 | ## SoLoud::FlangerFilter 2 | 3 | The flanger filter can be used to create a "flanger" effect on the 4 | signal. Applying this on a human voice may sound more "robotic", for instance. 5 | 6 | // Set up flanger filter 7 | gFlangerFilter.setParams(0.005f, 10); 8 | // Set the filter as the first filter of the bus 9 | gBus.setFilter(0, &gFlangerFilter); 10 | 11 | It's also possible to set, fade or oscillate the parameters of a "live" filter 12 | 13 | gSoloud.fadeFilterParameter( 14 | gMusicHandle, // Sound handle 15 | 0, // First filter 16 | SoLoud::LofiFilter::WET, // What to adjust 17 | 0, // Target value 18 | 3); // Time in seconds 19 | 20 | Currently, four parameters can be adjusted: 21 | 22 | Parameter Description 23 | ----------- ------------- 24 | WET Filter's wet signal; 1.0f for fully filtered, 0.0f for original, 0.5f for half and half. 25 | FREQ Filter's frequency 26 | DELAY Filter's delay 27 | 28 | ### FlangerFilter.setParams() 29 | 30 | Set the parameters of the filter. 31 | 32 | gFlangerFilter.setParams(0.005f, 10); 33 | 34 | Changing the parameters does not affect "live" sounds. If invalid parameters are 35 | given, the function will return error. 36 | -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/speech/legal_readme.txt: -------------------------------------------------------------------------------- 1 | The speech synth is based on rsynth by the late 2 | Nick Ing-Simmons (et al). 3 | 4 | He described the legal status as: 5 | 6 | This is a text to speech system produced by 7 | integrating various pieces of code and tables 8 | of data, which are all (I believe) in the 9 | public domain. 10 | 11 | Since then, the rsynth source code has passed legal 12 | checks by several open source organizations, so it 13 | "should" be pretty safe. 14 | 15 | The primary copyright claims seem to have to do 16 | with text-to-speech dictionary use, which I've 17 | removed completely. 18 | 19 | I've done some serious refactoring, clean-up and 20 | feature removal on the source, as all I need is 21 | "a" free, simple speech synth, not a "good" 22 | speech synth. Since I've removed a bunch of stuff, 23 | this is probably safer public domain release 24 | than the original. 25 | 26 | (I'm rather surprised there's no good public domain 27 | speech synths out there; after all, it's 2013..) 28 | 29 | I'm placing my changes in public domain as well, 30 | or if that's not acceptable for you, then CC0: 31 | http://creativecommons.org/publicdomain/zero/1.0/ 32 | 33 | The SoLoud interface files (soloud_speech.*) are 34 | under ZLib/LibPNG license. 35 | 36 | -- Jari Komppa 37 | 2013 38 | -------------------------------------------------------------------------------- /src/ember/render_queue.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "shaders.hpp" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace ember { 13 | 14 | class render_queue { 15 | public: 16 | struct item { 17 | struct attachment { 18 | sushi::pose pose; 19 | int bone_idx; 20 | }; 21 | 22 | sushi::transform transform; 23 | glm::vec4 tint = {1, 1, 1, 1}; 24 | std::shared_ptr mesh; 25 | std::shared_ptr texture; 26 | std::optional pose; 27 | std::optional attached_to; 28 | }; 29 | 30 | /** Prepares the queue */ 31 | void prepare( 32 | shaders::basic_shader_program& shader, 33 | const glm::mat4& proj_matrix, 34 | const glm::mat4& view_matrix); 35 | 36 | /** Adds an item to the queue if it is within the view frustum */ 37 | void add(const item& item); 38 | 39 | /** Renders all queued items */ 40 | void render_items(); 41 | 42 | private: 43 | std::vector queue; 44 | shaders::basic_shader_program* basic_shader; 45 | glm::mat4 proj; 46 | glm::mat4 view; 47 | sushi::frustum frustum; 48 | }; 49 | 50 | } // namespace ember 51 | -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/speech/darray.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "darray.h" 4 | 5 | darray::darray() 6 | { 7 | mAllocChunk = 128; 8 | mAllocated = mUsed = 0; 9 | mData = NULL; 10 | } 11 | 12 | void darray::clear() 13 | { 14 | free(mData); 15 | mAllocChunk = 128; 16 | mAllocated = mUsed = 0; 17 | mData = NULL; 18 | } 19 | 20 | darray::~darray() 21 | { 22 | clear(); 23 | } 24 | 25 | char * darray::getDataInPos(int aPosition) 26 | { 27 | if (aPosition < mAllocated && aPosition < mUsed) 28 | return mData + aPosition; 29 | 30 | if (aPosition >= mAllocated) 31 | { 32 | int newsize = mAllocated; 33 | 34 | while (newsize <= aPosition) 35 | { 36 | newsize += mAllocChunk; 37 | mAllocChunk *= 2; 38 | } 39 | 40 | char *newdata = (char*)realloc(mData, newsize); 41 | if (!newdata) 42 | { 43 | free(mData); 44 | mData = NULL; 45 | mAllocated = mUsed = 0; 46 | return NULL; 47 | } 48 | else 49 | { 50 | memset(newdata + mAllocated, 0, newsize - mAllocated); 51 | } 52 | 53 | mData = newdata; 54 | mAllocated = newsize; 55 | } 56 | 57 | if (aPosition >= mUsed) 58 | { 59 | mUsed = aPosition + 1; 60 | } 61 | 62 | return mData + aPosition; 63 | } 64 | 65 | void darray::put(int aData) 66 | { 67 | char *s = getDataInPos(mUsed); 68 | 69 | *s = aData; 70 | } 71 | -------------------------------------------------------------------------------- /ext/soloud/doc/css/vs.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Visual Studio-like style based on original C# coloring by Jason Diamond 4 | 5 | */ 6 | pre .comment, 7 | pre .annotation, 8 | pre .template_comment, 9 | pre .diff .header, 10 | pre .chunk, 11 | pre .apache .cbracket { 12 | color: #c57917; 13 | } 14 | 15 | pre .keyword, 16 | pre .id, 17 | pre .title, 18 | pre .built_in, 19 | pre .aggregate, 20 | pre .smalltalk .class, 21 | pre .winutils, 22 | pre .bash .variable { 23 | color: rgb(0, 0, 0); 24 | } 25 | 26 | pre .string, 27 | pre .title, 28 | pre .parent, 29 | pre .tag .attribute .value, 30 | pre .rules .value, 31 | pre .rules .value .number, 32 | pre .ruby .symbol, 33 | pre .instancevar, 34 | pre .aggregate, 35 | pre .template_tag, 36 | pre .django .variable, 37 | pre .addition, 38 | pre .flow, 39 | pre .stream, 40 | pre .apache .tag, 41 | pre .date { 42 | color: rgb(0, 0, 0); 43 | } 44 | 45 | pre .ruby .string, 46 | pre .decorator, 47 | pre .filter .argument, 48 | pre .localvars, 49 | pre .array, 50 | pre .attr_selector, 51 | pre .pseudo, 52 | pre .pi, 53 | pre .doctype, 54 | pre .deletion, 55 | pre .envvar, 56 | pre .shebang, 57 | pre .preprocessor, 58 | pre .userType, 59 | pre .apache .sqbracket { 60 | color: rgb(0, 0, 0); 61 | } 62 | 63 | pre .phpdoc, 64 | pre .javadoc, 65 | pre .xmlDocTag { 66 | color: rgb(0, 0, 0); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ext/soloud/doc/lofifilter.mmd: -------------------------------------------------------------------------------- 1 | ## SoLoud::LofiFilter 2 | 3 | The lofi filter is a signal degrading filter. You can adjust both 4 | the bit depth and the sample rate of the output, and these parameters 5 | can also be adjusted (and even faded) on the fly. 6 | 7 | // Set up low-pass filter 8 | gLofiFilter.setParams(8000, 5); 9 | // Set the filter as the first filter of the bus 10 | gBus.setFilter(0, &gLofiFilter); 11 | 12 | It's also possible to set, fade or oscillate the parameters of a "live" filter 13 | 14 | gSoloud.fadeFilterParameter( 15 | gMusicHandle, // Sound handle 16 | 0, // First filter 17 | SoLoud::LofiFilter::BITDEPTH, // What to adjust 18 | 2, // Target value 19 | 3); // Time in seconds 20 | 21 | Currently, four parameters can be adjusted: 22 | 23 | Parameter Description 24 | ----------- ------------- 25 | WET Filter's wet signal; 1.0f for fully filtered, 0.0f for original, 0.5f for half and half. 26 | SAMPLERATE Filter's samplerate parameter 27 | BITDEPTH Filter's bit-depth parameter 28 | 29 | ### LofiFilter.setParams() 30 | 31 | Set the parameters of the filter. 32 | 33 | gLofiFilter.setParams(8000, 5); 34 | 35 | Changing the parameters does not affect "live" sounds. If invalid parameters are 36 | given, the function will return error. 37 | -------------------------------------------------------------------------------- /ext/soloud/src/tools/tedsid2dump/tedplay.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "psid.h" 5 | 6 | class TED; 7 | 8 | extern TED *machineInit(); 9 | extern void tedPlayGetInfo(void *file, PsidHeader &hdr); 10 | extern int tedplayMain(char *fileName, int model); 11 | extern void tedPlaySetVolume(unsigned int masterVolume); 12 | extern void tedPlaySetSpeed(unsigned int speedPct); 13 | extern void tedplayPause(); 14 | extern void tedplayPlay(); 15 | extern void tedplayStop(); 16 | extern void tedplayClose(); 17 | extern void tedPlayGetSongs(unsigned int ¤t, unsigned int &total); 18 | extern bool tedPlayIsChannelEnabled(unsigned int channel); 19 | extern void tedPlayChannelEnable(unsigned int channel, bool enable); 20 | extern int tedPlayGetState(); 21 | extern void tedPlaySidEnable(bool enable, unsigned int disableMask); 22 | extern void tedPlaySetFilterOrder(unsigned int filterOrder); 23 | extern unsigned int tedPlayGetWaveform(unsigned int channel); 24 | extern void tedPlaySetWaveform(unsigned int channel, unsigned int wave); 25 | extern bool tedPlayCreateWav(const char *fileName); 26 | extern void tedPlayCloseWav(); 27 | extern unsigned int tedplayGetSecondsPlayed(); 28 | extern void tedPlayResetCycleCounter(); 29 | // 30 | extern void machineReset(); 31 | extern void machineDoSomeFrames(unsigned int count); 32 | extern void dumpMem(std::string name); 33 | -------------------------------------------------------------------------------- /ext/soloud/scripts/checkapidoc.py: -------------------------------------------------------------------------------- 1 | """ Complains if some API call is not documented """ 2 | 3 | import soloud_codegen 4 | import glob 5 | import os 6 | 7 | def checkfile(apifunc, fname): 8 | """ Checks whether the string can be found in a file """ 9 | if apifunc in open(fname).read(): 10 | #print apifunc + " found in " + fname 11 | return True 12 | return False 13 | 14 | def checkfiles(apifunc): 15 | """ Goes through all multimarkdown files in doc dir and passes 16 | them to checkfile. If found, early out. 17 | """ 18 | for file in glob.glob("../doc/*.mmd"): 19 | if checkfile(apifunc, file): 20 | return True 21 | return False 22 | 23 | print "Checking for undocumented APIs.." 24 | print 25 | 26 | found = 0 27 | total = 0 28 | 29 | for func in soloud_codegen.soloud_func: 30 | apifunc = func[1].replace("_",".") 31 | if ((apifunc[-2::] != "Ex") and 32 | (apifunc[-7::] != "destroy") and 33 | (apifunc[-6::] != "create")): 34 | total += 1 35 | if not checkfiles(apifunc + "()"): 36 | print apifunc 37 | found += 1 38 | 39 | if found == 0: 40 | print "All good! (" + str(total) + ", not counting ctor/dtor/ex)" 41 | else: 42 | print 43 | print str(found) + " / " + str(total) + " APIs undocumented. Get to work!" 44 | print "(not counting ctor/dtor/ex variants)" 45 | -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/speech/resonator.h: -------------------------------------------------------------------------------- 1 | #ifndef RESONATOR_H 2 | #define RESONATOR_H 3 | 4 | class resonator 5 | { 6 | float mA, mB, mC, mP1, mP2; 7 | public: 8 | 9 | /* Convert formant freqencies and bandwidth into resonator difference equation coefficents 10 | */ 11 | void initResonator( 12 | int aFrequency, /* Frequency of resonator in Hz */ 13 | int aBandwidth, /* Bandwidth of resonator in Hz */ 14 | int aSamplerate); 15 | 16 | /* Convert formant freqencies and bandwidth into anti-resonator difference equation constants 17 | */ 18 | void initAntiresonator( 19 | int aFrequency, /* Frequency of resonator in Hz */ 20 | int aBandwidth, /* Bandwidth of resonator in Hz */ 21 | int aSamplerate); 22 | 23 | /* Set gain */ 24 | void setGain(float aG); 25 | 26 | /* Generic resonator function */ 27 | float resonate(float input); 28 | 29 | /* Generic anti-resonator function 30 | Same as resonator except that a,b,c need to be set with initAntiresonator() 31 | and we save inputs in p1/p2 rather than outputs. 32 | There is currently only one of these - "mNasalZero" 33 | 34 | Output = (mNasalZero.a * input) + (mNasalZero.b * oldin1) + (mNasalZero.c * oldin2) 35 | */ 36 | 37 | float antiresonate(float input); 38 | 39 | resonator(); 40 | 41 | ~resonator(); 42 | }; 43 | 44 | #endif -------------------------------------------------------------------------------- /doc/scripting.md: -------------------------------------------------------------------------------- 1 | Scripting 2 | ========= 3 | 4 | Script Structure 5 | ---------------- 6 | 7 | A script must define the following functions: 8 | 9 | ### `update(eid, delta, entities)` 10 | 11 | Will be called once per tick. 12 | 13 | Parameters: 14 | 15 | - `eid`: Entity ID of this entitiy. 16 | - `delta`: Delta time, in seconds. 17 | - `entities`: Entities database. 18 | 19 | Global Objects 20 | -------------- 21 | 22 | These objects are always available to scripts. 23 | 24 | ### `entities` 25 | 26 | The entity database. 27 | 28 | Methods: 29 | 30 | - `create_entity(net_id)` 31 | - `destroy_entity(net_id)` 32 | - `get_entity(net_id)` 33 | - `create_component(ent_id, com)` 34 | - `destroy_component(ent_id, com_type)` 35 | - `get_component(ent_id, com_type)` 36 | - `has_component(ent_id, com_type)` 37 | 38 | Global Functions 39 | ---------------- 40 | 41 | These functions are automatically provided to all scripts. 42 | 43 | ### `rotate_left(dir)` 44 | 45 | Rotates a direction to the left. 46 | 47 | Parameters: 48 | 49 | - `dir`: The starting direction. 50 | 51 | ### `rotate_right(dir)` 52 | 53 | Rotates a direction to the right. 54 | 55 | Parameters: 56 | 57 | - `dir`: The starting direction. 58 | 59 | ### `find_entities_at(entities, row, col)` 60 | 61 | Gets a list of entities at the given position. 62 | 63 | Parameters: 64 | 65 | - `entities`: The entity database. 66 | - `row`: Row. 67 | - `col`: Col. 68 | 69 | -------------------------------------------------------------------------------- /ext/soloud/demos/glue/rpgmaker/space.rb: -------------------------------------------------------------------------------- 1 | gSoloud = SoLoud::Soloud.new 2 | gSpeech = SoLoud::Speech.new 3 | gLofi = SoLoud::LofiFilter.new 4 | gFlanger = SoLoud::FlangerFilter.new 5 | gReso = SoLoud::BiquadResonantFilter.new 6 | gSpeechBus = SoLoud::Bus.new 7 | gMusicBus = SoLoud::Bus.new 8 | 9 | gSoloud.init(); 10 | gSoloud.setVisualizationEnable(1); 11 | gSoloud.setGlobalVolume(3); 12 | gSoloud.setPostClipScaler(0.75); 13 | 14 | gSoloud.play(gSpeechBus); 15 | gSoloud.play(gMusicBus); 16 | 17 | gSpeech.setFilter(1, gFlanger); 18 | gSpeech.setFilter(0, gLofi); 19 | gSpeech.setFilter(2, gReso); 20 | gLofi.setParams(8000,4); 21 | gFlanger.setParams(0.002,100); 22 | gReso.setParams(SoLoud::BiquadResonantFilter::BANDPASS, 8000, 1000, 0.5); 23 | 24 | gSpeech.setText(<<-EOS) 25 | What the alien has to say might 26 | appear around here if this 27 | wasn't just a dummy mockup.. 28 | 29 | .......... 30 | This is a demo of getting 31 | visualization data from different 32 | parts of the audio pipeline. 33 | 34 | .......... 35 | 36 | .......... 37 | 38 | .......... 39 | EOS 40 | 41 | gSpeech.setLooping(1); 42 | 43 | speechhandle = gSpeechBus.play(gSpeech, 3, -0.25); 44 | gSoloud.setRelativePlaySpeed(speechhandle, 1.2); 45 | 46 | gSoloud.oscillateFilterParameter(speechhandle, 0, SoLoud::LofiFilter::SAMPLERATE, 2000, 8000, 4); 47 | 48 | gSpeechBus.setVisualizationEnable(1); 49 | gMusicBus.setVisualizationEnable(1); 50 | 51 | rgss_stop -------------------------------------------------------------------------------- /src/ember/ez3d.cpp: -------------------------------------------------------------------------------- 1 | #include "ez3d.hpp" 2 | 3 | namespace ember::ez3d { 4 | 5 | void renderer::begin(engine* eng, const camera::perspective& cam) { 6 | glEnable(GL_DEPTH_TEST); 7 | glDepthFunc(GL_LEQUAL); 8 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 9 | glEnable(GL_BLEND); 10 | //glEnable(GL_SAMPLE_COVERAGE); 11 | //glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); 12 | 13 | eng->basic_shader.bind(); 14 | eng->basic_shader.set_cam_forward(get_forward(cam)); 15 | eng->basic_shader.set_tint({1, 1, 1, 1}); 16 | eng->basic_shader.set_hue(0); 17 | eng->basic_shader.set_saturation(1); 18 | 19 | renderq.prepare(eng->basic_shader, get_proj(cam), get_view(cam)); 20 | } 21 | 22 | void renderer::add(const model& model, const sushi::transform& transform) { 23 | if (model.mesh && model.texture) { 24 | // Pose 25 | 26 | std::optional pose; 27 | 28 | if (model.skeleton) { 29 | pose = sushi::get_pose(*model.skeleton, model.anim_index, model.anim_time, true); 30 | } 31 | 32 | // Render 33 | 34 | auto item = render_queue::item{}; 35 | item.transform = transform; 36 | item.mesh = model.mesh; 37 | item.texture = model.texture; 38 | item.pose = pose; 39 | 40 | renderq.add(item); 41 | } 42 | } 43 | 44 | void renderer::finish() { 45 | renderq.render_items(); 46 | } 47 | 48 | } // namespace ember::ez3d 49 | -------------------------------------------------------------------------------- /src/components.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ember/component_common.hpp" 4 | #include "ember/entities.hpp" 5 | #include "ember/net_id.hpp" 6 | #include "ember/ez3d.hpp" 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #define EMBER_REFLECTION_ENABLE_REGISTRY 18 | #include "ember/reflection_start.hpp" 19 | 20 | namespace component { 21 | 22 | using tag_brick_breaker = ginseng::tag; 23 | REFLECT(tag_brick_breaker) 24 | 25 | /** Actor script used for various events */ 26 | struct script { 27 | std::string name; /** Script name within the 'actors.' namespace */ 28 | }; 29 | REFLECT(script, (name)) 30 | 31 | /** World transform */ 32 | struct transform : sushi::transform {}; 33 | REFLECT(transform, (pos)(rot)(scl)) 34 | 35 | struct sprite { 36 | std::string texture; 37 | glm::vec2 size = {1, 1}; 38 | std::vector frames; 39 | float time = 0; 40 | }; 41 | REFLECT(sprite, (texture)(size)(frames)(time)) 42 | 43 | struct rigid_body { 44 | b2Body* body; 45 | }; 46 | REFLECT(rigid_body, (body)) 47 | 48 | struct controller { 49 | bool left = false; 50 | bool right = false; 51 | bool action_pressed = false; 52 | }; 53 | REFLECT(controller, (left)(right)(action_pressed)) 54 | 55 | } // namespace component 56 | 57 | #include "ember/reflection_end.hpp" 58 | -------------------------------------------------------------------------------- /src/scene_gameplay.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ember/box2d_helpers.hpp" 4 | #include "ember/camera.hpp" 5 | #include "ember/entities.hpp" 6 | #include "ember/scene.hpp" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | class scene_gameplay final : public ember::scene { 18 | public: 19 | scene_gameplay(ember::engine& eng, scene* prev); 20 | 21 | virtual void init() override; 22 | virtual void tick(float delta) override; 23 | virtual void render() override; 24 | virtual auto handle_game_input(const SDL_Event& event) -> bool override; 25 | virtual auto render_gui() -> sol::table override; 26 | 27 | private: 28 | class contact_listener : public b2ContactListener { 29 | public: 30 | contact_listener(scene_gameplay& scene); 31 | virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) override; 32 | private: 33 | scene_gameplay* scene; 34 | }; 35 | 36 | ember::camera::orthographic camera; 37 | ember::database entities; 38 | b2World world; 39 | contact_listener world_contact_listener; 40 | ember::box2d_fixed_timestep timestep; 41 | sol::table gui_state; 42 | sushi::mesh_group sprite_mesh; 43 | sushi::mesh_group tilemap_mesh; 44 | int lives; 45 | std::vector destroy_queue; 46 | }; 47 | -------------------------------------------------------------------------------- /src/ember/camera.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | namespace ember::camera { 11 | 12 | /** Perspective projection camera */ 13 | struct perspective { 14 | float fov_y = 90.f; 15 | float aspect_ratio = 4.f/3.f; /** fov_x/fov_y */ 16 | float near = 0.05f; 17 | float far = 100.f; 18 | glm::vec3 pos = {0, 0, 0}; 19 | glm::quat rot = {1, 0, 0, 0}; /** Orientation from forward: -Z, up: Y */ 20 | }; 21 | 22 | auto get_proj(const perspective& cam) -> glm::mat4; 23 | 24 | auto get_view(const perspective& cam) -> glm::mat4; 25 | 26 | auto get_forward(const perspective& cam) -> glm::vec3; 27 | 28 | void look_at(perspective& cam, const glm::vec3& target, const glm::vec3& up); 29 | 30 | /** Orthographic projection camera */ 31 | struct orthographic { 32 | float height = 2.f; 33 | float aspect_ratio = 4.f/3.f; /** width/height */ 34 | float near = 0.f; 35 | float far = 100.f; 36 | glm::vec3 pos = {0, 0, 0}; 37 | glm::quat rot = {1, 0, 0, 0}; /** Orientation from forward: -Z, up: Y */ 38 | }; 39 | 40 | auto get_proj(const orthographic& cam) -> glm::mat4; 41 | 42 | auto get_view(const orthographic& cam) -> glm::mat4; 43 | 44 | auto get_forward(const orthographic& cam) -> glm::vec3; 45 | 46 | void look_at(orthographic& cam, const glm::vec3& target, const glm::vec3& up); 47 | 48 | } // namespace ember::camera 49 | -------------------------------------------------------------------------------- /src/ember/lua_gui.cpp: -------------------------------------------------------------------------------- 1 | #include "lua_gui.hpp" 2 | 3 | #include "gui.hpp" 4 | 5 | namespace ember::lua_gui { 6 | 7 | void register_types(sol::table& lua) { 8 | using gui::block_layout; 9 | using gui::widget; 10 | 11 | auto block_layout_type = lua.new_usertype("block_layout", sol::constructors<>{}); 12 | block_layout_type["position"] = &block_layout::position; 13 | block_layout_type["size"] = &block_layout::size; 14 | block_layout_type["visible"] = &block_layout::visible; 15 | 16 | auto widget_type = lua.new_usertype("widget", sol::constructors<>{}); 17 | widget_type["get_type"] = &widget::get_type; 18 | widget_type["create_widget"] = &widget::create_widget; 19 | widget_type["get_parent"] = &widget::get_parent; 20 | widget_type["get_children"] = &widget::get_children; 21 | widget_type["add_child"] = &widget::add_child; 22 | widget_type["remove_child"] = &widget::remove_child; 23 | widget_type["replace_child"] = &widget::replace_child; 24 | widget_type["clear_children"] = &widget::clear_children; 25 | widget_type["set_attribute"] = &widget::set_attribute; 26 | widget_type["get_attribute"] = &widget::get_attribute; 27 | widget_type["get_all_attributes"] = &widget::get_all_attributes; 28 | widget_type["on_click"] = &widget::on_click; 29 | widget_type["on_textinput"] = &widget::on_textinput; 30 | widget_type["on_keydown"] = &widget::on_keydown; 31 | widget_type["get_layout"] = &widget::get_layout; 32 | } 33 | 34 | } // namespace ember::lua_gui 35 | -------------------------------------------------------------------------------- /data/scripts/archetypes/ball.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local eid = entities:create_entity() 3 | 4 | local sprite = component.sprite.new() 5 | sprite.texture = "sprites"; 6 | sprite.size.x = 1/8 7 | sprite.size.y = 1/8 8 | sprite.frames:add(1) 9 | sprite.frames:add(0) 10 | sprite.frames:add(8) 11 | sprite.frames:add(0) 12 | 13 | local transform = component.transform.new() 14 | transform.scl.x = 0.5 15 | transform.scl.y = 0.5 16 | 17 | local bodyDef = b2BodyDef.new() 18 | bodyDef.type = b2BodyType.b2_dynamicBody 19 | bodyDef.userData = entities:to_ptr(eid) 20 | bodyDef.fixedRotation = true 21 | bodyDef.bullet = true 22 | bodyDef.position:Set(transform.pos.x, transform.pos.y) 23 | bodyDef.linearVelocity:Set((math.random() * 2 - 1) * 15, -20) 24 | 25 | local shape = b2PolygonShape.new() 26 | shape:SetAsBox(0.25, 0.25) 27 | 28 | local fixture = b2FixtureDef.new() 29 | fixture.shape = shape 30 | fixture.friction = 0 31 | fixture.restitution = 1 32 | fixture.density = 1 33 | 34 | local body = component.rigid_body.new() 35 | body.body = world:CreateBody(bodyDef) 36 | body.body:CreateFixture(fixture) 37 | 38 | local script = component.script.new() 39 | script.name = 'ball' 40 | 41 | entities:add_component(eid, sprite) 42 | entities:add_component(eid, transform) 43 | entities:add_component(eid, body) 44 | entities:add_component(eid, script) 45 | entities:add_component(eid, component.tag_brick_breaker.new()) 46 | end 47 | -------------------------------------------------------------------------------- /ext/soloud/doc/attenuator.mmd: -------------------------------------------------------------------------------- 1 | ## SoLoud::AudioAttenuator 2 | 3 | 3d sound sources may have custom audio attenuators attached to them. Sometimes the default options provided by SoLoud are not 4 | enough. 5 | 6 | Custom attenuators are used by creating the object and passing it to an audio source via set3dAttenuator call: 7 | 8 | MyCustomAttenuator ca; 9 | gSound.set3dAttenuator(&ca); 10 | gSoloud.play(gSound); 11 | 12 | The attenuator pointer is copied to audio instances, so if you wish to launch several instances of a sound source with different attenuator, simply call the set3dAttenuator() before any play() calls. Disabling the attenuator can be done by giving the call a NULL pointer. 13 | 14 | ### AudioAttenuator.attenuate() 15 | 16 | To create a custom attenuator, extend the AudioAttenuator class. The class defines only one function: 17 | 18 | virtual float attenuate(float aDistance, 19 | float aMinDistance, 20 | float aMaxDistance, 21 | float aRolloffFactor) 22 | 23 | The return value is expected to be in the 0..1 range, and gives the general volume level. 24 | 25 | The custom attenuators are called while processing the 3d audio in the update3dAudio() call, before any panning is calculated. 26 | 27 | Note that calling any SoLoud functions (even to set the position of a 3d audio source) from the attenuate function will most likely cause the application - or at least the audio thread - to freeze due to mutex locks. 28 | -------------------------------------------------------------------------------- /ext/soloud/include/soloud_fft.h: -------------------------------------------------------------------------------- 1 | /* 2 | SoLoud audio engine 3 | Copyright (c) 2013-2015 Jari Komppa 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #ifndef SOLOUD_FFT_H 26 | #define SOLOUD_FFT_H 27 | 28 | #include "soloud.h" 29 | 30 | namespace SoLoud 31 | { 32 | namespace FFT 33 | { 34 | // Perform 1024 unit FFT. Buffer must have 1024 floats, and will be overwritten 35 | void fft1024(float *aBuffer); 36 | 37 | // Perform 256 unit FFT. Buffer must have 256 floats, and will be overwritten 38 | void fft256(float *aBuffer); 39 | 40 | // Perform 256 unit IFFT. Buffer must have 256 floats, and will be overwritten 41 | void ifft256(float *aBuffer); 42 | }; 43 | }; 44 | 45 | #endif -------------------------------------------------------------------------------- /ext/soloud/include/soloud_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | SoLoud audio engine 3 | Copyright (c) 2013-2014 Jari Komppa 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | #ifndef SOLOUD_ERROR_H 25 | #define SOLOUD_ERROR_H 26 | 27 | namespace SoLoud 28 | { 29 | enum SOLOUD_ERRORS 30 | { 31 | SO_NO_ERROR = 0, // No error 32 | INVALID_PARAMETER = 1, // Some parameter is invalid 33 | FILE_NOT_FOUND = 2, // File not found 34 | FILE_LOAD_FAILED = 3, // File found, but could not be loaded 35 | DLL_NOT_FOUND = 4, // DLL not found, or wrong DLL 36 | OUT_OF_MEMORY = 5, // Out of memory 37 | NOT_IMPLEMENTED = 6, // Feature not implemented 38 | UNKNOWN_ERROR = 7 // Other error 39 | }; 40 | }; 41 | #endif -------------------------------------------------------------------------------- /ext/lua/src/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.45 2017/01/12 17:14:26 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* version suffix for environment variable names */ 15 | #define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR 16 | 17 | 18 | LUAMOD_API int (luaopen_base) (lua_State *L); 19 | 20 | #define LUA_COLIBNAME "coroutine" 21 | LUAMOD_API int (luaopen_coroutine) (lua_State *L); 22 | 23 | #define LUA_TABLIBNAME "table" 24 | LUAMOD_API int (luaopen_table) (lua_State *L); 25 | 26 | #define LUA_IOLIBNAME "io" 27 | LUAMOD_API int (luaopen_io) (lua_State *L); 28 | 29 | #define LUA_OSLIBNAME "os" 30 | LUAMOD_API int (luaopen_os) (lua_State *L); 31 | 32 | #define LUA_STRLIBNAME "string" 33 | LUAMOD_API int (luaopen_string) (lua_State *L); 34 | 35 | #define LUA_UTF8LIBNAME "utf8" 36 | LUAMOD_API int (luaopen_utf8) (lua_State *L); 37 | 38 | #define LUA_BITLIBNAME "bit32" 39 | LUAMOD_API int (luaopen_bit32) (lua_State *L); 40 | 41 | #define LUA_MATHLIBNAME "math" 42 | LUAMOD_API int (luaopen_math) (lua_State *L); 43 | 44 | #define LUA_DBLIBNAME "debug" 45 | LUAMOD_API int (luaopen_debug) (lua_State *L); 46 | 47 | #define LUA_LOADLIBNAME "package" 48 | LUAMOD_API int (luaopen_package) (lua_State *L); 49 | 50 | 51 | /* open all previous libraries */ 52 | LUALIB_API void (luaL_openlibs) (lua_State *L); 53 | 54 | 55 | 56 | #if !defined(lua_assert) 57 | #define lua_assert(x) ((void)0) 58 | #endif 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /ext/soloud/doc/d_api.mmd: -------------------------------------------------------------------------------- 1 | ## D API 2 | 3 | One of the generated glue interfaces for SoLoud is the D API. 4 | 5 | All of the existing interfaces can be used via the D API, but 6 | features that require extending SoLoud are not available. 7 | 8 | ### Using the D API 9 | 10 | The glue file soloud.d can be found under the "glue" directory. 11 | 12 | Include the soloud.d from the glue directory in your project, and 13 | make sure the SoLoud DLL is in the same directory as your 14 | executable files. You'll also want to link your executable against the 15 | generated soloud_dll_x86.lib. 16 | 17 | ### D API Example 18 | 19 | The D API mirrors the c++ API. 20 | 21 | If the c++ API functions have default parameters, the same function 22 | in the D API will also have default parameters. 23 | 24 | As an example, here's a simple example in the C++ api: 25 | 26 | SoLoud::Soloud soloud; 27 | SoLoud::Speech speech; 28 | 29 | speech.setText("Hello c++ api"); 30 | 31 | soloud.init(SoLoud::Soloud::CLIP_ROUNDOFF | 32 | SoLoud::Soloud::ENABLE_VISUALIZATION); 33 | 34 | soloud.setGlobalVolume(4); 35 | soloud.play(speech); 36 | 37 | // ... 38 | 39 | soloud.deinit(); 40 | 41 | Converted to the D API, this becomes: 42 | 43 | Soloud soloud = Soloud.create(); 44 | Speech speech = Speech.create(); 45 | 46 | speech.setText("Hello D api"); 47 | 48 | soloud.init(Soloud.CLIP_ROUNDOFF | 49 | Soloud.ENABLE_VISUALIZATION); 50 | 51 | soloud.setGlobalVolume(4); 52 | soloud.play(speech); 53 | 54 | // ... 55 | 56 | soloud.deinit(); 57 | -------------------------------------------------------------------------------- /platform/emscripten/data/shaders/basic.frag: -------------------------------------------------------------------------------- 1 | precision mediump float; 2 | 3 | varying vec2 v_texcoord; 4 | varying vec3 v_normal; 5 | 6 | uniform sampler2D s_texture; 7 | uniform vec3 cam_forward; 8 | uniform vec4 tint; 9 | uniform float hue; 10 | uniform float saturation; 11 | uniform vec3 sky_dir; 12 | uniform vec3 sky_color; 13 | uniform vec3 ambient_color; 14 | uniform bool enable_lighting; 15 | 16 | // http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl 17 | vec3 rgb2hsv(vec3 c) 18 | { 19 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 20 | vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); 21 | vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); 22 | float d = q.x - min(q.w, q.y); 23 | float e = 1.0e-10; 24 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 25 | } 26 | 27 | vec3 hsv2rgb(vec3 c) 28 | { 29 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 30 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 31 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 32 | } 33 | 34 | void main() 35 | { 36 | vec4 color = texture2D(s_texture, v_texcoord) * tint; 37 | 38 | if (color.a < 1.0/255.0) discard; 39 | 40 | vec3 hsv = rgb2hsv(color.rgb); 41 | 42 | hsv.x += hue; 43 | hsv.y *= saturation; 44 | 45 | color.rgb = hsv2rgb(hsv); 46 | 47 | if (enable_lighting) { 48 | vec3 diffuse = 0.6 * max(dot(v_normal, sky_dir), 0.0) * sky_color; 49 | vec3 ambient = 0.4 * ambient_color; 50 | color.rgb = color.rgb * (ambient + diffuse); 51 | } 52 | 53 | gl_FragColor = color; 54 | } 55 | -------------------------------------------------------------------------------- /ext/lua/src/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | 21 | LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, 22 | const char *opname); 23 | LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, 24 | const TValue *p2); 25 | LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, 26 | const TValue *p2, 27 | const char *msg); 28 | LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, 29 | const TValue *p2); 30 | LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, 31 | const TValue *p2); 32 | LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); 33 | LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, 34 | TString *src, int line); 35 | LUAI_FUNC l_noret luaG_errormsg (lua_State *L); 36 | LUAI_FUNC void luaG_traceexec (lua_State *L); 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /ext/soloud/doc/cs_api.mmd: -------------------------------------------------------------------------------- 1 | ## C sharp (C#) API 2 | 3 | One of the generated glue interfaces for SoLoud is the C sharp API (C#). 4 | 5 | All of the existing interfaces can be used via the C sharp API, but 6 | features that require extending SoLoud are not available. 7 | 8 | ### Using the C sharp API 9 | 10 | The glue file soloud.cs can be found under the "glue" directory. 11 | 12 | Include the soloud.cs from the glue directory in your project, and 13 | make sure the SoLoud DLL is in the same directory as your 14 | executable files. 15 | 16 | ### C sharp API Example 17 | 18 | The C sharp API mirrors the c++ API. 19 | 20 | If the c++ API functions have default parameters, the same function 21 | in the C sharp API will also have default parameters. 22 | 23 | As an example, here's a simple example in the C++ api: 24 | 25 | SoLoud::Soloud soloud; 26 | SoLoud::Speech speech; 27 | 28 | speech.setText("Hello c++ api"); 29 | 30 | soloud.init(SoLoud::Soloud::CLIP_ROUNDOFF | 31 | SoLoud::Soloud::ENABLE_VISUALIZATION); 32 | 33 | soloud.setGlobalVolume(4); 34 | soloud.play(speech); 35 | 36 | // ... 37 | 38 | soloud.deinit(); 39 | 40 | Converted to the C sharp API, this becomes: 41 | 42 | SoLoud.Soloud soloud = new SoLoud.Soloud(); 43 | SoLoud.Speech speech = new SoLoud.Speech(); 44 | 45 | speech.setText("Hello c sharp api"); 46 | 47 | soloud.init(SoLoud.Soloud.CLIP_ROUNDOFF | 48 | SoLoud.Soloud.ENABLE_VISUALIZATION); 49 | 50 | soloud.setGlobalVolume(4); 51 | soloud.play(speech); 52 | 53 | // ... 54 | 55 | soloud.deinit(); 56 | -------------------------------------------------------------------------------- /ext/soloud/doc/ruby_api.mmd: -------------------------------------------------------------------------------- 1 | ## Ruby API 2 | 3 | One of the generated glue interfaces for SoLoud is the Ruby API. 4 | 5 | All of the existing interfaces can be used via the Ruby API, but 6 | features that require extending SoLoud are not available. 7 | 8 | ### Using the Ruby API 9 | 10 | The glue file soloud.rb can be found under the "glue" directory. 11 | 12 | Include the SoLoud DLL and soloud.rb in the same directory as your 13 | ruby files, and use 14 | 15 | load 'soloud.rb' 16 | 17 | to include SoLoud to your project. 18 | 19 | ### Ruby API Example 20 | 21 | 22 | The Ruby API mirrors the c++ API. 23 | 24 | If the c++ API functions have default parameters, the same function 25 | in the ruby API will also have default parameters. 26 | 27 | As an example, here's a simple example in the C++ api: 28 | 29 | SoLoud::Soloud soloud; 30 | SoLoud::Speech speech; 31 | 32 | speech.setText("Hello c++ api"); 33 | 34 | soloud.init(SoLoud::Soloud::CLIP_ROUNDOFF | 35 | SoLoud::Soloud::ENABLE_VISUALIZATION) 36 | 37 | soloud.setGlobalVolume(4); 38 | soloud.play(speech); 39 | 40 | // ... 41 | 42 | soloud.deinit(); 43 | 44 | Converted to the Ruby API, this becomes: 45 | 46 | load 'soloud.rb' 47 | 48 | soloud=Soloud.new("") 49 | speech=Speech.new("") 50 | 51 | speech.set_text("Hello Ruby api") 52 | 53 | soloud.init(soloud::CLIP_ROUNDOFF | 54 | soloud::ENABLE_VISUALIZATION) 55 | 56 | soloud.set_global_volume(4) 57 | soloud.play(speech) 58 | 59 | # ... 60 | 61 | soloud.deinit() 62 | speech.destroy() 63 | soloud.destroy() 64 | -------------------------------------------------------------------------------- /platform/x86_64/data/shaders/basic.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | in vec2 v_texcoord; 4 | in vec3 v_normal; 5 | 6 | uniform sampler2D s_texture; 7 | uniform vec3 cam_forward; 8 | uniform vec4 tint; 9 | uniform float hue; 10 | uniform float saturation; 11 | uniform vec3 sky_dir; 12 | uniform vec3 sky_color; 13 | uniform vec3 ambient_color; 14 | uniform bool enable_lighting; 15 | 16 | layout(location = 0) out vec4 outColor; 17 | 18 | // http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl 19 | vec3 rgb2hsv(vec3 c) 20 | { 21 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 22 | vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); 23 | vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); 24 | float d = q.x - min(q.w, q.y); 25 | float e = 1.0e-10; 26 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 27 | } 28 | 29 | vec3 hsv2rgb(vec3 c) 30 | { 31 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 32 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 33 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 34 | } 35 | 36 | void main() 37 | { 38 | vec4 color = texture2D(s_texture, v_texcoord) * tint; 39 | 40 | if (color.a < 1.0/255.0) discard; 41 | 42 | vec3 hsv = rgb2hsv(color.rgb); 43 | 44 | hsv.x += hue; 45 | hsv.y *= saturation; 46 | 47 | color.rgb = hsv2rgb(hsv); 48 | 49 | if (enable_lighting) { 50 | vec3 diffuse = 0.6 * max(dot(v_normal, sky_dir), 0.0) * sky_color; 51 | vec3 ambient = 0.4 * ambient_color; 52 | color.rgb = color.rgb * (ambient + diffuse); 53 | } 54 | 55 | outColor = color; 56 | } 57 | -------------------------------------------------------------------------------- /ext/lua/src/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.61 2015/11/03 15:36:01 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | #include "lgc.h" 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | 14 | 15 | #define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) 16 | 17 | #define sizeludata(l) (sizeof(union UUdata) + (l)) 18 | #define sizeudata(u) sizeludata((u)->len) 19 | 20 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 21 | (sizeof(s)/sizeof(char))-1)) 22 | 23 | 24 | /* 25 | ** test whether a string is a reserved word 26 | */ 27 | #define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) 28 | 29 | 30 | /* 31 | ** equality for short strings, which are always internalized 32 | */ 33 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) 34 | 35 | 36 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); 37 | LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); 38 | LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); 39 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 40 | LUAI_FUNC void luaS_clearcache (global_State *g); 41 | LUAI_FUNC void luaS_init (lua_State *L); 42 | LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); 43 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s); 44 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 45 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); 46 | LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); 47 | 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /ext/lua/src/lzio.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.c,v 1.37 2015/09/08 15:41:05 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lzio_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include 14 | 15 | #include "lua.h" 16 | 17 | #include "llimits.h" 18 | #include "lmem.h" 19 | #include "lstate.h" 20 | #include "lzio.h" 21 | 22 | 23 | int luaZ_fill (ZIO *z) { 24 | size_t size; 25 | lua_State *L = z->L; 26 | const char *buff; 27 | lua_unlock(L); 28 | buff = z->reader(L, z->data, &size); 29 | lua_lock(L); 30 | if (buff == NULL || size == 0) 31 | return EOZ; 32 | z->n = size - 1; /* discount char being returned */ 33 | z->p = buff; 34 | return cast_uchar(*(z->p++)); 35 | } 36 | 37 | 38 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { 39 | z->L = L; 40 | z->reader = reader; 41 | z->data = data; 42 | z->n = 0; 43 | z->p = NULL; 44 | } 45 | 46 | 47 | /* --------------------------------------------------------------- read --- */ 48 | size_t luaZ_read (ZIO *z, void *b, size_t n) { 49 | while (n) { 50 | size_t m; 51 | if (z->n == 0) { /* no bytes in buffer? */ 52 | if (luaZ_fill(z) == EOZ) /* try to read more */ 53 | return n; /* no more input; return number of missing bytes */ 54 | else { 55 | z->n++; /* luaZ_fill consumed first byte; put it back */ 56 | z->p--; 57 | } 58 | } 59 | m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ 60 | memcpy(b, z->p, m); 61 | z->n -= m; 62 | z->p += m; 63 | b = (char *)b + m; 64 | n -= m; 65 | } 66 | return 0; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ext/msdfgen/core/arithmetics.hpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | namespace msdfgen { 8 | 9 | /// Returns the smaller of the arguments. 10 | template 11 | inline T min(T a, T b) { 12 | return b < a ? b : a; 13 | } 14 | 15 | /// Returns the larger of the arguments. 16 | template 17 | inline T max(T a, T b) { 18 | return a < b ? b : a; 19 | } 20 | 21 | /// Returns the middle out of three values 22 | template 23 | inline T median(T a, T b, T c) { 24 | return max(min(a, b), min(max(a, b), c)); 25 | } 26 | 27 | /// Returns the weighted average of a and b. 28 | template 29 | inline T mix(T a, T b, S weight) { 30 | return T((S(1)-weight)*a+weight*b); 31 | } 32 | 33 | /// Clamps the number to the interval from 0 to 1. 34 | template 35 | inline T clamp(T n) { 36 | return n >= T(0) && n <= T(1) ? n : T(n > T(0)); 37 | } 38 | 39 | /// Clamps the number to the interval from 0 to b. 40 | template 41 | inline T clamp(T n, T b) { 42 | return n >= T(0) && n <= b ? n : T(n > T(0))*b; 43 | } 44 | 45 | /// Clamps the number to the interval from a to b. 46 | template 47 | inline T clamp(T n, T a, T b) { 48 | return n >= a && n <= b ? n : n < a ? a : b; 49 | } 50 | 51 | /// Returns 1 for positive values, -1 for negative values, and 0 for zero. 52 | template 53 | inline int sign(T n) { 54 | return (T(0) < n)-(n < T(0)); 55 | } 56 | 57 | /// Returns 1 for non-negative values and -1 for negative values. 58 | template 59 | inline int nonZeroSign(T n) { 60 | return 2*(n > T(0))-1; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /ext/soloud/doc/rpgmaker_api.mmd: -------------------------------------------------------------------------------- 1 | ## RPG Maker API 2 | 3 | 4 | One of the generated glue interfaces for SoLoud is the RPG Maker API. 5 | Since RPG Maker uses Ruby, this API is equal to the Ruby API. 6 | 7 | All of the existing interfaces can be used via the Ruby API, but 8 | features that require extending SoLoud are not available. 9 | 10 | ### Using the RPG Maker API 11 | 12 | The glue file rpgmaker_soloud.rb can be found under the "glue" directory. 13 | 14 | Copy the contents of rpgmaker_soloud.rb into one RPG Maker script 15 | tab, drop the "soloud_x86.dll" in your project's System folder and 16 | just use it. 17 | 18 | ### RPG Maker API Example 19 | 20 | The RPG Maker Ruby API mirrors the c++ API. 21 | 22 | If the c++ API functions have default parameters, the same function 23 | in the ruby API will also have default parameters. 24 | 25 | As an example, here's a simple example in the C++ api: 26 | 27 | SoLoud::Soloud soloud; 28 | SoLoud::Speech speech; 29 | 30 | speech.setText("Hello c++ api"); 31 | 32 | soloud.init(SoLoud::Soloud::CLIP_ROUNDOFF | 33 | SoLoud::Soloud::ENABLE_VISUALIZATION) 34 | 35 | soloud.setGlobalVolume(4); 36 | soloud.play(speech); 37 | 38 | // ... 39 | 40 | soloud.deinit(); 41 | 42 | Converted to the RPG Maker API, this becomes: 43 | 44 | soloud=SoLoud::Soloud.new 45 | speech=SoLoud::Speech.new 46 | 47 | speech.set_text("Hello Ruby api") 48 | 49 | soloud.init(SoLoud::Soloud::CLIP_ROUNDOFF | 50 | SoLoud::Soloud::ENABLE_VISUALIZATION) 51 | 52 | soloud.set_global_volume(4) 53 | soloud.play(speech) 54 | 55 | # ... 56 | 57 | soloud.deinit() 58 | speech.destroy() 59 | soloud.destroy() 60 | -------------------------------------------------------------------------------- /src/ember/sushi_renderer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "gui.hpp" 4 | #include "font.hpp" 5 | #include "shaders.hpp" 6 | #include "resource_cache.hpp" 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace ember { 13 | 14 | class sushi_renderer final : public gui::render_context { 15 | public: 16 | template 17 | using cache = resource_cache; 18 | 19 | sushi_renderer() = default; 20 | sushi_renderer( 21 | const glm::vec2& display_area, 22 | shaders::basic_shader_program& program, 23 | shaders::msdf_shader_program& msdf_shader, 24 | cache& font_cache, 25 | cache& mesh_cache, 26 | cache& texture_cache); 27 | 28 | virtual void begin() override; 29 | virtual void end() override; 30 | virtual void draw_rectangle(const std::string& texture, const glm::vec4& color, glm::vec2 position, glm::vec2 size) override; 31 | virtual void draw_model(const std::string& mesh, const std::string& texture, glm::vec2 position, glm::vec2 size, glm::mat4 model_mat) override; 32 | virtual void draw_text(const std::string& text, const std::string& font, const glm::vec4& color, glm::vec2 position, float size) override; 33 | virtual float get_text_width(const std::string& text, const std::string& font) override; 34 | 35 | private: 36 | glm::vec2 display_area; 37 | shaders::basic_shader_program* program; 38 | shaders::msdf_shader_program* msdf_shader; 39 | cache* font_cache; 40 | cache* mesh_cache; 41 | cache* texture_cache; 42 | sushi::mesh_group rectangle_mesh; 43 | }; 44 | 45 | } // namespace ember 46 | -------------------------------------------------------------------------------- /setup.ps1: -------------------------------------------------------------------------------- 1 | $MSYS2_URL = 'https://github.com/msys2/msys2-installer/releases/download/2020-06-29/msys2-base-x86_64-20200629.sfx.exe' 2 | $PKG = "$PSScriptRoot\.pkg" 3 | $TMP = "$PSScriptRoot\.tmp" 4 | $EMSDK = "$PSScriptRoot\.pkg\emsdk" 5 | $DOTVSCODE = "$PSScriptRoot\.vscode" 6 | $C_CPP_PROPERTIES = "$DOTVSCODE\c_cpp_properties.json" 7 | $CMAKE_KITS = "$DOTVSCODE\cmake-kits.json" 8 | 9 | if (!(Test-Path "$PKG")) { 10 | New-Item -Path "$PSScriptRoot" -Name ".tmp" -ItemType "directory" 11 | New-Item -Path "$PSScriptRoot" -Name ".pkg" -ItemType "directory" 12 | wget "$MSYS2_URL" -OutFile "$TMP\msys2.exe" 13 | & "$TMP\msys2.exe" -y "-o$PKG\" 14 | 15 | & "$PKG\msys64\usr\bin\bash" -lc ' ' 16 | & "$PKG\msys64\usr\bin\bash" -lc 'pacman -Syuu' 17 | & "$PKG\msys64\usr\bin\bash" -lc 'pacman -Syuu' 18 | & "$PKG\msys64\usr\bin\bash" -lc 'pacman -S --noconfirm git unzip mingw-w64-x86_64-python mingw-w64-x86_64-curl mingw-w64-x86_64-make mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc' 19 | } 20 | 21 | if (!(Test-Path "$EMSDK")) { 22 | $OLD_PATH = "$Env:PATH" 23 | $Env:PATH = "$PKG\msys64\mingw64\bin;$PKG\msys64\usr\bin;$Env:PATH" 24 | git clone https://github.com/emscripten-core/emsdk "$EMSDK" 25 | & "$EMSDK\emsdk.bat" install latest 26 | & "$EMSDK\emsdk.bat" activate latest 27 | $Env:PATH = "$OLD_PATH" 28 | } 29 | 30 | if (!(Test-Path "$DOTVSCODE")) { 31 | New-Item -Path "$PSScriptRoot" -Name ".vscode" -ItemType "directory" 32 | } 33 | 34 | if (!(Test-Path "$C_CPP_PROPERTIES")) { 35 | cp "$PSScriptRoot\setup_c_cpp_properties.json" $C_CPP_PROPERTIES 36 | } 37 | 38 | if (!(Test-Path "$CMAKE_KITS")) { 39 | cp "$PSScriptRoot\setup_cmake-kits.json" $CMAKE_KITS 40 | } 41 | 42 | echo Done -------------------------------------------------------------------------------- /ext/lua/src/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h,v 1.31 2015/09/08 15:41:05 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) 21 | 22 | 23 | typedef struct Mbuffer { 24 | char *buffer; 25 | size_t n; 26 | size_t buffsize; 27 | } Mbuffer; 28 | 29 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 30 | 31 | #define luaZ_buffer(buff) ((buff)->buffer) 32 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 33 | #define luaZ_bufflen(buff) ((buff)->n) 34 | 35 | #define luaZ_buffremove(buff,i) ((buff)->n -= (i)) 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ 41 | (buff)->buffsize, size), \ 42 | (buff)->buffsize = size) 43 | 44 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 45 | 46 | 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 48 | void *data); 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ 50 | 51 | 52 | 53 | /* --------- Private Part ------------------ */ 54 | 55 | struct Zio { 56 | size_t n; /* bytes still unread */ 57 | const char *p; /* current position in buffer */ 58 | lua_Reader reader; /* reader function */ 59 | void *data; /* additional data */ 60 | lua_State *L; /* Lua state (for reader) */ 61 | }; 62 | 63 | 64 | LUAI_FUNC int luaZ_fill (ZIO *z); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/ember/json_serializers.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "json.hpp" 4 | 5 | #include "reflection.hpp" 6 | 7 | #include 8 | 9 | namespace ember::json_serializers::basic { 10 | 11 | template 12 | auto from_json(const nlohmann::json& json, T& msg) -> std::enable_if_t::is_reflectable> { 13 | using type = std::decay_t; 14 | auto refl = reflect(); 15 | std::apply([&](auto&&... members) { ((msg.*members.ptr() = json[members.name()]), ...); }, refl.members); 16 | } 17 | 18 | template 19 | auto to_json(nlohmann::json& json, const T& msg) -> std::enable_if_t::is_reflectable> { 20 | using type = std::decay_t; 21 | auto refl = reflect(); 22 | std::apply([&](auto&&... members) { ((json[members.name()] = msg.*members.ptr()), ...); }, refl.members); 23 | } 24 | 25 | } // namespace ember::json_serializers::basic 26 | 27 | namespace ember::json_serializers::with_type { 28 | 29 | template 30 | auto from_json(const nlohmann::json& json, T& msg) -> std::enable_if_t::is_reflectable> { 31 | using type = std::decay_t; 32 | auto refl = reflect(); 33 | std::apply([&](auto&&... members) { ((msg.*members.ptr() = json[members.name()]), ...); }, refl.members); 34 | } 35 | 36 | template 37 | auto to_json(nlohmann::json& json, const T& msg) -> std::enable_if_t::is_reflectable> { 38 | using type = std::decay_t; 39 | auto refl = reflect(); 40 | json["type"] = refl.name; 41 | std::apply([&](auto&&... members) { ((json[members.name()] = msg.*members.ptr()), ...); }, refl.members); 42 | } 43 | 44 | } // namespace ember::json_serializers::with_type 45 | -------------------------------------------------------------------------------- /ext/soloud/src/audiosource/tedsid/ted.h: -------------------------------------------------------------------------------- 1 | 2 | class TED 3 | { 4 | public: 5 | unsigned int masterVolume; 6 | int Volume; 7 | int Snd1Status; 8 | int Snd2Status; 9 | int SndNoiseStatus; 10 | int DAStatus; 11 | unsigned short Freq1; 12 | unsigned short Freq2; 13 | int NoiseCounter; 14 | int FlipFlop[2]; 15 | int dcOutput[2]; 16 | int oscCount[2]; 17 | int OscReload[2]; 18 | int waveForm[2]; 19 | int oscStep; 20 | int sampleRate; 21 | unsigned char noise[256]; // 0-8 22 | unsigned int channelMask[3]; 23 | int vol; 24 | 25 | TED(); 26 | void enableChannel(unsigned int channel, bool enable); 27 | void setFreq(unsigned int channel, int freq); 28 | void oscillatorReset(); 29 | void oscillatorInit(); 30 | void writeSoundReg(unsigned int reg, unsigned char value); 31 | void storeToBuffer(short *buffer, unsigned int count); 32 | unsigned int waveSquare(unsigned int channel); 33 | unsigned int waveSawTooth(unsigned int channel); 34 | unsigned int waveTriangle(unsigned int channel); 35 | unsigned int getWaveSample(unsigned int channel, unsigned int wave); 36 | void renderSound(unsigned int nrsamples, short *buffer); 37 | void setMasterVolume(unsigned int shift); 38 | void selectWaveForm(unsigned int channel, unsigned int wave); 39 | void setplaybackSpeed(unsigned int speed); 40 | unsigned int getTimeSinceLastReset(); 41 | void setSampleRate(unsigned int value); 42 | void setFilterOrder(unsigned int value); 43 | void initFilter(unsigned int sampleRate_, unsigned int filterOrder_); 44 | }; -------------------------------------------------------------------------------- /ext/soloud/scripts/gen_autoit.py: -------------------------------------------------------------------------------- 1 | # AutoIt wrapper generator 2 | 3 | from soloud_codegen import * 4 | 5 | fo = open("soloud.au3", "w") 6 | 7 | """ 8 | Global $dll = DllOpen(@ScriptDir & "\soloud.dll") 9 | 10 | Const $CONSTANT = 1234567890 11 | 12 | 13 | 14 | Func _SoLoud_method($param1, $param2, $paramN) 15 | Local $ret = DllCall($dll, "return type e.g. int", "function", "type1 if necessary", "param1 if necessary", "typeN if necessary", "paramN if necessary") 16 | If @error Then Return SetError(1, 1, 0) 17 | Return $ret[0] 18 | EndFunc 19 | """ 20 | 21 | fo.write("; SoLoud wrapper for AutoIt\n") 22 | fo.write("; This file is autogenerated; any changes will be overwritten\n") 23 | fo.write('Global $dll = DllOpen(@ScriptDir & "\\soloud_x86.dll")\n') 24 | fo.write("\n") 25 | fo.write("; Enumerations\n") 26 | for x in soloud_enum: 27 | fo.write("Const $" + x + " = " + str(soloud_enum[x]) + "\n") 28 | fo.write("\n") 29 | fo.write("; Functions\n") 30 | for x in soloud_func: 31 | funcdef = "Func _" + x[1] + "(" 32 | first = True; 33 | for p in x[2]: 34 | if len(p) > 0: 35 | if not first: 36 | funcdef += ", " 37 | else: 38 | first = False 39 | funcdef += "$" + p[1] 40 | funcdef += ")" 41 | 42 | calldef = "\tLocal $ret = DllCall($dll, " 43 | calldef += '"' + x[0] + '", ' # return type 44 | calldef += '"' + x[1] + '"' 45 | 46 | for p in x[2]: 47 | if len(p) > 0: 48 | calldef += ', "' + p[0] + '", "' + p[1] + '"' 49 | calldef += ')' 50 | 51 | fo.write(funcdef + "\n") 52 | fo.write(calldef + "\n") 53 | fo.write('\tIf @error Then Return SetError(1, 1, 0)\n') 54 | fo.write('\tReturn $ret[0]\n') 55 | fo.write('EndFunc\n') 56 | fo.write("\n") 57 | 58 | fo.close() 59 | print "soloud.au3 generated" 60 | -------------------------------------------------------------------------------- /src/ember/reflection.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace ember::reflection { 6 | 7 | /** Type tag used to get ADL for reflected types */ 8 | template 9 | struct tag { 10 | using type = T; 11 | }; 12 | 13 | /** Type member reflection info */ 14 | template 15 | struct member { 16 | constexpr explicit member(const char* n) : _name(n) {} 17 | /** Name of the member */ 18 | constexpr auto name() const { return _name; } 19 | /** Pointer to the member */ 20 | constexpr auto ptr() const { return P; } 21 | private: 22 | const char* _name; 23 | }; 24 | 25 | /** Type reflection info */ 26 | template 27 | struct refl_info { 28 | /** Type */ 29 | using type = T; 30 | /** Name of the type */ 31 | const char* name; 32 | /** Members of the type */ 33 | std::tuple...> members; 34 | }; 35 | 36 | /** Crates a refl_info */ 37 | template 38 | constexpr auto make_refl_info(tag, const char* name, std::tuple...> members) { 39 | return refl_info{name, members}; 40 | } 41 | 42 | /** Get reflection info for a type */ 43 | template 44 | constexpr auto reflect() { 45 | return reflect(tag{}); 46 | } 47 | 48 | /** Reflection traits, determines if a type is reflectable or not. */ 49 | template 50 | struct refl_traits { 51 | static constexpr bool is_reflectable = false; 52 | }; 53 | 54 | template 55 | struct refl_traits>()))>> { 56 | static constexpr bool is_reflectable = true; 57 | }; 58 | 59 | } // namespace ember::reflection 60 | 61 | namespace ember { 62 | 63 | using reflection::reflect; 64 | 65 | } // namespace ember 66 | -------------------------------------------------------------------------------- /ext/soloud/demos/common/soloud_demo_framework.h: -------------------------------------------------------------------------------- 1 | /* SoLoud demo framework 2 | * version 1.0, April 2015 3 | * 4 | * Copyright (C) 2015 Jari Komppa 5 | * 6 | * This software is provided 'as-is', without any express or implied 7 | * warranty. In no event will the authors be held liable for any damages 8 | * arising from the use of this software. 9 | * 10 | * Permission is granted to anyone to use this software for any purpose, 11 | * including commercial applications, and to alter it and redistribute it 12 | * freely, subject to the following restrictions: 13 | * 14 | * 1. The origin of this software must not be misrepresented; you must not 15 | * claim that you wrote the original software. If you use this software 16 | * in a product, an acknowledgment in the product documentation would be 17 | * appreciated but is not required. 18 | * 2. Altered source versions must be plainly marked as such, and must not be 19 | * misrepresented as being the original software. 20 | * 3. This notice may not be removed or altered from any source distribution. 21 | * 22 | * Jari Komppa http://iki.fi/sol/ 23 | * 24 | ************************************* 25 | * Parts copied from ImGui examples 26 | */ 27 | 28 | #define ONCE(x) { static int oncetrigger = 1; if (oncetrigger) { x; oncetrigger = 0; }} 29 | 30 | extern int gPressed[256], gWasPressed[256]; 31 | extern int gMouseX, gMouseY; 32 | unsigned int DemoLoadTexture(char * aFilename); 33 | void DemoInit(); 34 | void DemoUpdateStart(); 35 | void DemoUpdateEnd(); 36 | int DemoTick(); 37 | void DemoYield(); 38 | void DemoTriangle(float x0, float y0, float x1, float y1, float x2, float y2, unsigned int color); 39 | void DemoQuad(float x0, float y0, float x1, float y1, unsigned int color); 40 | void DemoTexQuad(int tex, float x0, float y0, float x1, float y1); -------------------------------------------------------------------------------- /src/ember/camera.cpp: -------------------------------------------------------------------------------- 1 | #include "camera.hpp" 2 | 3 | #include 4 | 5 | namespace ember::camera { 6 | 7 | // Perspective 8 | 9 | auto get_proj(const perspective& cam) -> glm::mat4 { 10 | return glm::perspective(cam.fov_y, cam.aspect_ratio, cam.near, cam.far); 11 | } 12 | 13 | auto get_view(const perspective& cam) -> glm::mat4 { 14 | auto mat = glm::mat4(1.f); 15 | mat = glm::translate(mat, cam.pos); 16 | mat = glm::mat4_cast(cam.rot) * mat; 17 | return mat; 18 | } 19 | 20 | auto get_forward(const perspective& cam) -> glm::vec3 { 21 | return cam.rot * glm::vec3{0, 0, -1}; 22 | } 23 | 24 | void look_at(perspective& cam, const glm::vec3& target, const glm::vec3& up) { 25 | auto forward = glm::normalize(target - cam.pos); 26 | 27 | if (glm::length(forward) == 0) { 28 | return; 29 | } 30 | 31 | cam.rot = glm::quatLookAt(forward, up); 32 | } 33 | 34 | // Orthographic 35 | 36 | auto get_proj(const orthographic& cam) -> glm::mat4 { 37 | auto width = cam.height * cam.aspect_ratio; 38 | 39 | return glm::ortho(-width/2, width/2, -cam.height/2, cam.height/2, cam.near, cam.far); 40 | } 41 | 42 | auto get_view(const orthographic& cam) -> glm::mat4 { 43 | auto mat = glm::mat4(1.f); 44 | mat = glm::translate(mat, cam.pos); 45 | mat = glm::mat4_cast(cam.rot) * mat; 46 | return mat; 47 | } 48 | 49 | auto get_forward(const orthographic& cam) -> glm::vec3 { 50 | return cam.rot * glm::vec3{0, 0, -1}; 51 | } 52 | 53 | void look_at(orthographic& cam, const glm::vec3& target, const glm::vec3& up) { 54 | auto forward = glm::normalize(target - cam.pos); 55 | 56 | if (glm::length(forward) == 0) { 57 | return; 58 | } 59 | 60 | cam.rot = glm::quatLookAt(forward, up); 61 | } 62 | 63 | } // namespace ember::camera 64 | -------------------------------------------------------------------------------- /src/ember/shaders.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace ember::shaders { 6 | 7 | class basic_shader_program : public sushi::shader_base { 8 | public: 9 | basic_shader_program() = default; 10 | 11 | basic_shader_program(const std::string& vert, const std::string& frag); 12 | 13 | void set_MVP(const glm::mat4& mat); 14 | void set_normal_mat(const glm::mat4& mat); 15 | void set_uvmat(const glm::mat3& mat); 16 | void set_s_texture(GLint i); 17 | void set_cam_forward(const glm::vec3& vec); 18 | void set_tint(const glm::vec4& v); 19 | void set_hue(float f); 20 | void set_saturation(float f); 21 | void set_animated(bool b); 22 | void set_bones(const glm::mat4* ms, std::size_t n); 23 | 24 | private: 25 | struct { 26 | GLint MVP; 27 | GLint normal_mat; 28 | GLint uvmat; 29 | GLint s_texture; 30 | GLint cam_forward; 31 | GLint tint; 32 | GLint hue; 33 | GLint saturation; 34 | GLint animated; 35 | GLint bones; 36 | } uniforms; 37 | }; 38 | 39 | class msdf_shader_program : public sushi::shader_base { 40 | public: 41 | msdf_shader_program() = default; 42 | 43 | msdf_shader_program(const std::string& vertfile, const std::string& fragfile); 44 | 45 | void set_MVP(const glm::mat4& mat); 46 | void set_normal_mat(const glm::mat4& mat); 47 | void set_msdf(int slot); 48 | void set_pxRange(float f); 49 | void set_texSize(const glm::vec2& vec); 50 | void set_fgColor(const glm::vec4& vec); 51 | 52 | private: 53 | struct { 54 | GLint MVP; 55 | GLint normal_mat; 56 | GLint msdf; 57 | GLint pxRange; 58 | GLint texSize; 59 | GLint fgColor; 60 | } uniforms; 61 | }; 62 | 63 | } // namespace ember::shaders 64 | -------------------------------------------------------------------------------- /static/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | background: black; 4 | color: white; 5 | overflow: hidden; 6 | } 7 | 8 | .loading-screen { 9 | display: flex; 10 | flex-direction: column; 11 | align-items: center; 12 | } 13 | 14 | .loading-screen[hidden] { 15 | display: none; 16 | } 17 | 18 | /* the canvas *must not* have any border or padding, or mouse coords will be wrong */ 19 | #canvas { 20 | border: 0px none; 21 | background-color: black; 22 | display: block; 23 | margin: auto; 24 | /* Needs to have a non-zero size so SDL2 initialized correctly. */ 25 | width: 1px; 26 | height: 1px; 27 | } 28 | 29 | /* Spinner from https://loading.io/css/ */ 30 | .lds-heart { 31 | display: inline-block; 32 | position: relative; 33 | width: 64px; 34 | height: 64px; 35 | transform: rotate(45deg); 36 | transform-origin: 32px 32px; 37 | } 38 | .lds-heart div { 39 | top: 23px; 40 | left: 19px; 41 | position: absolute; 42 | width: 26px; 43 | height: 26px; 44 | background: #fcf; 45 | animation: lds-heart 1.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1); 46 | } 47 | .lds-heart div:after, 48 | .lds-heart div:before { 49 | content: " "; 50 | position: absolute; 51 | display: block; 52 | width: 26px; 53 | height: 26px; 54 | background: #fcf; 55 | } 56 | .lds-heart div:before { 57 | left: -17px; 58 | border-radius: 50% 0 0 50%; 59 | } 60 | .lds-heart div:after { 61 | top: -17px; 62 | border-radius: 50% 50% 0 0; 63 | } 64 | @keyframes lds-heart { 65 | 0% { 66 | transform: scale(0.95); 67 | } 68 | 5% { 69 | transform: scale(1.1); 70 | } 71 | 39% { 72 | transform: scale(0.85); 73 | } 74 | 45% { 75 | transform: scale(1); 76 | } 77 | 60% { 78 | transform: scale(0.95); 79 | } 80 | 100% { 81 | transform: scale(0.9); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /ext/soloud/include/soloud_dcremovalfilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | SoLoud audio engine 3 | Copyright (c) 2013-2015 Jari Komppa 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #ifndef SOLOUD_DCREMOVAL_H 26 | #define SOLOUD_DCREMOVAL_H 27 | 28 | #include "soloud.h" 29 | 30 | namespace SoLoud 31 | { 32 | class DCRemovalFilter; 33 | 34 | class DCRemovalFilterInstance : public FilterInstance 35 | { 36 | float *mBuffer; 37 | float *mTotals; 38 | int mBufferLength; 39 | DCRemovalFilter *mParent; 40 | int mOffset; 41 | 42 | public: 43 | virtual void filter(float *aBuffer, unsigned int aSamples, unsigned int aChannels, float aSamplerate, time aTime); 44 | virtual ~DCRemovalFilterInstance(); 45 | DCRemovalFilterInstance(DCRemovalFilter *aParent); 46 | }; 47 | 48 | class DCRemovalFilter : public Filter 49 | { 50 | public: 51 | float mLength; 52 | virtual FilterInstance *createInstance(); 53 | DCRemovalFilter(); 54 | result setParams(float aLength = 0.1f); 55 | }; 56 | } 57 | 58 | #endif -------------------------------------------------------------------------------- /ext/msdfgen/core/Contour.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Contour.h" 3 | 4 | #include "arithmetics.hpp" 5 | 6 | namespace msdfgen { 7 | 8 | static double shoelace(const Point2 &a, const Point2 &b) { 9 | return (b.x-a.x)*(a.y+b.y); 10 | } 11 | 12 | void Contour::addEdge(const EdgeHolder &edge) { 13 | edges.push_back(edge); 14 | } 15 | 16 | #ifdef MSDFGEN_USE_CPP11 17 | void Contour::addEdge(EdgeHolder &&edge) { 18 | edges.push_back((EdgeHolder &&) edge); 19 | } 20 | #endif 21 | 22 | EdgeHolder & Contour::addEdge() { 23 | edges.resize(edges.size()+1); 24 | return edges[edges.size()-1]; 25 | } 26 | 27 | void Contour::bounds(double &l, double &b, double &r, double &t) const { 28 | for (std::vector::const_iterator edge = edges.begin(); edge != edges.end(); ++edge) 29 | (*edge)->bounds(l, b, r, t); 30 | } 31 | 32 | int Contour::winding() const { 33 | if (edges.empty()) 34 | return 0; 35 | double total = 0; 36 | if (edges.size() == 1) { 37 | Point2 a = edges[0]->point(0), b = edges[0]->point(1/3.), c = edges[0]->point(2/3.); 38 | total += shoelace(a, b); 39 | total += shoelace(b, c); 40 | total += shoelace(c, a); 41 | } else if (edges.size() == 2) { 42 | Point2 a = edges[0]->point(0), b = edges[0]->point(.5), c = edges[1]->point(0), d = edges[1]->point(.5); 43 | total += shoelace(a, b); 44 | total += shoelace(b, c); 45 | total += shoelace(c, d); 46 | total += shoelace(d, a); 47 | } else { 48 | Point2 prev = edges[edges.size()-1]->point(0); 49 | for (std::vector::const_iterator edge = edges.begin(); edge != edges.end(); ++edge) { 50 | Point2 cur = (*edge)->point(0); 51 | total += shoelace(prev, cur); 52 | prev = cur; 53 | } 54 | } 55 | return sign(total); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /ext/soloud/include/soloud_echofilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | SoLoud audio engine 3 | Copyright (c) 2013-2014 Jari Komppa 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #ifndef SOLOUD_ECHOFILTER_H 26 | #define SOLOUD_ECHOFILTER_H 27 | 28 | #include "soloud.h" 29 | 30 | namespace SoLoud 31 | { 32 | class EchoFilter; 33 | 34 | class EchoFilterInstance : public FilterInstance 35 | { 36 | float *mBuffer; 37 | int mBufferLength; 38 | EchoFilter *mParent; 39 | int mOffset; 40 | 41 | public: 42 | virtual void filter(float *aBuffer, unsigned int aSamples, unsigned int aChannels, float aSamplerate, time aTime); 43 | virtual ~EchoFilterInstance(); 44 | EchoFilterInstance(EchoFilter *aParent); 45 | }; 46 | 47 | class EchoFilter : public Filter 48 | { 49 | public: 50 | float mDelay; 51 | float mDecay; 52 | float mFilter; 53 | virtual FilterInstance *createInstance(); 54 | EchoFilter(); 55 | result setParams(float aDelay, float aDecay = 0.7f, float aFilter = 0.0f); 56 | }; 57 | } 58 | 59 | #endif -------------------------------------------------------------------------------- /ext/soloud/doc/css/soloud.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif; 3 | color:#000000; 4 | } 5 | 6 | body { 7 | background-image: url(logo.png); 8 | background-repeat: no-repeat; 9 | background-color: #ffffff; 10 | } 11 | 12 | .logo { 13 | position:absolute; 14 | left:0px; 15 | top:0px; 16 | width:190px; 17 | height:130px; 18 | } 19 | 20 | .divider { 21 | position:absolute; 22 | top:130px; 23 | left:0px; 24 | width:100%; 25 | overflow:hidden; 26 | background:#c57917; 27 | height:1px; 28 | } 29 | 30 | .content { 31 | position:absolute; 32 | top:140px; 33 | left:200px; 34 | width:600px; 35 | } 36 | 37 | .menu { 38 | position:absolute; 39 | top:140px; 40 | left:8px; 41 | width:170px; 42 | } 43 | 44 | h1, h2 45 | { 46 | font-size: 32px; 47 | line-height: 46px; 48 | font-weight: normal; 49 | padding: 0; 50 | margin: 0; 51 | margin-top: 10px; 52 | word-wrap: break-word; 53 | } 54 | 55 | a 56 | { 57 | text-decoration:none; 58 | color:#c57917; 59 | } 60 | 61 | a:hover 62 | { 63 | text-decoration:underline; 64 | } 65 | 66 | .code 67 | { 68 | font-family: Consolas, "Lucida Console", "Bitstream Vera Sans Mono", Monaco, monospace; 69 | font-size: 12px; 70 | color: black; 71 | background-color: #e4f5fd; 72 | padding: 8px 8px 8px 8px; 73 | border-style: none; 74 | clear: both; 75 | } 76 | 77 | .img_mid 78 | { 79 | display: block; 80 | margin-left: auto; 81 | margin-right: auto; 82 | } 83 | 84 | 85 | 86 | table { border-collapse: collapse; border-top: 1px solid #c57917; border-bottom: 1px solid #c57917; } 87 | table th { border-bottom: 1px solid #c57917; } 88 | table th, table td { padding: 1px 6px; } 89 | 90 | .content h1:first-child, .content h2:first-child { 91 | font-size: 60px; 92 | position: absolute; 93 | left:-10px; 94 | top:-114px; 95 | width:610px; 96 | text-align:right; 97 | } 98 | -------------------------------------------------------------------------------- /ext/msdfgen/core/Bitmap.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Bitmap.h" 3 | 4 | #include 5 | 6 | namespace msdfgen { 7 | 8 | template 9 | Bitmap::Bitmap() : content(NULL), w(0), h(0) { } 10 | 11 | template 12 | Bitmap::Bitmap(int width, int height) : w(width), h(height) { 13 | content = new T[w*h]; 14 | } 15 | 16 | template 17 | Bitmap::Bitmap(const Bitmap &orig) : w(orig.w), h(orig.h) { 18 | content = new T[w*h]; 19 | memcpy(content, orig.content, w*h*sizeof(T)); 20 | } 21 | 22 | #ifdef MSDFGEN_USE_CPP11 23 | template 24 | Bitmap::Bitmap(Bitmap &&orig) : content(orig.content), w(orig.w), h(orig.h) { 25 | orig.content = NULL; 26 | } 27 | #endif 28 | 29 | template 30 | Bitmap::~Bitmap() { 31 | delete [] content; 32 | } 33 | 34 | template 35 | Bitmap & Bitmap::operator=(const Bitmap &orig) { 36 | delete [] content; 37 | w = orig.w, h = orig.h; 38 | content = new T[w*h]; 39 | memcpy(content, orig.content, w*h*sizeof(T)); 40 | return *this; 41 | } 42 | 43 | #ifdef MSDFGEN_USE_CPP11 44 | template 45 | Bitmap & Bitmap::operator=(Bitmap &&orig) { 46 | delete [] content; 47 | content = orig.content; 48 | w = orig.w, h = orig.h; 49 | orig.content = NULL; 50 | return *this; 51 | } 52 | #endif 53 | 54 | template 55 | int Bitmap::width() const { 56 | return w; 57 | } 58 | 59 | template 60 | int Bitmap::height() const { 61 | return h; 62 | } 63 | 64 | template 65 | T & Bitmap::operator()(int x, int y) { 66 | return content[y*w+x]; 67 | } 68 | 69 | template 70 | const T & Bitmap::operator()(int x, int y) const { 71 | return content[y*w+x]; 72 | } 73 | 74 | template class Bitmap; 75 | template class Bitmap; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /ext/soloud/demos/piano/soloud_basicwave.h: -------------------------------------------------------------------------------- 1 | /* 2 | SoLoud audio engine 3 | Copyright (c) 2013 Jari Komppa 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #ifndef BASICWAVE_H 26 | #define BASICWAVE_H 27 | 28 | #include "soloud.h" 29 | 30 | namespace SoLoud 31 | { 32 | class Basicwave; 33 | 34 | class BasicwaveInstance : public AudioSourceInstance 35 | { 36 | Basicwave *mParent; 37 | int mOffset; 38 | public: 39 | BasicwaveInstance(Basicwave *aParent); 40 | virtual void getAudio(float *aBuffer, unsigned int aSamples); 41 | virtual bool hasEnded(); 42 | }; 43 | 44 | class Basicwave : public AudioSource 45 | { 46 | public: 47 | enum WAVEFORMS 48 | { 49 | SINE, 50 | TRIANGLE, 51 | SQUARE, 52 | SAW, 53 | INVERSESAW 54 | }; 55 | float mFreq; 56 | int mWaveform; 57 | Basicwave(); 58 | virtual ~Basicwave(); 59 | void setSamplerate(float aSamplerate); 60 | void setWaveform(int aWaveform); 61 | virtual AudioSourceInstance *createInstance(); 62 | }; 63 | }; 64 | 65 | #endif -------------------------------------------------------------------------------- /ext/soloud/demos/android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | LOCAL_PATH := $(call my-dir) 16 | 17 | include $(CLEAR_VARS) 18 | 19 | SOLOUD_FILES := $(wildcard $(LOCAL_PATH)/../../../src/audiosource/monotone/*.cpp) 20 | SOLOUD_FILES += $(wildcard $(LOCAL_PATH)/../../../src/audiosource/speech/*.cpp) 21 | SOLOUD_FILES += $(wildcard $(LOCAL_PATH)/../../../src/audiosource/sfxr/*.cpp) 22 | SOLOUD_FILES += $(wildcard $(LOCAL_PATH)/../../../src/audiosource/wav/*.cpp) 23 | SOLOUD_FILES += $(wildcard $(LOCAL_PATH)/../../../src/audiosource/wav/*.c) 24 | SOLOUD_FILES += $(wildcard $(LOCAL_PATH)/../../../src/backend/opensles/*.cpp) 25 | SOLOUD_FILES += $(wildcard $(LOCAL_PATH)/../../../src/core/*.cpp) 26 | SOLOUD_FILES += $(wildcard $(LOCAL_PATH)/../../../src/filter/*.cpp) 27 | SOLOUD_FILES := $(SOLOUD_FILES:$(LOCAL_PATH)/%=%) 28 | 29 | LOCAL_MODULE := soloud-android 30 | LOCAL_SRC_FILES := main.cpp 31 | LOCAL_SRC_FILES += $(SOLOUD_FILES) 32 | 33 | LOCAL_CPPFLAGS += -DWITH_OPENSLES=1 34 | 35 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../include 36 | 37 | LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lOpenSLES 38 | LOCAL_STATIC_LIBRARIES := android_native_app_glue 39 | 40 | include $(BUILD_SHARED_LIBRARY) 41 | 42 | $(call import-module,android/native_app_glue) 43 | -------------------------------------------------------------------------------- /ext/lua/src/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | /* test whether thread is in 'twups' list */ 22 | #define isintwups(L) (L->twups != L) 23 | 24 | 25 | /* 26 | ** maximum number of upvalues in a closure (both C and Lua). (Value 27 | ** must fit in a VM register.) 28 | */ 29 | #define MAXUPVAL 255 30 | 31 | 32 | /* 33 | ** Upvalues for Lua closures 34 | */ 35 | struct UpVal { 36 | TValue *v; /* points to stack or to its own value */ 37 | lu_mem refcount; /* reference counter */ 38 | union { 39 | struct { /* (when open) */ 40 | UpVal *next; /* linked list */ 41 | int touched; /* mark to avoid cycles with dead threads */ 42 | } open; 43 | TValue value; /* the value (when closed) */ 44 | } u; 45 | }; 46 | 47 | #define upisopen(up) ((up)->v != &(up)->u.value) 48 | 49 | 50 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 51 | LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); 52 | LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); 53 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); 54 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 55 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 56 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 57 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 58 | int pc); 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /ext/soloud/demos/simplest/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | SoLoud audio engine 3 | Copyright (c) 2013-2014 Jari Komppa 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #include 26 | 27 | #include "soloud.h" 28 | #include "soloud_speech.h" 29 | #include "soloud_thread.h" 30 | 31 | // Entry point 32 | int main(int argc, char *argv[]) 33 | { 34 | // Define a couple of variables 35 | SoLoud::Soloud soloud; // SoLoud engine core 36 | SoLoud::Speech speech; // A sound source (speech, in this case) 37 | 38 | // Configure sound source 39 | speech.setText("1 2 3 1 2 3 Hello world. Welcome to So-Loud."); 40 | 41 | // initialize SoLoud. 42 | soloud.init(); 43 | 44 | // Play the sound source (we could do this several times if we wanted) 45 | soloud.play(speech); 46 | 47 | // Wait until sounds have finished 48 | while (soloud.getActiveVoiceCount() > 0) 49 | { 50 | // Still going, sleep for a bit 51 | SoLoud::Thread::sleep(100); 52 | } 53 | 54 | // Clean up SoLoud 55 | soloud.deinit(); 56 | 57 | // All done. 58 | return 0; 59 | } -------------------------------------------------------------------------------- /ext/msdfgen/core/equation-solver.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "equation-solver.h" 3 | 4 | #define _USE_MATH_DEFINES 5 | #include 6 | 7 | namespace msdfgen { 8 | 9 | int solveQuadratic(double x[2], double a, double b, double c) { 10 | if (fabs(a) < 1e-14) { 11 | if (fabs(b) < 1e-14) { 12 | if (c == 0) 13 | return -1; 14 | return 0; 15 | } 16 | x[0] = -c/b; 17 | return 1; 18 | } 19 | double dscr = b*b-4*a*c; 20 | if (dscr > 0) { 21 | dscr = sqrt(dscr); 22 | x[0] = (-b+dscr)/(2*a); 23 | x[1] = (-b-dscr)/(2*a); 24 | return 2; 25 | } else if (dscr == 0) { 26 | x[0] = -b/(2*a); 27 | return 1; 28 | } else 29 | return 0; 30 | } 31 | 32 | int solveCubicNormed(double *x, double a, double b, double c) { 33 | double a2 = a*a; 34 | double q = (a2 - 3*b)/9; 35 | double r = (a*(2*a2-9*b) + 27*c)/54; 36 | double r2 = r*r; 37 | double q3 = q*q*q; 38 | double A, B; 39 | if (r2 < q3) { 40 | double t = r/sqrt(q3); 41 | if (t < -1) t = -1; 42 | if (t > 1) t = 1; 43 | t = acos(t); 44 | a /= 3; q = -2*sqrt(q); 45 | x[0] = q*cos(t/3)-a; 46 | x[1] = q*cos((t+2*M_PI)/3)-a; 47 | x[2] = q*cos((t-2*M_PI)/3)-a; 48 | return 3; 49 | } else { 50 | A = -pow(fabs(r)+sqrt(r2-q3), 1/3.); 51 | if (r < 0) A = -A; 52 | B = A == 0 ? 0 : q/A; 53 | a /= 3; 54 | x[0] = (A+B)-a; 55 | x[1] = -0.5*(A+B)-a; 56 | x[2] = 0.5*sqrt(3.)*(A-B); 57 | if (fabs(x[2]) < 1e-14) 58 | return 2; 59 | return 1; 60 | } 61 | } 62 | 63 | int solveCubic(double x[3], double a, double b, double c, double d) { 64 | if (fabs(a) < 1e-14) 65 | return solveQuadratic(x, b, c, d); 66 | return solveCubicNormed(x, b/a, c/a, d/a); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /ext/soloud/CONTRIBUTING: -------------------------------------------------------------------------------- 1 | Here's some guidelines on contributing to the SoLoud project. 2 | 3 | - SoLoud is extremely liberally licensed. All submitted code 4 | must follow suit to keep it that way. 5 | (public domain, CC0, wtfpl, zlib/libpng, unlicense, or similar 6 | no-attribution and definitely no viral licenses). 7 | 8 | - When submitting the first time, add your name in AUTHORS. 9 | 10 | - Many small commits are better than few huge ones. 11 | 12 | - Try to follow the coding convention of the surrounding code. 13 | If stand alone (such as platform or output device specific), 14 | this isn't as important. 15 | 16 | - All optimized code (such as SSE or assembler) must be 17 | accompanied by plain 'c' version, because: 18 | a) optimizations come and go, porting 30 years from now 19 | can be really painful. 20 | b) plain 'c' version works as documentation of the 21 | optimized code. 22 | 23 | - When doing platform specific code or otherwise optionally 24 | compiled code, it's often better to have some duplicate 25 | code inside large ifdef block than to have tons of hard 26 | to follow small ifdef blocks. 27 | 28 | - Unless there's a really, really good reason, no templates, 29 | including funkycast. foo = (int)bar works fine. 30 | 31 | - Unless performance critical, always try to write for readability. 32 | 33 | Coding convention in brief: 34 | 35 | - On naming: 36 | aFunctionParameter 37 | mMemberVariable 38 | gGlobalVariable 39 | localVariable 40 | CONSTANT_VALUE 41 | ClassName 42 | functionName 43 | 44 | int ExampleClass::example(int aFoo) 45 | { 46 | if (aFoo) 47 | { 48 | int i; 49 | for (i = 0; i < mBarCycles; i++) 50 | { 51 | bar(); 52 | } 53 | switch (gBah) 54 | { 55 | case BOO: 56 | return HISS; 57 | } 58 | } 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /ext/soloud/doc/bmx_api.mmd: -------------------------------------------------------------------------------- 1 | ## BlitzMax API 2 | 3 | 4 | Using the BlitzMax wrapper, SoLoud DLL can be used from BlitzMax. 5 | 6 | All of the existing interfaces can be used via the BlitzMax API, but 7 | features that require extending SoLoud are not available. 8 | 9 | ### Using the BlitzMax API 10 | 11 | The glue file soloud.bmx can be found under the "glue" directory. 12 | 13 | To use SoLoud with BlitzMax, you can use the soloud.bmx from the glue 14 | directory. Be sure to have soloud_x86.dll in your project directory. 15 | 16 | 17 | ### BlitzMax API Example 18 | 19 | The BlitzMax API mirrors the c++ API. 20 | 21 | If the c++ API functions have default parameters, two functions 22 | are generated: one without the default parameters, and one with. 23 | The one where you can change the default parameters is post-fixed Ex, 24 | such as Soloud_init and Soloud_initEx. 25 | 26 | As an example, here's a simple example in the C++ api: 27 | 28 | SoLoud::Soloud soloud; 29 | SoLoud::Speech speech; 30 | 31 | speech.setText("Hello c++ api"); 32 | 33 | soloud.init(SoLoud::Soloud::CLIP_ROUNDOFF | 34 | SoLoud::Soloud::ENABLE_VISUALIZATION) 35 | 36 | soloud.setGlobalVolume(4); 37 | soloud.play(speech); 38 | 39 | // ... 40 | 41 | soloud.deinit(); 42 | 43 | Converted to the BlitzMax API, this becomes: 44 | 45 | SuperStrict 46 | 47 | Import "soloud.bmx" 48 | 49 | Local soloud:Byte Ptr = Soloud_create () 50 | Local speech:Byte Ptr = Speech_create () 51 | 52 | Speech_setText speech, "hello from blits max".ToCString () 53 | 54 | Soloud_initEx soloud, SOLOUD_CLIP_ROUNDOFF | SOLOUD_ENABLE_VISUALIZATION, 55 | SOLOUD_AUTO, SOLOUD_AUTO, SOLOUD_AUTO 56 | 57 | Soloud_setGlobalVolume soloud, 4 58 | Soloud_play soloud, speech 59 | 60 | ' ... 61 | 62 | Soloud_deinit soloud 63 | 64 | Speech_destroy speech 65 | Soloud_destroy soloud 66 | -------------------------------------------------------------------------------- /ext/soloud/include/soloud_openmpt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Openmpt module for SoLoud audio engine 3 | Copyright (c) 2016 Jari Komppa 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #ifndef OPENMPT_H 26 | #define OPENMPT_H 27 | 28 | #include "soloud.h" 29 | 30 | namespace SoLoud 31 | { 32 | class Openmpt; 33 | class File; 34 | 35 | class OpenmptInstance : public AudioSourceInstance 36 | { 37 | Openmpt *mParent; 38 | void *mModfile; 39 | int mPlaying; 40 | 41 | public: 42 | OpenmptInstance(Openmpt *aParent); 43 | virtual ~OpenmptInstance(); 44 | virtual void getAudio(float *aBuffer, unsigned int aSamples); 45 | virtual bool hasEnded(); 46 | }; 47 | 48 | class Openmpt : public AudioSource 49 | { 50 | public: 51 | char *mData; 52 | unsigned int mDataLen; 53 | Openmpt(); 54 | virtual ~Openmpt(); 55 | result load(const char* aFilename); 56 | result loadMem(unsigned char *aMem, unsigned int aLength, bool aCopy = false, bool aTakeOwnership = true); 57 | result loadFile(File *aFile); 58 | virtual AudioSourceInstance *createInstance(); 59 | }; 60 | }; 61 | 62 | #endif --------------------------------------------------------------------------------