/* * Verrückte Turing-Maschinen — A turing complete game * Copyright (C) 2016 Christian Fraß * * 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 . */ module mod_vtm { export module mod_manifestation { export module mod_svg { export module mod_aktor { /** * @author kcf */ export type signatur_aktor = { darstellen : (aktor : mod_vtm.mod_aufbau.mod_aktor.typ_aktor)=>Array; } ; /** * @author kcf */ export var brauch_aktor : lib_brauch.typ_brauch = lib_brauch.erstellen(); /** * @author kcf */ export type typ_aktor = { aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor; stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle; } ; /** * @author kcf */ function erstellen ( aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor, stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle ) : typ_aktor { return { "aufbau": aufbau, "stelle": stelle }; } /** * @author kcf */ export function erstellen_manifestation ( aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor, stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle ) : typ_manifestation { return { "art": "svg_aktor", "angaben": erstellen(aufbau, stelle), }; } /** * @author kcf */ function darstellen(aktor_ : typ_aktor) : lib_xml.typ_knoten { let aktor : mod_vtm.mod_aufbau.mod_aktor.typ_aktor = aktor_.aufbau; let knoten_rahmen = function () : lib_xml.typ_knoten { return ( pfad ( mod_vtm.mod_helfer.sequenz(6).map(i => lib_vektor.polar(((i+0.5)/6) * (2*Math.PI), 0.5)), true, { "class": "rahmen" } ) ); } ; let position : mod_position.typ_position = mod_position.von_stelle(aktor_.stelle); let knoten_feld : lib_xml.typ_knoten = ( lib_xml.erstellen_normal ( "g", { "class": "feld", "rel": mod_vtm.mod_aufbau.mod_stelle.hash(aktor_.stelle), "transform": translation(position.x, position.y), }, ( [knoten_rahmen()] .concat(lib_brauch.anwenden(brauch_aktor, aktor.art)["darstellen"](aktor)) ) ) ); return knoten_feld; } /** * @author kcf */ function binden(aktor : typ_aktor) : void { } /** * @author kcf */ lib_brauch.umsetzen> ( brauch_manifestation, "svg_aktor", { "darstellen": (manifestation) => darstellen(manifestation.angaben), "binden": (manifestation) => binden(manifestation.angaben), } ) ; } } } }