Basic starting classes for asciiflow

This commit is contained in:
Lewis Hemens 2014-01-05 00:24:48 +00:00
父節點 ef70c24806
當前提交 b2b0d875ca
共有 5 個檔案被更改,包括 59 行新增0 行删除

1
compile.sh Executable file
查看文件

@ -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

7
js-lib/constants.js Normal file
查看文件

@ -0,0 +1,7 @@
goog.provide('asciiflow.constants');
/**
* @const
* @type {string}
*/
asciiflow.constants.CanvasElemId = 'ascii-canvas';

15
js-lib/launch.js Normal file
查看文件

@ -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();

25
js-lib/view.js Normal file
查看文件

@ -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');
};

11
root.html Normal file
查看文件

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>asciiflow-2.0</title>
</head>
<body>
<canvas id="ascii-canvas" style="position:absolute; left:0px; top:0px;"></canvas>
<script src="js-compiled.js"></script>
</body>
</html>