1
1
/**
2
2
* @file Superclass for managing game view.
3
3
* @author Una Ada <una@anarchy.website>
4
- * @version 2021.06.01
4
+ * @version 2021.06.03
5
5
*/
6
6
7
7
/*----- Imports --------------------------------------------------------------*/
8
8
import GameData from "./GameData.js" ;
9
9
10
10
/*----- Classes --------------------------------------------------------------*/
11
11
/** @module Renderer - Superclass for managing game view. */
12
- export default class {
12
+ export default class Renderer {
13
13
/**
14
14
* Initialize base rendering functions.
15
15
* @arg {GameData} model - A game model instance.
@@ -18,6 +18,15 @@ export default class {
18
18
/** @var {GameData} model - Reference to the game's model. */
19
19
this . model = model ;
20
20
}
21
+
22
+ /*---- Setters and getters -------------------------------------------------*/
23
+ /** @type {number[] } */
24
+ get bounds ( ) {
25
+ const { top, left, height, width } = this . container . getBoundingClientRect ( ) ;
26
+ return { top, left, height, width } ;
27
+ }
28
+
29
+ /*----- Methods ------------------------------------------------------------*/
21
30
/**
22
31
* Sets the view container
23
32
* @arg {HTMLElement} el - Element to set as view container.
@@ -28,9 +37,8 @@ export default class {
28
37
/** @var {HTMLElement} container - DOM Element holding all game views. */
29
38
this . container = el ;
30
39
}
31
- /** @type {number[] } */
32
- get bounds ( ) {
33
- const { top, left, height, width } = this . container . getBoundingClientRect ( ) ;
34
- return { top, left, height, width } ;
40
+ /** Render the game scene. */
41
+ render ( ) {
42
+ console . error ( "Renderer#render() has not been overwritten by subclass!" ) ;
35
43
}
36
44
}
0 commit comments