This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch feature/scenes into main (#76)
* Implement scenes Add Scenes framework - Implement Scene class - Implement Elements - Implement SceneRenderer - Implement ElementRenderer - Implement SceneManager - Add SceneRenderer to RenderPipeline - Add ElementRenderer to RenderPipeline - Other adaptations * Scene framework changes - Remove LevelScene - Add InGame Scene * More Scene stuff - Implement CheckBox Element - Implement InGame base scene.
- Loading branch information
Showing
25 changed files
with
1,129 additions
and
48 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
10 changes: 4 additions & 6 deletions
10
src/ts/engine/event/events/mouseclickevent/mouseclickevent.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Vector2D from "./vector2d.js"; | ||
|
||
class Rectangle { | ||
private _location: Vector2D; | ||
private _width: number; | ||
private _height: number; | ||
|
||
get location(): Vector2D { | ||
return this._location; | ||
} | ||
|
||
get width(): number { | ||
return this._width; | ||
} | ||
|
||
get height(): number { | ||
return this._height; | ||
} | ||
|
||
get centerRelative(): Vector2D { | ||
return new Vector2D(this.width / 2, this.height / 2); | ||
} | ||
|
||
get centerAbsolute(): Vector2D { | ||
return this.location.add(this.centerRelative); | ||
} | ||
|
||
get corners(): Vector2D[] { | ||
let topLeft = this.location; | ||
let topRight = new Vector2D(this.location.x + this.width, this.location.y); | ||
let bottomLeft = new Vector2D( | ||
this.location.x, | ||
this.location.y + this.height | ||
); | ||
let bottomRight = new Vector2D( | ||
this.location.x + this.width, | ||
this.location.y + this.height | ||
); | ||
|
||
return [topLeft, topRight, bottomLeft, bottomRight]; | ||
} | ||
|
||
constructor(x: number, y: number, width: number, height: number) { | ||
this._location = new Vector2D(x, y); | ||
this._width = width; | ||
this._height = height; | ||
} | ||
|
||
public isInside(point: Vector2D): boolean { | ||
return ( | ||
point.x >= this.location.x && | ||
point.x <= this.location.x + this.width && | ||
point.y >= this.location.y && | ||
point.y <= this.location.y + this.height | ||
); | ||
} | ||
} | ||
|
||
export default Rectangle; |
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.