Skip to content

Commit

Permalink
stitching
Browse files Browse the repository at this point in the history
  • Loading branch information
exp111 committed Jan 11, 2024
1 parent 883de72 commit 073051c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 42 deletions.
42 changes: 0 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,6 @@ Uses Leaflet to show the map.

You need to first load a map before being able to play. A test map is available through the menu (Click "Load Test Map").

## TODO:
- mp:
- let users set color
- let users select name?
- make connecting less cbt
- ping? => do direction effect on border when ping off screen
- notify user that other user has changed/reset case
- host migration/close lobby when host leaves
- right click menu:
- delete all markers
- debug:
- on circle/shape: set color
- style markers (so you can see what you marked)
- fix bounds on small images
- mark solved cards better in ui
- make objective display better on mobile
- add shake on mobile/general cards after waiting too long?
- add possibility to (temporarily) see unflipped card?
- save case progress
- save settings
- optimize loading (zip limited?)
- show step progress (1/4) somewhere on mobile (card menu? corner?)
- finer file load progress bar (hook put onsuccess?)
- performance test loading (seperate zip and idb tests)
- hints
- tests??
- toolbar like debug menu for quick access?
- finish timer
- fix slides not being centered after resizing while case is finished (swiper is disabled)
- Ui shouldnt have to do case logic checks, mark step as unsolvable (in buildnodes?), only check that flag
- use card classes instead of adding card overlays for locked and solved?
- fix caseclosed.png clipping
- delete circles after clicking them in a AND/OR node
- clean up multi-steps + objectives code
- move to (first) unlocked card after solving card?
- test multi steps more
- case finish animation not working on mobile?

## CaseBuilder TODO:
- better step requirement input
- show error symbol when something went wrong

# How to create a map from a image
To transform a image to raster tiles you can use libvips with this command:

Expand Down
26 changes: 26 additions & 0 deletions map/stitchWS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from PIL import Image
offsets = [
#x,y
[(0,0), (3244,0), (6493,0), (9742,0)],
[(0,2209), (3244,2209), (6493,2209), (9742,2209)],
[(0,4428), (3244,4422), (6493,4427), (9742,4422)],
[(0,6647), (3244,6641), (6493,6637), (9742,6635)],
]

# get the last image
lastRow = len(offsets) - 1
lastColumn = len(offsets[0]) - 1
lastImg = Image.open(f"{lastRow}_{lastColumn}.png")

totalWidth = offsets[lastRow][lastColumn][0] + lastImg.width
totalHeight = offsets[lastRow][lastColumn][1] + lastImg.height
print(f"Width: {totalWidth}, Height: {totalHeight}")

img = Image.new("RGBA", (totalWidth, totalHeight))
offset = 0
for row in range(len(offsets)):
for column in range(len(offsets[0])):
offset = offsets[row][column]
img.paste(Image.open(f"{row}_{column}.png"), offset)
img.save("out.png")
print("Done")

0 comments on commit 073051c

Please sign in to comment.