From b2b0d875ca9fb48b4d575d4f22d45c51e0eaded0 Mon Sep 17 00:00:00 2001 From: Lewis Hemens Date: Sun, 5 Jan 2014 00:24:48 +0000 Subject: [PATCH] Basic starting classes for asciiflow --- compile.sh | 1 + js-lib/constants.js | 7 +++++++ js-lib/launch.js | 15 +++++++++++++++ js-lib/view.js | 25 +++++++++++++++++++++++++ root.html | 11 +++++++++++ 5 files changed, 59 insertions(+) create mode 100755 compile.sh create mode 100644 js-lib/constants.js create mode 100644 js-lib/launch.js create mode 100644 js-lib/view.js create mode 100644 root.html diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..5c039ce --- /dev/null +++ b/compile.sh @@ -0,0 +1 @@ +closure-library/closure/bin/build/closurebuilder.py --root=js-lib/ --root=closure-library/ --namespace="asciiflow.launch" --compiler_flags="--warning_level=VERBOSE" --compiler_flags="--formatting=PRETTY_PRINT" --compiler_flags="--compilation_level=ADVANCED_OPTIMIZATIONS" --output_mode=compiled --compiler_jar=closure-library/compiler.jar > js-compiled.js diff --git a/js-lib/constants.js b/js-lib/constants.js new file mode 100644 index 0000000..893d9e3 --- /dev/null +++ b/js-lib/constants.js @@ -0,0 +1,7 @@ +goog.provide('asciiflow.constants'); + +/** + * @const + * @type {string} + */ +asciiflow.constants.CanvasElemId = 'ascii-canvas'; \ No newline at end of file diff --git a/js-lib/launch.js b/js-lib/launch.js new file mode 100644 index 0000000..76d3913 --- /dev/null +++ b/js-lib/launch.js @@ -0,0 +1,15 @@ +/** + * + */ + +goog.provide('asciiflow.launch'); +goog.require('asciiflow.View'); + +asciiflow.launch = function() { + var view = new asciiflow.View(); + var context = view.getCsontext(); + context.font = 'italic 10pt Calibri'; + context.fillText('Hello World!', 150, 100); +}; + +asciiflow.launch(); \ No newline at end of file diff --git a/js-lib/view.js b/js-lib/view.js new file mode 100644 index 0000000..40aacc3 --- /dev/null +++ b/js-lib/view.js @@ -0,0 +1,25 @@ +/** + * Functions relating to view operations and management of the screen. + */ +goog.provide('asciiflow.View'); + +goog.require('asciiflow.constants'); + +/** + * @constructor + */ +asciiflow.View = function() { + this.canvasElem = document.getElementById('ascii-canvas'); + + this.resizeCanvas(); + // Setup view-port size monitoring. +}; + +asciiflow.View.prototype.resizeCanvas = function() { + this.canvasElem.width = document.documentElement.clientWidth; + this.canvasElem.height = document.documentElement.clientHeight; +}; + +asciiflow.View.prototype.getContext = function() { + return this.canvasElem.getContext('2d'); +}; \ No newline at end of file diff --git a/root.html b/root.html new file mode 100644 index 0000000..ffd3913 --- /dev/null +++ b/root.html @@ -0,0 +1,11 @@ + + + + +asciiflow-2.0 + + + + + + \ No newline at end of file