Plaster

common-lisp
(defpackage #:workbench (:use #:cl+trial #:3d-vectors) (:local-nicknames (#:alloy #:org.shirakumo.alloy) (#:simple #:org.shirakumo.alloy.renderers.simple) (#:presentations #:org.shirakumo.alloy.renderers.simple.presentations) (#:opengl #:org.shirakumo.alloy.renderers.opengl) (#:colored #:org.shirakumo.alloy.colored) (#:colors #:org.shirakumo.alloy.colored.colors)) (:export #:workbench)) (in-package #:workbench) (defclass workbench (main) () (:default-initargs :clear-color (vec 0.25 0.3 0.35 0) :width 1280 :height 720)) (define-pool workbench) (define-asset (workbench grid) mesh (make-line-grid 10 100 100)) (define-shader-entity grid (vertex-entity) ((vertex-array :initform (// 'workbench 'grid)))) (defclass ui (org.shirakumo.fraf.trial.alloy:ui org.shirakumo.alloy:lock-step-scaling-ui org.shirakumo.alloy.renderers.simple.presentations:default-look-and-feel) ((alloy:target-resolution :initform (alloy:px-size 1280 720)))) (progn (defmethod setup-scene ((workbench workbench) scene) (let* ((ui (make-instance 'ui)) (layout (make-instance 'alloy:vertical-linear-layout :layout-parent (alloy:layout-tree ui))) (focus (make-instance 'alloy:focus-list :focus-parent (alloy:focus-tree ui))) (button (alloy:represent "Hi!" 'alloy:button :layout-parent layout :focus-parent focus))) (alloy:register ui ui) (alloy:on alloy:activate (button) (print :hey)) (enter ui scene)) (enter (make-instance 'grid) scene) (enter (make-instance 'editor-camera) scene) (enter (make-instance 'render-pass) scene)) (maybe-reload-scene))