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
1 change: 1 addition & 0 deletions packages/common/src/library/libraries/abstracts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { BaseAssetManagerLibrary } from "./asset-manager.library.abstract";
export { BaseComponentSystemLibrary } from "./component-system.library.abstract";
export { BaseGraphicsLibrary } from "./graphics.library.abstract";
export { BaseInputLibrary } from "./input.library.abstract";
export { BaseNetworkLibrary } from "./network.library.abstract";
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { type InitContext } from "../../../context";
import { type IInputLibrary } from "../interfaces";
import { Library } from "../library";

export abstract class BaseInputLibrary extends Library implements IInputLibrary {
public abstract init(context: InitContext): Promise<void>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export const COMPONENT_SYSTEM_LIBRARY = Symbol("COMPONENT_SYSTEM_LIBRARY");
export const GRAPHICS_LIBRARY = Symbol("GRAPHICS_LIBRARY");
export const NETWORK_LIBRARY = Symbol("NETWORK_LIBRARY");
export const ASSET_MANAGER_LIBRARY = Symbol("ASSET_MANAGER_LIBRARY");
export const INPUT_LIBRARY = Symbol("INPUT_LIBRARY");
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { type IExposedLibrary } from "../bases/exposed.library.type";

export interface IInputLibrary extends IExposedLibrary {}
1 change: 1 addition & 0 deletions packages/common/src/library/libraries/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export { IRunnerLibrary } from "./bases/runner.library.type";
export { IAssetManagerLibrary } from "./finals/asset-manager.library.type";
export { IComponentSystemLibrary } from "./finals/component-system.library.type";
export { IGraphicsLibrary } from "./finals/graphics.library.type";
export { IInputLibrary } from "./finals/input.library.type";
export { INetworkLibrary } from "./finals/network.library.type";
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
type IAssetManagerLibrary,
type IComponentSystemLibrary,
type IGraphicsLibrary,
type IInputLibrary,
type INetworkLibrary,
NETWORK_LIBRARY,
} from "../../libraries";
Expand All @@ -13,6 +14,7 @@ import { BaseLibraryManager } from "./base-library.manager";

export enum DefaultLibrariesEnum {
ASSET_MANAGER,
INPUT,
COMPONENT_SYSTEM,
NETWORK,
GRAPHICS,
Expand Down Expand Up @@ -48,6 +50,10 @@ export class LibraryManager extends BaseLibraryManager {
return this._get<T>(DefaultLibrariesEnum.NETWORK);
}

public getInput<T extends IInputLibrary = IInputLibrary>(): LibraryHandle<T> {
return this._get<T>(DefaultLibrariesEnum.INPUT);
}

public getAssetManager<
T extends IAssetManagerLibrary = IAssetManagerLibrary,
>(): LibraryHandle<T> {
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/application/application-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
type IAssetManagerLibrary,
type IComponentSystemLibrary,
type IGraphicsLibrary,
type IInputLibrary,
type ILibrary,
type INetworkLibrary,
type LibraryHandle,
Expand Down Expand Up @@ -59,4 +60,12 @@ export class ApplicationConfig {
public useAssetManagerLibrary(library: IAssetManagerLibrary) {
this._libraryManager.setAssetManager(library);
}

public getInputLibrary() {
return this._libraryManager.getInput();
}

public useInputLibrary(library: IInputLibrary) {
this._libraryManager.setInput(library);
}
}
6 changes: 5 additions & 1 deletion packages/core/src/application/nanoforge-client.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { type IGraphicsLibrary } from "@nanoforge/common";
import { type IGraphicsLibrary, type IInputLibrary } from "@nanoforge/common";

import { NanoforgeApplication } from "./nanoforge-application";

export class NanoforgeClient extends NanoforgeApplication {
public useGraphics(library: IGraphicsLibrary) {
this.applicationConfig.useGraphicsLibrary(library);
}

public useInput(library: IInputLibrary) {
this.applicationConfig.useInputLibrary(library);
}
}
6 changes: 6 additions & 0 deletions packages/core/src/common/library/manager/library.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
type IAssetManagerLibrary,
type IComponentSystemLibrary,
type IGraphicsLibrary,
type IInputLibrary,
type ILibrary,
INPUT_LIBRARY,
type INetworkLibrary,
type IRunnerLibrary,
type LibraryHandle,
Expand Down Expand Up @@ -52,6 +54,10 @@ export class EditableLibraryManager extends LibraryManager {
this._set(DefaultLibrariesEnum.NETWORK, NETWORK_LIBRARY, library, new EditableLibraryContext());
}

public setInput(library: IInputLibrary): void {
this._set(DefaultLibrariesEnum.INPUT, INPUT_LIBRARY, library, new EditableLibraryContext());
}

public getLibraries(): LibraryHandle<ILibrary>[] {
return this._libraries;
}
Expand Down
272 changes: 272 additions & 0 deletions packages/input/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### C++ template
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Private

# NX
.nx/

# Compiled files
src/**/*.js
src/**/*.d.ts

# pubilc directory
public/
compile_commands.json
emsdk/
8 changes: 8 additions & 0 deletions packages/input/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/input/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading