chuckrector / mappo Goto Github PK
View Code? Open in Web Editor NEW๐น Retro 2D tile map editor for VERGE maps.
License: MIT License
๐น Retro 2D tile map editor for VERGE maps.
License: MIT License
i need to understand the math here a lot better. it's proving to be a little tricky. regardless of zoom level, it will jiggle by one canvas pixel.
see inside middlePanel
's mousemove
handler:
if (state.selectedTileLayerIndex !== -1) {
const layer = state.map.tileLayers[state.selectedTileLayerIndex]
const tileWidth = tileset.tileWidth
const tileHeight = tileset.tileHeight
const scaleX = ~~(event.offsetX / scale)
const scaleY = ~~(event.offsetY / scale)
const parallaxX = ~~(state.camera.x * layer.parallax.x)
const parallaxY = ~~(state.camera.y * layer.parallax.y)
const x = scaleX - ((parallaxX + scaleX) % tileWidth)
const y = scaleY - ((parallaxY + scaleY) % tileHeight)
if (x !== state.highlightedMapTile.x || y !== state.highlightedMapTile.y) {
store.dispatch({type: `HIGHLIGHT_MAP_TILE`, x, y})
}
}
happens regardless of ~~
truncation. note that renderLayer
performs ~~
truncation, since rendering is faster at whole-pixel boundaries.
do not want
not a big deal, but makes the app feel less "solid"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.