Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller support #416

Draft
wants to merge 206 commits into
base: master
Choose a base branch
from

Conversation

Arman-AIi
Copy link

*Not using requestAnimationFrame anymore

Copy link
Contributor

@kenos1 kenos1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very incomplete, has no buttons support, has bad practices and needs more refinement.

@@ -8,6 +8,7 @@ import { ItemType, type ItemDefinition } from "@common/utils/objectDefinitions";
import { Vec } from "@common/utils/vector";
import $ from "jquery";
import nipplejs, { type JoystickOutputData } from "nipplejs";
import * as PIXI from "pixi.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not import everything from pixijs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, now it only imports ticker

@@ -342,6 +343,50 @@ export class InputManager {
shootOnRelease = false;
});
}
const ticker = new PIXI.Ticker();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Game class's pixi ticker

const ticker = new PIXI.Ticker();
ticker.stop();
ticker.add(() => {
const gamepads = navigator.getGamepads();
Copy link
Contributor

@kenos1 kenos1 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use Game's pixi ticker, put this into its own method

client/src/scripts/managers/inputManager.ts Outdated Show resolved Hide resolved
client/src/scripts/managers/inputManager.ts Outdated Show resolved Hide resolved
client/src/scripts/managers/inputManager.ts Outdated Show resolved Hide resolved
client/src/scripts/managers/inputManager.ts Outdated Show resolved Hide resolved
this.turning = true;
const activePlayer = game.activePlayer;
if (game.console.getBuiltInCVar("cv_responsive_rotation") && !game.gameOver && game.activePlayer) {
game.activePlayer.container.rotation = this.rotation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a better way to do this in the Player class?

client/src/scripts/managers/inputManager.ts Outdated Show resolved Hide resolved
client/src/scripts/managers/inputManager.ts Outdated Show resolved Hide resolved
const ticker = new PIXI.Ticker();
ticker.stop();
ticker.add(() => {
const gamepads = navigator.getGamepads();
Copy link
Contributor

@kenos1 kenos1 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you really need to call this method every frame, is it required?

fix: only imported ticker instead of all of pixi.js
@@ -8,7 +8,7 @@ import { ItemType, type ItemDefinition } from "@common/utils/objectDefinitions";
import { Vec } from "@common/utils/vector";
import $ from "jquery";
import nipplejs, { type JoystickOutputData } from "nipplejs";
import * as PIXI from "pixi.js";
import { Ticker } from "pixi.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still wrong, use the Game update method

client/index.html Outdated Show resolved Hide resolved
@Arman-AIi Arman-AIi changed the title Controller joysticks Controller support Nov 16, 2024
hsanger and others added 30 commits December 24, 2024 10:02
also updated cute english (again)
Updated changelog.
Bumped protocol version.
Bumped package.json version number.
Set mode to fall in constants.
Map to fall in config.ts.
Updated game bg.
Updated embed bg.
Updated github bg.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants