Basic starting classes for asciiflow
This commit is contained in:
parent
ef70c24806
commit
b2b0d875ca
|
@ -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
|
|
@ -0,0 +1,7 @@
|
|||
goog.provide('asciiflow.constants');
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
asciiflow.constants.CanvasElemId = 'ascii-canvas';
|
|
@ -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();
|
|
@ -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');
|
||||
};
|
Loading…
Reference in New Issue