summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-03 00:28:24 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-03 00:28:24 +0100
commit019d72562a421917da3e7d6642764687d925f3cd (patch)
treee1d7e9e8442722ef058358a39dfc43dc8551cccc
parente0531e25f3d91fdfd335a1f2db0ac9ef0079cbf6 (diff)
downloadhexmap-019d72562a421917da3e7d6642764687d925f3cd.zip
hexmap-019d72562a421917da3e7d6642764687d925f3cd.tar.gz
add a path with top left hex only
-rw-r--r--hexmap.scm94
1 files changed, 65 insertions, 29 deletions
diff --git a/hexmap.scm b/hexmap.scm
index 8c56680..91a84f6 100644
--- a/hexmap.scm
+++ b/hexmap.scm
@@ -344,7 +344,63 @@
border_edges
)
-(define (build_grid grid_path border_path width height sideLength orientation xOff yOff)
+(define (stroke_grid_hex grip_path vx vy)
+ (gimp-vectors-stroke-new-from-points grip_path 0 (* 8 2 3)
+ (vector
+ (vector-ref vx 0) (vector-ref vy 0)
+ (vector-ref vx 0) (vector-ref vy 0)
+ (vector-ref vx 0) (vector-ref vy 0)
+ (vector-ref vx 1) (vector-ref vy 1)
+ (vector-ref vx 1) (vector-ref vy 1)
+ (vector-ref vx 1) (vector-ref vy 1)
+ (vector-ref vx 2) (vector-ref vy 2)
+ (vector-ref vx 2) (vector-ref vy 2)
+ (vector-ref vx 2) (vector-ref vy 2)
+ (vector-ref vx 3) (vector-ref vy 3)
+ (vector-ref vx 3) (vector-ref vy 3)
+ (vector-ref vx 3) (vector-ref vy 3)
+ (vector-ref vx 4) (vector-ref vy 4)
+ (vector-ref vx 4) (vector-ref vy 4)
+ (vector-ref vx 4) (vector-ref vy 4)
+ (vector-ref vx 5) (vector-ref vy 5)
+ (vector-ref vx 5) (vector-ref vy 5)
+ (vector-ref vx 5) (vector-ref vy 5)
+ (vector-ref vx 6) (vector-ref vy 6)
+ (vector-ref vx 6) (vector-ref vy 6)
+ (vector-ref vx 6) (vector-ref vy 6)
+ (vector-ref vx 7) (vector-ref vy 7)
+ (vector-ref vx 7) (vector-ref vy 7)
+ (vector-ref vx 7) (vector-ref vy 7)
+ ) FALSE
+ )
+)
+
+(define (stroke_hex hex_path vx vy)
+ (gimp-vectors-stroke-new-from-points hex_path 0 (* 6 2 3)
+ (vector
+ (vector-ref vx 1) (vector-ref vy 1)
+ (vector-ref vx 1) (vector-ref vy 1)
+ (vector-ref vx 1) (vector-ref vy 1)
+ (vector-ref vx 2) (vector-ref vy 2)
+ (vector-ref vx 2) (vector-ref vy 2)
+ (vector-ref vx 2) (vector-ref vy 2)
+ (vector-ref vx 3) (vector-ref vy 3)
+ (vector-ref vx 3) (vector-ref vy 3)
+ (vector-ref vx 3) (vector-ref vy 3)
+ (vector-ref vx 4) (vector-ref vy 4)
+ (vector-ref vx 4) (vector-ref vy 4)
+ (vector-ref vx 4) (vector-ref vy 4)
+ (vector-ref vx 5) (vector-ref vy 5)
+ (vector-ref vx 5) (vector-ref vy 5)
+ (vector-ref vx 5) (vector-ref vy 5)
+ (vector-ref vx 6) (vector-ref vy 6)
+ (vector-ref vx 6) (vector-ref vy 6)
+ (vector-ref vx 6) (vector-ref vy 6)
+ ) TRUE
+ )
+)
+
+(define (build_grid hex_path grid_path border_path width height sideLength orientation xOff yOff)
(let*
(
(w (- width xOff))
@@ -420,34 +476,11 @@
(vector-set! vy 5 (+ (vector-ref hY 5) yAdd))
(vector-set! vy 6 (+ (vector-ref hY 6) yAdd))
(vector-set! vy 7 (+ (vector-ref hY 7) yAdd))
+ ; grid path
+ (stroke_grid_hex grid_path vx vy)
; hex path
- (gimp-vectors-stroke-new-from-points grid_path 0 (* 8 2 3)
- (vector
- (vector-ref vx 0) (vector-ref vy 0)
- (vector-ref vx 0) (vector-ref vy 0)
- (vector-ref vx 0) (vector-ref vy 0)
- (vector-ref vx 1) (vector-ref vy 1)
- (vector-ref vx 1) (vector-ref vy 1)
- (vector-ref vx 1) (vector-ref vy 1)
- (vector-ref vx 2) (vector-ref vy 2)
- (vector-ref vx 2) (vector-ref vy 2)
- (vector-ref vx 2) (vector-ref vy 2)
- (vector-ref vx 3) (vector-ref vy 3)
- (vector-ref vx 3) (vector-ref vy 3)
- (vector-ref vx 3) (vector-ref vy 3)
- (vector-ref vx 4) (vector-ref vy 4)
- (vector-ref vx 4) (vector-ref vy 4)
- (vector-ref vx 4) (vector-ref vy 4)
- (vector-ref vx 5) (vector-ref vy 5)
- (vector-ref vx 5) (vector-ref vy 5)
- (vector-ref vx 5) (vector-ref vy 5)
- (vector-ref vx 6) (vector-ref vy 6)
- (vector-ref vx 6) (vector-ref vy 6)
- (vector-ref vx 6) (vector-ref vy 6)
- (vector-ref vx 7) (vector-ref vy 7)
- (vector-ref vx 7) (vector-ref vy 7)
- (vector-ref vx 7) (vector-ref vy 7)
- ) FALSE
+ (if (and (= y 0) (= x 0))
+ (stroke_hex hex_path vx vy)
)
; border
(if (= orientation 0) ; horizontal
@@ -484,6 +517,7 @@
(mask 0)
(width 0)
(height 0)
+ (hex_path 0)
(grid_path 0)
(hex_edges 0)
(border_path 0)
@@ -525,11 +559,13 @@
(gimp-context-set-paint-method "gimp-pencil")
; paths
+ (set! hex_path (car (gimp-vectors-new img "Hex")))
+ (gimp-image-add-vectors img hex_path -1)
(set! grid_path (car (gimp-vectors-new img "Hex Grid")))
(gimp-image-add-vectors img grid_path -1)
(set! border_path (car (gimp-vectors-new img "Map Border")))
(gimp-image-add-vectors img border_path -1)
- (set! hex_edges (build_grid grid_path border_path width height sideLength orientation xOff yOff))
+ (set! hex_edges (build_grid hex_path grid_path border_path width height sideLength orientation xOff yOff))
; grid layer
(set! gridLayer (car (gimp-layer-new img width height RGBA-IMAGE "Grid" 100 NORMAL-MODE)))