-
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.
adding Input, removing initialize method
- Loading branch information
1 parent
d4e14e8
commit ff5c86e
Showing
23 changed files
with
268 additions
and
304 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
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,11 @@ | ||
export default class Controller { | ||
|
||
constructor() { | ||
|
||
} | ||
|
||
update() { | ||
|
||
} | ||
|
||
} |
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,14 @@ | ||
import Emitter from "./Emitter"; | ||
|
||
class Input extends Emitter { | ||
|
||
constructor() { | ||
this.controllers = []; | ||
} | ||
|
||
update() { | ||
for(let controller of this.controllers){ | ||
controller.update(); | ||
} | ||
} | ||
} |
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,9 @@ | ||
export default class View { | ||
constructor() { | ||
|
||
} | ||
|
||
update() { | ||
//render stuff. | ||
} | ||
} |
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,14 @@ | ||
import Actor from "../core/Actor"; | ||
|
||
export default class Camera extends Actor { | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
mouseToWorld(mouse) { | ||
console.warn("mouseToWorld has not been implemented"); | ||
return null; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
import Camera from "../Camera"; | ||
import Transform2D from "../../core/components/Transform2D"; | ||
import {vec2} from "../../math/math"; | ||
|
||
//technically this should maybe be a component? Gah ask matt. | ||
|
||
export default class Camera2D extends Camera { | ||
|
||
constructor(width, height) { | ||
super(); | ||
|
||
this.width = width; | ||
this.height = height; | ||
|
||
this.addComponent(new Transform2D()); | ||
this.getComponent("transform").scale = new vec2(width/2, height/2) | ||
} | ||
|
||
mouseToWorld(mouse) { | ||
|
||
var transform = this.getComponent("transform"); | ||
var position = transform.position; | ||
var scale = transform.scale; | ||
|
||
var tmp = new vec2( mouse.x * this.width/2, mouse.y * this.height/2 ); | ||
tmp.add(position); | ||
|
||
return tmp; | ||
} | ||
|
||
} |
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,7 @@ | ||
export default class ray2 { | ||
constructor(origin, direction) { | ||
this.origin = origin; | ||
this.direction = direction; | ||
} | ||
|
||
} |
Oops, something went wrong.