Trying to get modules to work
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,2 +1,2 @@
|
|||||||
all: tsconfig.json $(wildcard src/*.ts)
|
all: tsconfig.json $(wildcard ts/*.ts)
|
||||||
tsc
|
tsc
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import { TowerMap } from 'tower_map.js';
|
import { TowerMap } from 'tower_map.js';
|
||||||
export function main() {
|
export function main() {
|
||||||
const map = new TowerMap();
|
document.body.style.margin = '0';
|
||||||
|
document.body.style.backgroundColor = 'black';
|
||||||
|
const container = document.createElement('div');
|
||||||
|
document.body.appendChild(container);
|
||||||
|
container.style.width = '100vmin';
|
||||||
|
container.style.height = '100vmin';
|
||||||
|
const map = new TowerMap(container);
|
||||||
|
map.draw();
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
//# sourceMappingURL=tower.js.map
|
//# sourceMappingURL=tower.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tower.js","sourceRoot":"","sources":["../src/tower.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,UAAU,IAAI;IAClB,MAAM,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC;AAC7B,CAAC;AAAA,CAAC"}
|
{"version":3,"file":"tower.js","sourceRoot":"","sources":["../ts/tower.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,UAAU,IAAI;IAClB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC;IAE9C,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAChD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IAClC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IAEnC,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,GAAG,CAAC,IAAI,EAAE,CAAC;AACb,CAAC;AAAA,CAAC"}
|
||||||
@@ -1,3 +1,28 @@
|
|||||||
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
||||||
|
if (!privateMap.has(receiver)) {
|
||||||
|
throw new TypeError("attempted to set private field on non-instance");
|
||||||
|
}
|
||||||
|
privateMap.set(receiver, value);
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
||||||
|
if (!privateMap.has(receiver)) {
|
||||||
|
throw new TypeError("attempted to get private field on non-instance");
|
||||||
|
}
|
||||||
|
return privateMap.get(receiver);
|
||||||
|
};
|
||||||
|
var _prnt;
|
||||||
export class TowerMap {
|
export class TowerMap {
|
||||||
|
constructor(prnt) {
|
||||||
|
_prnt.set(this, void 0);
|
||||||
|
__classPrivateFieldSet(this, _prnt, prnt);
|
||||||
|
__classPrivateFieldGet(this, _prnt).style.display = 'grid';
|
||||||
|
}
|
||||||
|
draw() {
|
||||||
|
__classPrivateFieldGet(this, _prnt).style.backgroundImage = 'url("images/land1.svg")';
|
||||||
|
__classPrivateFieldGet(this, _prnt).style.gridTemplateColumns = 'repeat(20, 1ft)';
|
||||||
|
__classPrivateFieldGet(this, _prnt).style.gridTemplateRows = 'repeat(20, 1ft)';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_prnt = new WeakMap();
|
||||||
//# sourceMappingURL=tower_map.js.map
|
//# sourceMappingURL=tower_map.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tower_map.js","sourceRoot":"","sources":["../src/tower_map.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;CACpB"}
|
{"version":3,"file":"tower_map.js","sourceRoot":"","sources":["../ts/tower_map.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,MAAM,OAAO,QAAQ;IAGnB,YAAY,IAAiB;QAF7B,wBAAM;QAGJ,uBAAA,IAAI,SAAS,IAAI,EAAC;QAClB,oCAAW,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IACpC,CAAC;IAED,IAAI;QACF,oCAAW,KAAK,CAAC,eAAe,GAAG,yBAAyB,CAAC;QAC7D,oCAAW,KAAK,CAAC,mBAAmB,GAAG,iBAAiB,CAAC;QACzD,oCAAW,KAAK,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;IACxD,CAAC;CACF"}
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { TowerMap } from 'tower_map.js';
|
|
||||||
|
|
||||||
export function main() {
|
|
||||||
const map = new TowerMap();
|
|
||||||
};
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
export class TowerMap {
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,6 @@ div {
|
|||||||
width: var(--map-width);
|
width: var(--map-width);
|
||||||
height: var(--map-height);
|
height: var(--map-height);
|
||||||
background-image: url('images/land1.svg');
|
background-image: url('images/land1.svg');
|
||||||
background-size: 100% 100%;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(var(--map-width-tiles), 1fr);
|
grid-template-columns: repeat(var(--map-width-tiles), 1fr);
|
||||||
grid-template-rows: repeat(var(--map-height-tiles), 1fr);
|
grid-template-rows: repeat(var(--map-height-tiles), 1fr);
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<script src="js/tower.js"></script>
|
<script type="module" src="js/tower.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
14
ts/tower.ts
Normal file
14
ts/tower.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { TowerMap } from 'tower_map.js';
|
||||||
|
|
||||||
|
export function main() {
|
||||||
|
document.body.style.margin = '0';
|
||||||
|
document.body.style.backgroundColor = 'black';
|
||||||
|
|
||||||
|
const container = document.createElement('div');
|
||||||
|
document.body.appendChild(container);
|
||||||
|
container.style.width = '100vmin';
|
||||||
|
container.style.height = '100vmin';
|
||||||
|
|
||||||
|
const map = new TowerMap(container);
|
||||||
|
map.draw();
|
||||||
|
};
|
||||||
14
ts/tower_map.ts
Normal file
14
ts/tower_map.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
export class TowerMap {
|
||||||
|
#prnt;
|
||||||
|
|
||||||
|
constructor(prnt: HTMLElement) {
|
||||||
|
this.#prnt = prnt;
|
||||||
|
this.#prnt.style.display = 'grid';
|
||||||
|
}
|
||||||
|
|
||||||
|
draw() {
|
||||||
|
this.#prnt.style.backgroundImage = 'url("images/land1.svg")';
|
||||||
|
this.#prnt.style.gridTemplateColumns = 'repeat(20, 1ft)';
|
||||||
|
this.#prnt.style.gridTemplateRows = 'repeat(20, 1ft)';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,12 +2,21 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"module": "ES2020",
|
"module": "ES2020",
|
||||||
"noImplicitAny": true,
|
"outDir": "js",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "js"
|
|
||||||
|
"alwaysStrict": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"strictFunctionTypes": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"strictPropertyInitialization": true
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"src/tower.ts",
|
"ts/tower.ts",
|
||||||
"src/tower_map.ts"
|
"ts/tower_map.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user