├── .gitattributes ├── .gitignore ├── README.md ├── build ├── deploy_for_exe.bat ├── deploy_for_web.bat ├── kuincl.exe ├── libs │ ├── Debug │ │ ├── d0000.knd │ │ ├── d0001.knd │ │ ├── d0004.knd │ │ ├── d0005.knd │ │ ├── d1000.knd │ │ ├── d1001.knd │ │ ├── d1002.knd │ │ ├── d1003.knd │ │ ├── d1004.knd │ │ ├── d1005.knd │ │ └── d1006.knd │ ├── Release_dbg │ │ ├── d0000.knd │ │ ├── d0001.knd │ │ ├── d0004.knd │ │ ├── d0005.knd │ │ ├── d1000.knd │ │ ├── d1001.knd │ │ ├── d1002.knd │ │ ├── d1003.knd │ │ ├── d1004.knd │ │ ├── d1005.knd │ │ └── d1006.knd │ └── Release_rls │ │ ├── d0000.knd │ │ ├── d0001.knd │ │ ├── d0004.knd │ │ ├── d0005.knd │ │ ├── d1000.knd │ │ ├── d1001.knd │ │ ├── d1002.knd │ │ ├── d1003.knd │ │ ├── d1004.knd │ │ ├── d1005.knd │ │ └── d1006.knd ├── minify.bat ├── output │ ├── common.h │ ├── debugger.cpp │ ├── exe_correct │ │ └── empty │ ├── exe_output │ │ └── empty │ ├── interpret1.cpp │ ├── kuin_cpp.sln │ ├── kuin_cpp_en.vcxproj │ ├── kuin_cpp_en.vcxproj.filters │ ├── kuin_cpp_ja.vcxproj │ ├── kuin_cpp_ja.vcxproj.filters │ ├── kuin_dll_en.vcxproj │ ├── kuin_dll_en.vcxproj.filters │ ├── kuin_dll_ja.vcxproj │ ├── kuin_dll_ja.vcxproj.filters │ ├── kuin_dll_main.cpp │ ├── kuin_interpreter.h │ ├── low_level.asm │ ├── test_kuin_cpp.sln │ ├── test_kuin_cpp.vcxproj │ ├── test_kuin_cpp.vcxproj.filters │ ├── test_kuin_cpp_correct.txt │ ├── test_kuin_exe_correct.txt │ └── test_kuin_js2.html ├── package_en │ ├── readme.txt │ ├── samples │ │ ├── 0000_kuinvaders │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ ├── back.jpg │ │ │ │ ├── game.png │ │ │ │ └── title.jpg │ │ ├── 0001_kuinote │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0002_draw_2d │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ └── kuin.png │ │ ├── 0003_draw_3d │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ ├── board.knobj │ │ │ │ ├── board.png │ │ │ │ ├── box.knobj │ │ │ │ ├── box.png │ │ │ │ ├── cone.knobj │ │ │ │ ├── sphere.knobj │ │ │ │ └── sphere.png │ │ ├── 0004_sound │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ ├── bgm.ogg │ │ │ │ └── se.wav │ │ ├── 0005_input │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0007_random │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0008_time │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0009_file │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0010_network │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0012_kuina_chan_model │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ ├── albedo.png │ │ │ │ ├── kuina_chan.knobj │ │ │ │ └── normal.png │ │ ├── 0013_collision_and_particles │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ └── tex_particle.png │ │ ├── 0014_edit_pixels │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0015_kuinvaders_on_web │ │ │ ├── files │ │ │ │ ├── back.jpg │ │ │ │ ├── game.png │ │ │ │ └── title.jpg │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ └── free_resources │ │ │ ├── bgm_sample.ogg │ │ │ ├── dot_back_side.png │ │ │ ├── dot_kuina_chan.png │ │ │ ├── dot_map_chips_side.png │ │ │ ├── map_sample_racing.txt │ │ │ ├── map_sample_side.txt │ │ │ ├── obj_car.fbx │ │ │ ├── tex_car_albedo.png │ │ │ ├── tex_field_albedo.jpg │ │ │ ├── tex_sky_albedo.png │ │ │ ├── tex_wall_albedo.jpg │ │ │ ├── uv_box.png │ │ │ ├── uv_plane.png │ │ │ └── uv_sphere.png │ ├── sys │ │ └── snippet.knd │ └── tools │ │ └── knobj_maker.exe ├── package_ja │ ├── readme.txt │ ├── samples │ │ ├── 0000_kuinvaders │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ ├── back.jpg │ │ │ │ ├── game.png │ │ │ │ └── title.jpg │ │ ├── 0001_kuinote │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0002_draw_2d │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ └── kuin.png │ │ ├── 0003_draw_3d │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ ├── board.knobj │ │ │ │ ├── board.png │ │ │ │ ├── box.knobj │ │ │ │ ├── box.png │ │ │ │ ├── cone.knobj │ │ │ │ ├── sphere.knobj │ │ │ │ └── sphere.png │ │ ├── 0004_sound │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ ├── bgm.ogg │ │ │ │ └── se.wav │ │ ├── 0005_input │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0007_random │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0008_time │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0009_file │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0010_network │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0012_kuina_chan_model │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ ├── albedo.png │ │ │ │ ├── kuina_chan.knobj │ │ │ │ └── normal.png │ │ ├── 0013_collision_and_particles │ │ │ ├── main.kn │ │ │ ├── main.knprop │ │ │ └── res │ │ │ │ └── tex_particle.png │ │ ├── 0014_edit_pixels │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ ├── 0015_kuinvaders_on_web │ │ │ ├── files │ │ │ │ ├── back.jpg │ │ │ │ ├── game.png │ │ │ │ └── title.jpg │ │ │ ├── main.kn │ │ │ └── main.knprop │ │ └── free_resources │ │ │ ├── bgm_sample.ogg │ │ │ ├── dot_back_side.png │ │ │ ├── dot_kuina_chan.png │ │ │ ├── dot_map_chips_side.png │ │ │ ├── map_sample_racing.txt │ │ │ ├── map_sample_side.txt │ │ │ ├── obj_car.fbx │ │ │ ├── tex_car_albedo.png │ │ │ ├── tex_field_albedo.jpg │ │ │ ├── tex_sky_albedo.png │ │ │ ├── tex_wall_albedo.jpg │ │ │ ├── uv_box.png │ │ │ ├── uv_plane.png │ │ │ └── uv_sphere.png │ ├── sys │ │ └── snippet.knd │ └── tools │ │ └── knobj_maker.exe ├── package_src_en │ └── readme.txt ├── package_src_ja │ └── readme.txt ├── sys │ ├── common.h │ ├── cpp │ │ ├── _preset00.kn │ │ ├── cui.kn │ │ ├── dbg.kn │ │ ├── draw.kn │ │ ├── excpt.kn │ │ ├── file.kn │ │ ├── hash.kn │ │ ├── hash.sha256.kn │ │ ├── hash.xxh64.kn │ │ ├── kuin.kn │ │ ├── lib.kn │ │ ├── math.kn │ │ └── wnd.kn │ ├── data │ │ ├── dbg │ │ │ ├── d0000.knd │ │ │ └── d0001.knd │ │ └── rls │ │ │ ├── d0000.knd │ │ │ └── d0001.knd │ ├── default.ico │ ├── exe │ │ ├── _preset00.kn │ │ ├── cui.kn │ │ ├── dbg.kn │ │ ├── draw.kn │ │ ├── excpt.kn │ │ ├── file.kn │ │ ├── hash.kn │ │ ├── hash.sha256.kn │ │ ├── hash.xxh64.kn │ │ ├── kuin.kn │ │ ├── lib.kn │ │ ├── math.kn │ │ └── wnd.kn │ └── web │ │ ├── _preset00.kn │ │ ├── cui.kn │ │ ├── dbg.kn │ │ ├── draw.kn │ │ ├── excpt.kn │ │ ├── file.kn │ │ ├── hash.kn │ │ ├── hash.sha256.kn │ │ ├── hash.xxh64.kn │ │ ├── kuin.kn │ │ ├── lib.kn │ │ ├── math.kn │ │ └── wnd.kn ├── test.bat ├── test_data │ └── test.kn └── test_web.bat └── src ├── compiler ├── analyze.kn ├── ast.kn ├── builtin_func.kn ├── convert.kn ├── cpp │ └── output.kn ├── err.kn ├── exe │ ├── asm.assemble.kn │ ├── asm.excpt_func.kn │ ├── asm.kn │ ├── machine.kn │ ├── manifest.kn │ └── output.kn ├── interpret.debugger.kn ├── interpret.i1.kn ├── interpret.i2.kn ├── interpret.kn ├── main.kn ├── main.knprop ├── msg.kn ├── option.kn ├── parse.kn ├── pos.kn └── web │ ├── builtin.kn │ └── output.kn ├── kuin_editor ├── add_file.kn ├── color_sel.kn ├── common.kn ├── completion.kn ├── dbgwnd.kn ├── dll.kn ├── doc.kn ├── doc_ar.kn ├── doc_ar_2d.kn ├── doc_ar_wnd.kn ├── doc_gen.kn ├── doc_src.kn ├── find.kn ├── form.kn ├── go_to_line.kn ├── knobj_maker.kn ├── kuin_editor.kn ├── kuin_editor.knprop ├── obj_prop.kn ├── proj_settings.kn ├── prop.kn ├── recent.kn ├── res │ ├── draw2d.png │ ├── kn.png │ ├── obj_btn.png │ ├── obj_chk.png │ ├── obj_circle.png │ ├── obj_edit.png │ ├── obj_edit_multi.png │ ├── obj_group.png │ ├── obj_img.png │ ├── obj_label.png │ ├── obj_none.png │ ├── obj_particle.png │ ├── obj_rect.png │ ├── obj_roundrect.png │ ├── obj_text.png │ ├── tex.png │ └── wnd.png ├── snippet.kn ├── src.kn └── web_server.kn ├── lib ├── converter.exe ├── converter │ ├── main.kn │ └── main.knprop ├── data │ ├── d0000.knd │ └── d0002.knd ├── dll │ ├── additional_libs │ │ ├── additional_libs.sln │ │ ├── lib_game │ │ │ ├── lib_game.vcxproj │ │ │ ├── lib_game.vcxproj.filters │ │ │ └── main.h │ │ ├── lib_math_boost │ │ │ ├── build_boost.txt │ │ │ ├── lib_math_boost.vcxproj │ │ │ ├── lib_math_boost.vcxproj.filters │ │ │ ├── main.cpp │ │ │ ├── main.h │ │ │ ├── math_boost.cpp │ │ │ └── math_boost.h │ │ ├── lib_ogg │ │ │ ├── lib_ogg.vcxproj │ │ │ ├── lib_ogg.vcxproj.filters │ │ │ ├── main.c │ │ │ └── main.h │ │ ├── lib_regex │ │ │ ├── build_boost.txt │ │ │ ├── lib_regex.vcxproj │ │ │ ├── lib_regex.vcxproj.filters │ │ │ ├── main.cpp │ │ │ ├── main.h │ │ │ ├── regex.cpp │ │ │ └── regex.h │ │ ├── lib_sql │ │ │ ├── lib_sql.vcxproj │ │ │ ├── lib_sql.vcxproj.filters │ │ │ ├── main.c │ │ │ └── main.h │ │ ├── lib_xml │ │ │ ├── lib_xml.vcxproj │ │ │ ├── lib_xml.vcxproj.filters │ │ │ ├── main.cpp │ │ │ └── main.h │ │ └── lib_zip │ │ │ ├── lib_zip.vcxproj │ │ │ ├── lib_zip.vcxproj.filters │ │ │ ├── main.c │ │ │ └── main.h │ ├── common.c │ ├── common.h │ ├── kuin_lib.sln │ ├── lib_common │ │ ├── cui.c │ │ ├── cui.h │ │ ├── file.c │ │ ├── file.h │ │ ├── kuin.c │ │ ├── kuin.h │ │ ├── lib.c │ │ ├── lib.h │ │ ├── lib_common.vcxproj │ │ ├── lib_common.vcxproj.filters │ │ ├── main.c │ │ ├── main.h │ │ ├── task.c │ │ └── task.h │ ├── lib_draw2d │ │ ├── draw2d.cpp │ │ ├── draw2d.h │ │ ├── lib_draw2d.vcxproj │ │ ├── lib_draw2d.vcxproj.filters │ │ ├── main.cpp │ │ └── main.h │ ├── lib_net │ │ ├── http.c │ │ ├── http.h │ │ ├── lib_net.vcxproj │ │ ├── lib_net.vcxproj.filters │ │ ├── main.c │ │ ├── main.h │ │ ├── tcp.c │ │ └── tcp.h │ ├── lib_win │ │ ├── bc_decoder.cpp │ │ ├── bc_decoder.h │ │ ├── bins │ │ │ ├── box_knobj.c │ │ │ ├── circle_line_ps_bin.cpp │ │ │ ├── circle_ps_bin.cpp │ │ │ ├── circle_vs_bin.cpp │ │ │ ├── filter_monotone_ps_bin.cpp │ │ │ ├── filter_none_ps_bin.cpp │ │ │ ├── filter_vs_bin.cpp │ │ │ ├── font_ps_bin.cpp │ │ │ ├── obj_fast_joint_sm_vs_bin.cpp │ │ │ ├── obj_fast_joint_vs_bin.cpp │ │ │ ├── obj_fast_ps_bin.cpp │ │ │ ├── obj_fast_sm_ps_bin.cpp │ │ │ ├── obj_fast_sm_vs_bin.cpp │ │ │ ├── obj_fast_vs_bin.cpp │ │ │ ├── obj_flat_fast_joint_vs_bin.cpp │ │ │ ├── obj_flat_fast_vs_bin.cpp │ │ │ ├── obj_flat_joint_vs_bin.cpp │ │ │ ├── obj_flat_ps_bin.cpp │ │ │ ├── obj_flat_vs_bin.cpp │ │ │ ├── obj_joint_sm_vs_bin.cpp │ │ │ ├── obj_joint_vs_bin.cpp │ │ │ ├── obj_outline_joint_vs_bin.cpp │ │ │ ├── obj_outline_ps_bin.cpp │ │ │ ├── obj_outline_vs_bin.cpp │ │ │ ├── obj_ps_bin.cpp │ │ │ ├── obj_shadow_joint_vs_bin.cpp │ │ │ ├── obj_shadow_vs_bin.cpp │ │ │ ├── obj_sm_ps_bin.cpp │ │ │ ├── obj_sm_vs_bin.cpp │ │ │ ├── obj_toon_fast_ps_bin.cpp │ │ │ ├── obj_toon_fast_sm_ps_bin.cpp │ │ │ ├── obj_toon_ps_bin.cpp │ │ │ ├── obj_toon_sm_ps_bin.cpp │ │ │ ├── obj_vs_bin.cpp │ │ │ ├── particle_2d_ps_bin.cpp │ │ │ ├── particle_2d_vs_bin.cpp │ │ │ ├── particle_updating_ps_bin.cpp │ │ │ ├── particle_updating_vs_bin.cpp │ │ │ ├── plane_knobj.c │ │ │ ├── rect_vs_bin.cpp │ │ │ ├── sphere_knobj.c │ │ │ ├── tex_ps_bin.cpp │ │ │ ├── tex_rot_vs_bin.cpp │ │ │ ├── tex_vs_bin.cpp │ │ │ ├── toon_ramp_png.c │ │ │ ├── tri_ps_bin.cpp │ │ │ └── tri_vs_bin.cpp │ │ ├── draw_common.cpp │ │ ├── draw_common.h │ │ ├── draw_ctrl.cpp │ │ ├── draw_ctrl.h │ │ ├── draw_device.cpp │ │ ├── draw_device.h │ │ ├── draw_font.cpp │ │ ├── draw_font.h │ │ ├── draw_obj.cpp │ │ ├── draw_obj.h │ │ ├── draw_particle.cpp │ │ ├── draw_particle.h │ │ ├── draw_primitive.cpp │ │ ├── draw_primitive.h │ │ ├── draw_shadow.cpp │ │ ├── draw_shadow.h │ │ ├── draw_tex.cpp │ │ ├── draw_tex.h │ │ ├── input.cpp │ │ ├── input.h │ │ ├── jpg_decoder.cpp │ │ ├── jpg_decoder.h │ │ ├── lib_win.vcxproj │ │ ├── lib_win.vcxproj.filters │ │ ├── main.cpp │ │ ├── main.h │ │ ├── png_decoder.cpp │ │ ├── png_decoder.h │ │ ├── snd.cpp │ │ ├── snd.h │ │ ├── wav_decoder.cpp │ │ ├── wav_decoder.h │ │ ├── wnd_common.cpp │ │ ├── wnd_common.h │ │ ├── wnd_ctrl.cpp │ │ ├── wnd_ctrl.h │ │ ├── wnd_wnd.cpp │ │ └── wnd_wnd.h │ ├── low_level.asm │ └── shaders │ │ ├── bin_to_text.exe │ │ ├── bin_to_text │ │ └── main.kn │ │ ├── build.bat │ │ ├── circle_line_ps.fx │ │ ├── circle_ps.fx │ │ ├── circle_vs.fx │ │ ├── data │ │ ├── d0000.knd │ │ └── d0002.knd │ │ ├── filter_monotone_ps.fx │ │ ├── filter_none_ps.fx │ │ ├── filter_vs.fx │ │ ├── font_ps.fx │ │ ├── obj_fast_ps.fx │ │ ├── obj_fast_vs.fx │ │ ├── obj_flat_ps.fx │ │ ├── obj_flat_vs.fx │ │ ├── obj_outline_ps.fx │ │ ├── obj_outline_vs.fx │ │ ├── obj_ps.fx │ │ ├── obj_shadow_vs.fx │ │ ├── obj_toon_fast_ps.fx │ │ ├── obj_toon_ps.fx │ │ ├── obj_vs.fx │ │ ├── particle_2d_ps.fx │ │ ├── particle_2d_vs.fx │ │ ├── particle_updating_ps.fx │ │ ├── particle_updating_vs.fx │ │ ├── rect_vs.fx │ │ ├── tex_ps.fx │ │ ├── tex_rot_vs.fx │ │ ├── tex_vs.fx │ │ ├── tri_ps.fx │ │ └── tri_vs.fx └── sys │ ├── _preset00.kn │ ├── _preset00_wnd.kn │ ├── _preset01.kn │ ├── _preset01_wnd.kn │ ├── _preset02.kn │ ├── _preset02_wnd.kn │ ├── _preset03.kn │ ├── _preset03_wnd.kn │ ├── bgm.kn │ ├── cipher.kn │ ├── cui.kn │ ├── cursor.kn │ ├── dbg.kn │ ├── draw.kn │ ├── draw2d.kn │ ├── drawex.kn │ ├── excpt.kn │ ├── file.kn │ ├── game.kn │ ├── hash.kn │ ├── hash.sha256.kn │ ├── hash.xxh64.kn │ ├── input.kn │ ├── kuin.kn │ ├── lib.kn │ ├── math.kn │ ├── net.kn │ ├── num.kn │ ├── num2.kn │ ├── ogg.kn │ ├── regex.kn │ ├── rescache.kn │ ├── snd.kn │ ├── sql.kn │ ├── task.kn │ ├── undo.kn │ ├── web.kn │ ├── wipe.kn │ ├── wnd.kn │ ├── wndex.kn │ ├── xml.kn │ └── zip.kn └── sys ├── common.h ├── cpp ├── _preset00.kn ├── _preset01.kn ├── _preset02.kn ├── _preset03.kn ├── cipher.kn ├── cui.kn ├── drawex.kn ├── excpt.kn ├── file.kn ├── hash.kn ├── hash.sha256.kn ├── hash.xxh64.kn ├── kuin.kn ├── lib.kn ├── math.kn ├── rescache.kn ├── undo.kn ├── wnd.kn └── wndex.kn ├── default.ico ├── exe ├── _preset00.kn ├── _preset00_wnd.kn ├── _preset01.kn ├── _preset01_wnd.kn ├── _preset02.kn ├── _preset02_wnd.kn ├── _preset03.kn ├── _preset03_wnd.kn ├── bgm.kn ├── cipher.kn ├── cui.kn ├── cursor.kn ├── draw.kn ├── draw2d.kn ├── drawex.kn ├── excpt.kn ├── file.kn ├── game.kn ├── hash.kn ├── hash.sha256.kn ├── hash.xxh64.kn ├── input.kn ├── kuin.kn ├── lib.kn ├── math.kn ├── net.kn ├── num.kn ├── ogg.kn ├── regex.kn ├── rescache.kn ├── snd.kn ├── sql.kn ├── task.kn ├── undo.kn ├── wipe.kn ├── wnd.kn ├── wndex.kn ├── xml.kn └── zip.kn ├── license_ogg_vorbis.txt └── web ├── _preset00.kn ├── _preset01.kn ├── _preset02.kn ├── _preset03.kn ├── cipher.kn ├── cui.kn ├── draw.kn ├── drawex.kn ├── excpt.kn ├── file.kn ├── hash.kn ├── hash.sha256.kn ├── hash.xxh64.kn ├── input.kn ├── kuin.kn ├── lib.kn ├── math.kn ├── rescache.kn ├── undo.kn ├── web.kn ├── wnd.kn └── wndex.kn /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bat text eol=crlf 2 | *.c text eol=crlf 3 | *.cpp text eol=crlf 4 | *.h text eol=crlf 5 | *.kn text eol=crlf 6 | *.sln eol=crlf 7 | *.txt text eol=crlf 8 | *.vcxproj eol=crlf 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | *.idb 3 | *.ilk 4 | *.ipch 5 | *.log 6 | *.obj 7 | *.opendb 8 | *.pdb 9 | *.suo 10 | *.tlog 11 | *.user 12 | *.VC.db 13 | *.FileListAbsolute.txt 14 | 15 | /src/lib/dll/output/ 16 | /src/lib/dll/additional_libs/ 17 | /build/output/ 18 | /build/deploy_*/ 19 | /build/package/ 20 | /build/package_src_*/sys/ 21 | /build/package_src_*/kuin.cpp 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kuin Programming Language 2 | プログラミング言語「Kuin」 3 | 4 | ## [English] 5 | 6 | ***-- Welcome to the Labyrinth of Kuin Compiler,*** 7 | ***where many programmers who challenged to read the code never came back. --*** 8 | 9 | This is the git repository for the Kuin programming language, developed by Kuina-chan. 10 | 11 | All the files here are provided under the Kuina-chan License. 12 | If you have any questions, please let me know in English or Japanese. 13 | 14 | Kuina-chan's website: 15 | Kuina-chan's twitter account: (@kuina_ch) 16 | 17 | ## [Japanese] 18 | 19 | ***――Kuinコンパイラの迷宮へようこそ。*** 20 | ***ここは、読解に挑んだ多くのプログラマが帰らぬこととなった場所です――。*** 21 | 22 | 「くいなちゃん」が開発するプログラミング言語「Kuin」( )のリポジトリです。 23 | 24 | #### # 報告の方法 25 | 不具合の報告や機能追加を要望したい場合は、下記の方法で行うことができます。 26 | * 開発者(くいなちゃん)に日本語か英語で直接報告する。 27 | * リポジトリをForkして編集した後Pull Requestをくいなちゃん宛てに送る。 28 | * 修正したソースコードの断片をどこかにアップロードしてくいなちゃんに知らせる。 29 | 戴いたソースコードはわたしが検査して適宜修正しますので、不具合やコーディングルールの不統一があっても問題ありません。 30 | 31 | #### # ビルド方法 32 | Kuinコンパイラを手元でビルドする場合には、Visual C++ 2019が必要です。 33 | 34 | /build/deploy_for_exe.batを実行すると、以下の段階を経て/build/deploy_exe_ja内にKuinコンパイラ及びKuinエディタが生成されます。 35 | 1. 仮のKuinコンパイラ(/build/kuincl.exe)を使って、/src/compilerのソースからKuinコンパイラが/build/output/kuin.exeに生成されます。 36 | 2. 生成されたコンパイラを使って、/src/compilerのソースからC++のKuinコンパイラ(/build/output/kuin_cpp_ja.cppおよび/build/output/kuin_dll_ja.cpp)が生成されます。 37 | 3. Visual C++を使って、C++のKuinコンパイラから最終的なKuinコンパイラ/build/deploy_exe_ja/kuincl.exeが生成されます。 38 | C++を経ているのは、Visual C++の強力な最適化によってパフォーマンスを高めるためです。 39 | 4. 最終的なKuinコンパイラを使って、/src/kuin_editorのソースからKuinエディタが/build/deploy_exe_ja/kuin.exeに生成されます。 40 | 41 | その後、/build/deploy_exe_ja/内の全ファイルを/build/package_ja/内にコピーすると、パッケージが完成します。 42 | 43 | すべてのファイルは「くいなちゃんライセンス( )」でご自由にお使いいただけます。 44 | その他、あらゆるご質問はくいなちゃんまでどうぞ。 45 | 46 | Webサイト: 47 | Twitterアカウント: (@kuina_ch) 48 | -------------------------------------------------------------------------------- /build/deploy_for_web.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | rem Kuin2.kn ->[Kuin1.exe]-> Kuin2.exe 6 | .\kuincl.exe -i "%~dp0../src/compiler/main.kn" -o "%~dp0output/kuin.exe" -s "%~dp0./sys/" -e exe -x lang=ja 7 | 8 | rem --------------------------------------------------------------------------- 9 | 10 | rem Kuin2.kn ->[Kuin2.exe]-> Kuin2.js 11 | if exist "%~dp0deploy_web_res" rd /s /q "%~dp0deploy_web_res" 12 | mkdir "%~dp0deploy_web_res" 13 | mkdir "%~dp0deploy_web_res\sys" 14 | copy /Y "..\src\sys\common.h" ".\deploy_web_res\sys\" 15 | xcopy /s /e /q /i /y "..\src\sys\cpp" ".\deploy_web_res\sys\cpp" 16 | xcopy /s /e /q /i /y "..\src\sys\web" ".\deploy_web_res\sys\web" 17 | if exist "%~dp0deploy_web_ja" rd /s /q "%~dp0deploy_web_ja" 18 | mkdir "%~dp0deploy_web_ja" 19 | .\output\kuin.exe -i "%~dp0../src/compiler/main.kn" -o "%~dp0deploy_web_ja/kuin" -s "%~dp0../src/sys/" -p "%~dp0./deploy_web_res/" -e web -x static -r -x lang=ja 20 | 21 | rem --------------------------------------------------------------------------- 22 | 23 | rem Kuin2.kn ->[Kuin2.exe]-> Kuin2.js 24 | if exist "%~dp0deploy_web_en" rd /s /q "%~dp0deploy_web_en" 25 | mkdir "%~dp0deploy_web_en" 26 | .\output\kuin.exe -i "%~dp0../src/compiler/main.kn" -o "%~dp0deploy_web_en/kuin" -s "%~dp0../src/sys/" -p "%~dp0./deploy_web_res/" -e web -x static -r -x lang=en 27 | 28 | pause 29 | 30 | popd 31 | -------------------------------------------------------------------------------- /build/kuincl.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/kuincl.exe -------------------------------------------------------------------------------- /build/libs/Debug/d0000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d0000.knd -------------------------------------------------------------------------------- /build/libs/Debug/d0001.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d0001.knd -------------------------------------------------------------------------------- /build/libs/Debug/d0004.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d0004.knd -------------------------------------------------------------------------------- /build/libs/Debug/d0005.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d0005.knd -------------------------------------------------------------------------------- /build/libs/Debug/d1000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d1000.knd -------------------------------------------------------------------------------- /build/libs/Debug/d1001.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d1001.knd -------------------------------------------------------------------------------- /build/libs/Debug/d1002.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d1002.knd -------------------------------------------------------------------------------- /build/libs/Debug/d1003.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d1003.knd -------------------------------------------------------------------------------- /build/libs/Debug/d1004.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d1004.knd -------------------------------------------------------------------------------- /build/libs/Debug/d1005.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d1005.knd -------------------------------------------------------------------------------- /build/libs/Debug/d1006.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Debug/d1006.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d0000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d0000.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d0001.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d0001.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d0004.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d0004.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d0005.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d0005.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d1000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d1000.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d1001.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d1001.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d1002.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d1002.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d1003.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d1003.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d1004.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d1004.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d1005.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d1005.knd -------------------------------------------------------------------------------- /build/libs/Release_dbg/d1006.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_dbg/d1006.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d0000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d0000.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d0001.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d0001.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d0004.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d0004.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d0005.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d0005.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d1000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d1000.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d1001.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d1001.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d1002.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d1002.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d1003.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d1003.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d1004.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d1004.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d1005.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d1005.knd -------------------------------------------------------------------------------- /build/libs/Release_rls/d1006.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/libs/Release_rls/d1006.knd -------------------------------------------------------------------------------- /build/minify.bat: -------------------------------------------------------------------------------- 1 | "C:\Program Files (x86)\Microsoft\Microsoft Ajax Minifier\AjaxMin.exe" deploy_web_ja\kuin.js -out deploy_web_ja\kuin_minified.js -clobber 2 | "C:\Program Files (x86)\Microsoft\Microsoft Ajax Minifier\AjaxMin.exe" deploy_web_en\kuin.js -out deploy_web_en\kuin_minified.js -clobber 3 | pause 4 | -------------------------------------------------------------------------------- /build/output/exe_correct/empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/output/exe_correct/empty -------------------------------------------------------------------------------- /build/output/exe_output/empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/output/exe_output/empty -------------------------------------------------------------------------------- /build/output/kuin_cpp_en.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/output/kuin_cpp_ja.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/output/kuin_dll_en.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /build/output/kuin_dll_ja.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /build/output/kuin_interpreter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | static int64_t* classTable_; 6 | #define new_(...) newImpl_<__VA_ARGS__> 7 | #define type_(...) __VA_ARGS__* 8 | #define newPrim_(...) newImpl_<__VA_ARGS__> 9 | #define delPrim_(x) 10 | #define newPrimArray_(x, ...) newArrayImpl_<__VA_ARGS__>(x) 11 | #define delPrimArray_(x) 12 | #define dcast_(...) reinterpret_cast<__VA_ARGS__*> 13 | #define addr_(...) reinterpret_cast(__VA_ARGS__) 14 | template T* newArrayImpl_(std::size_t n); 15 | template T* newImpl_(A... a); 16 | #include "common.h" 17 | 18 | extern "C" void* Call0Asm(void* func); 19 | extern "C" void* Call1Asm(void* arg1, void* func); 20 | extern "C" void* Call2Asm(void* arg1, void* arg2, void* func); 21 | extern "C" void* Call3Asm(void* arg1, void* arg2, void* arg3, void* func); 22 | 23 | // debugger.cpp 24 | bool RunDbgImpl(const uint8_t* path, const uint8_t* cmd_line, void* idle_func, void* event_func, void* break_points_func, void* break_func, void* dbg_func); 25 | 26 | // interpret1.cpp 27 | bool InterpretImpl1(void* str, void* color, void* comment_level, void* flags, int64_t line, void* me, void* replace_func, int64_t cursor_x, int64_t cursor_y, int64_t* new_cursor_x, int64_t old_line, int64_t new_line); 28 | -------------------------------------------------------------------------------- /build/output/test_kuin_cpp.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}") = "test_kuin_cpp", "test_kuin_cpp.vcxproj", "{46EF85F3-AE65-4CC5-9106-DEAB05AB3F18}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {46EF85F3-AE65-4CC5-9106-DEAB05AB3F18}.Debug|x64.ActiveCfg = Debug|x64 15 | {46EF85F3-AE65-4CC5-9106-DEAB05AB3F18}.Debug|x64.Build.0 = Debug|x64 16 | {46EF85F3-AE65-4CC5-9106-DEAB05AB3F18}.Release|x64.ActiveCfg = Release|x64 17 | {46EF85F3-AE65-4CC5-9106-DEAB05AB3F18}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /build/output/test_kuin_cpp.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /build/package_en/samples/0000_kuinvaders/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0000_kuinvaders/res/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0000_kuinvaders/res/back.jpg -------------------------------------------------------------------------------- /build/package_en/samples/0000_kuinvaders/res/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0000_kuinvaders/res/game.png -------------------------------------------------------------------------------- /build/package_en/samples/0000_kuinvaders/res/title.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0000_kuinvaders/res/title.jpg -------------------------------------------------------------------------------- /build/package_en/samples/0001_kuinote/main.kn: -------------------------------------------------------------------------------- 1 | ; Kuinote (C)Kuina-chan 2 | 3 | ; Windows and controls. 4 | var wndMain: wnd@Wnd 5 | var editText: wnd@EditMulti 6 | 7 | func main() 8 | ; Creating a window. 9 | do @wndMain :: wnd@makeWnd(null, %normal, 1024, 768, "Kuinote") 10 | do @wndMain.onClose :: @wndMainOnClose {Register an event when the window is closed.} 11 | do @wndMain.onPushMenu :: @wndMainOnPushMenu {Register an event when a menu item is selected.} 12 | do @editText :: wnd@makeEditMulti(@wndMain, 12, 12, 1000, 744, %scale, %scale) 13 | ; Creating a menu. 14 | var menuMain: wnd@Menu :: wnd@makeMenu() 15 | var popupMainFile: wnd@Popup :: wnd@makePopup() 16 | do menuMain.addPopup("&File", popupMainFile) 17 | do popupMainFile.add(0x0001, "&New") 18 | do popupMainFile.addLine() 19 | do popupMainFile.add(0x0002, "E&xit") 20 | var popupMainHelp: wnd@Popup :: wnd@makePopup() 21 | do menuMain.addPopup("&Help", popupMainHelp) 22 | do popupMainHelp.add(0x1001, "&About Kuinote...") 23 | ; Registering the menu. 24 | do @wndMain.setMenu(menuMain) 25 | ; Wait for the user to perform an operation. 26 | while(wnd@act()) 27 | end while 28 | end func 29 | 30 | ; Event function called when the window is closed. 31 | func wndMainOnClose(wnd: wnd@WndBase): bool 32 | var result: wnd@MsgBoxResult :: wnd@msgBox(@wndMain, "Do you want to close the application?", "Kuinote", %warn, %yesNoCancel) 33 | if(result = %yes) 34 | ret true {If true is returned, the window will be closed.} 35 | else 36 | ret false {If false is returned, the window will not be closed.} 37 | end if 38 | end func 39 | 40 | ; Event function called when a menu item is selected. 41 | func wndMainOnPushMenu(wnd: wnd@WndBase, id: int) 42 | switch(id) 43 | case 0x0001 {New} 44 | do @editText.setText("") {Empty the text.} 45 | case 0x0002 {Exit} 46 | do @wndMain.close() {Close the window.} 47 | case 0x1001 {About Kuinote} 48 | do wnd@msgBox(@wndMain, "Kuinote\nVersion 1.0.0\n(C)Kuina-chan", "Kuinote", %info, %ok) 49 | end switch 50 | end func 51 | -------------------------------------------------------------------------------- /build/package_en/samples/0001_kuinote/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0002_draw_2d/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0002_draw_2d/res/kuin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0002_draw_2d/res/kuin.png -------------------------------------------------------------------------------- /build/package_en/samples/0003_draw_3d/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0003_draw_3d/res/board.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0003_draw_3d/res/board.knobj -------------------------------------------------------------------------------- /build/package_en/samples/0003_draw_3d/res/board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0003_draw_3d/res/board.png -------------------------------------------------------------------------------- /build/package_en/samples/0003_draw_3d/res/box.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0003_draw_3d/res/box.knobj -------------------------------------------------------------------------------- /build/package_en/samples/0003_draw_3d/res/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0003_draw_3d/res/box.png -------------------------------------------------------------------------------- /build/package_en/samples/0003_draw_3d/res/cone.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0003_draw_3d/res/cone.knobj -------------------------------------------------------------------------------- /build/package_en/samples/0003_draw_3d/res/sphere.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0003_draw_3d/res/sphere.knobj -------------------------------------------------------------------------------- /build/package_en/samples/0003_draw_3d/res/sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0003_draw_3d/res/sphere.png -------------------------------------------------------------------------------- /build/package_en/samples/0004_sound/main.kn: -------------------------------------------------------------------------------- 1 | ; Sound Sample (C)Kuina-chan 2 | 3 | var sndSe: snd@Snd 4 | var sndBgm: snd@Snd 5 | 6 | func main() 7 | do ogg@init() {Initializing the Ogg library.} 8 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "Sound Sample") 9 | var btnSe: wnd@Btn :: wnd@makeBtn(wndMain, 12, 12, 150, 23, %fix, %fix, "Play SE") {Creating the SE button.} 10 | do btnSe.onPush :: btnSeOnPush {Event when the SE button is pressed.} 11 | var btnBgm: wnd@Btn :: wnd@makeBtn(wndMain, 168, 12, 150, 23, %fix, %fix, "Play BGM") {Creating the BGM button.} 12 | do btnBgm.onPush :: btnBgmOnPush {Event when the BGM button is pressed.} 13 | do @sndSe :: snd@makeSnd("res/se.wav") {Load sound as non-streaming.} 14 | do @sndBgm :: snd@makeSnd("res/bgm.ogg") {Load sound as streaming.} 15 | while(wnd@act()) 16 | end while 17 | 18 | func btnSeOnPush(wnd: wnd@WndBase) 19 | do @sndSe.setPos(0.0) {Set the playback position to 0 seconds.} 20 | do @sndSe.play() {Play SE when the SE button is pressed.} 21 | end func 22 | 23 | func btnBgmOnPush(wnd: wnd@WndBase) 24 | var btn: wnd@Btn :: wnd $ wnd@Btn 25 | if(@sndBgm.playing()) 26 | do @sndBgm.stop() {When the BGM button is pressed, stop BGM if it is playing.} 27 | do btn.setText("Play BGM") 28 | else 29 | do @sndBgm.playLoop() {When the BGM button is pressed, play BGM in a loop if it is stopped.} 30 | do btn.setText("Stop BGM") 31 | end if 32 | end func 33 | end func 34 | -------------------------------------------------------------------------------- /build/package_en/samples/0004_sound/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0004_sound/res/bgm.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0004_sound/res/bgm.ogg -------------------------------------------------------------------------------- /build/package_en/samples/0004_sound/res/se.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0004_sound/res/se.wav -------------------------------------------------------------------------------- /build/package_en/samples/0005_input/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0007_random/main.kn: -------------------------------------------------------------------------------- 1 | ; Random Sample (C)Kuina-chan 2 | 3 | func main() 4 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1000, 700, "Random Sample") 5 | var edit1: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 485, 676, %fix, %scale) 6 | do edit1.readonly(true) 7 | var edit2: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 500, 12, 485, 676, %scale, %scale) 8 | do edit2.readonly(true) 9 | var rnd: lib@Rnd :: lib@makeRnd(1234b32) {Generate reproducible random numbers with seed 1234.} 10 | 11 | ; Generate integer random numbers between 1 and 6. 12 | do edit1.setText("[1, 6]\n----------\n") 13 | do edit2.setText("[1, 6]\n----------\n") 14 | for(1, 20) 15 | do edit1.setText(edit1.getText() ~ lib@rnd(1, 6).toStr() ~ "\n") 16 | do edit2.setText(edit2.getText() ~ rnd.rnd(1, 6).toStr() ~ "\n") 17 | end for 18 | 19 | ; Generate decimal random numbers greater than or equal to 0.0 and less than 1.0 20 | do edit1.setText(edit1.getText() ~ "\n[0.0, 1.0)\n----------\n") 21 | do edit2.setText(edit2.getText() ~ "\n[0.0, 1.0)\n----------\n") 22 | for(1, 20) 23 | do edit1.setText(edit1.getText() ~ lib@rndFloat(0.0, 1.0).toStr() ~ "\n") 24 | do edit2.setText(edit2.getText() ~ rnd.rndFloat(0.0, 1.0).toStr() ~ "\n") 25 | end for 26 | 27 | while(wnd@act()) 28 | end while 29 | end func 30 | -------------------------------------------------------------------------------- /build/package_en/samples/0007_random/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0008_time/main.kn: -------------------------------------------------------------------------------- 1 | ; Time Sample (C)Kuina-chan 2 | 3 | func main() 4 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %aspect, 1600, 900, "Time Sample") 5 | var drawMain: wnd@Draw :: wnd@makeDraw(wndMain, 0, 0, 1600, 900, %scale, %scale, false) 6 | var font: draw@Font :: draw@makeFont(null, 28, false, false, false, 30.0) 7 | var year: int 8 | var month: int 9 | var day: int 10 | var hour: int 11 | var minute: int 12 | var second: int 13 | var dayOfWeek: int 14 | while(wnd@act()) 15 | do font.draw(100.0, 50.0, "System Time: " ~ lib@sysTime().toStr(), draw@white) 16 | do font.draw(100.0, 100.0, "Unix Time : " ~ lib@now().toStr(), draw@white) 17 | ; Decompose the current time to UTC. 18 | do dayOfWeek :: lib@intToDate(lib@now(), &year, &month, &day, &hour, &minute, &second) 19 | do font.draw(100.0, 200.0, "[UTC]", draw@white) 20 | do font.draw(100.0, 250.0, "Year : " ~ year.toStr(), draw@white) 21 | do font.draw(100.0, 300.0, "Month : " ~ month.toStr(), draw@white) 22 | do font.draw(100.0, 350.0, "Day : " ~ day.toStr(), draw@white) 23 | do font.draw(100.0, 400.0, "Hour : " ~ hour.toStr(), draw@white) 24 | do font.draw(100.0, 450.0, "Minute: " ~ minute.toStr(), draw@white) 25 | do font.draw(100.0, 500.0, "Second: " ~ second.toStr(), draw@white) 26 | do font.draw(100.0, 550.0, "Day of Week: " ~ dayOfWeek.toStr(), draw@white) 27 | do font.draw(100.0, 600.0, "Unix Time : " ~ lib@dateToInt(year, month, day, hour, minute, second).toStr(), draw@white) 28 | do draw@render(60) 29 | end while 30 | end func 31 | -------------------------------------------------------------------------------- /build/package_en/samples/0008_time/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0009_file/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0010_network/main.kn: -------------------------------------------------------------------------------- 1 | ; Network Sample (C)Kuina-chan 2 | 3 | const url: []char :: "https://kuina.ch" 4 | 5 | func main() 6 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "Network Sample") 7 | var edit1: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 485, 676, %fix, %scale) 8 | do edit1.readonly(true) 9 | var edit2: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 500, 12, 485, 676, %scale, %scale) 10 | do edit2.readonly(true) 11 | 12 | ; Obtaining HTML data via HTTP. 13 | var http: net@Http :: net@makeHttp(@url, false, null) 14 | var s: []char :: null 15 | while(s =& null) {Loop until successful acquisition.} 16 | do lib@sleep(1) {Avoid occupying the CPU.} 17 | do s :: http.get() 18 | end while 19 | do edit1.setText(s ~ "\n") 20 | 21 | ; TCP communication. 22 | var testData: []bit8 :: "Test Data" $> []bit8 {Data to be sent.} 23 | var server: net@TcpServer :: net@makeTcpServer(1024) {Creating a server.} 24 | var client: net@Tcp :: net@makeTcpClient("localhost", 1024) {Create a client and connect to the server.} 25 | var serverConnect: net@Tcp :: null 26 | while(serverConnect =& null) {Loop until a connection request is received from the client.} 27 | do lib@sleep(1) 28 | do serverConnect :: server.get() 29 | end while 30 | do client.send(testData) {Send data from the client.} 31 | var serverData: []bit8 :: null 32 | while(serverData =& null) {Loop until the data sent by the client can be received.} 33 | do lib@sleep(1) 34 | do serverData :: serverConnect.receive(^testData) 35 | end while 36 | do edit2.setText((serverData $< []char) ~ "\n") 37 | 38 | while(wnd@act()) 39 | end while 40 | end func 41 | -------------------------------------------------------------------------------- /build/package_en/samples/0010_network/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0012_kuina_chan_model/main.kn: -------------------------------------------------------------------------------- 1 | ; Draw Kuina-chan Model Sample (C)Kuina-chan 2 | 3 | func main() 4 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %aspect, 1600, 900, "Draw Kuina-chan Model Sample") {Creating a window.} 5 | var drawMain: wnd@Draw :: wnd@makeDraw(wndMain, 0, 0, 1600, 900, %scale, %scale, false) {Creating a draw control.} 6 | var obj: draw@Obj :: draw@makeObj("res/kuina_chan.knobj") {Loading the Kuina-chan model.} 7 | var texAlbedo: draw@Tex :: draw@makeTex("res/albedo.png") {Loading albedo textures for the Kuina-chan model.} 8 | var texNormal: draw@Tex :: draw@makeTexArgb("res/normal.png") {Loading normal map textures for the Kuina-chan model.} 9 | do draw@clearColor(0xFFEEEEEE) {Setting the background color.} 10 | do draw@depth(true, true) {Setting the Z buffer.} 11 | do draw@ambLight(0.9, 0.9, 1.0, 1.0, 0.9, 0.9) {Setting the ambient light.} 12 | do obj.pos(1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0) {Setting the position of the Kuina-chan model.} 13 | var angle: float :: 0.0 {Camera angle.} 14 | do draw@proj(lib@pi / 180.0 * 27.0, 16.0, 9.0, 0.1, 100.0) {Projection Settings.} 15 | var anim: float :: 0.0 {For animation of Kuina-chan.} 16 | while(wnd@act()) 17 | do angle :+ lib@pi / 120.0 {Make it go around once every 4 seconds.} 18 | do draw@camera(80.0 * lib@sin(angle), 4.0, 80.0 * lib@cos(angle), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) {Camera settings.} 19 | do obj.drawToon(0, anim, texAlbedo, null, texNormal) {Drawing the Kuina-chan model.} 20 | do obj.drawOutline(0, anim, 0.05, 0xFF664444) {Drawing the contour line.} 21 | do anim :: (anim + 0.5) % 60.0 {Perform animation.} 22 | do draw@render(60) 23 | end while 24 | end func 25 | -------------------------------------------------------------------------------- /build/package_en/samples/0012_kuina_chan_model/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0012_kuina_chan_model/res/albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0012_kuina_chan_model/res/albedo.png -------------------------------------------------------------------------------- /build/package_en/samples/0012_kuina_chan_model/res/kuina_chan.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0012_kuina_chan_model/res/kuina_chan.knobj -------------------------------------------------------------------------------- /build/package_en/samples/0012_kuina_chan_model/res/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0012_kuina_chan_model/res/normal.png -------------------------------------------------------------------------------- /build/package_en/samples/0013_collision_and_particles/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0013_collision_and_particles/res/tex_particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0013_collision_and_particles/res/tex_particle.png -------------------------------------------------------------------------------- /build/package_en/samples/0014_edit_pixels/main.kn: -------------------------------------------------------------------------------- 1 | ; Edit Pixels Sample (C)Kuina-chan 2 | 3 | var x: int 4 | var y: int 5 | var vx: int 6 | var vy: int 7 | 8 | func main() 9 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %fix, 640, 707, "Edit Pixels Sample") {Creating a window.} 10 | var drawMain: wnd@Draw :: wnd@makeDrawEditable(wndMain, 0, 0, 640, 707) {Creating a editable draw control.} 11 | do draw@autoClear(false) 12 | 13 | ; Explicitly clear. 14 | do draw@clearColor(0xFF111111) 15 | do draw@clear() 16 | 17 | do @x :: 0 18 | do @y :: 0 19 | do @vx :: 1 20 | do @vy :: 1 21 | while(wnd@act()) 22 | do draw@editPixels(@updatePixels) 23 | do draw@render(60) 24 | end while 25 | end func 26 | 27 | func updatePixels(width: int, height: int, pixels: []bit32) 28 | for(1, 20) 29 | do @x :+ @vx 30 | do @y :+ @vy 31 | if(@x < 0) 32 | do @x :: 0 33 | do @vx :: 1 34 | end if 35 | if(@x >= width) 36 | do @x :: width - 1 37 | do @vx :: -1 38 | end if 39 | if(@y < 0) 40 | do @y :: 0 41 | do @vy :: 1 42 | end if 43 | if(@y >= height) 44 | do @y :: height - 1 45 | do @vy :: -1 46 | end if 47 | 48 | do pixels[@y * width + @x] :: 0xFF000000b32 + (lib@rnd(0, 0xFFFFFF) $ bit32) 49 | end for 50 | end func 51 | -------------------------------------------------------------------------------- /build/package_en/samples/0014_edit_pixels/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/0015_kuinvaders_on_web/files/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0015_kuinvaders_on_web/files/back.jpg -------------------------------------------------------------------------------- /build/package_en/samples/0015_kuinvaders_on_web/files/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0015_kuinvaders_on_web/files/game.png -------------------------------------------------------------------------------- /build/package_en/samples/0015_kuinvaders_on_web/files/title.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/0015_kuinvaders_on_web/files/title.jpg -------------------------------------------------------------------------------- /build/package_en/samples/0015_kuinvaders_on_web/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | web 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/bgm_sample.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/bgm_sample.ogg -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/dot_back_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/dot_back_side.png -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/dot_kuina_chan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/dot_kuina_chan.png -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/dot_map_chips_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/dot_map_chips_side.png -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/map_sample_racing.txt: -------------------------------------------------------------------------------- 1 | 20,20 2 | -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1 3 | -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1 4 | -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 5 | -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 6 | -1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, -1, -1 7 | -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 8 | -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1 9 | 0, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1 10 | 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1 11 | 0, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1 12 | 0, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0 13 | 0, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 14 | 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 15 | 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 16 | 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0 17 | 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 18 | 0, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 19 | 0, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 20 | 0, -1, -1, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 21 | -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 22 | -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/map_sample_side.txt: -------------------------------------------------------------------------------- 1 | 26,15 2 | 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 3 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 4 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 5 | 1, -1, 0, -1, 0, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 6 | 1, -1, 1, -1, 1, -1, -1, -1, -1, 6, 6, 6, 6, 6, -1, -1, 6, 6, 6, 6, -1, -1, -1, -1, -1, 1 7 | 1, -1, 1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 8 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1 9 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 10 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 0, 0, -1, -1, -1, 1 11 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 0, 0, 1, 1, 1, -1, -1, -1, 1 12 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1 13 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 14 | 1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 15 | 1, -1, -1, -1, -1, 0, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 16 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 17 | -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/obj_car.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/obj_car.fbx -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/tex_car_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/tex_car_albedo.png -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/tex_field_albedo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/tex_field_albedo.jpg -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/tex_sky_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/tex_sky_albedo.png -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/tex_wall_albedo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/tex_wall_albedo.jpg -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/uv_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/uv_box.png -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/uv_plane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/uv_plane.png -------------------------------------------------------------------------------- /build/package_en/samples/free_resources/uv_sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/samples/free_resources/uv_sphere.png -------------------------------------------------------------------------------- /build/package_en/sys/snippet.knd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | main And An Empty Window 5 | var {{wndMain}}: wnd@Wnd 6 | 7 | func main() 8 | do @{{wndMain}} :: wnd@makeWnd(null, %normal, 800, 450, "{{Title}}") 9 | 10 | while(wnd@act()) 11 | end while 12 | end func 13 | 14 | 15 | 16 | main And A draw Control 17 | var {{wndMain}}: wnd@Wnd 18 | var {{drawMain}}: wnd@Draw 19 | 20 | func main() 21 | do @{{wndMain}} :: wnd@makeWnd(null, %aspect, 1600, 900, "{{Title}}") 22 | do @{{drawMain}} :: wnd@makeDraw(@{{wndMain}}, 0, 0, 1600, 900, %scale, %scale, false) 23 | 24 | while(wnd@act()) 25 | do draw@render(60) 26 | end while 27 | end func 28 | 29 | 30 | 31 | Scanning A list 32 | do {{x}}.head() 33 | while(!{{x}}.term()) 34 | var {{item}}: {{itemType}} :: {{x}}.get() 35 | 36 | do {{x}}.next() 37 | end while 38 | 39 | 40 | 41 | Scanning A dict 42 | do {{x}}.forEach({{callback}}, null) 43 | 44 | func {{callback}}(key: {{keyType}}, value: {{valueType}}, data: kuin@Class): bool 45 | ret true 46 | end func 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /build/package_en/tools/knobj_maker.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_en/tools/knobj_maker.exe -------------------------------------------------------------------------------- /build/package_ja/samples/0000_kuinvaders/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0000_kuinvaders/res/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0000_kuinvaders/res/back.jpg -------------------------------------------------------------------------------- /build/package_ja/samples/0000_kuinvaders/res/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0000_kuinvaders/res/game.png -------------------------------------------------------------------------------- /build/package_ja/samples/0000_kuinvaders/res/title.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0000_kuinvaders/res/title.jpg -------------------------------------------------------------------------------- /build/package_ja/samples/0001_kuinote/main.kn: -------------------------------------------------------------------------------- 1 | ; Kuinote (くいのーと) (C)Kuina-chan 2 | 3 | ; ウインドウやコントロール 4 | var wndMain: wnd@Wnd 5 | var editText: wnd@EditMulti 6 | 7 | func main() 8 | ; ウインドウの作成 9 | do @wndMain :: wnd@makeWnd(null, %normal, 1024, 768, "Kuinote") 10 | do @wndMain.onClose :: @wndMainOnClose {ウインドウが閉じられたときのイベントを登録} 11 | do @wndMain.onPushMenu :: @wndMainOnPushMenu {メニューが選択されたときのイベントを登録} 12 | do @editText :: wnd@makeEditMulti(@wndMain, 12, 12, 1000, 744, %scale, %scale) 13 | ; メニューの作成 14 | var menuMain: wnd@Menu :: wnd@makeMenu() 15 | var popupMainFile: wnd@Popup :: wnd@makePopup() 16 | do menuMain.addPopup("&File", popupMainFile) 17 | do popupMainFile.add(0x0001, "&New") 18 | do popupMainFile.addLine() 19 | do popupMainFile.add(0x0002, "E&xit") 20 | var popupMainHelp: wnd@Popup :: wnd@makePopup() 21 | do menuMain.addPopup("&Help", popupMainHelp) 22 | do popupMainHelp.add(0x1001, "&About Kuinote...") 23 | ; メニューの登録 24 | do @wndMain.setMenu(menuMain) 25 | ; ユーザが操作を行うのを待機する 26 | while(wnd@act()) 27 | end while 28 | end func 29 | 30 | ; ウインドウが閉じられたときに呼ばれるイベント関数 31 | func wndMainOnClose(wnd: wnd@WndBase): bool 32 | var result: wnd@MsgBoxResult :: wnd@msgBox(@wndMain, "終了しても良いですか?", "Kuinote", %warn, %yesNoCancel) 33 | if(result = %yes) 34 | ret true {trueを返すとウインドウは閉じる} 35 | else 36 | ret false {falseを返すとウインドウは閉じない} 37 | end if 38 | end func 39 | 40 | ; メニューが選択されたときに呼ばれるイベント関数 41 | func wndMainOnPushMenu(wnd: wnd@WndBase, id: int) 42 | switch(id) 43 | case 0x0001 {New} 44 | do @editText.setText("") {テキストを空にする} 45 | case 0x0002 {Exit} 46 | do @wndMain.close() {ウインドウを閉じる} 47 | case 0x1001 {About Kuinote} 48 | do wnd@msgBox(@wndMain, "Kuinote\nVersion 1.0.0\n(C)Kuina-chan", "Kuinote", %info, %ok) 49 | end switch 50 | end func 51 | -------------------------------------------------------------------------------- /build/package_ja/samples/0001_kuinote/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0002_draw_2d/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0002_draw_2d/res/kuin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0002_draw_2d/res/kuin.png -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/main.kn: -------------------------------------------------------------------------------- 1 | ; Draw 3D Sample (C)Kuina-chan 2 | 3 | func main() 4 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %aspect, 1600, 900, "Draw 3D Sample") {ウインドウの生成} 5 | var drawMain: wnd@Draw :: wnd@makeDraw(wndMain, 0, 0, 1600, 900, %scale, %scale, false) {ドローコントロールの生成} 6 | var objBoard: draw@Obj :: draw@makeObj("res/board.knobj") {板モデルの読み込み} 7 | var texBoard: draw@Tex :: draw@makeTex("res/board.png") {板モデル用のテクスチャの読み込み} 8 | var objBox: draw@Obj :: draw@makeObj("res/box.knobj") {箱モデルの読み込み} 9 | var texBox: draw@Tex :: draw@makeTex("res/box.png") {箱モデル用のテクスチャの読み込み} 10 | var objSphere: draw@Obj :: draw@makeObj("res/sphere.knobj") {球モデルの読み込み} 11 | var texSphere: draw@Tex :: draw@makeTex("res/sphere.png") {球モデル用のテクスチャの読み込み} 12 | var objCone: draw@Obj :: draw@makeObj("res/cone.knobj") {コーンモデルの読み込み} 13 | var texCone: draw@Tex :: draw@makeTexEvenArgb(1.0, 0.35, 0.1, 0.05) 14 | var texConeSpecular: draw@Tex :: draw@makeTexEvenArgb(2.0, 0.3, 0.3, 0.3) 15 | do draw@clearColor(0xFF999999) {背景色の設定} 16 | do draw@depth(true, true) {Zバッファの設定} 17 | do objBoard.pos(20.0, 20.0, 20.0, 0.0, 0.0, 0.0, 0.0, 0.0, -15.0) {板モデルの位置設定} 18 | do objBox.pos(1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0) {箱モデルの位置設定} 19 | do objSphere.pos(1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 2.0, 0.5, 0.0) {球モデルの位置設定} 20 | do objCone.pos(2.0, 2.0, 2.0, 0.0, 0.0, 0.0, -2.0, 0.0, 0.0) {コーンモデルの位置設定} 21 | var angle: float :: 0.0 22 | while(wnd@act()) 23 | do angle :+ lib@pi / 120.0 {4秒間に1周させる} 24 | do draw@camera(15.0 * lib@sin(angle), 4.0, 15.0 * lib@cos(angle), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) {カメラの設定} 25 | do objBoard.draw(0, 0.0, texBoard, null, null) {板モデルの描画} 26 | do objBox.draw(0, 0.0, texBox, null, null) {箱モデルの描画} 27 | do objSphere.draw(0, 0.0, texSphere, null, null) {球モデルの描画} 28 | do objCone.draw(0, 0.0, texCone, texConeSpecular, null) {コーンモデルの描画} 29 | do draw@render(60) 30 | end while 31 | end func 32 | -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/res/board.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0003_draw_3d/res/board.knobj -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/res/board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0003_draw_3d/res/board.png -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/res/box.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0003_draw_3d/res/box.knobj -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/res/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0003_draw_3d/res/box.png -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/res/cone.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0003_draw_3d/res/cone.knobj -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/res/sphere.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0003_draw_3d/res/sphere.knobj -------------------------------------------------------------------------------- /build/package_ja/samples/0003_draw_3d/res/sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0003_draw_3d/res/sphere.png -------------------------------------------------------------------------------- /build/package_ja/samples/0004_sound/main.kn: -------------------------------------------------------------------------------- 1 | ; Sound Sample (C)Kuina-chan 2 | 3 | var sndSe: snd@Snd 4 | var sndBgm: snd@Snd 5 | 6 | func main() 7 | do ogg@init() {Oggライブラリの初期化} 8 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "Sound Sample") 9 | var btnSe: wnd@Btn :: wnd@makeBtn(wndMain, 12, 12, 150, 23, %fix, %fix, "Play SE") {SEボタンの作成} 10 | do btnSe.onPush :: btnSeOnPush {SEボタンが押されたときのイベント} 11 | var btnBgm: wnd@Btn :: wnd@makeBtn(wndMain, 168, 12, 150, 23, %fix, %fix, "Play BGM") {BGMボタンの作成} 12 | do btnBgm.onPush :: btnBgmOnPush {BGMボタンが押されたときのイベント} 13 | do @sndSe :: snd@makeSnd("res/se.wav") {サウンドを非ストリーミングで読み込む} 14 | do @sndBgm :: snd@makeSnd("res/bgm.ogg") {サウンドをストリーミングで読み込む} 15 | while(wnd@act()) 16 | end while 17 | 18 | func btnSeOnPush(wnd: wnd@WndBase) 19 | do @sndSe.setPos(0.0) {再生位置を0秒に設定} 20 | do @sndSe.play() {SEボタンが押されたらSEを再生} 21 | end func 22 | 23 | func btnBgmOnPush(wnd: wnd@WndBase) 24 | var btn: wnd@Btn :: wnd $ wnd@Btn 25 | if(@sndBgm.playing()) 26 | do @sndBgm.stop() {BGMボタンが押されたら再生中ならBGMを停止} 27 | do btn.setText("Play BGM") 28 | else 29 | do @sndBgm.playLoop() {BGMボタンが押されたら停止中ならBGMをループ再生} 30 | do btn.setText("Stop BGM") 31 | end if 32 | end func 33 | end func 34 | -------------------------------------------------------------------------------- /build/package_ja/samples/0004_sound/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0004_sound/res/bgm.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0004_sound/res/bgm.ogg -------------------------------------------------------------------------------- /build/package_ja/samples/0004_sound/res/se.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0004_sound/res/se.wav -------------------------------------------------------------------------------- /build/package_ja/samples/0005_input/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0007_random/main.kn: -------------------------------------------------------------------------------- 1 | ; Random Sample (C)Kuina-chan 2 | 3 | func main() 4 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1000, 700, "Random Sample") 5 | var edit1: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 485, 676, %fix, %scale) 6 | do edit1.readonly(true) 7 | var edit2: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 500, 12, 485, 676, %scale, %scale) 8 | do edit2.readonly(true) 9 | var rnd: lib@Rnd :: lib@makeRnd(1234b32) {シード1234で再現性のある乱数を生成} 10 | 11 | ; 1以上6以下の整数の乱数を生成 12 | do edit1.setText("[1, 6]\n----------\n") 13 | do edit2.setText("[1, 6]\n----------\n") 14 | for(1, 20) 15 | do edit1.setText(edit1.getText() ~ lib@rnd(1, 6).toStr() ~ "\n") 16 | do edit2.setText(edit2.getText() ~ rnd.rnd(1, 6).toStr() ~ "\n") 17 | end for 18 | 19 | ; 0.0以上1.0未満の小数の乱数を生成 20 | do edit1.setText(edit1.getText() ~ "\n[0.0, 1.0)\n----------\n") 21 | do edit2.setText(edit2.getText() ~ "\n[0.0, 1.0)\n----------\n") 22 | for(1, 20) 23 | do edit1.setText(edit1.getText() ~ lib@rndFloat(0.0, 1.0).toStr() ~ "\n") 24 | do edit2.setText(edit2.getText() ~ rnd.rndFloat(0.0, 1.0).toStr() ~ "\n") 25 | end for 26 | 27 | while(wnd@act()) 28 | end while 29 | end func 30 | -------------------------------------------------------------------------------- /build/package_ja/samples/0007_random/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0008_time/main.kn: -------------------------------------------------------------------------------- 1 | ; Time Sample (C)Kuina-chan 2 | 3 | func main() 4 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %aspect, 1600, 900, "Time Sample") 5 | var drawMain: wnd@Draw :: wnd@makeDraw(wndMain, 0, 0, 1600, 900, %scale, %scale, false) 6 | var font: draw@Font :: draw@makeFont(null, 28, false, false, false, 30.0) 7 | var year: int 8 | var month: int 9 | var day: int 10 | var hour: int 11 | var minute: int 12 | var second: int 13 | var dayOfWeek: int 14 | while(wnd@act()) 15 | do font.draw(100.0, 50.0, "System Time: " ~ lib@sysTime().toStr(), draw@white) 16 | do font.draw(100.0, 100.0, "Unix Time : " ~ lib@now().toStr(), draw@white) 17 | ; 現在日時をUTCに分解 18 | do dayOfWeek :: lib@intToDate(lib@now(), &year, &month, &day, &hour, &minute, &second) 19 | do font.draw(100.0, 200.0, "[UTC]", draw@white) 20 | do font.draw(100.0, 250.0, "Year : " ~ year.toStr(), draw@white) 21 | do font.draw(100.0, 300.0, "Month : " ~ month.toStr(), draw@white) 22 | do font.draw(100.0, 350.0, "Day : " ~ day.toStr(), draw@white) 23 | do font.draw(100.0, 400.0, "Hour : " ~ hour.toStr(), draw@white) 24 | do font.draw(100.0, 450.0, "Minute: " ~ minute.toStr(), draw@white) 25 | do font.draw(100.0, 500.0, "Second: " ~ second.toStr(), draw@white) 26 | do font.draw(100.0, 550.0, "Day of Week: " ~ dayOfWeek.toStr(), draw@white) 27 | do font.draw(100.0, 600.0, "Unix Time : " ~ lib@dateToInt(year, month, day, hour, minute, second).toStr(), draw@white) 28 | do draw@render(60) 29 | end while 30 | end func 31 | -------------------------------------------------------------------------------- /build/package_ja/samples/0008_time/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0009_file/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0010_network/main.kn: -------------------------------------------------------------------------------- 1 | ; Network Sample (C)Kuina-chan 2 | 3 | const url: []char :: "https://kuina.ch" 4 | 5 | func main() 6 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "Network Sample") 7 | var edit1: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 485, 676, %fix, %scale) 8 | do edit1.readonly(true) 9 | var edit2: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 500, 12, 485, 676, %scale, %scale) 10 | do edit2.readonly(true) 11 | 12 | ; HTTPでHTMLデータを取得する 13 | var http: net@Http :: net@makeHttp(@url, false, null) 14 | var s: []char :: null 15 | while(s =& null) {取得に成功するまでループ} 16 | do lib@sleep(1) {CPUを占有しないようにする} 17 | do s :: http.get() 18 | end while 19 | do edit1.setText(s ~ "\n") 20 | 21 | ; TCP通信を行う 22 | var testData: []bit8 :: "Test Data" $> []bit8 {送信するデータ} 23 | var server: net@TcpServer :: net@makeTcpServer(1024) {サーバの作成} 24 | var client: net@Tcp :: net@makeTcpClient("localhost", 1024) {クライアントを作成してサーバに接続} 25 | var serverConnect: net@Tcp :: null 26 | while(serverConnect =& null) {クライアントからの接続要求があるまでループ} 27 | do lib@sleep(1) 28 | do serverConnect :: server.get() 29 | end while 30 | do client.send(testData) {クライアントからデータを送信} 31 | var serverData: []bit8 :: null 32 | while(serverData =& null) {クライアントが送信したデータが受信できるまでループ} 33 | do lib@sleep(1) 34 | do serverData :: serverConnect.receive(^testData) 35 | end while 36 | do edit2.setText((serverData $< []char) ~ "\n") 37 | 38 | while(wnd@act()) 39 | end while 40 | end func 41 | -------------------------------------------------------------------------------- /build/package_ja/samples/0010_network/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0012_kuina_chan_model/main.kn: -------------------------------------------------------------------------------- 1 | ; Draw Kuina-chan Model Sample (C)Kuina-chan 2 | 3 | func main() 4 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %aspect, 1600, 900, "Draw Kuina-chan Model Sample") {ウインドウの生成} 5 | var drawMain: wnd@Draw :: wnd@makeDraw(wndMain, 0, 0, 1600, 900, %scale, %scale, false) {ドローコントロールの生成} 6 | var obj: draw@Obj :: draw@makeObj("res/kuina_chan.knobj") {くいなちゃんモデルの読み込み} 7 | var texAlbedo: draw@Tex :: draw@makeTex("res/albedo.png") {くいなちゃんモデル用のアルベドテクスチャの読み込み} 8 | var texNormal: draw@Tex :: draw@makeTexArgb("res/normal.png") {くいなちゃんモデル用の法線マップテクスチャの読み込み} 9 | do draw@clearColor(0xFFEEEEEE) {背景色の設定} 10 | do draw@depth(true, true) {Zバッファの設定} 11 | do draw@ambLight(0.9, 0.9, 1.0, 1.0, 0.9, 0.9) {環境光の設定} 12 | do obj.pos(1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0) {くいなちゃんモデルの位置設定} 13 | var angle: float :: 0.0 {カメラの角度} 14 | do draw@proj(lib@pi / 180.0 * 27.0, 16.0, 9.0, 0.1, 100.0) {プロジェクションの設定} 15 | var anim: float :: 0.0 {くいなちゃんのアニメーション用} 16 | while(wnd@act()) 17 | do angle :+ lib@pi / 120.0 {4秒間に1周させる} 18 | do draw@camera(80.0 * lib@sin(angle), 4.0, 80.0 * lib@cos(angle), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) {カメラの設定} 19 | do obj.drawToon(0, anim, texAlbedo, null, texNormal) {くいなちゃんモデルの描画} 20 | do obj.drawOutline(0, anim, 0.05, 0xFF664444) {輪郭線の描画} 21 | do anim :: (anim + 0.5) % 60.0 {アニメーションを行う} 22 | do draw@render(60) 23 | end while 24 | end func 25 | -------------------------------------------------------------------------------- /build/package_ja/samples/0012_kuina_chan_model/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0012_kuina_chan_model/res/albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0012_kuina_chan_model/res/albedo.png -------------------------------------------------------------------------------- /build/package_ja/samples/0012_kuina_chan_model/res/kuina_chan.knobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0012_kuina_chan_model/res/kuina_chan.knobj -------------------------------------------------------------------------------- /build/package_ja/samples/0012_kuina_chan_model/res/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0012_kuina_chan_model/res/normal.png -------------------------------------------------------------------------------- /build/package_ja/samples/0013_collision_and_particles/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0013_collision_and_particles/res/tex_particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0013_collision_and_particles/res/tex_particle.png -------------------------------------------------------------------------------- /build/package_ja/samples/0014_edit_pixels/main.kn: -------------------------------------------------------------------------------- 1 | ; Edit Pixels Sample (C)Kuina-chan 2 | 3 | var x: int 4 | var y: int 5 | var vx: int 6 | var vy: int 7 | 8 | func main() 9 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %fix, 640, 707, "Edit Pixels Sample") {ウインドウの生成} 10 | var drawMain: wnd@Draw :: wnd@makeDrawEditable(wndMain, 0, 0, 640, 707) {編集可能なドローコントロールの生成} 11 | do draw@autoClear(false) 12 | 13 | ; 明示的にクリア 14 | do draw@clearColor(0xFF111111) 15 | do draw@clear() 16 | 17 | do @x :: 0 18 | do @y :: 0 19 | do @vx :: 1 20 | do @vy :: 1 21 | while(wnd@act()) 22 | do draw@editPixels(@updatePixels) 23 | do draw@render(60) 24 | end while 25 | end func 26 | 27 | func updatePixels(width: int, height: int, pixels: []bit32) 28 | for(1, 20) 29 | do @x :+ @vx 30 | do @y :+ @vy 31 | if(@x < 0) 32 | do @x :: 0 33 | do @vx :: 1 34 | end if 35 | if(@x >= width) 36 | do @x :: width - 1 37 | do @vx :: -1 38 | end if 39 | if(@y < 0) 40 | do @y :: 0 41 | do @vy :: 1 42 | end if 43 | if(@y >= height) 44 | do @y :: height - 1 45 | do @vy :: -1 46 | end if 47 | 48 | do pixels[@y * width + @x] :: 0xFF000000b32 + (lib@rnd(0, 0xFFFFFF) $ bit32) 49 | end for 50 | end func 51 | -------------------------------------------------------------------------------- /build/package_ja/samples/0014_edit_pixels/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/0015_kuinvaders_on_web/files/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0015_kuinvaders_on_web/files/back.jpg -------------------------------------------------------------------------------- /build/package_ja/samples/0015_kuinvaders_on_web/files/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0015_kuinvaders_on_web/files/game.png -------------------------------------------------------------------------------- /build/package_ja/samples/0015_kuinvaders_on_web/files/title.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/0015_kuinvaders_on_web/files/title.jpg -------------------------------------------------------------------------------- /build/package_ja/samples/0015_kuinvaders_on_web/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | web 5 | 5 6 | 1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/bgm_sample.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/bgm_sample.ogg -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/dot_back_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/dot_back_side.png -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/dot_kuina_chan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/dot_kuina_chan.png -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/dot_map_chips_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/dot_map_chips_side.png -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/map_sample_racing.txt: -------------------------------------------------------------------------------- 1 | 20,20 2 | -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1 3 | -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1 4 | -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 5 | -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 6 | -1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, -1, -1 7 | -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 8 | -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1 9 | 0, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1 10 | 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1 11 | 0, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1 12 | 0, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0 13 | 0, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 14 | 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 15 | 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 16 | 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0 17 | 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 18 | 0, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 19 | 0, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 20 | 0, -1, -1, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 21 | -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 22 | -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/map_sample_side.txt: -------------------------------------------------------------------------------- 1 | 26,15 2 | 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 3 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 4 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 5 | 1, -1, 0, -1, 0, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 6 | 1, -1, 1, -1, 1, -1, -1, -1, -1, 6, 6, 6, 6, 6, -1, -1, 6, 6, 6, 6, -1, -1, -1, -1, -1, 1 7 | 1, -1, 1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 8 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1 9 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 10 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 0, 0, -1, -1, -1, 1 11 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 0, 0, 1, 1, 1, -1, -1, -1, 1 12 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1 13 | 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 14 | 1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 15 | 1, -1, -1, -1, -1, 0, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 16 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 17 | -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/obj_car.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/obj_car.fbx -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/tex_car_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/tex_car_albedo.png -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/tex_field_albedo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/tex_field_albedo.jpg -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/tex_sky_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/tex_sky_albedo.png -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/tex_wall_albedo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/tex_wall_albedo.jpg -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/uv_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/uv_box.png -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/uv_plane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/uv_plane.png -------------------------------------------------------------------------------- /build/package_ja/samples/free_resources/uv_sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/samples/free_resources/uv_sphere.png -------------------------------------------------------------------------------- /build/package_ja/sys/snippet.knd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | mainと空のウインドウ 5 | var {{wndMain}}: wnd@Wnd 6 | 7 | func main() 8 | do @{{wndMain}} :: wnd@makeWnd(null, %normal, 800, 450, "{{Title}}") 9 | 10 | while(wnd@act()) 11 | end while 12 | end func 13 | 14 | 15 | 16 | mainとdrawコントロール 17 | var {{wndMain}}: wnd@Wnd 18 | var {{drawMain}}: wnd@Draw 19 | 20 | func main() 21 | do @{{wndMain}} :: wnd@makeWnd(null, %aspect, 1600, 900, "{{Title}}") 22 | do @{{drawMain}} :: wnd@makeDraw(@{{wndMain}}, 0, 0, 1600, 900, %scale, %scale, false) 23 | 24 | while(wnd@act()) 25 | do draw@render(60) 26 | end while 27 | end func 28 | 29 | 30 | 31 | listの走査 32 | do {{x}}.head() 33 | while(!{{x}}.term()) 34 | var {{item}}: {{itemType}} :: {{x}}.get() 35 | 36 | do {{x}}.next() 37 | end while 38 | 39 | 40 | 41 | dictの走査 42 | do {{x}}.forEach({{callback}}, null) 43 | 44 | func {{callback}}(key: {{keyType}}, value: {{valueType}}, data: kuin@Class): bool 45 | ret true 46 | end func 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /build/package_ja/tools/knobj_maker.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/package_ja/tools/knobj_maker.exe -------------------------------------------------------------------------------- /build/sys/cpp/_preset00.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("Hello, world!") 3 | end func 4 | -------------------------------------------------------------------------------- /build/sys/cpp/dbg.kn: -------------------------------------------------------------------------------- 1 | +func print(str: []char) 2 | ; TODO: 3 | end func 4 | -------------------------------------------------------------------------------- /build/sys/cpp/draw.kn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/sys/cpp/draw.kn -------------------------------------------------------------------------------- /build/sys/cpp/excpt.kn: -------------------------------------------------------------------------------- 1 | +const userMin: int :: 0x00000001 2 | +const userMax: int :: 0x0000FFFF 3 | +const accessViolation: int :: 0xC0000005 4 | +const noMem: int :: 0xC0000017 5 | +const intDivideByZero: int :: 0xC0000094 6 | +const stackOverflow: int :: 0xC00000FD 7 | +const ctrlCExit: int :: 0xC000013A 8 | +const dbgAssertFailed: int :: 0xE9170000 9 | +const classCastFailed: int :: 0xE9170001 10 | +const dbgArrayIdxOutOfRange: int :: 0xE9170002 11 | +const invalidCmp: int :: 0xE9170004 12 | +const dbgArgOutDomain: int :: 0xE9170006 13 | +const invalidDataFmt: int :: 0xE9170008 14 | +const deviceInitFailed: int :: 0xE9170009 15 | +const dbgInoperableState: int :: 0xE917000A 16 | -------------------------------------------------------------------------------- /build/sys/cpp/hash.kn: -------------------------------------------------------------------------------- 1 | include sha256 2 | include xxh64 3 | -------------------------------------------------------------------------------- /build/sys/cpp/wnd.kn: -------------------------------------------------------------------------------- 1 | +func exeDir(): []char 2 | excode "#if defined(_WIN32)\n" 3 | excode "wchar_t b_[512];\n" 4 | excode "wchar_t*p_;\n" 5 | excode "GetModuleFileName(nullptr,b_,512);\n" 6 | excode "p_=wcsrchr(b_,L'\\\\');\n" 7 | excode "if(p_==nullptr)return nullptr;\n" 8 | excode "*(p_+1)=L'\\0';\n" 9 | excode "p_=b_;\n" 10 | excode "while(*p_!=L'\\0'){\n" 11 | excode "if(*p_==L'\\\\')*p_=L'/';\n" 12 | excode "p_++;\n" 13 | excode "}\n" 14 | excode "size_t l_=wcslen(b_);\n" 15 | excode "type_(Array_)a_=new_(Array_)();\n" 16 | excode "a_->L=l_;\n" 17 | excode "a_->B=newPrimArray_(static_cast(l_+1),char16_t);\n" 18 | excode "memcpy(a_->B,b_,sizeof(char16_t)*static_cast(l_+1));\n" 19 | excode "return a_;\n" 20 | excode "#else\n" 21 | excode "return nullptr;\n" 22 | excode "#endif\n" 23 | end func 24 | 25 | -------------------------------------------------------------------------------- /build/sys/data/dbg/d0000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/sys/data/dbg/d0000.knd -------------------------------------------------------------------------------- /build/sys/data/dbg/d0001.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/sys/data/dbg/d0001.knd -------------------------------------------------------------------------------- /build/sys/data/rls/d0000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/sys/data/rls/d0000.knd -------------------------------------------------------------------------------- /build/sys/data/rls/d0001.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/sys/data/rls/d0001.knd -------------------------------------------------------------------------------- /build/sys/default.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/sys/default.ico -------------------------------------------------------------------------------- /build/sys/exe/_preset00.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("Hello, world!") 3 | end func 4 | -------------------------------------------------------------------------------- /build/sys/exe/dbg.kn: -------------------------------------------------------------------------------- 1 | +func print(str: []char) 2 | ; TODO: 3 | end func 4 | -------------------------------------------------------------------------------- /build/sys/exe/excpt.kn: -------------------------------------------------------------------------------- 1 | +const userMin: int :: 0x00000001 2 | +const userMax: int :: 0x0000FFFF 3 | +const accessViolation: int :: 0xC0000005 4 | +const noMem: int :: 0xC0000017 5 | +const intDivideByZero: int :: 0xC0000094 6 | +const stackOverflow: int :: 0xC00000FD 7 | +const ctrlCExit: int :: 0xC000013A 8 | +const dbgAssertFailed: int :: 0xE9170000 9 | +const classCastFailed: int :: 0xE9170001 10 | +const dbgArrayIdxOutOfRange: int :: 0xE9170002 11 | +const invalidCmp: int :: 0xE9170004 12 | +const dbgArgOutDomain: int :: 0xE9170006 13 | +const invalidDataFmt: int :: 0xE9170008 14 | +const deviceInitFailed: int :: 0xE9170009 15 | +const dbgInoperableState: int :: 0xE917000A 16 | -------------------------------------------------------------------------------- /build/sys/exe/hash.kn: -------------------------------------------------------------------------------- 1 | include sha256 2 | include xxh64 3 | -------------------------------------------------------------------------------- /build/sys/web/_preset00.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("Hello, world!") 3 | end func 4 | -------------------------------------------------------------------------------- /build/sys/web/cui.kn: -------------------------------------------------------------------------------- 1 | const strBufSize: int :: 1024 2 | var delimiters: []char :: " ,\n" 3 | 4 | +func delimiter(delimiters_: []char) 5 | do @delimiters :: delimiters_ 6 | end func 7 | 8 | +func flush() 9 | end func 10 | 11 | +func input(): []char 12 | ret null 13 | end func 14 | 15 | +func inputChar(): char 16 | ret 0 $ char 17 | end func 18 | 19 | +func inputFloat(): float 20 | ret 0.0 21 | end func 22 | 23 | +func inputInt(): int 24 | ret 0 25 | end func 26 | 27 | +func inputLetter(): char 28 | ret 0 $ char 29 | end func 30 | 31 | +func inputStr(): []char 32 | ret null 33 | end func 34 | 35 | +func print(str: []char) 36 | excode "if(`0`==null)`0`={S:\"(null)\"};\n" 37 | excode "if(O_&&O_.print){O_.print(`0`.S);return;}\n" 38 | excode "console.log(`0`.S);\n" 39 | end func 40 | 41 | -------------------------------------------------------------------------------- /build/sys/web/dbg.kn: -------------------------------------------------------------------------------- 1 | +func print(str: []char) 2 | ; TODO: 3 | end func 4 | -------------------------------------------------------------------------------- /build/sys/web/draw.kn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/build/sys/web/draw.kn -------------------------------------------------------------------------------- /build/sys/web/excpt.kn: -------------------------------------------------------------------------------- 1 | +const userMin: int :: 0x00000001 2 | +const userMax: int :: 0x0000FFFF 3 | +const accessViolation: int :: 0xC0000005 4 | +const noMem: int :: 0xC0000017 5 | +const intDivideByZero: int :: 0xC0000094 6 | +const stackOverflow: int :: 0xC00000FD 7 | +const ctrlCExit: int :: 0xC000013A 8 | +const dbgAssertFailed: int :: 0xE9170000 9 | +const classCastFailed: int :: 0xE9170001 10 | +const dbgArrayIdxOutOfRange: int :: 0xE9170002 11 | +const invalidCmp: int :: 0xE9170004 12 | +const dbgArgOutDomain: int :: 0xE9170006 13 | +const invalidDataFmt: int :: 0xE9170008 14 | +const deviceInitFailed: int :: 0xE9170009 15 | +const dbgInoperableState: int :: 0xE917000A 16 | -------------------------------------------------------------------------------- /build/sys/web/hash.kn: -------------------------------------------------------------------------------- 1 | include sha256 2 | include xxh64 3 | -------------------------------------------------------------------------------- /build/sys/web/wnd.kn: -------------------------------------------------------------------------------- 1 | +func exeDir(): []char 2 | excode "return null;\n" 3 | end func 4 | 5 | -------------------------------------------------------------------------------- /build/test_web.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | rem --------------------------------------------------------------------------- 6 | 7 | set browser_path=C:\Program Files\Mozilla Firefox\firefox.exe 8 | 9 | rem Kuin2.kn ->[Kuin2.exe]-> Kuin2.js 10 | :: .\output\x64\Release\kuin_cpp_ja\kuin_cpp_ja.exe -i "%~dp0../src/compiler/main.kn" -o "%~dp0output/kuin_js" -s "%~dp0output/test_res/sys/" -p "%~dp0output/test_res/" -e web -x lang=ja 11 | 12 | rem Kuin2.js ->[Kuin2.js]-> Kuin2.js 13 | "%browser_path%" "file:///%~dp0output\kuin_js.html?-i&res/main.kn&-o&kuin_js2&-s&res/sys/&-e&web" 14 | 15 | rem Test Kuin2.js 16 | "%browser_path%" "file:///%~dp0output\kuin_js.html?-i&res/test.kn&-o&test_kuin_js&-s&res/sys/&-e&web&-x&static" 17 | echo "Place the files..." 18 | pause 19 | "%browser_path%" "file:///%~dp0output\test_kuin_js2.html" 20 | 21 | popd 22 | -------------------------------------------------------------------------------- /src/compiler/err.kn: -------------------------------------------------------------------------------- 1 | +var errCnt: int 2 | var logFunc: func<(int, []char, []char, int, int)> 3 | 4 | +func err(id: \msg@Id, pos: \pos@Pos, args: [][]char) 5 | if(id < %_nonErrs) 6 | if(@errCnt >= 100) 7 | ret {Stop error detection at 100 pieces.} 8 | end if 9 | else 10 | if(\option@quiet) 11 | ret 12 | end if 13 | end if 14 | 15 | var msg: []char :: \msg@get(id, args) 16 | if(@logFunc =& null) 17 | do cui@print((id $ bit32).toStr() ~ ": ") 18 | if(pos <>& null) 19 | do cui@print("[\{pos.srcName}: \{pos.row}, \{pos.col}]") 20 | end if 21 | do cui@print(msg ~ "\n") 22 | else 23 | if(pos =& null) 24 | do @logFunc(id $ int, msg, null, -1, -1) 25 | else 26 | do @logFunc(id $ int, msg, pos.srcName, pos.row, pos.col) 27 | end if 28 | end if 29 | if(id < %_nonErrs) 30 | do @errCnt :+ 1 31 | end if 32 | end func 33 | 34 | +func[__rwi]setLogFunc(logFunc: func<(int, []char, []char, int, int)>) 35 | do @logFunc :: logFunc 36 | end func 37 | -------------------------------------------------------------------------------- /src/compiler/interpret.i1.kn: -------------------------------------------------------------------------------- 1 | +func[__rwi]isReserved(word: []char): bool 2 | ret \parse@isReserved(word) 3 | end func 4 | -------------------------------------------------------------------------------- /src/compiler/interpret.kn: -------------------------------------------------------------------------------- 1 | include debugger 2 | include i1 3 | include i2 4 | -------------------------------------------------------------------------------- /src/compiler/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | cui 5 | 5 6 | 1 7 | 8 | 9 | 10 | analyze.kn 11 | ast.kn 12 | builtin_func.kn 13 | convert.kn 14 | cpp\output.kn 15 | err.kn 16 | exe\asm.kn 17 | exe\asm.assemble.kn 18 | exe\asm.excpt_func.kn 19 | exe\machine.kn 20 | exe\manifest.kn 21 | exe\output.kn 22 | interpret.kn 23 | interpret.debugger.kn 24 | interpret.i1.kn 25 | interpret.i2.kn 26 | msg.kn 27 | option.kn 28 | parse.kn 29 | pos.kn 30 | web\builtin.kn 31 | web\output.kn 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/compiler/pos.kn: -------------------------------------------------------------------------------- 1 | +class Pos() 2 | +var srcName: []char 3 | +var row: int 4 | +var col: int 5 | end class 6 | 7 | +func make(srcName: []char, row: int, col: int): @Pos 8 | var pos: @Pos :: #@Pos 9 | do pos.srcName :: srcName 10 | do pos.row :: row 11 | do pos.col :: col 12 | ret pos 13 | end func 14 | -------------------------------------------------------------------------------- /src/kuin_editor/color_sel.kn: -------------------------------------------------------------------------------- 1 | var wndColorSel: wnd@Wnd 2 | var result: bool 3 | var color: int 4 | 5 | +func show(parent: wnd@Wnd, color: int): []char 6 | do @color :: color.clamp(0, 0xFFFFFFFF) 7 | 8 | do @wndColorSel :: wnd@makeWnd(\form@wndMain, (%fix $ wnd@WndStyle).or(%noMinimize), 300, 300, \common@langEn ?("Color Selection", "色の選択")) 9 | 10 | var btnOk: wnd@Btn :: wnd@makeBtn(@wndColorSel, 72, 265, 75, 23, %fix, %fix, "OK") 11 | do btnOk.onPush :: btnOkOnPush 12 | var btnCancel: wnd@Btn :: wnd@makeBtn(@wndColorSel, 153, 265, 75, 23, %fix, %fix, \common@langEn ?("Cancel", "キャンセル")) 13 | do btnCancel.onPush :: btnCancelOnPush 14 | 15 | do @result :: false 16 | do @wndColorSel.modal() 17 | 18 | do @wndColorSel :: null 19 | 20 | ret @result ?("0x" ~ @color.toStrFmt("08X"), null) 21 | 22 | func btnOkOnPush(wnd: wnd@WndBase) 23 | do @result :: true 24 | do @wndColorSel.close() 25 | end func 26 | 27 | func btnCancelOnPush(wnd: wnd@WndBase) 28 | do @wndColorSel.close() 29 | end func 30 | end func 31 | -------------------------------------------------------------------------------- /src/kuin_editor/common.kn: -------------------------------------------------------------------------------- 1 | +const fontSize: int :: 11 2 | +const cellWidth: int :: 9 3 | +const cellHeight: int :: 18 4 | +const langEn: bool :: env("lang") = "en" 5 | +const colorBack: int :: 0xFFFFF5F5 6 | +const colorBackLocked: int :: 0xFFFFFFF5 7 | +const defaultDir: []char :: "./" 8 | 9 | +var title: []char 10 | +var font: draw@Font 11 | +var fontP: draw@Font 12 | +var tex: draw@Tex 13 | 14 | +func init() 15 | var major: int 16 | var minor: int 17 | var micro: int 18 | do \dll@version(&major, &minor, µ) 19 | do @title :: "Kuin Programming Language \{major}.\{minor}.\{micro}" 20 | 21 | do @font :: draw@makeFont("Consolas", @fontSize, false, false, false, @cellWidth $ float) 22 | do @fontP :: draw@makeFont("Consolas", @fontSize, false, false, true, 0.0) 23 | do @tex :: draw@makeTex("res/tex.png") 24 | end func 25 | 26 | +func nullStr(s: []char): []char 27 | ret s =& null ?("(null)", s) 28 | end func 29 | -------------------------------------------------------------------------------- /src/kuin_editor/dll.kn: -------------------------------------------------------------------------------- 1 | +func[d0917.knd, InitCompiler]initCompiler() 2 | end func 3 | 4 | +func[d0917.knd, FinCompiler]finCompiler() 5 | end func 6 | 7 | +func[d0917.knd, BuildMem]build(option: [][]char, funcGetSrc: func<([]char): [][]char>, funcLog: func<([][]char, int, int)>): bool 8 | end func 9 | 10 | +func[d0917.knd, Interpret1]interpret1(src: kuin@Class, line: int, me_: kuin@Class, replaceFunc: func<(\doc_src@DocSrc, int, []char)>, cursorX: int, cursorY: int, newCursorX: &int, oldLine: int, newLine: int) 11 | end func 12 | 13 | +func[d0917.knd, Interpret2]interpret2(option: [][]char, funcGetSrc: func<([]char): [][]char>, funcLog: func<([][]char, int, int)>, funcComplete: func<()>, prioritizedCode: []char) 14 | end func 15 | 16 | +func[d0917.knd, Version]version(major: &int, minor: &int, micro: &int) 17 | end func 18 | 19 | +func[d0917.knd, ResetMemAllocator]resetMemAllocator() 20 | end func 21 | 22 | ; TODO: +func[d0917.knd, GetHint]getHint(bufIdx: int, src: []char, row: int, keyword: []char, hintSrc: &[]char, hintRow: &int, hintCol: &int): []char 23 | ; end func 24 | 25 | +func[d0917.knd, GetKeywords]getKeywords(src: kuin@Class, srcName: []char, x: int, y: int, callback: func<([]char)>): []char 26 | end func 27 | 28 | +func[d0917.knd, RunDbg]runDbg(name: []char, cmdLine: []char, idleFunc: func<()>, eventFunc: func<(int, []char): int>, breakPointsFunc: func<()>, breakFunc: func<(int, \src@Pos, []char)>, dbgFunc: func<(int, []char, []char)>): bool 29 | end func 30 | 31 | +func[d0917.knd, SetBreakPoints]setBreakPoints(breakPoints: []\src@Pos) 32 | end func 33 | 34 | +func[d0917.knd, LockThread]lockThread() 35 | end func 36 | 37 | +func[d0917.knd, Interpret2Running]interpret2Running(): bool 38 | end func 39 | 40 | +func[d0917.knd, WaitEndOfInterpret2]waitEndOfInterpret2() 41 | end func 42 | -------------------------------------------------------------------------------- /src/kuin_editor/go_to_line.kn: -------------------------------------------------------------------------------- 1 | +var wndGoToLine: wnd@Wnd 2 | var wndEditLineNumber: wnd@Edit 3 | var wndBtnOk: wnd@Btn 4 | var wndBtnCancel: wnd@Btn 5 | 6 | +func show() 7 | var x: int 8 | var y: int 9 | var w: int 10 | do \form@drawEditor.getPosScreen(&x, &y, &w, &) 11 | if(@wndGoToLine =& null) 12 | do @wndGoToLine :: wnd@makeWnd(\form@wndMain, %fix $ wnd@WndStyle, 380, 332, \common@langEn ?("Go To Line", "指定行へ移動")) 13 | do @wndGoToLine.setPos(x + w - 380 - 17, y, 300, 130) 14 | do @wndGoToLine.onClose :: wndGoToLineOnClose 15 | do wnd@makeLabel(@wndGoToLine, 15, 8, 250, 15, %fix, %fix, \common@langEn ?("Line number:", "行番号:")) 16 | do @wndEditLineNumber :: wnd@makeEdit(@wndGoToLine, 15, 26, 250, 19, %scale, %fix) 17 | do @wndEditLineNumber.focus() 18 | do @wndBtnOk :: wnd@makeBtn(@wndGoToLine, 110, 56, 75, 23, %fix, %fix, \common@langEn ?("OK", "OK")) 19 | do @wndBtnOk.onPush :: wndBtnOkOnPush 20 | do @wndBtnCancel :: wnd@makeBtn(@wndGoToLine, 190, 56, 75, 23, %fix, %fix, \common@langEn ?("Cancel", "キャンセル")) 21 | do @wndBtnCancel.onPush :: wndBtnCancelOnPush 22 | end if 23 | 24 | func wndGoToLineOnClose(wnd: wnd@WndBase): bool 25 | do @wndGoToLine :: null 26 | ret true 27 | end func 28 | 29 | func wndBtnOkOnPush(wnd: wnd@WndBase) 30 | do @goToLine() 31 | end func 32 | 33 | func wndBtnCancelOnPush(wnd: wnd@WndBase) 34 | do @wndGoToLine.close() 35 | end func 36 | end func 37 | 38 | +func goToLine() 39 | var line: int :: @wndEditLineNumber.getText().toInt(&) - 1 40 | do (\src@curDoc $ \doc_src@DocSrc).move(0, line - 10) 41 | do (\src@curDoc $ \doc_src@DocSrc).move(0, line + 10) 42 | do (\src@curDoc $ \doc_src@DocSrc).move(0, line) 43 | do \form@paintDrawEditor(false) 44 | do \form@focusDrawEditor() 45 | do @wndGoToLine.close() 46 | end func 47 | -------------------------------------------------------------------------------- /src/kuin_editor/kuin_editor.kn: -------------------------------------------------------------------------------- 1 | ; Kuin Editor 2 | ; (C)Kuina-chan 3 | 4 | func main() 5 | do \common@init() 6 | 7 | do \dll@initCompiler() 8 | do \completion@init() 9 | do \find@init() 10 | do \snippet@load() 11 | do \form@makeWnd() 12 | do \recent@load() 13 | do \doc_src@init() 14 | do \src@init() 15 | 16 | if(^lib@cmdLine() > 0) 17 | do \src@openMainSrc(lib@cmdLine()[0].replace("\\", "/")) 18 | end if 19 | if(\src@curDoc =& null) 20 | do \src@newMainSrc() 21 | end if 22 | 23 | do \form@init() 24 | do mainLoop() 25 | do \src@fin() 26 | do \dll@finCompiler() 27 | 28 | func mainLoop() 29 | while(wnd@act()) 30 | do \dll@lockThread() 31 | do \form@updateState() 32 | end while 33 | end func 34 | end func 35 | -------------------------------------------------------------------------------- /src/kuin_editor/kuin_editor.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wnd 5 | 5 6 | 1 7 | 8 | 9 | 10 | add_file.kn 11 | common.kn 12 | completion.kn 13 | dbgwnd.kn 14 | dll.kn 15 | doc.kn 16 | doc_ar.kn 17 | doc_ar_2d.kn 18 | doc_ar_wnd.kn 19 | doc_gen.kn 20 | doc_src.kn 21 | find.kn 22 | form.kn 23 | go_to_line.kn 24 | knobj_maker.kn 25 | obj_prop.kn 26 | proj_settings.kn 27 | prop.kn 28 | recent.kn 29 | snippet.kn 30 | src.kn 31 | web_server.kn 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/kuin_editor/res/draw2d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/draw2d.png -------------------------------------------------------------------------------- /src/kuin_editor/res/kn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/kn.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_btn.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_chk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_chk.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_circle.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_edit.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_edit_multi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_edit_multi.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_group.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_img.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_label.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_none.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_particle.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_rect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_rect.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_roundrect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_roundrect.png -------------------------------------------------------------------------------- /src/kuin_editor/res/obj_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/obj_text.png -------------------------------------------------------------------------------- /src/kuin_editor/res/tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/tex.png -------------------------------------------------------------------------------- /src/kuin_editor/res/wnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/kuin_editor/res/wnd.png -------------------------------------------------------------------------------- /src/lib/converter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/lib/converter.exe -------------------------------------------------------------------------------- /src/lib/converter/main.kn: -------------------------------------------------------------------------------- 1 | var curTarget: []char 2 | 3 | func main() 4 | var target: [][]char :: ["cpp", "web", "exe"] 5 | for i(0, ^target - 1) 6 | do @curTarget :: target[i] 7 | do file@makeDir("./../sys/\{@curTarget}/") 8 | do file@forEach("./sys/", false, @convert, null) 9 | end for 10 | end func 11 | 12 | func convert(path: []char, dir: bool, data: kuin@Class): bool 13 | if(dir | file@ext(path) <> "kn") 14 | ret true 15 | end if 16 | var reader: file@Reader :: file@makeReader(path) 17 | var writingPath: []char :: "./../sys/\{@curTarget}/\{file@fileName(path)}" 18 | var writer: file@Writer :: file@makeWriter(writingPath, false) 19 | var skip_: bool :: false 20 | while loop(!reader.term()) 21 | var s: []char :: reader.readLine() 22 | if(^s >= 1 & s[0] = '#') 23 | var targets: [][]char :: s.sub(1, -1).split(",") 24 | do skip_ :: true 25 | for i(0, ^targets - 1) 26 | var t: []char :: targets[i].trim() 27 | if(t = "any" | t = @curTarget) 28 | do skip_ :: false 29 | break i 30 | end if 31 | end for 32 | skip loop 33 | end if 34 | if(!skip_) 35 | do writer.writeStr(s ~ "\n") 36 | end if 37 | end while 38 | do writer.fin() 39 | do reader.fin() 40 | if(file@fileSize(writingPath) = 0) 41 | do file@delFile(writingPath) 42 | end if 43 | ret true 44 | end func 45 | -------------------------------------------------------------------------------- /src/lib/converter/main.knprop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | cui 5 | 5 6 | 1 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/lib/data/d0000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/lib/data/d0000.knd -------------------------------------------------------------------------------- /src/lib/data/d0002.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/lib/data/d0002.knd -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_game/lib_game.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_game/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\..\common.h" 4 | 5 | // 'game' 6 | EXPORT void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 7 | EXPORT void _rectBackFriction(SClass* me_, double back_friction); 8 | EXPORT void _rectFluidFriction(SClass* me_, double fluid_friction); 9 | EXPORT void _rectMove(SClass* me_, double max_velo); 10 | EXPORT void _rectUpdate(SClass* me_); 11 | EXPORT SClass* _makeMapImpl(SClass* me_, S64 map_width, S64 map_height, const void* data, double chip_width, double chip_height); 12 | EXPORT SClass* _makeMapEmpty(SClass* me_, S64 map_width, S64 map_height, double chip_width, double chip_height); 13 | EXPORT void _mapDtor(SClass* me_); 14 | EXPORT S64 _mapGet(SClass* me_, S64 x, S64 y); 15 | EXPORT void _mapSet(SClass* me_, S64 x, S64 y, S64 value); 16 | EXPORT Bool _mapFind(SClass* me_, S64* x, S64* y, S64 value); 17 | EXPORT SClass* _hitMapRectImpl(SClass* me2, SClass* map, SClass* rect, const void* chip_info_callback, const void* hit_callback); 18 | EXPORT S64 _hitRectRect(SClass* rect1, SClass* rect2, double weight1, double weight2, double repulsion, double solid_friction); 19 | EXPORT void _rollDtor(SClass* me_); 20 | EXPORT Bool _rollProceed(SClass* me_, double speed); 21 | EXPORT void _rollReset(SClass* me_); 22 | EXPORT SClass* _makeRollImpl(SClass* me_, const void* timings, const void* params, const void* roll_callback); 23 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_math_boost/build_boost.txt: -------------------------------------------------------------------------------- 1 | b2.exe install -j2 --prefix=E:\boost toolset=msvc link=static address-model=64 2 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_math_boost/lib_math_boost.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_math_boost/main.cpp: -------------------------------------------------------------------------------- 1 | // LibMathBoost.dll 2 | // 3 | // (C)Kuina-chan 4 | // 5 | 6 | #include "main.h" 7 | 8 | BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) 9 | { 10 | UNUSED(hinst); 11 | UNUSED(reason); 12 | UNUSED(reserved); 13 | return TRUE; 14 | } 15 | 16 | EXPORT_CPP void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags) 17 | { 18 | InitEnvVars(heap, heap_cnt, app_code, use_res_flags); 19 | } 20 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_math_boost/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\..\common.h" 4 | 5 | EXPORT_CPP void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 6 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_ogg/lib_ogg.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_ogg/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\..\common.h" 4 | 5 | #pragma comment(lib, "libogg_static.lib") 6 | #pragma comment(lib, "libvorbis_static.lib") 7 | #pragma comment(lib, "libvorbisfile_static.lib") 8 | 9 | #include 10 | #include 11 | 12 | EXPORT void* LoadOgg(size_t size, const U8* data, S64* channel, S64* samples_per_sec, S64* bits_per_sample, S64* total, void(**func_close)(void*), Bool(**func_read)(void*, void*, S64, S64)); 13 | EXPORT void init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 14 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_regex/build_boost.txt: -------------------------------------------------------------------------------- 1 | b2.exe install -j2 --prefix=E:\boost toolset=msvc link=static address-model=64 2 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_regex/lib_regex.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_regex/main.cpp: -------------------------------------------------------------------------------- 1 | // LibRegex.dll 2 | // 3 | // (C)Kuina-chan 4 | // 5 | 6 | #include "main.h" 7 | 8 | BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) 9 | { 10 | UNUSED(hinst); 11 | UNUSED(reason); 12 | UNUSED(reserved); 13 | return TRUE; 14 | } 15 | 16 | EXPORT_CPP void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags) 17 | { 18 | InitEnvVars(heap, heap_cnt, app_code, use_res_flags); 19 | } 20 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_regex/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\..\common.h" 4 | 5 | EXPORT_CPP void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 6 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_regex/regex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\..\common.h" 4 | 5 | EXPORT_CPP void _regexDtor(SClass* me_); 6 | EXPORT_CPP void* _regexFind(SClass* me_, S64* pos, const U8* text, S64 start); 7 | EXPORT_CPP void* _regexFindAll(SClass* me_, U8** pos, const U8* text); 8 | EXPORT_CPP void* _regexFindLast(SClass* me_, S64* pos, const U8* text, S64 start); 9 | EXPORT_CPP void* _regexMatch(SClass* me_, const U8* text); 10 | EXPORT_CPP void* _regexReplace(SClass* me_, const U8* text, const U8* newText, Bool all); 11 | EXPORT_CPP SClass* _makeRegex(SClass* me_, const U8* pattern); 12 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_sql/lib_sql.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_sql/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\..\common.h" 4 | 5 | EXPORT void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 6 | EXPORT Bool _sqlApply(SClass* me_); 7 | EXPORT void* _sqlErrMsg(SClass* me_); 8 | EXPORT Bool _sqlExec(SClass* me_, const void* cmd); 9 | EXPORT void _sqlFin(SClass* me_); 10 | EXPORT void* _sqlGetBlob(SClass* me_, S64 col); 11 | EXPORT double _sqlGetFloat(SClass* me_, S64 col); 12 | EXPORT S64 _sqlGetInt(SClass* me_, S64 col); 13 | EXPORT void* _sqlGetStr(SClass* me_, S64 col); 14 | EXPORT void _sqlNext(SClass* me_); 15 | EXPORT Bool _sqlPrepare(SClass* me_, const void* cmd); 16 | EXPORT Bool _sqlSetBlob(SClass* me_, S64 idx, const void* value); 17 | EXPORT Bool _sqlSetFloat(SClass* me_, S64 idx, double value); 18 | EXPORT Bool _sqlSetInt(SClass* me_, S64 idx, S64 value); 19 | EXPORT Bool _sqlSetStr(SClass* me_, S64 idx, const void* value); 20 | EXPORT Bool _sqlTerm(SClass* me_); 21 | EXPORT SClass* _makeSql(SClass* me_, const U8* path); 22 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_xml/lib_xml.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_xml/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\..\common.h" 4 | 5 | // 'xml' 6 | EXPORT_CPP void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 7 | EXPORT_CPP SClass* _xmlNodeAddChild(SClass* me_, SClass* me2, const U8* name); 8 | EXPORT_CPP void _xmlNodeDelChild(SClass* me_, SClass* node); 9 | EXPORT_CPP SClass* _xmlNodeFindChild(SClass* me_, SClass* me2, const U8* name); 10 | EXPORT_CPP SClass* _xmlNodeFindChildLast(SClass* me_, SClass* me2, const U8* name); 11 | EXPORT_CPP SClass* _xmlNodeFindNext(SClass* me_, SClass* me2, const U8* name); 12 | EXPORT_CPP SClass* _xmlNodeFindPrev(SClass* me_, SClass* me2, const U8* name); 13 | EXPORT_CPP SClass* _xmlNodeFirstChild(SClass* me_, SClass* me2); 14 | EXPORT_CPP void* _xmlNodeGetAttr(SClass* me_, const U8* attr_name); 15 | EXPORT_CPP void* _xmlNodeGetName(SClass* me_); 16 | EXPORT_CPP void* _xmlNodeGetValue(SClass* me_); 17 | EXPORT_CPP SClass* _xmlNodeInsChild(SClass* me_, SClass* me2, SClass* node, const U8* name); 18 | EXPORT_CPP SClass* _xmlNodeLastChild(SClass* me_, SClass* me2); 19 | EXPORT_CPP SClass* _xmlNodeNext(SClass* me_, SClass* me2); 20 | EXPORT_CPP SClass* _xmlNodeParent(SClass* me_, SClass* me2); 21 | EXPORT_CPP SClass* _xmlNodePrev(SClass* me_, SClass* me2); 22 | EXPORT_CPP void _xmlNodeSetAttr(SClass* me_, const U8* attr_name, const U8* attr_value); 23 | EXPORT_CPP void _xmlNodeSetName(SClass* me_, const U8* name); 24 | EXPORT_CPP void _xmlNodeSetValue(SClass* me_, const U8* value); 25 | EXPORT_CPP void _xmlDtor(SClass* me_); 26 | EXPORT_CPP SClass* _xmlRoot(SClass* me_, SClass* me2); 27 | EXPORT_CPP Bool _xmlSave(SClass* me_, const U8* path, Bool compact); 28 | EXPORT_CPP SClass* _makeXml(SClass* me_, const U8* data); 29 | EXPORT_CPP SClass* _makeXmlEmpty(SClass* me_); 30 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_zip/lib_zip.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/lib/dll/additional_libs/lib_zip/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\..\common.h" 4 | 5 | #pragma comment(lib, "zlibstat.lib") 6 | 7 | #include 8 | 9 | EXPORT void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 10 | EXPORT Bool _unzip(const U8* dst, const U8* src); 11 | EXPORT Bool _zip(const U8* dst, const U8* src, S64 compression_level); 12 | -------------------------------------------------------------------------------- /src/lib/dll/lib_common/cui.c: -------------------------------------------------------------------------------- 1 | #include "cui.h" 2 | 3 | EXPORT void _flush(void) 4 | { 5 | fflush(stdout); 6 | } 7 | 8 | EXPORT Char _inputLetter(void) 9 | { 10 | Char c = fgetwc(stdin); 11 | if (c == WEOF) 12 | return 0xffff; 13 | return c; 14 | } 15 | 16 | EXPORT void _print(const U8* str) 17 | { 18 | const Char* str2; 19 | if (str == NULL) 20 | str2 = L"(null)"; 21 | else 22 | str2 = (const Char*)(str + 0x10); 23 | fputws(str2, stdout); // '_putws' is not used because it carries a new line at the end. 24 | #if defined(_DEBUG) 25 | OutputDebugString(str2); 26 | #endif 27 | } 28 | -------------------------------------------------------------------------------- /src/lib/dll/lib_common/cui.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT void _flush(void); 6 | EXPORT Char _inputLetter(void); 7 | EXPORT void _print(const U8* str); 8 | -------------------------------------------------------------------------------- /src/lib/dll/lib_common/file.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT void _fileInit(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 6 | EXPORT void _fileFin(void); 7 | EXPORT Bool _copyDir(const U8* dst, const U8* src); 8 | EXPORT Bool _copyFile(const U8* dst, const U8* src); 9 | EXPORT Bool _delDir(const U8* path); 10 | EXPORT Bool _delFile(const U8* path); 11 | EXPORT Bool _existPath(const U8* path); 12 | EXPORT Bool _forEachDir(const U8* path, Bool recursion, void* callback, void* data); 13 | EXPORT void* _fullPath(const U8* path); 14 | EXPORT void* _getCurDir(void); 15 | EXPORT Bool _makeDir(const U8* path); 16 | EXPORT Bool _moveDir(const U8* dst, const U8* src); 17 | EXPORT Bool _moveFile(const U8* dst, const U8* src); 18 | EXPORT void _setCurDir(const U8* path); 19 | EXPORT void* _openAsReadingImpl(const U8* path, Bool pack, Bool* success); 20 | EXPORT void _readerCloseImpl(void* handle); 21 | EXPORT void _readerSeekImpl(void* handle, S64 origin, S64 pos); 22 | EXPORT S64 _readerTellImpl(void* handle); 23 | EXPORT Bool _readerReadImpl(void* handle, void* buf, S64 start, S64 size); 24 | EXPORT void* _openAsWritingImpl(const U8* path, Bool append, Bool* success); 25 | EXPORT void _writerCloseImpl(void* handle); 26 | EXPORT void _writerFlushImpl(void* handle); 27 | EXPORT void _writerSeekImpl(void* handle, S64 origin, S64 pos); 28 | EXPORT S64 _writerTellImpl(void* handle); 29 | EXPORT void _writerWriteImpl(void* handle, void* data, S64 start, S64 size); 30 | EXPORT S64 _writerWriteNewLineImpl(void* handle); 31 | -------------------------------------------------------------------------------- /src/lib/dll/lib_common/lib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT double _acos(double x); 6 | EXPORT double _acosh(double x); 7 | EXPORT U64 _addr(SClass* me_); 8 | EXPORT double _asin(double x); 9 | EXPORT double _asinh(double x); 10 | EXPORT double _atan(double x); 11 | EXPORT double _atanh(double x); 12 | EXPORT double _ceil(double x); 13 | EXPORT void* _cmdLine(void); 14 | EXPORT double _cos(double x); 15 | EXPORT double _cosh(double x); 16 | EXPORT double _dist(double x, double y, double centerX, double centerY); 17 | EXPORT double _exp(double x); 18 | EXPORT double _floor(double x); 19 | EXPORT double _invRot(double x, double y, double centerX, double centerY); 20 | EXPORT double _ln(double x); 21 | EXPORT S64 _now(void); 22 | EXPORT double _sin(double x); 23 | EXPORT double _sinh(double x); 24 | EXPORT void __sleep(S64 ms); 25 | EXPORT double _sqrt(double x); 26 | EXPORT S64 _sysTime(void); 27 | EXPORT double _tan(double x); 28 | EXPORT double _tanh(double x); 29 | EXPORT U64 _toBit64Forcibly(double x); 30 | EXPORT double _toFloatForcibly(U64 x); 31 | -------------------------------------------------------------------------------- /src/lib/dll/lib_common/lib_common.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/lib/dll/lib_common/main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) 4 | { 5 | UNUSED(hinst); 6 | UNUSED(reason); 7 | UNUSED(reserved); 8 | return TRUE; 9 | } 10 | -------------------------------------------------------------------------------- /src/lib/dll/lib_common/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | -------------------------------------------------------------------------------- /src/lib/dll/lib_common/task.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT S64 _processRun(SClass* me_, Bool wait_until_exit); 6 | EXPORT void _processFin(SClass* me_); 7 | EXPORT Bool _processRunning(SClass* me_, S64* exit_code); 8 | EXPORT void* _processReadPipe(SClass* me_); 9 | EXPORT SClass* _makeProcess(SClass* me_, const U8* path, const U8* cmd_line); 10 | EXPORT void _taskOpen(const U8* path, S64 mode, Bool wait_until_exit); 11 | -------------------------------------------------------------------------------- /src/lib/dll/lib_draw2d/draw2d.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT_CPP void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 6 | EXPORT_CPP void _fin(); 7 | EXPORT_CPP void _circle(double x, double y, double radius_x, double radius_y, S64 color); 8 | EXPORT_CPP void _circleLine(double x, double y, double radius_x, double radius_y, double stroke_width, S64 color); 9 | EXPORT_CPP void _line(double x1, double y1, double x2, double y2, double stroke_width, S64 color); 10 | EXPORT_CPP void _rect(double x, double y, double width, double height, S64 color); 11 | EXPORT_CPP void _rectLine(double x, double y, double width, double height, double stroke_width, S64 color); 12 | EXPORT_CPP void _roundRect(double x, double y, double width, double height, double radius_x, double radius_y, S64 color); 13 | EXPORT_CPP void _roundRectLine(double x, double y, double width, double height, double radius_x, double radius_y, double stroke_width, S64 color); 14 | EXPORT_CPP void _tri(double x1, double y1, double x2, double y2, double x3, double y3, S64 color); 15 | -------------------------------------------------------------------------------- /src/lib/dll/lib_draw2d/lib_draw2d.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/lib/dll/lib_draw2d/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) 4 | { 5 | UNUSED(hinst); 6 | UNUSED(reason); 7 | UNUSED(reserved); 8 | return TRUE; 9 | } 10 | -------------------------------------------------------------------------------- /src/lib/dll/lib_draw2d/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | -------------------------------------------------------------------------------- /src/lib/dll/lib_net/http.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT void _httpFin(SClass* me_); 6 | EXPORT void* _httpGet(SClass* me_); 7 | EXPORT SClass* _makeHttp(SClass* me_, const U8* url, Bool post, const U8* agent); 8 | -------------------------------------------------------------------------------- /src/lib/dll/lib_net/lib_net.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/lib/dll/lib_net/main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include 4 | 5 | static WSADATA* WsaData = NULL; 6 | 7 | BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) 8 | { 9 | UNUSED(hinst); 10 | UNUSED(reason); 11 | UNUSED(reserved); 12 | return TRUE; 13 | } 14 | 15 | EXPORT void _init(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags) 16 | { 17 | InitEnvVars(heap, heap_cnt, app_code, use_res_flags); 18 | 19 | WsaData = (WSADATA*)AllocMem(sizeof(WSADATA)); 20 | if (WSAStartup(MAKEWORD(2, 2), WsaData) != 0) 21 | { 22 | FreeMem(WsaData); 23 | WsaData = NULL; 24 | } 25 | } 26 | 27 | EXPORT void _fin(void) 28 | { 29 | if (WsaData != NULL) 30 | { 31 | WSACleanup(); 32 | FreeMem(WsaData); 33 | WsaData = NULL; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/lib/dll/lib_net/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | -------------------------------------------------------------------------------- /src/lib/dll/lib_net/tcp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT Bool _tcpConnecting(SClass* me_); 6 | EXPORT void _tcpFin(SClass* me_); 7 | EXPORT void* _tcpReceive(SClass* me_, S64 size); 8 | EXPORT S64 _tcpReceivedSize(SClass* me_); 9 | EXPORT void _tcpSend(SClass* me_, const U8* data); 10 | EXPORT void _tcpServerFin(SClass* me_); 11 | EXPORT SClass* _tcpServerGet(SClass* me_, SClass* me2); 12 | EXPORT SClass* _makeTcpClient(SClass* me_, const U8* host, S64 port); 13 | EXPORT SClass* _makeTcpServer(SClass* me_, S64 port); 14 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/bc_decoder.cpp: -------------------------------------------------------------------------------- 1 | #include "bc_decoder.h" 2 | 3 | void* DecodeBc(size_t size, const void* data, int* width, int* height) 4 | { 5 | UNUSED(size); 6 | 7 | const U8* ptr = static_cast(data); 8 | if (*reinterpret_cast(ptr) != 0x20534444) 9 | THROW(0xe9170008); // ' SDD' 10 | ptr += sizeof(DWORD); 11 | if (*reinterpret_cast(ptr) != 124) 12 | THROW(0xe9170008); // Always 124. 13 | ptr += sizeof(DWORD); 14 | // DWORD header_flags = *reinterpret_cast(ptr); 15 | ptr += sizeof(DWORD); 16 | DWORD header_height = *reinterpret_cast(ptr); 17 | ptr += sizeof(DWORD); 18 | DWORD header_width = *reinterpret_cast(ptr); 19 | ptr += sizeof(DWORD); 20 | // DWORD header_pitch_or_linear_size 21 | ptr += sizeof(DWORD); 22 | if (*reinterpret_cast(ptr) != 1) 23 | THROW(0xe9170008); // DWORD header_depth 24 | ptr += sizeof(DWORD); 25 | if (*reinterpret_cast(ptr) != 1) 26 | THROW(0xe9170008); // DWORD header_mip_map 27 | ptr += sizeof(DWORD); 28 | for (int i = 0; i < 11; i++) 29 | ptr += sizeof(DWORD); 30 | if (*reinterpret_cast(ptr) != 32) 31 | THROW(0xe9170008); // Always 32. 32 | ptr += sizeof(DWORD); 33 | if ((*reinterpret_cast(ptr) & 0x00000004) == 0) 34 | THROW(0xe9170008); 35 | ptr += sizeof(DWORD); 36 | if (*reinterpret_cast(ptr) != 0x30315844) 37 | THROW(0xe9170008); // 'DX10' 38 | ptr += sizeof(DWORD); 39 | for (int i = 0; i < 11; i++) 40 | ptr += sizeof(DWORD); 41 | 42 | *width = static_cast(header_width); 43 | *height = static_cast(header_height); 44 | return const_cast(ptr); // 'Const' is removed to fit the interface, but of course it must not be rewritten. 45 | } 46 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/bc_decoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | void* DecodeBc(size_t size, const void* data, int* width, int* height); 6 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/bins/plane_knobj.c: -------------------------------------------------------------------------------- 1 | #include "../../common.h" 2 | 3 | const U8* GetPlaneKnobjBin(size_t* size) 4 | { 5 | static const U8 plane_knobj_bin[0x000000bc] = 6 | { 7 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 8 | 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 9 | 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 10 | 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 11 | 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 12 | 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 13 | }; 14 | 15 | *size = 0x000000bc; 16 | return plane_knobj_bin; 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/draw_ctrl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | #include "wnd_common.h" 5 | #include "draw_common.h" 6 | 7 | struct SDraw 8 | { 9 | SWndBase WndBase; 10 | Bool EqualMagnification; 11 | Bool DrawTwice; 12 | Bool Enter; 13 | Bool Editable; 14 | S16 WheelX; 15 | S16 WheelY; 16 | void* DrawBuf; 17 | void* OnPaint; 18 | void* OnMouseDownL; 19 | void* OnMouseDownR; 20 | void* OnMouseDownM; 21 | void* OnMouseDoubleClick; 22 | void* OnMouseUpL; 23 | void* OnMouseUpR; 24 | void* OnMouseUpM; 25 | void* OnMouseMove; 26 | void* OnMouseEnter; 27 | void* OnMouseLeave; 28 | void* OnMouseWheelX; 29 | void* OnMouseWheelY; 30 | void* OnFocus; 31 | void* OnKeyDown; 32 | void* OnKeyUp; 33 | void* OnKeyChar; 34 | void* OnScrollX; 35 | void* OnScrollY; 36 | void* OnSetMouseImg; 37 | }; 38 | 39 | EXPORT_CPP void _drawDtor(SClass* me_); 40 | EXPORT_CPP void _drawPaint(SClass* me_); 41 | EXPORT_CPP void _drawHideCaret(SClass* me_); 42 | EXPORT_CPP void _drawMouseCapture(SClass* me_, Bool enabled); 43 | EXPORT_CPP void _drawMoveCaret(SClass* me_, S64 x, S64 y); 44 | EXPORT_CPP void _drawShowCaret(SClass* me_, S64 height, S64 font_handle); 45 | EXPORT_CPP SClass* _makeDraw(SClass* me_, SClass* parent, S64 x, S64 y, S64 width, S64 height, S64 anchorX, S64 anchorY, Bool equalMagnification); 46 | EXPORT_CPP SClass* _makeDrawEditable(SClass* me_, SClass* parent, S64 x, S64 y, S64 width, S64 height); 47 | EXPORT_CPP SClass* _makeDrawReduced(SClass* me_, SClass* parent, S64 x, S64 y, S64 width, S64 height, S64 anchorX, S64 anchorY, Bool equalMagnification, S64 split); 48 | EXPORT_CPP void _target(SClass* draw_ctrl); 49 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/draw_device.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | #include "draw_common.h" 5 | 6 | EXPORT_CPP void _drawInit(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 7 | EXPORT_CPP void _drawFin(); 8 | EXPORT_CPP void _ambLight(double topR, double topG, double topB, double bottomR, double bottomG, double bottomB); 9 | EXPORT_CPP S64 _argbToColor(double a, double r, double g, double b); 10 | EXPORT_CPP void _autoClear(Bool enabled); 11 | EXPORT_CPP void _blend(S64 kind); 12 | EXPORT_CPP void _camera(double eyeX, double eyeY, double eyeZ, double atX, double atY, double atZ, double upX, double upY, double upZ); 13 | EXPORT_CPP Bool _capture(const U8* path); 14 | EXPORT_CPP void _clear(); 15 | EXPORT_CPP void _clearColor(S64 color); 16 | EXPORT_CPP S64 _cnt(); 17 | EXPORT_CPP void _colorToArgb(double* a, double* r, double* g, double* b, S64 color); 18 | EXPORT_CPP void _depth(Bool test, Bool write); 19 | EXPORT_CPP void _dirLight(double atX, double atY, double atZ, double r, double g, double b); 20 | EXPORT_CPP void _editPixels(const void* callback); 21 | EXPORT_CPP void _filterMonotone(S64 color, double rate); 22 | EXPORT_CPP void _filterNone(); 23 | EXPORT_CPP void _proj(double fovy, double aspectX, double aspectY, double nearZ, double farZ); 24 | EXPORT_CPP void _render(S64 fps); 25 | EXPORT_CPP void _sampler(S64 kind); 26 | EXPORT_CPP S64 _screenHeight(); 27 | EXPORT_CPP S64 _screenWidth(); 28 | 29 | // This method is provided for the 'draw2d' library. 30 | EXPORT_CPP void _set2dCallback(void* (*callback)(int, void*, void*)); 31 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/draw_font.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | #include "draw_common.h" 5 | 6 | EXPORT_CPP void _fontAlign(SClass* me_, S64 horizontal, S64 vertical); 7 | EXPORT_CPP void _fontCalcSize(SClass* me_, double* width, double* height, const U8* text); 8 | EXPORT_CPP double _fontCalcWidth(SClass* me_, const U8* text); 9 | EXPORT_CPP void _fontDraw(SClass* me_, double dstX, double dstY, const U8* text, S64 color); 10 | EXPORT_CPP void _fontDrawScale(SClass* me_, double dstX, double dstY, double dstScaleX, double dstScaleY, const U8* text, S64 color); 11 | EXPORT_CPP void _fontFin(SClass* me_); 12 | EXPORT_CPP double _fontGetHeight(SClass* me_); 13 | EXPORT_CPP S64 _fontHandle(SClass* me_); 14 | EXPORT_CPP double _fontMaxHeight(SClass* me_); 15 | EXPORT_CPP double _fontMaxWidth(SClass* me_); 16 | EXPORT_CPP void _fontSetHeight(SClass* me_, double height); 17 | EXPORT_CPP SClass* _makeFont(SClass* me_, const U8* fontName, S64 size, bool bold, bool italic, bool proportional, double advance); 18 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/draw_obj.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | #include "draw_common.h" 5 | 6 | EXPORT_CPP void _objDraw(SClass* me_, S64 element, double frame, SClass* diffuse, SClass* specular, SClass* normal); 7 | EXPORT_CPP void _objDrawFlat(SClass* me_, S64 element, double frame, SClass* diffuse); 8 | EXPORT_CPP void _objDrawOutline(SClass* me_, S64 element, double frame, double width, S64 color); 9 | EXPORT_CPP void _objDrawToon(SClass* me_, S64 element, double frame, SClass* diffuse, SClass* specular, SClass* normal); 10 | EXPORT_CPP void _objDrawToonWithShadow(SClass* me_, S64 element, double frame, SClass* diffuse, SClass* specular, SClass* normal, SClass* shadow); 11 | EXPORT_CPP void _objDrawWithShadow(SClass* me_, S64 element, double frame, SClass* diffuse, SClass* specular, SClass* normal, SClass* shadow); 12 | EXPORT_CPP void _objFin(SClass* me_); 13 | EXPORT_CPP void _objLook(SClass* me_, double x, double y, double z, double atX, double atY, double atZ, double upX, double upY, double upZ, Bool fixUp); 14 | EXPORT_CPP void _objLookCamera(SClass* me_, double x, double y, double z, double upX, double upY, double upZ, Bool fixUp); 15 | EXPORT_CPP void _objMat(SClass* me_, const U8* mat, const U8* normMat); 16 | EXPORT_CPP void _objPos(SClass* me_, double scaleX, double scaleY, double scaleZ, double rotX, double rotY, double rotZ, double transX, double transY, double transZ); 17 | EXPORT_CPP SClass* _makeBox(SClass* me_); 18 | EXPORT_CPP SClass* _makeObj(SClass* me_, const U8* data); 19 | EXPORT_CPP SClass* _makePlane(SClass* me_); 20 | EXPORT_CPP SClass* _makeSphere(SClass* me_); 21 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/draw_particle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | #include "draw_common.h" 5 | 6 | EXPORT_CPP void _particleDraw(SClass* me_, SClass* tex); 7 | EXPORT_CPP void _particleDraw2d(SClass* me_, SClass* tex); 8 | EXPORT_CPP void _particleEmit(SClass* me_, double x, double y, double z, double velo_x, double velo_y, double velo_z, double size, double size_velo, double rot, double rot_velo); 9 | EXPORT_CPP void _particleFin(SClass* me_); 10 | EXPORT_CPP SClass* _makeParticle(SClass* me_, S64 life_span, S64 color1, S64 color2, double friction, double accel_x, double accel_y, double accel_z, double size_accel, double rot_accel); 11 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/draw_primitive.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | #include "draw_common.h" 5 | 6 | EXPORT_CPP void _circle(double x, double y, double radiusX, double radiusY, S64 color); 7 | EXPORT_CPP void _circleLine(double x, double y, double radiusX, double radiusY, S64 color); 8 | EXPORT_CPP void _line(double x1, double y1, double x2, double y2, S64 color); 9 | EXPORT_CPP void _rect(double x, double y, double w, double h, S64 color); 10 | EXPORT_CPP void _rectLine(double x, double y, double w, double h, S64 color); 11 | EXPORT_CPP void _tri(double x1, double y1, double x2, double y2, double x3, double y3, S64 color); 12 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/draw_shadow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | #include "draw_common.h" 5 | 6 | EXPORT_CPP void _shadowAdd(SClass* me_, SClass* obj, S64 element, double frame); 7 | EXPORT_CPP void _shadowBeginRecord(SClass* me_, double x, double y, double z, double radius); 8 | EXPORT_CPP void _shadowEndRecord(SClass* me_); 9 | EXPORT_CPP void _shadowFin(SClass* me_); 10 | EXPORT_CPP SClass* _makeShadow(SClass* me_, S64 width, S64 height); 11 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/draw_tex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | #include "draw_common.h" 5 | 6 | EXPORT_CPP void _texDraw(SClass* me_, double dstX, double dstY, double srcX, double srcY, double srcW, double srcH, S64 color); 7 | EXPORT_CPP void _texDrawRot(SClass* me_, double dstX, double dstY, double dstW, double dstH, double srcX, double srcY, double srcW, double srcH, double centerX, double centerY, double angle, S64 color); 8 | EXPORT_CPP void _texDrawScale(SClass* me_, double dstX, double dstY, double dstW, double dstH, double srcX, double srcY, double srcW, double srcH, S64 color); 9 | EXPORT_CPP void _texFin(SClass* me_); 10 | EXPORT_CPP S64 _texHeight(SClass* me_); 11 | EXPORT_CPP S64 _texImgHeight(SClass* me_); 12 | EXPORT_CPP S64 _texImgWidth(SClass* me_); 13 | EXPORT_CPP S64 _texWidth(SClass* me_); 14 | EXPORT_CPP SClass* _makeTex(SClass* me_, const U8* data, const U8* path); 15 | EXPORT_CPP SClass* _makeTexArgb(SClass* me_, const U8* data, const U8* path); 16 | EXPORT_CPP SClass* _makeTexEvenArgb(SClass* me_, double a, double r, double g, double b); 17 | EXPORT_CPP SClass* _makeTexEvenColor(SClass* me_, S64 color); 18 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/input.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT_CPP void _inputInit(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 6 | EXPORT_CPP void _inputFin(); 7 | EXPORT_CPP void _inputUpdate(); 8 | EXPORT_CPP void _enableCfgKey(Bool enabled); 9 | EXPORT_CPP S64 _getCfg(S64 idx, S64 btn); 10 | EXPORT_CPP Bool _inputKey(S64 key); 11 | EXPORT_CPP void _mousePos(S64* x, S64* y); 12 | EXPORT_CPP S64 _pad(S64 idx, S64 btn); 13 | EXPORT_CPP void _setCfg(S64 idx, S64 btn, S64 newBtn); 14 | EXPORT_CPP void _setCfgKey(S64 idx, S64 btn, const U8* keys); 15 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/jpg_decoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | void* DecodeJpg(size_t size, const void* data, int* width, int* height); 6 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) 4 | { 5 | UNUSED(hinst); 6 | UNUSED(reason); 7 | UNUSED(reserved); 8 | return TRUE; 9 | } 10 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/png_decoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | void* DecodePng(size_t size, const void* data, int* width, int* height); 6 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/snd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | EXPORT_CPP void _sndInit(void* heap, S64* heap_cnt, S64 app_code, const U8* use_res_flags); 6 | EXPORT_CPP void _sndFin(); 7 | EXPORT_CPP void _sndFin2(SClass* me_); 8 | EXPORT_CPP void _sndFreq(SClass* me_, double value); 9 | EXPORT_CPP double _sndGetPos(SClass* me_); 10 | EXPORT_CPP double _sndLen(SClass* me_); 11 | EXPORT_CPP void _sndPan(SClass* me_, double value); 12 | EXPORT_CPP void _sndPlay(SClass* me_); 13 | EXPORT_CPP Bool _sndPlaying(SClass* me_); 14 | EXPORT_CPP void _sndPlayLoop(SClass* me_); 15 | EXPORT_CPP void _sndSetPos(SClass* me_, double value); 16 | EXPORT_CPP void _sndStop(SClass* me_); 17 | EXPORT_CPP void _sndVolume(SClass* me_, double value); 18 | EXPORT_CPP double _getMainVolume(); 19 | EXPORT_CPP SClass* _makeSnd(SClass* me_, const U8* data, const U8* path); 20 | EXPORT_CPP void _setMainVolume(double value); 21 | -------------------------------------------------------------------------------- /src/lib/dll/lib_win/wav_decoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "..\common.h" 4 | 5 | void* LoadWav(size_t size, const U8* data, S64* channel, S64* samples_per_sec, S64* bits_per_sample, S64* total, void(**func_close)(void*), Bool(**func_read)(void*, void*, S64, S64)); 6 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/bin_to_text.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/lib/dll/shaders/bin_to_text.exe -------------------------------------------------------------------------------- /src/lib/dll/shaders/circle_line_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Color; 4 | float4 PixelLen; 5 | }; 6 | 7 | struct PS_INPUT 8 | { 9 | float4 Pos: SV_POSITION; 10 | float2 Tex: TEXCOORD; 11 | }; 12 | 13 | float4 main(PS_INPUT input): SV_TARGET 14 | { 15 | float4 output = Color; 16 | if (output.a <= 0.02f) 17 | discard; 18 | float len = input.Tex.x * input.Tex.x + input.Tex.y * input.Tex.y; 19 | if (len > 1.0f) 20 | discard; 21 | output.a *= 1.0f - clamp(abs((1.0f - len) * PixelLen.x - PixelLen.y) - PixelLen.y + 1.0f, 0.0f, 1.0f); 22 | return output; 23 | } 24 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/circle_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Color; 4 | float4 PixelLen; 5 | }; 6 | 7 | struct PS_INPUT 8 | { 9 | float4 Pos: SV_POSITION; 10 | float2 Tex: TEXCOORD; 11 | }; 12 | 13 | float4 main(PS_INPUT input): SV_TARGET 14 | { 15 | float4 output = Color; 16 | if (output.a <= 0.02f) 17 | discard; 18 | float len = input.Tex.x * input.Tex.x + input.Tex.y * input.Tex.y; 19 | if (len > 1.0f) 20 | discard; 21 | output.a *= min((1.0f - len) * PixelLen.x, 1.0f); 22 | return output; 23 | } 24 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/circle_vs.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Vecs; 4 | }; 5 | 6 | struct VS_INPUT 7 | { 8 | float2 Weight: K_WEIGHT; 9 | }; 10 | 11 | struct VS_OUTPUT 12 | { 13 | float4 Pos: SV_POSITION; 14 | float2 Tex: TEXCOORD; 15 | }; 16 | 17 | VS_OUTPUT main(VS_INPUT input) 18 | { 19 | VS_OUTPUT output; 20 | output.Pos.xy = Vecs.rg + Vecs.ba * input.Weight; 21 | output.Pos.z = 0.0f; 22 | output.Pos.w = 1.0f; 23 | output.Tex = input.Weight; 24 | return output; 25 | } 26 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/data/d0000.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/lib/dll/shaders/data/d0000.knd -------------------------------------------------------------------------------- /src/lib/dll/shaders/data/d0002.knd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/lib/dll/shaders/data/d0002.knd -------------------------------------------------------------------------------- /src/lib/dll/shaders/filter_monotone_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Color; 4 | }; 5 | 6 | Texture2D Img: register(t0); 7 | SamplerState Sampler: register(s0); 8 | 9 | struct PS_INPUT 10 | { 11 | float4 Pos: SV_POSITION; 12 | float2 Tex: TEXCOORD; 13 | }; 14 | 15 | float4 main(PS_INPUT input): SV_TARGET 16 | { 17 | float4 tex_color = Img.Sample(Sampler, input.Tex); 18 | float luminance = 0.298912f * tex_color.r + 0.586611f * tex_color.g + 0.114478f * tex_color.b; 19 | float4 output; 20 | output.rgb = luminance * float3(Color.rgb) * Color.a + tex_color.rgb * (1.0f - Color.a); 21 | output.a = 1.0f; 22 | return output; 23 | } 24 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/filter_none_ps.fx: -------------------------------------------------------------------------------- 1 | Texture2D Img: register(t0); 2 | SamplerState Sampler: register(s0); 3 | 4 | struct PS_INPUT 5 | { 6 | float4 Pos: SV_POSITION; 7 | float2 Tex: TEXCOORD; 8 | }; 9 | 10 | float4 main(PS_INPUT input): SV_TARGET 11 | { 12 | float4 output = Img.Sample(Sampler, input.Tex); 13 | return output; 14 | } 15 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/filter_vs.fx: -------------------------------------------------------------------------------- 1 | struct VS_INPUT 2 | { 3 | float2 Pos: K_POSITION; 4 | }; 5 | 6 | struct VS_OUTPUT 7 | { 8 | float4 Pos: SV_POSITION; 9 | float2 Tex: TEXCOORD; 10 | }; 11 | 12 | VS_OUTPUT main(VS_INPUT input) 13 | { 14 | VS_OUTPUT output; 15 | output.Pos.xy = input.Pos; 16 | output.Pos.z = 0.0f; 17 | output.Pos.w = 1.0f; 18 | output.Tex.x = (input.Pos.x + 1.0f) / 2.0f; 19 | output.Tex.y = 1.0f - (input.Pos.y + 1.0f) / 2.0f; 20 | return output; 21 | } 22 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/font_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Color; 4 | }; 5 | 6 | Texture2D Img: register(t0); 7 | SamplerState Sampler: register(s0); 8 | 9 | struct PS_INPUT 10 | { 11 | float4 Pos: SV_POSITION; 12 | float2 Tex: TEXCOORD; 13 | }; 14 | 15 | float4 main(PS_INPUT input): SV_TARGET 16 | { 17 | float4 output = float4(1.0f, 1.0f, 1.0f, Img.Sample(Sampler, input.Tex).r) * Color; 18 | if (output.a <= 0.02f) 19 | discard; 20 | return output; 21 | } 22 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/obj_fast_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 AmbTopColor; 4 | float4 AmbBottomColor; 5 | float4 DirColor; 6 | float4 Eye; 7 | float4 Dir; 8 | float4 Half; 9 | }; 10 | 11 | Texture2D ImgDiffuse: register(t0); 12 | Texture2D ImgSpecular: register(t1); 13 | SamplerState Sampler: register(s0); 14 | #ifdef SM 15 | Texture2D ImgSm: register(t2); 16 | SamplerComparisonState SamplerSm: register(s1); 17 | #endif 18 | 19 | struct PS_INPUT 20 | { 21 | float4 Pos: SV_POSITION; 22 | float2 Tex: TEXCOORD; 23 | float3 Normal: NORMAL; 24 | #ifdef SM 25 | float4 TexSm: K_SM_COORD; 26 | #endif 27 | }; 28 | 29 | float4 main(PS_INPUT input): SV_TARGET 30 | { 31 | float4 output; 32 | float4 diffuse = ImgDiffuse.Sample(Sampler, input.Tex); 33 | float4 specular = ImgSpecular.Sample(Sampler, input.Tex); 34 | 35 | input.Normal = normalize(input.Normal); 36 | 37 | float up = input.Normal.y * 0.5f + 0.5f; 38 | 39 | #ifdef SM 40 | float3 coord = input.TexSm.xyz / input.TexSm.w; 41 | float bias = min(0.01f + 0.01f * max(abs(ddx(coord.z)), abs(ddy(coord.z))), 0.1f); 42 | float3 dirColor2 = DirColor.xyz * ImgSm.SampleCmpLevelZero(SamplerSm, coord.xy, saturate(coord.z - bias)); 43 | #else 44 | float3 dirColor2 = DirColor.xyz; 45 | #endif 46 | 47 | output.xyz = 48 | diffuse.xyz * 49 | ( 50 | AmbTopColor.xyz * up + AmbBottomColor.xyz * (1.0f - up) + 51 | dirColor2 * 20.0f * max(1.0f - (specular.xyz + (1.0f - specular.xyz) * pow(max(1.0f - dot(input.Normal, Dir.xyz), 0.0f), 5.0f)), 0.0f) / 3.14159265358979f 52 | ) + 53 | dirColor2 * (0.0397436f * specular.w + 0.0856832f) * (specular.xyz + (1.0f - specular.xyz) * Half.w) * pow(max(dot(input.Normal, Half.xyz), 0.0f), specular.w) / max(max(dot(input.Normal, Dir.xyz), dot(input.Normal, Eye.xyz)), 0.00001f); 54 | output.a = diffuse.w; 55 | 56 | if (output.a <= 0.02f) 57 | discard; 58 | return output; 59 | } 60 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/obj_flat_ps.fx: -------------------------------------------------------------------------------- 1 | Texture2D ImgDiffuse: register(t0); 2 | SamplerState Sampler: register(s0); 3 | 4 | struct PS_INPUT 5 | { 6 | float4 Pos: SV_POSITION; 7 | float2 Tex: TEXCOORD; 8 | }; 9 | 10 | float4 main(PS_INPUT input): SV_TARGET 11 | { 12 | float4 output; 13 | 14 | output = ImgDiffuse.Sample(Sampler, input.Tex); 15 | 16 | if (output.a <= 0.02f) 17 | discard; 18 | return output; 19 | } 20 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/obj_flat_vs.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4x4 World; 4 | float4x4 NormWorld; 5 | float4x4 ProjView; 6 | float4x4 ShadowProjView; 7 | float4 Eye; 8 | float4 Dir; 9 | #ifdef JOINT 10 | float4x4 Joint[256]; 11 | #endif 12 | }; 13 | 14 | struct VS_INPUT 15 | { 16 | float3 Pos: POSITION; 17 | float3 Normal: NORMAL; 18 | #ifndef FAST 19 | float3 Tangent: TANGENT; 20 | #endif 21 | float2 Tex: TEXCOORD; 22 | #ifdef JOINT 23 | float4 Weight: K_WEIGHT; 24 | int4 Joint: K_JOINT; 25 | #endif 26 | }; 27 | 28 | struct VS_OUTPUT 29 | { 30 | float4 Pos: SV_POSITION; 31 | float2 Tex: TEXCOORD; 32 | }; 33 | 34 | VS_OUTPUT main(VS_INPUT input) 35 | { 36 | VS_OUTPUT output; 37 | 38 | // Convert vertices to world space. 39 | #ifdef JOINT 40 | float4x4 joint_mat = input.Weight[0] * Joint[input.Joint[0]] + input.Weight[1] * Joint[input.Joint[1]]; 41 | float4x4 mat = mul(World, joint_mat); 42 | float4 world_pos = mul(mat, float4(input.Pos, 1.0f)); 43 | #else 44 | float4 world_pos = mul(World, float4(input.Pos, 1.0f)); 45 | #endif 46 | 47 | output.Pos = mul(ProjView, world_pos); 48 | output.Tex = input.Tex; 49 | 50 | return output; 51 | } 52 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/obj_outline_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 OutlineColor; 4 | }; 5 | 6 | struct PS_INPUT 7 | { 8 | float4 Pos: SV_POSITION; 9 | }; 10 | 11 | float4 main(PS_INPUT input): SV_TARGET 12 | { 13 | float4 output = OutlineColor; 14 | 15 | if (output.a <= 0.02f) 16 | discard; 17 | return output; 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/obj_shadow_vs.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4x4 World; 4 | float4x4 ProjView; 5 | #ifdef JOINT 6 | float4x4 Joint[256]; 7 | #endif 8 | }; 9 | 10 | struct VS_INPUT 11 | { 12 | float3 Pos: POSITION; 13 | #ifdef JOINT 14 | float4 Weight: K_WEIGHT; 15 | int4 Joint: K_JOINT; 16 | #endif 17 | }; 18 | 19 | struct VS_OUTPUT 20 | { 21 | float4 Pos: SV_POSITION; 22 | }; 23 | 24 | VS_OUTPUT main(VS_INPUT input) 25 | { 26 | VS_OUTPUT output; 27 | 28 | // Convert vertices to world space. 29 | #ifdef JOINT 30 | float4x4 joint_mat = input.Weight[0] * Joint[input.Joint[0]] + input.Weight[1] * Joint[input.Joint[1]]; 31 | float4x4 mat = mul(World, joint_mat); 32 | float4 world_pos = mul(mat, float4(input.Pos, 1.0f)); 33 | #else 34 | float4 world_pos = mul(World, float4(input.Pos, 1.0f)); 35 | #endif 36 | output.Pos = mul(ProjView, world_pos); 37 | 38 | return output; 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/particle_2d_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Color1; 4 | float4 Color2; 5 | }; 6 | 7 | Texture2D Img: register(t0); 8 | SamplerState Sampler: register(s0); 9 | 10 | struct PS_INPUT 11 | { 12 | float4 Pos: SV_POSITION; 13 | float2 Tex: TEXCOORD; 14 | float Lifespan: K_LIFESPAN; 15 | }; 16 | 17 | float4 main(PS_INPUT input): SV_TARGET 18 | { 19 | float4 color = Color1 * input.Lifespan + Color2 * (1.0f - input.Lifespan); 20 | float4 output = Img.Sample(Sampler, input.Tex) * color; 21 | return output; 22 | } 23 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/particle_2d_vs.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Screen; 4 | }; 5 | 6 | Texture2D Img0: register(t0); 7 | Texture2D Img2: register(t1); 8 | SamplerState Sampler: register(s0); 9 | 10 | struct VS_INPUT 11 | { 12 | float2 Pos: K_POSITION; 13 | float Idx: K_IDX; 14 | }; 15 | 16 | struct VS_OUTPUT 17 | { 18 | float4 Pos: SV_POSITION; 19 | float2 Tex: TEXCOORD; 20 | float Lifespan: K_LIFESPAN; 21 | }; 22 | 23 | VS_OUTPUT main(VS_INPUT input) 24 | { 25 | VS_OUTPUT output; 26 | 27 | float2 tex = float2(input.Idx, 0.0f); 28 | float4 tex0 = Img0.SampleLevel(Sampler, tex, 0); 29 | float4 tex2 = Img2.SampleLevel(Sampler, tex, 0); 30 | 31 | if (tex0.w <= 0.0f) 32 | { 33 | output.Pos.xy = 0.0f; 34 | output.Lifespan = 0.0f; 35 | } 36 | else 37 | { 38 | float cos_th = cos(tex2.z); 39 | float sin_th = sin(tex2.z); 40 | output.Pos.xy = input.Pos * tex2.x / 2.0f; 41 | float x2, y2; 42 | x2 = cos_th * output.Pos.x + sin_th * output.Pos.y; 43 | y2 = -sin_th * output.Pos.x + cos_th * output.Pos.y; 44 | output.Pos.x = x2; 45 | output.Pos.y = y2; 46 | output.Pos.x += tex0.x; 47 | output.Pos.y += 1.0f / Screen.y - tex0.y; 48 | output.Pos.xy = output.Pos.xy * Screen.xy * 2.0f - 1.0f; 49 | output.Lifespan = clamp((tex0.w - 1.0f) / Screen.w, 0.0f, 1.0f); 50 | } 51 | output.Pos.z = tex0.z; 52 | output.Pos.w = 1.0f; 53 | output.Tex.x = (input.Pos.x + 1.0f) / 2.0f; 54 | output.Tex.y = 1.0f - (input.Pos.y + 1.0f) / 2.0f; 55 | return output; 56 | } 57 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/particle_updating_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 AccelAndFriction; 4 | float4 SizeAccelAndRotAccel; 5 | }; 6 | 7 | Texture2D Img0: register(t0); 8 | Texture2D Img1: register(t1); 9 | Texture2D Img2: register(t2); 10 | SamplerState Sampler: register(s0); 11 | 12 | struct PS_INPUT 13 | { 14 | float4 Pos: SV_POSITION; 15 | float2 Tex: TEXCOORD; 16 | }; 17 | 18 | struct PS_OUTPUT 19 | { 20 | float4 Out0: SV_TARGET0; 21 | float4 Out1: SV_TARGET1; 22 | float4 Out2: SV_TARGET2; 23 | }; 24 | 25 | PS_OUTPUT main(PS_INPUT input) 26 | { 27 | PS_OUTPUT output; 28 | output.Out0 = Img0.Sample(Sampler, input.Tex); 29 | output.Out1 = Img1.Sample(Sampler, input.Tex); 30 | output.Out2 = Img2.Sample(Sampler, input.Tex); 31 | 32 | // lifespan 33 | output.Out0.w = max(output.Out0.w - 1.0f, 0.0f); 34 | 35 | // velo 36 | output.Out1.xyz = (output.Out1.xyz + AccelAndFriction.xyz) * AccelAndFriction.w; 37 | 38 | // xyz 39 | output.Out0.xyz += output.Out1.xyz; 40 | 41 | // size 42 | output.Out2.y += SizeAccelAndRotAccel.x; 43 | output.Out2.x = max(output.Out2.x + output.Out2.y, 0.0f); 44 | 45 | // rot 46 | output.Out2.w += SizeAccelAndRotAccel.y; 47 | output.Out2.z += output.Out2.w; 48 | 49 | return output; 50 | } 51 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/particle_updating_vs.fx: -------------------------------------------------------------------------------- 1 | struct VS_INPUT 2 | { 3 | float2 Pos: K_POSITION; 4 | }; 5 | 6 | struct VS_OUTPUT 7 | { 8 | float4 Pos: SV_POSITION; 9 | float2 Tex: TEXCOORD; 10 | }; 11 | 12 | VS_OUTPUT main(VS_INPUT input) 13 | { 14 | VS_OUTPUT output; 15 | output.Pos.xy = input.Pos; 16 | output.Pos.z = 0.0f; 17 | output.Pos.w = 1.0f; 18 | output.Tex.x = (input.Pos.x + 1.0f) / 2.0f; 19 | output.Tex.y = 1.0f - (input.Pos.y + 1.0f) / 2.0f; 20 | return output; 21 | } 22 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/rect_vs.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Vecs; 4 | }; 5 | 6 | struct VS_INPUT 7 | { 8 | float2 Weight: K_WEIGHT; 9 | }; 10 | 11 | struct VS_OUTPUT 12 | { 13 | float4 Pos: SV_POSITION; 14 | }; 15 | 16 | VS_OUTPUT main(VS_INPUT input) 17 | { 18 | VS_OUTPUT output; 19 | output.Pos.xy = Vecs.rg + Vecs.ba * input.Weight; 20 | output.Pos.z = 0.0f; 21 | output.Pos.w = 1.0f; 22 | return output; 23 | } 24 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/tex_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Color; 4 | }; 5 | 6 | Texture2D Img: register(t0); 7 | SamplerState Sampler: register(s0); 8 | 9 | struct PS_INPUT 10 | { 11 | float4 Pos: SV_POSITION; 12 | float2 Tex: TEXCOORD; 13 | }; 14 | 15 | float4 main(PS_INPUT input): SV_TARGET 16 | { 17 | float4 output = Img.Sample(Sampler, input.Tex) * Color; 18 | if (output.a <= 0.02f) 19 | discard; 20 | return output; 21 | } 22 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/tex_rot_vs.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Vecs[2]; 4 | float4 Rot[2]; 5 | }; 6 | 7 | struct VS_INPUT 8 | { 9 | float2 Weight: K_WEIGHT; 10 | }; 11 | 12 | struct VS_OUTPUT 13 | { 14 | float4 Pos: SV_POSITION; 15 | float2 Tex: TEXCOORD; 16 | }; 17 | 18 | VS_OUTPUT main(VS_INPUT input) 19 | { 20 | VS_OUTPUT output; 21 | float2 xy = Vecs[0].ba * input.Weight - Rot[0].rg; 22 | output.Pos.x = xy.x * Rot[0].a - xy.y * Rot[0].b / Rot[1].r; 23 | output.Pos.y = xy.x * Rot[0].b * Rot[1].r + xy.y * Rot[0].a; 24 | output.Pos.xy += Vecs[0].rg + Rot[0].rg; 25 | output.Pos.z = 0.0f; 26 | output.Pos.w = 1.0f; 27 | output.Tex = Vecs[1].rg + Vecs[1].ba * input.Weight; 28 | return output; 29 | } 30 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/tex_vs.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Vecs[2]; 4 | }; 5 | 6 | struct VS_INPUT 7 | { 8 | float2 Weight: K_WEIGHT; 9 | }; 10 | 11 | struct VS_OUTPUT 12 | { 13 | float4 Pos: SV_POSITION; 14 | float2 Tex: TEXCOORD; 15 | }; 16 | 17 | VS_OUTPUT main(VS_INPUT input) 18 | { 19 | VS_OUTPUT output; 20 | output.Pos.xy = Vecs[0].rg + Vecs[0].ba * input.Weight; 21 | output.Pos.z = 0.0f; 22 | output.Pos.w = 1.0f; 23 | output.Tex = Vecs[1].rg + Vecs[1].ba * input.Weight; 24 | return output; 25 | } 26 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/tri_ps.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Color; 4 | }; 5 | 6 | struct PS_INPUT 7 | { 8 | float4 Pos: SV_POSITION; 9 | }; 10 | 11 | float4 main(PS_INPUT input): SV_TARGET 12 | { 13 | float4 output = Color; 14 | if (output.a <= 0.02f) 15 | discard; 16 | return output; 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/dll/shaders/tri_vs.fx: -------------------------------------------------------------------------------- 1 | cbuffer ConstBuf: register(b0) 2 | { 3 | float4 Vecs[2]; 4 | }; 5 | 6 | struct VS_INPUT 7 | { 8 | float3 Weight: K_WEIGHT; 9 | }; 10 | 11 | struct VS_OUTPUT 12 | { 13 | float4 Pos: SV_POSITION; 14 | }; 15 | 16 | VS_OUTPUT main(VS_INPUT input) 17 | { 18 | VS_OUTPUT output; 19 | output.Pos.xy = Vecs[0].rg * input.Weight.r + Vecs[0].ba * input.Weight.g + Vecs[1].rg * input.Weight.b; 20 | output.Pos.z = 0.0f; 21 | output.Pos.w = 1.0f; 22 | return output; 23 | } 24 | -------------------------------------------------------------------------------- /src/lib/sys/_preset00.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("Hello, world!") 3 | end func 4 | -------------------------------------------------------------------------------- /src/lib/sys/_preset00_wnd.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func main() 3 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "") 4 | var editLog: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 1000, 744, %scale, %scale) 5 | do editLog.readonly(true) 6 | do editLog.setText("Hello, world!") 7 | 8 | while(wnd@act()) 9 | end while 10 | end func 11 | -------------------------------------------------------------------------------- /src/lib/sys/_preset01.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("q") 3 | end func 4 | -------------------------------------------------------------------------------- /src/lib/sys/_preset01_wnd.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func main() 3 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "") 4 | var editLog: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 1000, 744, %scale, %scale) 5 | do editLog.readonly(true) 6 | do editLog.setText("q") 7 | 8 | while(wnd@act()) 9 | end while 10 | end func 11 | -------------------------------------------------------------------------------- /src/lib/sys/_preset02.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | for i(1, 100) 3 | if(i % 15 = 0) 4 | do cui@print("FizzBuzz\n") 5 | elif(i % 3 = 0) 6 | do cui@print("Fizz\n") 7 | elif(i % 5 = 0) 8 | do cui@print("Buzz\n") 9 | else 10 | do cui@print(i.toStr() ~ "\n") 11 | end if 12 | end for 13 | end func 14 | -------------------------------------------------------------------------------- /src/lib/sys/_preset02_wnd.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func main() 3 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "") 4 | var editLog: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 1000, 744, %scale, %scale) 5 | do editLog.readonly(true) 6 | do editLog.setText("") 7 | for i(1, 100) 8 | if(i % 15 = 0) 9 | do editLog.setText(editLog.getText() ~ "FizzBuzz\n") 10 | elif(i % 3 = 0) 11 | do editLog.setText(editLog.getText() ~ "Fizz\n") 12 | elif(i % 5 = 0) 13 | do editLog.setText(editLog.getText() ~ "Buzz\n") 14 | else 15 | do editLog.setText(editLog.getText() ~ (i.toStr() ~ "\n")) 16 | end if 17 | end for 18 | 19 | while(wnd@act()) 20 | end while 21 | end func 22 | -------------------------------------------------------------------------------- /src/lib/sys/_preset03.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | for i(99, 2, -1) 3 | do cui@print(i.toStr() ~ " bottles of beer on the wall, " ~ i.toStr() ~ " bottles of beer.\n") 4 | do cui@print("Take one down, pass it around, " ~ (i - 1).toStr() ~ " bottles of beer on the wall.\n") 5 | end for 6 | do cui@print("2 bottles of beer on the wall, 2 bottles of beer.\n") 7 | do cui@print("Take one down, pass it around, 1 bottle of beer on the wall.\n") 8 | do cui@print("1 bottle of beer on the wall, 1 bottle of beer.\n") 9 | do cui@print("Take one down, pass it around, no more bottles of beer on the wall.\n") 10 | do cui@print("No more bottles of beer on the wall, no more bottles of beer.\n") 11 | do cui@print("Go to the store and buy some more, 99 bottles of beer on the wall.\n") 12 | end func 13 | -------------------------------------------------------------------------------- /src/lib/sys/_preset03_wnd.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func main() 3 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "") 4 | var editLog: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 1000, 744, %scale, %scale) 5 | do editLog.readonly(true) 6 | do editLog.setText("") 7 | for i(99, 2, -1) 8 | do editLog.setText(editLog.getText() ~ (i.toStr() ~ " bottles of beer on the wall, " ~ i.toStr() ~ " bottles of beer.\n")) 9 | do editLog.setText(editLog.getText() ~ ("Take one down, pass it around, " ~ (i - 1).toStr() ~ " bottles of beer on the wall.\n")) 10 | end for 11 | do editLog.setText(editLog.getText() ~ "2 bottles of beer on the wall, 2 bottles of beer.\n") 12 | do editLog.setText(editLog.getText() ~ "Take one down, pass it around, 1 bottle of beer on the wall.\n") 13 | do editLog.setText(editLog.getText() ~ "1 bottle of beer on the wall, 1 bottle of beer.\n") 14 | do editLog.setText(editLog.getText() ~ "Take one down, pass it around, no more bottles of beer on the wall.\n") 15 | do editLog.setText(editLog.getText() ~ "No more bottles of beer on the wall, no more bottles of beer.\n") 16 | do editLog.setText(editLog.getText() ~ "Go to the store and buy some more, 99 bottles of beer on the wall.\n") 17 | 18 | while(wnd@act()) 19 | end while 20 | end func 21 | -------------------------------------------------------------------------------- /src/lib/sys/cursor.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | +class Cursor() 3 | *func ctor() 4 | do me.num :: 1 5 | do me.pos :: 0 6 | end func 7 | 8 | +func get(): int 9 | ret me.pos 10 | end func 11 | 12 | +func set(num: int, pos: int, horizontal: bool, ring: bool) 13 | if(dbg) 14 | if(num < 1 | pos < 0 | num <= pos) 15 | throw 0xE9170006 16 | end if 17 | end if 18 | do me.num :: num 19 | do me.pos :: pos 20 | do me.horizontal :: horizontal 21 | do me.ring :: ring 22 | end func 23 | 24 | +func update() 25 | if(me.horizontal) 26 | if(input@pad(0, %left) = 1) 27 | do me.pos :- 1 28 | elif(input@pad(0, %right) = 1) 29 | do me.pos :+ 1 30 | end if 31 | else 32 | if(input@pad(0, %up) = 1) 33 | do me.pos :- 1 34 | elif(input@pad(0, %down) = 1) 35 | do me.pos :+ 1 36 | end if 37 | end if 38 | if(me.pos < 0) 39 | if(me.ring) 40 | do me.pos :: me.num - 1 41 | else 42 | do me.pos :: 0 43 | end if 44 | elif(me.pos >= me.num) 45 | if(me.ring) 46 | do me.pos :: 0 47 | else 48 | do me.pos :: me.num - 1 49 | end if 50 | end if 51 | end func 52 | 53 | var num: int 54 | var pos: int 55 | var horizontal: bool 56 | var ring: bool 57 | end class 58 | -------------------------------------------------------------------------------- /src/lib/sys/dbg.kn: -------------------------------------------------------------------------------- 1 | #none 2 | +func print(str: []char) 3 | ; TODO: 4 | end func 5 | -------------------------------------------------------------------------------- /src/lib/sys/draw2d.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func[d0005.knd, _init]_init() 3 | end func 4 | 5 | func[d0005.knd, _fin]_fin() 6 | end func 7 | 8 | +func[d0005.knd, _circle]circle(x: float, y: float, radiusX: float, radiusY: float, color: int) 9 | end func 10 | 11 | +func[d0005.knd, _circleLine]circleLine(x: float, y: float, radiusX: float, radiusY: float, strokeWidth: float, color: int) 12 | end func 13 | 14 | +func[d0005.knd, _line]line(x1: float, y1: float, x2: float, y2: float, strokeWidth: float, color: int) 15 | end func 16 | 17 | +func[d0005.knd, _rect]rect(x: float, y: float, width: float, height: float, color: int) 18 | end func 19 | 20 | +func[d0005.knd, _rectLine]rectLine(x: float, y: float, width: float, height: float, strokeWidth: float, color: int) 21 | end func 22 | 23 | +func[d0005.knd, _roundRect]roundRect(x: float, y: float, width: float, height: float, radiusX: float, radiusY: float, color: int) 24 | end func 25 | 26 | +func[d0005.knd, _roundRectLine]roundRectLine(x: float, y: float, width: float, height: float, radiusX: float, radiusY: float, strokeWidth: float, color: int) 27 | end func 28 | 29 | +func[d0005.knd, _tri]tri(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, color: int) 30 | end func 31 | -------------------------------------------------------------------------------- /src/lib/sys/excpt.kn: -------------------------------------------------------------------------------- 1 | +const userMin: int :: 0x00000001 2 | +const userMax: int :: 0x0000FFFF 3 | +const accessViolation: int :: 0xC0000005 4 | +const noMem: int :: 0xC0000017 5 | +const intDivideByZero: int :: 0xC0000094 6 | +const stackOverflow: int :: 0xC00000FD 7 | +const ctrlCExit: int :: 0xC000013A 8 | +const dbgAssertFailed: int :: 0xE9170000 9 | +const classCastFailed: int :: 0xE9170001 10 | +const dbgArrayIdxOutOfRange: int :: 0xE9170002 11 | +const invalidCmp: int :: 0xE9170004 12 | +const dbgArgOutDomain: int :: 0xE9170006 13 | +const fileOpenFailed: int :: 0xE9170007 14 | +const invalidDataFmt: int :: 0xE9170008 15 | +const deviceInitFailed: int :: 0xE9170009 16 | +const dbgInoperableState: int :: 0xE917000A 17 | +const creatingInvalidArray: int :: 0xE917000B 18 | -------------------------------------------------------------------------------- /src/lib/sys/hash.kn: -------------------------------------------------------------------------------- 1 | include sha256 2 | include xxh64 3 | -------------------------------------------------------------------------------- /src/lib/sys/ogg.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func[d1000.knd, init]_init() 3 | end func 4 | 5 | +func init() 6 | do @_init() 7 | end func 8 | -------------------------------------------------------------------------------- /src/lib/sys/regex.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func[d1002.knd, _init]_init() 3 | end func 4 | 5 | +class Regex() 6 | *func[__ndc]ctor() 7 | end func 8 | 9 | *func[d1002.knd, _regexDtor, __frc]_dtor() 10 | end func 11 | 12 | +func[d1002.knd, _regexFind]find(pos: &int, text: []char, start: int): [][]char 13 | end func 14 | 15 | +func[d1002.knd, _regexFindAll]findAll(pos: &[]int, text: []char): [][][]char 16 | end func 17 | 18 | +func[d1002.knd, _regexFindLast]findLast(pos: &int, text: []char, start: int): [][]char 19 | end func 20 | 21 | +func[d1002.knd, _regexMatch]match(text: []char): [][]char 22 | end func 23 | 24 | +func[d1002.knd, _regexReplace]replace(text: []char, newText: []char, all: bool): []char 25 | end func 26 | 27 | var pattern: int 28 | end class 29 | 30 | +func[d1002.knd, _makeRegex, __mki]makeRegex(me2: @Regex, pattern: []char): @Regex 31 | end func 32 | -------------------------------------------------------------------------------- /src/lib/sys/rescache.kn: -------------------------------------------------------------------------------- 1 | +class Instance() 2 | +var instance: kuin@Class 3 | +var cnt: int 4 | end class 5 | 6 | +class ResCache() 7 | *func ctor() 8 | do me.instances :: #dict<[]char, @Instance> 9 | do me.baseDir :: "" 10 | end func 11 | 12 | +func add(key: []char): @Instance 13 | var success: bool 14 | var instance: @Instance :: me.instances.get(key, &success) 15 | if(success) 16 | do instance.cnt :+ 1 17 | ret instance 18 | end if 19 | do instance :: #@Instance 20 | do instance.instance :: null 21 | do instance.cnt :: 1 22 | do me.instances.add(key, instance) 23 | ret instance 24 | end func 25 | 26 | +func del(instance: kuin@Class) 27 | class Data() 28 | +var target: kuin@Class 29 | +var key: []char 30 | end class 31 | 32 | var data: Data :: #Data 33 | do data.target :: instance 34 | do data.key :: null 35 | do me.instances.forEach(freeRecursion, data) 36 | if(data.key <>& null) 37 | do me.instances.del(data.key) 38 | end if 39 | 40 | func freeRecursion(key: []char, value: @Instance, data: kuin@Class): bool 41 | var data2: Data :: data $ Data 42 | if(value.instance <>& data2.target) 43 | ret true 44 | end if 45 | 46 | do value.cnt :- 1 47 | if(value.cnt = 0) 48 | do data2.key :: key 49 | end if 50 | ret false 51 | end func 52 | end func 53 | 54 | +func setBaseDir(dir: []char) 55 | do me.baseDir :: dir 56 | end func 57 | 58 | var instances: dict<[]char, @Instance> 59 | var baseDir: []char 60 | end class 61 | -------------------------------------------------------------------------------- /src/lib/sys/snd.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func[d0001.knd, _sndInit]_init() 3 | end func 4 | 5 | func[d0001.knd, _sndFin]_fin() 6 | end func 7 | 8 | +class Snd() 9 | *func[__ndc]ctor() 10 | end func 11 | 12 | *func[__frc]_dtor() 13 | do me.fin() 14 | end func 15 | 16 | +func[d0001.knd, _sndFin2]fin() 17 | end func 18 | 19 | +func[d0001.knd, _sndFreq]freq(value: float) 20 | end func 21 | 22 | +func[d0001.knd, _sndGetPos]getPos(): float 23 | end func 24 | 25 | +func[d0001.knd, _sndLen]len(): float 26 | end func 27 | 28 | +func[d0001.knd, _sndPan]pan(value: float) 29 | end func 30 | 31 | +func[d0001.knd, _sndPlay]play() 32 | end func 33 | 34 | +func[d0001.knd, _sndPlaying]playing(): bool 35 | end func 36 | 37 | +func[d0001.knd, _sndPlayLoop]playLoop() 38 | end func 39 | 40 | +func[d0001.knd, _sndSetPos]setPos(value: float) 41 | end func 42 | 43 | +func[d0001.knd, _sndStop]stop() 44 | end func 45 | 46 | +func[d0001.knd, _sndVolume]volume(value: float) 47 | end func 48 | 49 | var sndBuf: int 50 | var sizePerSec: int 51 | var endPos: float 52 | var freq2: float 53 | var volume2: float 54 | end class 55 | 56 | +func[d0001.knd, _getMainVolume]getMainVolume(): float 57 | end func 58 | 59 | +func makeSnd(path: []char): @Snd 60 | var f: file@Reader :: file@makeReader(path) 61 | if(f =& null) 62 | throw 0xE9170007 63 | end if 64 | var d: []bit8 :: f.read(f.fileSize()) 65 | do f.fin() 66 | ret makeSndImpl(d, path) 67 | 68 | func[d0001.knd, _makeSnd, __mki]makeSndImpl(me2: @Snd, data: []bit8, path: []char): @Snd 69 | end func 70 | end func 71 | 72 | +func[d0001.knd, _setMainVolume]setMainVolume(value: float) 73 | end func 74 | -------------------------------------------------------------------------------- /src/lib/sys/sql.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func[d1005.knd, _init]_init() 3 | end func 4 | 5 | +class Sql() 6 | *func[__ndc]ctor() 7 | end func 8 | 9 | *func[__frc]_dtor() 10 | do me.fin() 11 | end func 12 | 13 | +func[d1005.knd, _sqlApply]apply(): bool 14 | end func 15 | 16 | +func[d1005.knd, _sqlErrMsg]errMsg(): []char 17 | end func 18 | 19 | +func[d1005.knd, _sqlExec]exec(cmd: []char): bool 20 | end func 21 | 22 | +func[d1005.knd, _sqlFin]fin() 23 | end func 24 | 25 | +func[d1005.knd, _sqlGetBlob]getBlob(col: int): []bit8 26 | end func 27 | 28 | +func[d1005.knd, _sqlGetFloat]getFloat(col: int): float 29 | end func 30 | 31 | +func[d1005.knd, _sqlGetInt]getInt(col: int): int 32 | end func 33 | 34 | +func[d1005.knd, _sqlGetStr]getStr(col: int): []char 35 | end func 36 | 37 | +func[d1005.knd, _sqlNext]next() 38 | end func 39 | 40 | +func[d1005.knd, _sqlPrepare]prepare(cmd: []char): bool 41 | end func 42 | 43 | +func[d1005.knd, _sqlSetBlob]setBlob(idx: int, value: []bit8): bool 44 | end func 45 | 46 | +func[d1005.knd, _sqlSetFloat]setFloat(idx: int, value: float): bool 47 | end func 48 | 49 | +func[d1005.knd, _sqlSetInt]setInt(idx: int, value: int): bool 50 | end func 51 | 52 | +func[d1005.knd, _sqlSetStr]setStr(idx: int, value: []char): bool 53 | end func 54 | 55 | +func[d1005.knd, _sqlTerm]term(): bool 56 | end func 57 | 58 | var db: int 59 | var statement: int 60 | var result: int 61 | end class 62 | 63 | +func[d1005.knd, _makeSql, __mki]makeSql(me2: @Sql, path: []char): @Sql 64 | end func 65 | -------------------------------------------------------------------------------- /src/lib/sys/task.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | +enum OpenMode 3 | open 4 | explore 5 | property 6 | end enum 7 | 8 | +class Process() 9 | *func[__ndc]ctor() 10 | end func 11 | 12 | *func[__frc]_dtor() 13 | do me.fin() 14 | end func 15 | 16 | +func[d0000.knd, _processRun]run(waitUntilExit: bool): int 17 | end func 18 | 19 | +func[d0000.knd, _processFin]fin() 20 | end func 21 | 22 | +func[d0000.knd, _processRunning]running(exitCode: &int): bool 23 | end func 24 | 25 | +func[d0000.knd, _processReadPipe]readPipe(): []char 26 | end func 27 | 28 | var processHandle: int 29 | var threadHandle: int 30 | var readPipeHandle: int 31 | var writePipeHandle: int 32 | end class 33 | 34 | +func[d0000.knd, _makeProcess, __mki]makeProcess(me2: @Process, path: []char, cmdLine: []char): @Process 35 | end func 36 | 37 | +func[d0000.knd, _taskOpen]open(path: []char, mode: @OpenMode, waitUntilExit: bool) 38 | end func 39 | -------------------------------------------------------------------------------- /src/lib/sys/wipe.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | var state: float 3 | var type: @Type 4 | var speed: float 5 | var colorR: float 6 | var colorG: float 7 | var colorB: float 8 | 9 | +enum Type 10 | none 11 | fade 12 | centerCircle 13 | end enum 14 | 15 | +func draw(): bool 16 | do @state :+ @speed 17 | if(@state < 0.0 & @speed < 0.0) 18 | do @state :: 0.0 19 | do @type :: %none 20 | do @speed :: 0.0 21 | elif(@state > 1.0 & @speed > 0.0) 22 | do @state :: 1.0 23 | do @type :: %none 24 | do @speed :: 0.0 25 | end if 26 | 27 | var width: float :: draw@screenWidth() $ float 28 | var height: float :: draw@screenHeight() $ float 29 | if(@state = 0.0) 30 | do draw@rect(0.0, 0.0, width, height, draw@argbToColor(1.0, @colorR, @colorG, @colorB)) 31 | ret true 32 | elif(@state = 1.0) 33 | ret true 34 | else 35 | switch(@type) 36 | case %fade 37 | do draw@rect(0.0, 0.0, width, height, draw@argbToColor(1.0 - @state, @colorR, @colorG, @colorB)) 38 | case %centerCircle 39 | var radius: float :: lib@dist(0.0, 0.0, width / 2.0, height / 2.0) * (1.0 - @state) 40 | do draw2d@circle(width / 2.0, height / 2.0, radius, radius, draw@argbToColor(1.0, @colorR, @colorG, @colorB)) 41 | end switch 42 | ret false 43 | end if 44 | end func 45 | 46 | +func set(type: @Type, in: bool, time: int, color: int) 47 | if(dbg) 48 | if(time <= 0) 49 | throw 0xE9170006 50 | end if 51 | end if 52 | do @state :: 0.0 53 | do @type :: type 54 | do @speed :: 1.0 / (time $ float) 55 | if(!in) 56 | do @state :: 1.0 57 | do @speed :: -@speed 58 | end if 59 | do draw@colorToArgb(&, &@colorR, &@colorG, &@colorB, color) 60 | end func 61 | -------------------------------------------------------------------------------- /src/lib/sys/zip.kn: -------------------------------------------------------------------------------- 1 | #exe 2 | func[d1001.knd, _init]_init() 3 | end func 4 | 5 | +func unzip(dst: []char, src: []char): bool 6 | var f: file@Reader :: file@makeReader(src) 7 | if(f =& null) 8 | throw 0xE9170007 9 | end if 10 | var d: []bit8 :: f.read(f.fileSize()) 11 | do f.fin() 12 | ret unzipImpl(dst, d) 13 | 14 | func[d1001.knd, _unzip]unzipImpl(outPath: []char, data: []bit8): bool 15 | end func 16 | end func 17 | 18 | +func[d1001.knd, _zip]zip(dst: []char, src: []char, compressionLevel: int): bool 19 | end func 20 | -------------------------------------------------------------------------------- /src/sys/cpp/_preset00.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("Hello, world!") 3 | end func 4 | -------------------------------------------------------------------------------- /src/sys/cpp/_preset01.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("q") 3 | end func 4 | -------------------------------------------------------------------------------- /src/sys/cpp/_preset02.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | for i(1, 100) 3 | if(i % 15 = 0) 4 | do cui@print("FizzBuzz\n") 5 | elif(i % 3 = 0) 6 | do cui@print("Fizz\n") 7 | elif(i % 5 = 0) 8 | do cui@print("Buzz\n") 9 | else 10 | do cui@print(i.toStr() ~ "\n") 11 | end if 12 | end for 13 | end func 14 | -------------------------------------------------------------------------------- /src/sys/cpp/_preset03.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | for i(99, 2, -1) 3 | do cui@print(i.toStr() ~ " bottles of beer on the wall, " ~ i.toStr() ~ " bottles of beer.\n") 4 | do cui@print("Take one down, pass it around, " ~ (i - 1).toStr() ~ " bottles of beer on the wall.\n") 5 | end for 6 | do cui@print("2 bottles of beer on the wall, 2 bottles of beer.\n") 7 | do cui@print("Take one down, pass it around, 1 bottle of beer on the wall.\n") 8 | do cui@print("1 bottle of beer on the wall, 1 bottle of beer.\n") 9 | do cui@print("Take one down, pass it around, no more bottles of beer on the wall.\n") 10 | do cui@print("No more bottles of beer on the wall, no more bottles of beer.\n") 11 | do cui@print("Go to the store and buy some more, 99 bottles of beer on the wall.\n") 12 | end func 13 | -------------------------------------------------------------------------------- /src/sys/cpp/excpt.kn: -------------------------------------------------------------------------------- 1 | +const userMin: int :: 0x00000001 2 | +const userMax: int :: 0x0000FFFF 3 | +const accessViolation: int :: 0xC0000005 4 | +const noMem: int :: 0xC0000017 5 | +const intDivideByZero: int :: 0xC0000094 6 | +const stackOverflow: int :: 0xC00000FD 7 | +const ctrlCExit: int :: 0xC000013A 8 | +const dbgAssertFailed: int :: 0xE9170000 9 | +const classCastFailed: int :: 0xE9170001 10 | +const dbgArrayIdxOutOfRange: int :: 0xE9170002 11 | +const invalidCmp: int :: 0xE9170004 12 | +const dbgArgOutDomain: int :: 0xE9170006 13 | +const fileOpenFailed: int :: 0xE9170007 14 | +const invalidDataFmt: int :: 0xE9170008 15 | +const deviceInitFailed: int :: 0xE9170009 16 | +const dbgInoperableState: int :: 0xE917000A 17 | +const creatingInvalidArray: int :: 0xE917000B 18 | -------------------------------------------------------------------------------- /src/sys/cpp/hash.kn: -------------------------------------------------------------------------------- 1 | include sha256 2 | include xxh64 3 | -------------------------------------------------------------------------------- /src/sys/cpp/rescache.kn: -------------------------------------------------------------------------------- 1 | +class Instance() 2 | +var instance: kuin@Class 3 | +var cnt: int 4 | end class 5 | 6 | +class ResCache() 7 | *func ctor() 8 | do me.instances :: #dict<[]char, @Instance> 9 | do me.baseDir :: "" 10 | end func 11 | 12 | +func add(key: []char): @Instance 13 | var success: bool 14 | var instance: @Instance :: me.instances.get(key, &success) 15 | if(success) 16 | do instance.cnt :+ 1 17 | ret instance 18 | end if 19 | do instance :: #@Instance 20 | do instance.instance :: null 21 | do instance.cnt :: 1 22 | do me.instances.add(key, instance) 23 | ret instance 24 | end func 25 | 26 | +func del(instance: kuin@Class) 27 | class Data() 28 | +var target: kuin@Class 29 | +var key: []char 30 | end class 31 | 32 | var data: Data :: #Data 33 | do data.target :: instance 34 | do data.key :: null 35 | do me.instances.forEach(freeRecursion, data) 36 | if(data.key <>& null) 37 | do me.instances.del(data.key) 38 | end if 39 | 40 | func freeRecursion(key: []char, value: @Instance, data: kuin@Class): bool 41 | var data2: Data :: data $ Data 42 | if(value.instance <>& data2.target) 43 | ret true 44 | end if 45 | 46 | do value.cnt :- 1 47 | if(value.cnt = 0) 48 | do data2.key :: key 49 | end if 50 | ret false 51 | end func 52 | end func 53 | 54 | +func setBaseDir(dir: []char) 55 | do me.baseDir :: dir 56 | end func 57 | 58 | var instances: dict<[]char, @Instance> 59 | var baseDir: []char 60 | end class 61 | -------------------------------------------------------------------------------- /src/sys/cpp/wnd.kn: -------------------------------------------------------------------------------- 1 | +func exeDir(): []char 2 | excode "#if defined(_WIN32)\n" 3 | excode "wchar_t b_[512];\n" 4 | excode "wchar_t*p_;\n" 5 | excode "GetModuleFileName(nullptr,b_,512);\n" 6 | excode "p_=wcsrchr(b_,L'\\\\');\n" 7 | excode "if(p_==nullptr)return nullptr;\n" 8 | excode "*(p_+1)=L'\\0';\n" 9 | excode "p_=b_;\n" 10 | excode "while(*p_!=L'\\0'){\n" 11 | excode "if(*p_==L'\\\\')*p_=L'/';\n" 12 | excode "p_++;\n" 13 | excode "}\n" 14 | excode "size_t l_=wcslen(b_);\n" 15 | excode "type_(Array_)a_=new_(Array_)();\n" 16 | excode "a_->L=l_;\n" 17 | excode "a_->B=newPrimArray_(static_cast(l_+1),char16_t);\n" 18 | excode "memcpy(a_->B,b_,sizeof(char16_t)*static_cast(l_+1));\n" 19 | excode "return a_;\n" 20 | excode "#else\n" 21 | excode "return nullptr;\n" 22 | excode "#endif\n" 23 | end func 24 | 25 | -------------------------------------------------------------------------------- /src/sys/default.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuina/Kuin/b63a042e88a279f356ac85455113a957b6c98fe6/src/sys/default.ico -------------------------------------------------------------------------------- /src/sys/exe/_preset00.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("Hello, world!") 3 | end func 4 | -------------------------------------------------------------------------------- /src/sys/exe/_preset00_wnd.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "") 3 | var editLog: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 1000, 744, %scale, %scale) 4 | do editLog.readonly(true) 5 | do editLog.setText("Hello, world!") 6 | 7 | while(wnd@act()) 8 | end while 9 | end func 10 | -------------------------------------------------------------------------------- /src/sys/exe/_preset01.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("q") 3 | end func 4 | -------------------------------------------------------------------------------- /src/sys/exe/_preset01_wnd.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "") 3 | var editLog: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 1000, 744, %scale, %scale) 4 | do editLog.readonly(true) 5 | do editLog.setText("q") 6 | 7 | while(wnd@act()) 8 | end while 9 | end func 10 | -------------------------------------------------------------------------------- /src/sys/exe/_preset02.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | for i(1, 100) 3 | if(i % 15 = 0) 4 | do cui@print("FizzBuzz\n") 5 | elif(i % 3 = 0) 6 | do cui@print("Fizz\n") 7 | elif(i % 5 = 0) 8 | do cui@print("Buzz\n") 9 | else 10 | do cui@print(i.toStr() ~ "\n") 11 | end if 12 | end for 13 | end func 14 | -------------------------------------------------------------------------------- /src/sys/exe/_preset02_wnd.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "") 3 | var editLog: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 1000, 744, %scale, %scale) 4 | do editLog.readonly(true) 5 | do editLog.setText("") 6 | for i(1, 100) 7 | if(i % 15 = 0) 8 | do editLog.setText(editLog.getText() ~ "FizzBuzz\n") 9 | elif(i % 3 = 0) 10 | do editLog.setText(editLog.getText() ~ "Fizz\n") 11 | elif(i % 5 = 0) 12 | do editLog.setText(editLog.getText() ~ "Buzz\n") 13 | else 14 | do editLog.setText(editLog.getText() ~ (i.toStr() ~ "\n")) 15 | end if 16 | end for 17 | 18 | while(wnd@act()) 19 | end while 20 | end func 21 | -------------------------------------------------------------------------------- /src/sys/exe/_preset03.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | for i(99, 2, -1) 3 | do cui@print(i.toStr() ~ " bottles of beer on the wall, " ~ i.toStr() ~ " bottles of beer.\n") 4 | do cui@print("Take one down, pass it around, " ~ (i - 1).toStr() ~ " bottles of beer on the wall.\n") 5 | end for 6 | do cui@print("2 bottles of beer on the wall, 2 bottles of beer.\n") 7 | do cui@print("Take one down, pass it around, 1 bottle of beer on the wall.\n") 8 | do cui@print("1 bottle of beer on the wall, 1 bottle of beer.\n") 9 | do cui@print("Take one down, pass it around, no more bottles of beer on the wall.\n") 10 | do cui@print("No more bottles of beer on the wall, no more bottles of beer.\n") 11 | do cui@print("Go to the store and buy some more, 99 bottles of beer on the wall.\n") 12 | end func 13 | -------------------------------------------------------------------------------- /src/sys/exe/_preset03_wnd.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | var wndMain: wnd@Wnd :: wnd@makeWnd(null, %normal, 1024, 768, "") 3 | var editLog: wnd@EditMulti :: wnd@makeEditMulti(wndMain, 12, 12, 1000, 744, %scale, %scale) 4 | do editLog.readonly(true) 5 | do editLog.setText("") 6 | for i(99, 2, -1) 7 | do editLog.setText(editLog.getText() ~ (i.toStr() ~ " bottles of beer on the wall, " ~ i.toStr() ~ " bottles of beer.\n")) 8 | do editLog.setText(editLog.getText() ~ ("Take one down, pass it around, " ~ (i - 1).toStr() ~ " bottles of beer on the wall.\n")) 9 | end for 10 | do editLog.setText(editLog.getText() ~ "2 bottles of beer on the wall, 2 bottles of beer.\n") 11 | do editLog.setText(editLog.getText() ~ "Take one down, pass it around, 1 bottle of beer on the wall.\n") 12 | do editLog.setText(editLog.getText() ~ "1 bottle of beer on the wall, 1 bottle of beer.\n") 13 | do editLog.setText(editLog.getText() ~ "Take one down, pass it around, no more bottles of beer on the wall.\n") 14 | do editLog.setText(editLog.getText() ~ "No more bottles of beer on the wall, no more bottles of beer.\n") 15 | do editLog.setText(editLog.getText() ~ "Go to the store and buy some more, 99 bottles of beer on the wall.\n") 16 | 17 | while(wnd@act()) 18 | end while 19 | end func 20 | -------------------------------------------------------------------------------- /src/sys/exe/cursor.kn: -------------------------------------------------------------------------------- 1 | +class Cursor() 2 | *func ctor() 3 | do me.num :: 1 4 | do me.pos :: 0 5 | end func 6 | 7 | +func get(): int 8 | ret me.pos 9 | end func 10 | 11 | +func set(num: int, pos: int, horizontal: bool, ring: bool) 12 | if(dbg) 13 | if(num < 1 | pos < 0 | num <= pos) 14 | throw 0xE9170006 15 | end if 16 | end if 17 | do me.num :: num 18 | do me.pos :: pos 19 | do me.horizontal :: horizontal 20 | do me.ring :: ring 21 | end func 22 | 23 | +func update() 24 | if(me.horizontal) 25 | if(input@pad(0, %left) = 1) 26 | do me.pos :- 1 27 | elif(input@pad(0, %right) = 1) 28 | do me.pos :+ 1 29 | end if 30 | else 31 | if(input@pad(0, %up) = 1) 32 | do me.pos :- 1 33 | elif(input@pad(0, %down) = 1) 34 | do me.pos :+ 1 35 | end if 36 | end if 37 | if(me.pos < 0) 38 | if(me.ring) 39 | do me.pos :: me.num - 1 40 | else 41 | do me.pos :: 0 42 | end if 43 | elif(me.pos >= me.num) 44 | if(me.ring) 45 | do me.pos :: 0 46 | else 47 | do me.pos :: me.num - 1 48 | end if 49 | end if 50 | end func 51 | 52 | var num: int 53 | var pos: int 54 | var horizontal: bool 55 | var ring: bool 56 | end class 57 | -------------------------------------------------------------------------------- /src/sys/exe/draw2d.kn: -------------------------------------------------------------------------------- 1 | func[d0005.knd, _init]_init() 2 | end func 3 | 4 | func[d0005.knd, _fin]_fin() 5 | end func 6 | 7 | +func[d0005.knd, _circle]circle(x: float, y: float, radiusX: float, radiusY: float, color: int) 8 | end func 9 | 10 | +func[d0005.knd, _circleLine]circleLine(x: float, y: float, radiusX: float, radiusY: float, strokeWidth: float, color: int) 11 | end func 12 | 13 | +func[d0005.knd, _line]line(x1: float, y1: float, x2: float, y2: float, strokeWidth: float, color: int) 14 | end func 15 | 16 | +func[d0005.knd, _rect]rect(x: float, y: float, width: float, height: float, color: int) 17 | end func 18 | 19 | +func[d0005.knd, _rectLine]rectLine(x: float, y: float, width: float, height: float, strokeWidth: float, color: int) 20 | end func 21 | 22 | +func[d0005.knd, _roundRect]roundRect(x: float, y: float, width: float, height: float, radiusX: float, radiusY: float, color: int) 23 | end func 24 | 25 | +func[d0005.knd, _roundRectLine]roundRectLine(x: float, y: float, width: float, height: float, radiusX: float, radiusY: float, strokeWidth: float, color: int) 26 | end func 27 | 28 | +func[d0005.knd, _tri]tri(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, color: int) 29 | end func 30 | -------------------------------------------------------------------------------- /src/sys/exe/excpt.kn: -------------------------------------------------------------------------------- 1 | +const userMin: int :: 0x00000001 2 | +const userMax: int :: 0x0000FFFF 3 | +const accessViolation: int :: 0xC0000005 4 | +const noMem: int :: 0xC0000017 5 | +const intDivideByZero: int :: 0xC0000094 6 | +const stackOverflow: int :: 0xC00000FD 7 | +const ctrlCExit: int :: 0xC000013A 8 | +const dbgAssertFailed: int :: 0xE9170000 9 | +const classCastFailed: int :: 0xE9170001 10 | +const dbgArrayIdxOutOfRange: int :: 0xE9170002 11 | +const invalidCmp: int :: 0xE9170004 12 | +const dbgArgOutDomain: int :: 0xE9170006 13 | +const fileOpenFailed: int :: 0xE9170007 14 | +const invalidDataFmt: int :: 0xE9170008 15 | +const deviceInitFailed: int :: 0xE9170009 16 | +const dbgInoperableState: int :: 0xE917000A 17 | +const creatingInvalidArray: int :: 0xE917000B 18 | -------------------------------------------------------------------------------- /src/sys/exe/hash.kn: -------------------------------------------------------------------------------- 1 | include sha256 2 | include xxh64 3 | -------------------------------------------------------------------------------- /src/sys/exe/ogg.kn: -------------------------------------------------------------------------------- 1 | func[d1000.knd, init]_init() 2 | end func 3 | 4 | +func init() 5 | do @_init() 6 | end func 7 | -------------------------------------------------------------------------------- /src/sys/exe/regex.kn: -------------------------------------------------------------------------------- 1 | func[d1002.knd, _init]_init() 2 | end func 3 | 4 | +class Regex() 5 | *func[__ndc]ctor() 6 | end func 7 | 8 | *func[d1002.knd, _regexDtor, __frc]_dtor() 9 | end func 10 | 11 | +func[d1002.knd, _regexFind]find(pos: &int, text: []char, start: int): [][]char 12 | end func 13 | 14 | +func[d1002.knd, _regexFindAll]findAll(pos: &[]int, text: []char): [][][]char 15 | end func 16 | 17 | +func[d1002.knd, _regexFindLast]findLast(pos: &int, text: []char, start: int): [][]char 18 | end func 19 | 20 | +func[d1002.knd, _regexMatch]match(text: []char): [][]char 21 | end func 22 | 23 | +func[d1002.knd, _regexReplace]replace(text: []char, newText: []char, all: bool): []char 24 | end func 25 | 26 | var pattern: int 27 | end class 28 | 29 | +func[d1002.knd, _makeRegex, __mki]makeRegex(me2: @Regex, pattern: []char): @Regex 30 | end func 31 | -------------------------------------------------------------------------------- /src/sys/exe/rescache.kn: -------------------------------------------------------------------------------- 1 | +class Instance() 2 | +var instance: kuin@Class 3 | +var cnt: int 4 | end class 5 | 6 | +class ResCache() 7 | *func ctor() 8 | do me.instances :: #dict<[]char, @Instance> 9 | do me.baseDir :: "" 10 | end func 11 | 12 | +func add(key: []char): @Instance 13 | var success: bool 14 | var instance: @Instance :: me.instances.get(key, &success) 15 | if(success) 16 | do instance.cnt :+ 1 17 | ret instance 18 | end if 19 | do instance :: #@Instance 20 | do instance.instance :: null 21 | do instance.cnt :: 1 22 | do me.instances.add(key, instance) 23 | ret instance 24 | end func 25 | 26 | +func del(instance: kuin@Class) 27 | class Data() 28 | +var target: kuin@Class 29 | +var key: []char 30 | end class 31 | 32 | var data: Data :: #Data 33 | do data.target :: instance 34 | do data.key :: null 35 | do me.instances.forEach(freeRecursion, data) 36 | if(data.key <>& null) 37 | do me.instances.del(data.key) 38 | end if 39 | 40 | func freeRecursion(key: []char, value: @Instance, data: kuin@Class): bool 41 | var data2: Data :: data $ Data 42 | if(value.instance <>& data2.target) 43 | ret true 44 | end if 45 | 46 | do value.cnt :- 1 47 | if(value.cnt = 0) 48 | do data2.key :: key 49 | end if 50 | ret false 51 | end func 52 | end func 53 | 54 | +func setBaseDir(dir: []char) 55 | do me.baseDir :: dir 56 | end func 57 | 58 | var instances: dict<[]char, @Instance> 59 | var baseDir: []char 60 | end class 61 | -------------------------------------------------------------------------------- /src/sys/exe/snd.kn: -------------------------------------------------------------------------------- 1 | func[d0001.knd, _sndInit]_init() 2 | end func 3 | 4 | func[d0001.knd, _sndFin]_fin() 5 | end func 6 | 7 | +class Snd() 8 | *func[__ndc]ctor() 9 | end func 10 | 11 | *func[__frc]_dtor() 12 | do me.fin() 13 | end func 14 | 15 | +func[d0001.knd, _sndFin2]fin() 16 | end func 17 | 18 | +func[d0001.knd, _sndFreq]freq(value: float) 19 | end func 20 | 21 | +func[d0001.knd, _sndGetPos]getPos(): float 22 | end func 23 | 24 | +func[d0001.knd, _sndLen]len(): float 25 | end func 26 | 27 | +func[d0001.knd, _sndPan]pan(value: float) 28 | end func 29 | 30 | +func[d0001.knd, _sndPlay]play() 31 | end func 32 | 33 | +func[d0001.knd, _sndPlaying]playing(): bool 34 | end func 35 | 36 | +func[d0001.knd, _sndPlayLoop]playLoop() 37 | end func 38 | 39 | +func[d0001.knd, _sndSetPos]setPos(value: float) 40 | end func 41 | 42 | +func[d0001.knd, _sndStop]stop() 43 | end func 44 | 45 | +func[d0001.knd, _sndVolume]volume(value: float) 46 | end func 47 | 48 | var sndBuf: int 49 | var sizePerSec: int 50 | var endPos: float 51 | var freq2: float 52 | var volume2: float 53 | end class 54 | 55 | +func[d0001.knd, _getMainVolume]getMainVolume(): float 56 | end func 57 | 58 | +func makeSnd(path: []char): @Snd 59 | var f: file@Reader :: file@makeReader(path) 60 | if(f =& null) 61 | throw 0xE9170007 62 | end if 63 | var d: []bit8 :: f.read(f.fileSize()) 64 | do f.fin() 65 | ret makeSndImpl(d, path) 66 | 67 | func[d0001.knd, _makeSnd, __mki]makeSndImpl(me2: @Snd, data: []bit8, path: []char): @Snd 68 | end func 69 | end func 70 | 71 | +func[d0001.knd, _setMainVolume]setMainVolume(value: float) 72 | end func 73 | -------------------------------------------------------------------------------- /src/sys/exe/sql.kn: -------------------------------------------------------------------------------- 1 | func[d1005.knd, _init]_init() 2 | end func 3 | 4 | +class Sql() 5 | *func[__ndc]ctor() 6 | end func 7 | 8 | *func[__frc]_dtor() 9 | do me.fin() 10 | end func 11 | 12 | +func[d1005.knd, _sqlApply]apply(): bool 13 | end func 14 | 15 | +func[d1005.knd, _sqlErrMsg]errMsg(): []char 16 | end func 17 | 18 | +func[d1005.knd, _sqlExec]exec(cmd: []char): bool 19 | end func 20 | 21 | +func[d1005.knd, _sqlFin]fin() 22 | end func 23 | 24 | +func[d1005.knd, _sqlGetBlob]getBlob(col: int): []bit8 25 | end func 26 | 27 | +func[d1005.knd, _sqlGetFloat]getFloat(col: int): float 28 | end func 29 | 30 | +func[d1005.knd, _sqlGetInt]getInt(col: int): int 31 | end func 32 | 33 | +func[d1005.knd, _sqlGetStr]getStr(col: int): []char 34 | end func 35 | 36 | +func[d1005.knd, _sqlNext]next() 37 | end func 38 | 39 | +func[d1005.knd, _sqlPrepare]prepare(cmd: []char): bool 40 | end func 41 | 42 | +func[d1005.knd, _sqlSetBlob]setBlob(idx: int, value: []bit8): bool 43 | end func 44 | 45 | +func[d1005.knd, _sqlSetFloat]setFloat(idx: int, value: float): bool 46 | end func 47 | 48 | +func[d1005.knd, _sqlSetInt]setInt(idx: int, value: int): bool 49 | end func 50 | 51 | +func[d1005.knd, _sqlSetStr]setStr(idx: int, value: []char): bool 52 | end func 53 | 54 | +func[d1005.knd, _sqlTerm]term(): bool 55 | end func 56 | 57 | var db: int 58 | var statement: int 59 | var result: int 60 | end class 61 | 62 | +func[d1005.knd, _makeSql, __mki]makeSql(me2: @Sql, path: []char): @Sql 63 | end func 64 | -------------------------------------------------------------------------------- /src/sys/exe/task.kn: -------------------------------------------------------------------------------- 1 | +enum OpenMode 2 | open 3 | explore 4 | property 5 | end enum 6 | 7 | +class Process() 8 | *func[__ndc]ctor() 9 | end func 10 | 11 | *func[__frc]_dtor() 12 | do me.fin() 13 | end func 14 | 15 | +func[d0000.knd, _processRun]run(waitUntilExit: bool): int 16 | end func 17 | 18 | +func[d0000.knd, _processFin]fin() 19 | end func 20 | 21 | +func[d0000.knd, _processRunning]running(exitCode: &int): bool 22 | end func 23 | 24 | +func[d0000.knd, _processReadPipe]readPipe(): []char 25 | end func 26 | 27 | var processHandle: int 28 | var threadHandle: int 29 | var readPipeHandle: int 30 | var writePipeHandle: int 31 | end class 32 | 33 | +func[d0000.knd, _makeProcess, __mki]makeProcess(me2: @Process, path: []char, cmdLine: []char): @Process 34 | end func 35 | 36 | +func[d0000.knd, _taskOpen]open(path: []char, mode: @OpenMode, waitUntilExit: bool) 37 | end func 38 | -------------------------------------------------------------------------------- /src/sys/exe/wipe.kn: -------------------------------------------------------------------------------- 1 | var state: float 2 | var type: @Type 3 | var speed: float 4 | var colorR: float 5 | var colorG: float 6 | var colorB: float 7 | 8 | +enum Type 9 | none 10 | fade 11 | centerCircle 12 | end enum 13 | 14 | +func draw(): bool 15 | do @state :+ @speed 16 | if(@state < 0.0 & @speed < 0.0) 17 | do @state :: 0.0 18 | do @type :: %none 19 | do @speed :: 0.0 20 | elif(@state > 1.0 & @speed > 0.0) 21 | do @state :: 1.0 22 | do @type :: %none 23 | do @speed :: 0.0 24 | end if 25 | 26 | var width: float :: draw@screenWidth() $ float 27 | var height: float :: draw@screenHeight() $ float 28 | if(@state = 0.0) 29 | do draw@rect(0.0, 0.0, width, height, draw@argbToColor(1.0, @colorR, @colorG, @colorB)) 30 | ret true 31 | elif(@state = 1.0) 32 | ret true 33 | else 34 | switch(@type) 35 | case %fade 36 | do draw@rect(0.0, 0.0, width, height, draw@argbToColor(1.0 - @state, @colorR, @colorG, @colorB)) 37 | case %centerCircle 38 | var radius: float :: lib@dist(0.0, 0.0, width / 2.0, height / 2.0) * (1.0 - @state) 39 | do draw2d@circle(width / 2.0, height / 2.0, radius, radius, draw@argbToColor(1.0, @colorR, @colorG, @colorB)) 40 | end switch 41 | ret false 42 | end if 43 | end func 44 | 45 | +func set(type: @Type, in: bool, time: int, color: int) 46 | if(dbg) 47 | if(time <= 0) 48 | throw 0xE9170006 49 | end if 50 | end if 51 | do @state :: 0.0 52 | do @type :: type 53 | do @speed :: 1.0 / (time $ float) 54 | if(!in) 55 | do @state :: 1.0 56 | do @speed :: -@speed 57 | end if 58 | do draw@colorToArgb(&, &@colorR, &@colorG, &@colorB, color) 59 | end func 60 | -------------------------------------------------------------------------------- /src/sys/exe/zip.kn: -------------------------------------------------------------------------------- 1 | func[d1001.knd, _init]_init() 2 | end func 3 | 4 | +func unzip(dst: []char, src: []char): bool 5 | var f: file@Reader :: file@makeReader(src) 6 | if(f =& null) 7 | throw 0xE9170007 8 | end if 9 | var d: []bit8 :: f.read(f.fileSize()) 10 | do f.fin() 11 | ret unzipImpl(dst, d) 12 | 13 | func[d1001.knd, _unzip]unzipImpl(outPath: []char, data: []bit8): bool 14 | end func 15 | end func 16 | 17 | +func[d1001.knd, _zip]zip(dst: []char, src: []char, compressionLevel: int): bool 18 | end func 19 | -------------------------------------------------------------------------------- /src/sys/license_ogg_vorbis.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2015 Xiph.org Foundation 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | - Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the Xiph.org Foundation nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /src/sys/web/_preset00.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("Hello, world!") 3 | end func 4 | -------------------------------------------------------------------------------- /src/sys/web/_preset01.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | do cui@print("q") 3 | end func 4 | -------------------------------------------------------------------------------- /src/sys/web/_preset02.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | for i(1, 100) 3 | if(i % 15 = 0) 4 | do cui@print("FizzBuzz\n") 5 | elif(i % 3 = 0) 6 | do cui@print("Fizz\n") 7 | elif(i % 5 = 0) 8 | do cui@print("Buzz\n") 9 | else 10 | do cui@print(i.toStr() ~ "\n") 11 | end if 12 | end for 13 | end func 14 | -------------------------------------------------------------------------------- /src/sys/web/_preset03.kn: -------------------------------------------------------------------------------- 1 | func main() 2 | for i(99, 2, -1) 3 | do cui@print(i.toStr() ~ " bottles of beer on the wall, " ~ i.toStr() ~ " bottles of beer.\n") 4 | do cui@print("Take one down, pass it around, " ~ (i - 1).toStr() ~ " bottles of beer on the wall.\n") 5 | end for 6 | do cui@print("2 bottles of beer on the wall, 2 bottles of beer.\n") 7 | do cui@print("Take one down, pass it around, 1 bottle of beer on the wall.\n") 8 | do cui@print("1 bottle of beer on the wall, 1 bottle of beer.\n") 9 | do cui@print("Take one down, pass it around, no more bottles of beer on the wall.\n") 10 | do cui@print("No more bottles of beer on the wall, no more bottles of beer.\n") 11 | do cui@print("Go to the store and buy some more, 99 bottles of beer on the wall.\n") 12 | end func 13 | -------------------------------------------------------------------------------- /src/sys/web/excpt.kn: -------------------------------------------------------------------------------- 1 | +const userMin: int :: 0x00000001 2 | +const userMax: int :: 0x0000FFFF 3 | +const accessViolation: int :: 0xC0000005 4 | +const noMem: int :: 0xC0000017 5 | +const intDivideByZero: int :: 0xC0000094 6 | +const stackOverflow: int :: 0xC00000FD 7 | +const ctrlCExit: int :: 0xC000013A 8 | +const dbgAssertFailed: int :: 0xE9170000 9 | +const classCastFailed: int :: 0xE9170001 10 | +const dbgArrayIdxOutOfRange: int :: 0xE9170002 11 | +const invalidCmp: int :: 0xE9170004 12 | +const dbgArgOutDomain: int :: 0xE9170006 13 | +const fileOpenFailed: int :: 0xE9170007 14 | +const invalidDataFmt: int :: 0xE9170008 15 | +const deviceInitFailed: int :: 0xE9170009 16 | +const dbgInoperableState: int :: 0xE917000A 17 | +const creatingInvalidArray: int :: 0xE917000B 18 | -------------------------------------------------------------------------------- /src/sys/web/hash.kn: -------------------------------------------------------------------------------- 1 | include sha256 2 | include xxh64 3 | -------------------------------------------------------------------------------- /src/sys/web/rescache.kn: -------------------------------------------------------------------------------- 1 | +class Instance() 2 | +var instance: kuin@Class 3 | +var cnt: int 4 | end class 5 | 6 | +class ResCache() 7 | *func ctor() 8 | do me.instances :: #dict<[]char, @Instance> 9 | do me.baseDir :: "" 10 | end func 11 | 12 | +func add(key: []char): @Instance 13 | var success: bool 14 | var instance: @Instance :: me.instances.get(key, &success) 15 | if(success) 16 | do instance.cnt :+ 1 17 | ret instance 18 | end if 19 | do instance :: #@Instance 20 | do instance.instance :: null 21 | do instance.cnt :: 1 22 | do me.instances.add(key, instance) 23 | ret instance 24 | end func 25 | 26 | +func del(instance: kuin@Class) 27 | class Data() 28 | +var target: kuin@Class 29 | +var key: []char 30 | end class 31 | 32 | var data: Data :: #Data 33 | do data.target :: instance 34 | do data.key :: null 35 | do me.instances.forEach(freeRecursion, data) 36 | if(data.key <>& null) 37 | do me.instances.del(data.key) 38 | end if 39 | 40 | func freeRecursion(key: []char, value: @Instance, data: kuin@Class): bool 41 | var data2: Data :: data $ Data 42 | if(value.instance <>& data2.target) 43 | ret true 44 | end if 45 | 46 | do value.cnt :- 1 47 | if(value.cnt = 0) 48 | do data2.key :: key 49 | end if 50 | ret false 51 | end func 52 | end func 53 | 54 | +func setBaseDir(dir: []char) 55 | do me.baseDir :: dir 56 | end func 57 | 58 | var instances: dict<[]char, @Instance> 59 | var baseDir: []char 60 | end class 61 | -------------------------------------------------------------------------------- /src/sys/web/wnd.kn: -------------------------------------------------------------------------------- 1 | +func exeDir(): []char 2 | excode "return null;\n" 3 | end func 4 | 5 | --------------------------------------------------------------------------------