From 7bd387d35baea9f6861c81f4286f68999849ea63 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 25 Feb 2021 23:57:06 +0100 Subject: Move from (chickadee render ...) to (chickadee graphics ...). The only notable changes are listed below: * engine/node-2d.scm (draw): Use new API from (chickadee graphics path). * scenes/game.scm (draw): Same. --- characters.scm | 11 +++++------ characters/lorenzo.scm | 6 +++--- characters/reaper.scm | 6 +++--- engine/node-2d.scm | 28 ++++++++++++++++++++-------- engine/shell.scm | 8 ++++---- scenes/death.scm | 10 +++++----- scenes/game.scm | 45 +++++++++++++++++++++++++++------------------ scenes/intro.scm | 6 +++--- utils.scm | 4 ++-- 9 files changed, 72 insertions(+), 52 deletions(-) diff --git a/characters.scm b/characters.scm index 03789f2..e4f3e53 100644 --- a/characters.scm +++ b/characters.scm @@ -1,5 +1,5 @@ ;;; The Inevitable Game -;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2018, 2021 Ricardo Wurmus ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -18,11 +18,10 @@ (define-module (characters) #:use-module (chickadee math rect) #:use-module (chickadee math vector) - #:use-module (chickadee render color) - #:use-module (chickadee render font) - #:use-module (chickadee render shapes) - #:use-module (chickadee render texture) - #:use-module (chickadee render tiled) + #:use-module (chickadee graphics color) + #:use-module (chickadee graphics font) + #:use-module (chickadee graphics texture) + #:use-module (chickadee graphics tiled) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match) diff --git a/characters/lorenzo.scm b/characters/lorenzo.scm index 8c8971f..7615b36 100644 --- a/characters/lorenzo.scm +++ b/characters/lorenzo.scm @@ -1,5 +1,5 @@ ;;; The Inevitable Game -;;; Copyright © 2018, 2019 Ricardo Wurmus +;;; Copyright © 2018, 2019, 2021 Ricardo Wurmus ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -16,8 +16,8 @@ ;;; . (define-module (characters lorenzo) - #:use-module (chickadee render texture) - #:use-module (chickadee render color) + #:use-module (chickadee graphics texture) + #:use-module (chickadee graphics color) #:use-module (chickadee math rect) #:use-module (chickadee math vector) #:use-module (engine assets) diff --git a/characters/reaper.scm b/characters/reaper.scm index 1a93ab1..e97d8b2 100644 --- a/characters/reaper.scm +++ b/characters/reaper.scm @@ -1,5 +1,5 @@ ;;; The Inevitable Game -;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2018, 2021 Ricardo Wurmus ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -16,8 +16,8 @@ ;;; . (define-module (characters reaper) - #:use-module (chickadee render texture) - #:use-module (chickadee render color) + #:use-module (chickadee graphics texture) + #:use-module (chickadee graphics color) #:use-module (chickadee math rect) #:use-module (chickadee math vector) #:use-module (engine assets) diff --git a/engine/node-2d.scm b/engine/node-2d.scm index 3de1597..d5919aa 100644 --- a/engine/node-2d.scm +++ b/engine/node-2d.scm @@ -1,5 +1,6 @@ ;;; Lisp Game Jam 2018 ;;; Copyright © 2018 David Thompson +;;; Copyright © 2021 Ricardo Wurmus ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -20,13 +21,13 @@ #:use-module (chickadee math matrix) #:use-module (chickadee math rect) #:use-module (chickadee math vector) - #:use-module (chickadee render) - #:use-module (chickadee render color) - #:use-module (chickadee render font) - #:use-module (chickadee render framebuffer) - #:use-module (chickadee render shapes) - #:use-module (chickadee render sprite) - #:use-module (chickadee render texture) + #:use-module (chickadee graphics) + #:use-module (chickadee graphics color) + #:use-module (chickadee graphics font) + #:use-module (chickadee graphics framebuffer) + #:use-module (chickadee graphics path) + #:use-module (chickadee graphics sprite) + #:use-module (chickadee graphics texture) #:use-module (chickadee scripting) #:use-module (ice-9 match) #:use-module (engine assets) @@ -346,7 +347,18 @@ (color #:accessor color #:init-form black #:init-keyword #:color)) (define-method (draw (r ) alpha) - (draw-filled-rect (region r) (color r) #:matrix (world-matrix r))) + (draw-canvas (make-canvas + (with-style + ((fill-color (color r))) + (fill + (rectangle (vec2 (rect-left (region r)) + (rect-bottom (region r))) + (rect-width (region r)) + (rect-height (region r))))) + ;; TODO: wrong type + ;#:matrix + ;(world-matrix r) + ))) ;;; diff --git a/engine/shell.scm b/engine/shell.scm index 3182483..14ae081 100644 --- a/engine/shell.scm +++ b/engine/shell.scm @@ -1,6 +1,6 @@ ;;; Lisp Game Jam 2018 +;;; Copyright © 2018, 2021 Ricardo Wurmus ;;; Copyright © 2018 David Thompson -;;; Copyright © 2018 Ricardo Wurmus ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -21,9 +21,9 @@ #:use-module (chickadee math matrix) #:use-module (chickadee math rect) #:use-module (chickadee math vector) - #:use-module (chickadee render) - #:use-module (chickadee render framebuffer) - #:use-module (chickadee render sprite) + #:use-module (chickadee graphics) + #:use-module (chickadee graphics framebuffer) + #:use-module (chickadee graphics sprite) #:use-module (chickadee scripting) #:use-module (ice-9 format) #:use-module (ice-9 match) diff --git a/scenes/death.scm b/scenes/death.scm index 0444112..388dae8 100644 --- a/scenes/death.scm +++ b/scenes/death.scm @@ -1,5 +1,5 @@ ;;; The Inevitable Game -;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2018, 2021 Ricardo Wurmus ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -21,10 +21,10 @@ #:use-module (chickadee) #:use-module (chickadee math rect) #:use-module (chickadee math vector) - #:use-module ((chickadee render color) #:select (make-color)) - #:use-module (chickadee render font) - #:use-module (chickadee render texture) - #:use-module (chickadee render tiled) + #:use-module ((chickadee graphics color) #:select (make-color)) + #:use-module (chickadee graphics font) + #:use-module (chickadee graphics texture) + #:use-module (chickadee graphics tiled) #:use-module (chickadee scripting) #:use-module (engine assets) #:use-module (engine audio) diff --git a/scenes/game.scm b/scenes/game.scm index 0a7cce9..70bf91a 100644 --- a/scenes/game.scm +++ b/scenes/game.scm @@ -1,5 +1,5 @@ ;;; The Inevitable Game -;;; Copyright © 2018, 2019 Ricardo Wurmus +;;; Copyright © 2018, 2019, 2021 Ricardo Wurmus ;;; Copyright © 2018 David Thompson ;;; ;;; This program is free software: you can redistribute it and/or @@ -20,11 +20,11 @@ #:use-module (chickadee math easings) #:use-module (chickadee math rect) #:use-module (chickadee math vector) - #:use-module ((chickadee render color) #:hide (color)) - #:use-module (chickadee render font) - #:use-module (chickadee render shapes) - #:use-module (chickadee render texture) - #:use-module (chickadee render tiled) + #:use-module (chickadee graphics color) + #:use-module (chickadee graphics font) + #:use-module ((chickadee graphics path) #:hide (move-to)) + #:use-module (chickadee graphics texture) + #:use-module (chickadee graphics tiled) #:use-module ((sdl2 input keyboard) #:prefix sdl2:) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) @@ -425,18 +425,27 @@ conversation." weight music)) (player (object stats))) - (for-each (lambda (property index) - (let* ((value (property player)) - (start (vec2 x (- y (* step index)))) - (end-y (- y (* step index))) - (end (vec2 (+ x 100) end-y))) - (draw-line start end - #:thickness thickness #:color red) - (when (> value 0) - (draw-line start (vec2 (+ x value) end-y) - #:thickness thickness #:color green)))) - properties - (iota (length properties))))) + (let ((painters + (map (lambda (property index) + (let* ((value (property player)) + (start (vec2 x (- y (* step index)))) + (end-y (- y (* step index))) + (end (vec2 (+ x 100) end-y))) + (with-style + ((stroke-color red) + (stroke-width thickness)) + (stroke + (line start end))) + (when (> value 0) + (with-style + ((stroke-color green) + (stroke-width thickness)) + (stroke + (line start (vec2 (+ x value) end-y))))))) + properties + (iota (length properties))))) + (draw-canvas + (make-canvas (apply superimpose painters)))))) (define-method (draw (game ) alpha) (draw-tile-map (asset-ref (tile-map game)) diff --git a/scenes/intro.scm b/scenes/intro.scm index b1480dc..053cfd8 100644 --- a/scenes/intro.scm +++ b/scenes/intro.scm @@ -18,9 +18,9 @@ (define-module (scenes intro) #:use-module (chickadee math rect) #:use-module (chickadee math vector) - #:use-module ((chickadee render color) #:select (make-color)) - #:use-module (chickadee render font) - #:use-module (chickadee render texture) + #:use-module ((chickadee graphics color) #:select (make-color)) + #:use-module (chickadee graphics font) + #:use-module (chickadee graphics texture) #:use-module (chickadee scripting) #:use-module (engine assets) #:use-module (engine audio) diff --git a/utils.scm b/utils.scm index d249e86..1e4a7cd 100644 --- a/utils.scm +++ b/utils.scm @@ -1,5 +1,5 @@ ;;; The Inevitable Game -;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2018, 2021 Ricardo Wurmus ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -16,7 +16,7 @@ ;;; . (define-module (utils) - #:use-module (chickadee render font) + #:use-module (chickadee graphics font) #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:use-module (config) -- cgit v1.2.3