Skip to content

Instantly share code, notes, and snippets.

View nokotan's full-sized avatar

かめのこにょこにょこ nokotan

View GitHub Profile
@nokotan
nokotan / Siv3DSample.cpp
Created August 3, 2020 02:13
OpenSiv3D Web版でHello, Siv3D! (TextureAsset, FontAsset使用バージョン)
# include <Siv3D.hpp> // OpenSiv3D v0.4.3
# include <emscripten.h>
// 猫の座標
Vec2 catPos(640, 450);
void MainLoop()
{
if (!s3d::System::Update()) {
emscripten_cancel_main_loop();
mergeInto(LibraryManager.library, {
glfwGetKeysSiv3D: function (windowid) {
var window = GLFW.WindowFromId(windowid);
if (!window) return 0;
if (!window.keysBuffer) {
window.keysBuffer = Module._malloc(349 /* GLFW_KEY_LAST + 1 */)
}
Module.HEAPU8.set(window.keys, window.keysBuffer);
return window.keysBuffer;
},