Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion codegen/ffi_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,63 @@
"return_type": "bool",
"is_unsafe": false
},
"goud_input_touch_active": {
"source_file": "ffi/input/touch.rs",
"params": [
"context_id: GoudContextId",
"touch_id: u64"
],
"return_type": "bool",
"is_unsafe": false
},
"goud_input_touch_count": {
"source_file": "ffi/input/touch.rs",
"params": [
"context_id: GoudContextId"
],
"return_type": "u32",
"is_unsafe": false
},
"goud_input_touch_delta": {
"source_file": "ffi/input/touch.rs",
"params": [
"context_id: GoudContextId",
"touch_id: u64",
"out_dx: *mut f32",
"out_dy: *mut f32"
],
"return_type": "bool",
"is_unsafe": true
},
"goud_input_touch_just_pressed": {
"source_file": "ffi/input/touch.rs",
"params": [
"context_id: GoudContextId",
"touch_id: u64"
],
"return_type": "bool",
"is_unsafe": false
},
"goud_input_touch_just_released": {
"source_file": "ffi/input/touch.rs",
"params": [
"context_id: GoudContextId",
"touch_id: u64"
],
"return_type": "bool",
"is_unsafe": false
},
"goud_input_touch_position": {
"source_file": "ffi/input/touch.rs",
"params": [
"context_id: GoudContextId",
"touch_id: u64",
"out_x: *mut f32",
"out_y: *mut f32"
],
"return_type": "bool",
"is_unsafe": true
},
"goud_last_error_code": {
"source_file": "ffi/error.rs",
"params": [],
Expand Down Expand Up @@ -6339,5 +6396,5 @@
"is_unsafe": false
}
},
"total_count": 642
"total_count": 648
}
8 changes: 8 additions & 0 deletions codegen/ffi_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,14 @@
"goud_input_get_mouse_delta": {},
"goud_input_get_scroll_delta": {}
},
"input_touch": {
"goud_input_touch_count": {},
"goud_input_touch_active": {},
"goud_input_touch_position": {},
"goud_input_touch_just_pressed": {},
"goud_input_touch_just_released": {},
"goud_input_touch_delta": {}
},
"input_actions": {
"goud_input_map_action_key": {},
"goud_input_action_pressed": {},
Expand Down
15 changes: 15 additions & 0 deletions codegen/gen_ts_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,21 @@ def gen_web_wrapper():
lines.append(" getScrollDelta(): IVec2 { return { x: this.handle.scroll_dx(), y: this.handle.scroll_dy() }; }")
lines.append("")

# Touch input (stubs — WASM touch bindings not yet implemented)
emit_jsdoc(lines, _method_docs.get("get_touch_count"))
lines.append(" getTouchCount(): number { return 0; }")
emit_jsdoc(lines, _method_docs.get("is_touch_active"))
lines.append(" isTouchActive(_touchId: number): boolean { return false; }")
emit_jsdoc(lines, _method_docs.get("get_touch_position"))
lines.append(" getTouchPosition(_touchId: number): IVec2 { return { x: 0, y: 0 }; }")
emit_jsdoc(lines, _method_docs.get("is_touch_just_pressed"))
lines.append(" isTouchJustPressed(_touchId: number): boolean { return false; }")
emit_jsdoc(lines, _method_docs.get("is_touch_just_released"))
lines.append(" isTouchJustReleased(_touchId: number): boolean { return false; }")
emit_jsdoc(lines, _method_docs.get("get_touch_delta"))
lines.append(" getTouchDelta(_touchId: number): IVec2 { return { x: 0, y: 0 }; }")
lines.append("")

emit_jsdoc(lines, _method_docs.get("map_action_key"))
lines.append(" mapActionKey(action: string, key: number): boolean { return this.handle.map_action_key(action, key); }")
emit_jsdoc(lines, _method_docs.get("is_action_pressed"))
Expand Down
34 changes: 34 additions & 0 deletions codegen/generated/goud_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,10 @@ typedef struct InputCapabilities {
* Maximum number of simultaneous gamepads.
*/
uint32_t max_gamepads;
/**
* Maximum number of simultaneous touch points supported.
*/
uint32_t max_touch_points;
} InputCapabilities;

/**
Expand Down Expand Up @@ -2910,6 +2914,36 @@ bool goud_input_get_mouse_delta(struct GoudContextId context_id, float *out_dx,
*/
bool goud_input_get_scroll_delta(struct GoudContextId context_id, float *out_dx, float *out_dy);

/**
* Returns the number of currently active touch points.
*/
uint32_t goud_input_touch_count(struct GoudContextId context_id);

/**
* Returns `true` if the given touch ID is currently active.
*/
bool goud_input_touch_active(struct GoudContextId context_id, uint64_t touch_id);

/**
* Writes the position of the given touch to the output pointers.
*/
bool goud_input_touch_position(struct GoudContextId context_id, uint64_t touch_id, float *out_x, float *out_y);

/**
* Returns `true` if the given touch began this frame.
*/
bool goud_input_touch_just_pressed(struct GoudContextId context_id, uint64_t touch_id);

/**
* Returns `true` if the given touch ended this frame.
*/
bool goud_input_touch_just_released(struct GoudContextId context_id, uint64_t touch_id);

/**
* Writes the movement delta of the given touch to the output pointers.
*/
bool goud_input_touch_delta(struct GoudContextId context_id, uint64_t touch_id, float *out_dx, float *out_dy);

/* === Audio === */

/**
Expand Down
119 changes: 119 additions & 0 deletions codegen/goud_sdk.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4649,6 +4649,67 @@
"params": [],
"returns": "Vec2"
},
{
"name": "getTouchCount",
"doc": "Returns the number of currently active touch points",
"params": [],
"returns": "u32"
},
{
"name": "isTouchActive",
"doc": "Returns true if the given touch ID is currently active",
"params": [
{
"name": "touchId",
"type": "u64"
}
],
"returns": "bool"
},
{
"name": "getTouchPosition",
"doc": "Returns the position of the given touch point",
"params": [
{
"name": "touchId",
"type": "u64"
}
],
"returns": "Vec2"
},
{
"name": "isTouchJustPressed",
"doc": "Returns true if the given touch began this frame",
"params": [
{
"name": "touchId",
"type": "u64"
}
],
"returns": "bool"
},
{
"name": "isTouchJustReleased",
"doc": "Returns true if the given touch ended this frame",
"params": [
{
"name": "touchId",
"type": "u64"
}
],
"returns": "bool"
},
{
"name": "getTouchDelta",
"doc": "Returns the movement delta for the given touch point since last frame",
"params": [
{
"name": "touchId",
"type": "u64"
}
],
"returns": "Vec2"
},
{
"$ref": "EcsMethods",
"name": "spawnEmpty"
Expand Down Expand Up @@ -8534,6 +8595,24 @@
{
"sig": "scroll_dy(): number"
},
{
"method": "getTouchCount"
},
{
"method": "isTouchActive"
},
{
"method": "getTouchPosition"
},
{
"method": "isTouchJustPressed"
},
{
"method": "isTouchJustReleased"
},
{
"method": "getTouchDelta"
},
{
"method": "mapActionKey"
},
Expand Down Expand Up @@ -12451,6 +12530,46 @@
],
"returns_struct": "Vec2"
},
"getTouchCount": {
"ffi": "goud_input_touch_count"
},
"isTouchActive": {
"ffi": "goud_input_touch_active"
},
"getTouchPosition": {
"ffi": "goud_input_touch_position",
"out_params": [
{
"name": "x",
"type": "f32"
},
{
"name": "y",
"type": "f32"
}
],
"returns_struct": "Vec2"
},
"isTouchJustPressed": {
"ffi": "goud_input_touch_just_pressed"
},
"isTouchJustReleased": {
"ffi": "goud_input_touch_just_released"
},
"getTouchDelta": {
"ffi": "goud_input_touch_delta",
"out_params": [
{
"name": "dx",
"type": "f32"
},
{
"name": "dy",
"type": "f32"
}
],
"returns_struct": "Vec2"
},
"spawnEmpty": {
"ffi": "goud_entity_spawn_empty",
"returns_entity": true
Expand Down
10 changes: 8 additions & 2 deletions codegen/kotlin_codegen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ def _write_gradle_build():
content = f"""\
// {HEADER_COMMENT}
plugins {{
kotlin("jvm") version "1.9.22"
kotlin("jvm") version "2.0.21"
`maven-publish`
signing
id("org.jetbrains.dokka") version "1.9.10"
id("org.jetbrains.dokka") version "1.9.20"
}}

group = "io.github.aram-devdocs"
Expand Down Expand Up @@ -201,6 +201,12 @@ def _write_gradle_build():
settings_gradle = kotlin_root / "settings.gradle.kts"
settings_content = f"""\
// {HEADER_COMMENT}
pluginManagement {{
repositories {{
gradlePluginPortal()
mavenCentral()
}}
}}
rootProject.name = "goudengine"
"""
settings_gradle.write_text(settings_content)
Expand Down
1 change: 1 addition & 0 deletions goud_engine/build_support/ffi_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const FFI_SOURCE_FILES: &[&str] = &[
"src/ffi/input/keyboard.rs",
"src/ffi/input/mouse.rs",
"src/ffi/input/actions.rs",
"src/ffi/input/touch.rs",
// collision (not yet split)
"src/ffi/collision.rs",
// scene module
Expand Down
13 changes: 13 additions & 0 deletions goud_engine/src/core/events/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ impl Default for AppExiting {
}
}

/// Emitted when the application is suspended (e.g. moved to background on mobile).
///
/// Systems should respond by pausing audio, suspending rendering, and saving
/// any transient state.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct AppSuspended;

/// Emitted when the application resumes from a suspended state.
///
/// Systems should respond by resuming audio and rendering.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct AppResumed;

/// Reason for application exit.
///
/// Used with [`AppExiting`] to indicate why the application is shutting down.
Expand Down
2 changes: 1 addition & 1 deletion goud_engine/src/core/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ mod frame;
mod tests;
mod window;

pub use app::{AppExiting, AppStarted, ExitReason};
pub use app::{AppExiting, AppResumed, AppStarted, AppSuspended, ExitReason};
pub use frame::{FrameEnded, FrameStarted};
pub use window::{
FullscreenChanged, WindowCloseRequested, WindowFocused, WindowMoved, WindowResized,
Expand Down
Loading
Loading