-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added actions to add a static ball to the page
- Loading branch information
Showing
11 changed files
with
206 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Action } from '../framework/Executor'; | ||
import OutsideContext from '../context/OutsideContext'; | ||
|
||
export type RemoveDerpyballAction = Action<undefined, OutsideContext>; | ||
|
||
export default function removeDerpyball({ state: outside }: RemoveDerpyballAction) { | ||
outside.removeBall(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Action } from '../framework/Executor'; | ||
import OutsideContext, { Throw } from '../context/OutsideContext'; | ||
|
||
export type ThrowDerpyballAction = Action<Throw, OutsideContext>; | ||
|
||
export default function throwDerpyball({ payload, state: outside }: ThrowDerpyballAction) { | ||
if (payload) { | ||
outside.throwBall(payload) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Container from '../framework/Container'; | ||
import { ActionType, State } from '../initialize'; | ||
import Controls, { ControlsProperties } from '../widgets/Controls'; | ||
import { Throw } from '../context/OutsideContext'; | ||
|
||
const ControlsContainer = Container(Controls, [ State.App, State.Executor ], { | ||
getProperties([ app, executor]): ControlsProperties { | ||
return { | ||
onActionButtonPressed() { | ||
console.log('pressed', app.state); | ||
const derpyball: Throw = { | ||
direction: [ 1, 0, 0], | ||
initialTime: performance.now(), | ||
position: [ 0, 3, -4], | ||
speed: 1 | ||
}; | ||
executor.execute({ type: ActionType.ThrowDerpyball, payload: derpyball }); | ||
}, | ||
onActionButtonReleased() { | ||
console.log('released', app.state); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
export default ControlsContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.