import Vector from '../vector'

import store from '../store'

import transform from '../drawers/transform'

const physics = (position, velocity) => {
	position.add(velocity)
	velocity.xy(0, 0)
}

// const gravity = new Vector(0, (0.098 * 1000) / 60)

const keys = store.keyboard.keys

export default ({ position, velocity }) => {
	const dt = store.dt

	// velocity.add(gravity)

	if (keys['KeyD']) velocity.x += dt
	if (keys['KeyA']) velocity.x -= dt
	if (keys['KeyW']) velocity.y -= dt
	if (keys['KeyS']) velocity.y += dt

	physics(position, velocity)

	// transform({
	// 	position,
	// 	scale: [0.2, 0.2],
	// 	children: () => {
	// 		// circle({ color: 'black', position, radius: 20 })
	// 		store.ctx.lineWidth = 15
	// 		store.ctx.fillStyle = 'white'
	// 		store.ctx.stroke(path)
	// 		store.ctx.fill(path)
	// 	},
	// })
}
