From 7722ad4271b0a3b5888b13d3ce989dbd89d4deb6 Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Mon, 17 Jun 2024 05:50:44 -0700 Subject: [PATCH] fixed #3 - glfwGetKey must return one of GLFW_PRESS or GLFW_RELEASE --- CMakeLists.txt | 2 +- README.md | 11 ++++++++--- port/emscripten-glfw3.py | 4 ++-- src/cpp/emscripten/glfw3/Keyboard.cpp | 6 ++---- src/cpp/emscripten/glfw3/version.h | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e23ec5..a85c5a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5) set(emscripten-glfw_RELEASE_YEAR "2024") set(emscripten-glfw_RELEASE_MONTH "06" ) -set(emscripten-glfw_RELEASE_DAY "16" ) +set(emscripten-glfw_RELEASE_DAY "17" ) set(emscripten-glfw_GLFW_VERSION "3.4.0") diff --git a/README.md b/README.md index c141fe3..8b2b2f0 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,14 @@ Introduction This project is an emscripten port of GLFW written in C++ for the web/wasm platform. The currently supported GLFW API is 3.4. -[![Latest - 3.4.0.20240616](https://img.shields.io/badge/Latest-3.4.0.20240616-blue)](https://github.com/pongasoft/emscripten-glfw/releases/latest) +[![Latest - 3.4.0.20240617](https://img.shields.io/badge/Latest-3.4.0.20240617-blue)](https://github.com/pongasoft/emscripten-glfw/releases/latest) [![GLFW - 3.4.0](https://img.shields.io/badge/GLFW-3.4.0-blue)](https://www.glfw.org/) [![emscripten - TBD](https://img.shields.io/badge/emscripten-TBD-blue)](https://emscripten.org) ![Compiles](https://github.com/pongasoft/emscripten-glfw/actions/workflows/main.yml/badge.svg) -[![Previous - 3.4.0.20240601](https://img.shields.io/badge/Previous-3.4.0.20240601-blue)](https://github.com/pongasoft/emscripten-glfw/releases/latest) +[![Released - 3.4.0.20240514](https://img.shields.io/badge/Released-3.4.0.20240514-blue)](https://github.com/pongasoft/emscripten-glfw/releases/latest) [![GLFW - 3.4.0](https://img.shields.io/badge/GLFW-3.4.0-blue)](https://www.glfw.org/) -[![emscripten - TBD](https://img.shields.io/badge/emscripten-TBD-blue)](https://emscripten.org) +[![emscripten - 3.1.60](https://img.shields.io/badge/emscripten-3.1.60-blue)](https://emscripten.org) [![License](https://img.shields.io/badge/License-Apache%20License%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) @@ -154,6 +154,7 @@ emcc --use-port=contrib.glfw3:disableWarning=true:disableMultiWindow=true main.c > #### Note about availability in emscripten > | this port | emscripten | > |----------------|------------| +> | 3.4.0.20240617 | TBD | > | 3.4.0.20240616 | TBD | > | 3.4.0.20240601 | TBD | > | 3.4.0.20240514 | 3.1.60 | @@ -223,6 +224,10 @@ LDFLAGS += -s USE_WEBGPU=1 --js-library $(EMS_GLFW3_DIR)/src/js/lib_emscripten_g Release Notes ------------- +#### 3.4.0.20240617 - 2024-06-17 | emscripten TBD + +- Fixed [#3](https://github.com/pongasoft/emscripten-glfw/issues/3): glfwGetKey must return one of `GLFW_PRESS` or `GLFW_RELEASE` + #### 3.4.0.20240616 - 2024-06-16 | emscripten TBD - Implemented `glfwGetClipboardString`. Note that due to the async (and restrictive) nature of the diff --git a/port/emscripten-glfw3.py b/port/emscripten-glfw3.py index 53fe5c4..9312695 100644 --- a/port/emscripten-glfw3.py +++ b/port/emscripten-glfw3.py @@ -17,8 +17,8 @@ import os from typing import Dict -TAG = '3.4.0.20240616' -HASH = 'a067effe2044020ed36199f7508c7ef143ee19b6d97e2e1e532974a97f8f2d510da486be0187630a9e0793a38ad7e67a52e74cddb40369c049b463cdebe304d4' +TAG = '3.4.0.20240617' +HASH = '148609b09e322e7f2433f5335431ba142ffe570248f296eb3a89d3d671476112657e30ebfe2ae23c09b99e7b0eddf875bfef149b43dbd50d5f58ccfc22770f89' ZIP_URL = f'https://github.com/pongasoft/emscripten-glfw/releases/download/v{TAG}/emscripten-glfw3-{TAG}.zip' # contrib port information (required) diff --git a/src/cpp/emscripten/glfw3/Keyboard.cpp b/src/cpp/emscripten/glfw3/Keyboard.cpp index f6c3ecf..6e271a5 100644 --- a/src/cpp/emscripten/glfw3/Keyboard.cpp +++ b/src/cpp/emscripten/glfw3/Keyboard.cpp @@ -91,12 +91,10 @@ bool Keyboard::onKeyDown(GLFWwindow *iWindow, EmscriptenKeyboardEvent const *iKe if(key != GLFW_KEY_UNKNOWN) { - glfw_key_state_t state = iKeyboardEvent->repeat == GLFW_TRUE ? GLFW_REPEAT : GLFW_PRESS; - - fKeyStates[key] = state; + fKeyStates[key] = GLFW_PRESS; if(fKeyCallback) - fKeyCallback(iWindow, key, scancode, state, computeCallbackModifierBits(iKeyboardEvent)); + fKeyCallback(iWindow, key, scancode, iKeyboardEvent->repeat == GLFW_TRUE ? GLFW_REPEAT : GLFW_PRESS, computeCallbackModifierBits(iKeyboardEvent)); } if(fCharCallback) { diff --git a/src/cpp/emscripten/glfw3/version.h b/src/cpp/emscripten/glfw3/version.h index 6f31d87..dd4614b 100644 --- a/src/cpp/emscripten/glfw3/version.h +++ b/src/cpp/emscripten/glfw3/version.h @@ -22,7 +22,7 @@ namespace emscripten::glfw3 { -#define D_EMSCRIPTEN_GLFW_VERSION_STR "3.4.0.20240616" +#define D_EMSCRIPTEN_GLFW_VERSION_STR "3.4.0.20240617" }