Add start of ship rendering
This commit is contained in:
parent
4a253b0184
commit
704c82838a
15 changed files with 199 additions and 13 deletions
|
@ -3,6 +3,7 @@ import {getContainedSectors} from '../world/index.mjs';
|
|||
import * as background from './background.mjs';
|
||||
import * as gui from './gui.mjs';
|
||||
import * as draw from './draw.mjs';
|
||||
import * as ship from './ship.mjs';
|
||||
|
||||
export let canvas, context, tempCanvas, tempContext;
|
||||
export let view;
|
||||
|
@ -36,6 +37,7 @@ export function render() {
|
|||
// TODO: Translate canvas.
|
||||
|
||||
background.render();
|
||||
ship.render();
|
||||
|
||||
context.restore();
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import {canvas, context} from './index.mjs';
|
||||
import * as assets from '../assets.mjs';
|
||||
|
||||
export function render() {
|
||||
|
||||
}
|
12
js/graphics/ship.mjs
Normal file
12
js/graphics/ship.mjs
Normal file
|
@ -0,0 +1,12 @@
|
|||
import {canvas, context} from './index.mjs';
|
||||
import * as assets from '../assets.mjs';
|
||||
import * as world from '../world/index.mjs';
|
||||
|
||||
export function render() {
|
||||
world.ships.forEach(renderShip);
|
||||
}
|
||||
|
||||
function renderShip(ship) {
|
||||
context.fillStyle = 'red';
|
||||
context.fillRect(ship.x, ship.y, 10, 10);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue