Skip to content

Commit

Permalink
fixed #3
Browse files Browse the repository at this point in the history
- glfwGetKey must return one of GLFW_PRESS or GLFW_RELEASE
  • Loading branch information
ypujante committed Jun 17, 2024
1 parent ab480db commit 7722ad4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 |
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions port/emscripten-glfw3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/cpp/emscripten/glfw3/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/emscripten/glfw3/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}

Expand Down

0 comments on commit 7722ad4

Please sign in to comment.