mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 23:40:34 +00:00
trying to build protos
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import {Jimp as JimpType, JimpConstructors} from '@jimp/core';
|
||||
import 'jimp';
|
||||
import {TerrainMap, TerrainTile} from '../../generated/protos';
|
||||
|
||||
|
||||
declare const Jimp: JimpType & JimpConstructors;
|
||||
|
||||
export async function loadTerrainMap(): Promise<TerrainMap> {
|
||||
const imageModule = await import(`../../resources/maps/World.png`);
|
||||
const imageUrl = imageModule.default;
|
||||
const image = await Jimp.read(imageUrl)
|
||||
const {width, height} = image.bitmap;
|
||||
|
||||
|
||||
image.scan(0, 0, width, height, function (x: number, y: number, idx: number) {
|
||||
const t: TerrainTile = new TerrainTile()
|
||||
const red = this.bitmap.data[idx + 0];
|
||||
|
||||
if (red > 100) {
|
||||
}
|
||||
})
|
||||
|
||||
return new TerrainMap()
|
||||
|
||||
}
|
||||
|
||||
// loadTerrainMap()
|
||||
Reference in New Issue
Block a user