From: Javier Sancho Date: Sat, 6 Aug 2016 06:27:33 +0000 (+0200) Subject: Environment for execution without previous installation X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=9f4be9277ea160fbed4e87db27d3a7a80e8bfbe5;p=gacela.git Environment for execution without previous installation --- diff --git a/examples/fran.scm b/examples/fran.scm index b857208..291a543 100644 --- a/examples/fran.scm +++ b/examples/fran.scm @@ -1,3 +1,6 @@ +#!/usr/bin/env guile +!# + ;;; Gacela, a GNU Guile extension for fast games development ;;; Copyright (C) 2016 by Javier Sancho Fernandez ;;; diff --git a/gacela.scm b/gacela.scm new file mode 100644 index 0000000..ea649e2 --- /dev/null +++ b/gacela.scm @@ -0,0 +1,18 @@ +;;; Gacela, a GNU Guile extension for fast games development +;;; Copyright (C) 2016 by Javier Sancho Fernandez +;;; +;;; This program is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + + +(define-module (gacela)) diff --git a/src/gacela.scm b/src/gacela.scm deleted file mode 100644 index 3b65aff..0000000 --- a/src/gacela.scm +++ /dev/null @@ -1,65 +0,0 @@ -;;; Gacela, a GNU Guile extension for fast games development -;;; Copyright (C) 2013 by Javier Sancho Fernandez -;;; -;;; This program is free software: you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published by -;;; the Free Software Foundation, either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; This program is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with this program. If not, see . - - -(define-module (gacela gacela) - #:use-module (gacela system) - #:use-module (ice-9 threads) - #:use-module (srfi srfi-1) - #:export (make-world)) - - -;;; Entities and components - -(define (make-world . entities) - (apply make-entity-set entities)) - -(define entities-mutex (make-mutex)) -(define game-entities '()) -(define game-components '()) - - -(define (entity . components) - (with-mutex entities-mutex - (let ((key (gensym))) - (set! game-entities - (acons key - (map (lambda (c) (list (get-component-type c) c)) components) - game-entities)) - (set! game-components (register-components key components)) - key))) - - -(define* (register-components entity components #:optional (clist game-components)) - (cond ((null? components) clist) - (else - (let* ((type (get-component-type (car components))) - (elist (assoc-ref clist type))) - (register-components entity (cdr components) - (assoc-set! clist type - (cond (elist - (lset-adjoin eq? elist entity)) - (else - (list entity))))))))) - - -(define (get-entity key) - (with-mutex entities-mutex - (assoc key game-entities))) - - -(export entity - get-entity)