Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 0.2.9

  • Loading branch information...
commit 226f664d523804f7408d22008713660d38c15fe1 1 parent 1c5b292
@santoshrajan authored
View
8 README.md
@@ -28,6 +28,14 @@ Irakli Gozalishvili [Gozala](https://github.com/Gozala).
### Change Log
+### Version 0.2.9, 14 Oct 2012
+
+Added more options to lispy command
+Added arrayInit, arrayInit2d, each2d
+Added breakout game example
+Added shortcut macros for browser usage
+Bug fix for division operator
+
### Version 0.2.8, 8 Oct 2012
Added continuation monad
View
21 examples/breakout/breakout.js
@@ -1,9 +1,9 @@
// Generated by LispyScript v0.2.9
-var canvas = document.getElementById("breakout");
-var context = canvas.getContext("2d");
+var canvas = null;
+var context = null;
var bricksNumX = 7;
var bricksNumY = 5;
-var brickWidth = (canvas.width / bricksNumX);
+var brickWidth = null;
var brickHeight = 20;
var brickMargin = 4;
var paddleWidth = 80;
@@ -130,8 +130,13 @@ var tick = function() {
})() :
clear());
};
-init();
-(canvas).addEventListener("mousemove",function(event) {
- paddleX = event.layerX;
-});
-window.setInterval(tick,30);
+window.onload = function(event) {
+ canvas = document.getElementById("breakout");
+ context = canvas.getContext("2d");
+ brickWidth = (canvas.width / bricksNumX);
+ (canvas).addEventListener("mousemove",function(event) {
+ paddleX = (event.offsetX || (event.pageX - canvas.offsetLeft));
+ });
+ init();
+ return window.setInterval(tick,30);
+};
View
20 examples/breakout/breakout.ls
@@ -1,14 +1,16 @@
;; The breakout game written in LisoyScript
-;; Open the html filr in the same folder to try ii
+;; Open the html file in the same folder to try it.
+;; Requires canvas support in browser
+;; Based on javascript version here http://www.jsdares.com/
;;
(include "browser.ls")
-(var canvas ($ "breakout"))
-(var context (canvas.getContext "2d"))
+(var canvas null)
+(var context null)
(var bricksNumX 7)
(var bricksNumY 5)
-(var brickWidth (/ canvas.width bricksNumX))
+(var brickWidth null)
(var brickHeight 20)
(var brickMargin 4)
(var paddleWidth 80)
@@ -101,6 +103,10 @@
(drawBricks))
(clear))))
-(init)
-($listener canvas "mousemove" (set paddleX event.layerX))
-(window.setInterval tick 30)
+(set window.onload (function (event)
+ (set canvas ($ "breakout"))
+ (set context (canvas.getContext "2d"))
+ (set brickWidth (/ canvas.width bricksNumX))
+ ($listener canvas "mousemove" (set paddleX (|| event.offsetX (- event.pageX canvas.offsetLeft))))
+ (init)
+ (window.setInterval tick 30)))
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "lispyscript",
- "description": "A Javascript with Lispy syntax and macros",
+ "description": "A JavaScript with Lispy Syntax and Macros",
"keywords": ["javascript", "language", "lispyscript", "compiler", "lisp"],
"author": "Santosh Rajan",
"version": "0.2.9",
Please sign in to comment.
Something went wrong with that request. Please try again.