Created
November 4, 2016 18:49
-
-
Save senthilsivanath/389f425072a8134cc5f88dc9505c2391 to your computer and use it in GitHub Desktop.
My Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using JSIL; | |
using JSIL.Meta; | |
public static class Program { | |
public static int x = 10; | |
public static int y = 20; | |
public static void Main () { | |
dynamic document = Builtins.Global["document"]; | |
dynamic window = Builtins.Global["window"]; | |
var canvas = document.createElement("canvas"); | |
var ctx = canvas.getContext("2d"); | |
var body = document.getElementsByTagName("body")[0]; | |
Console.WriteLine("Hello JSIL World!"); | |
body.appendChild(canvas); | |
window.setInterval((Action)(() => { | |
Redraw(ctx); | |
}), 25); | |
} | |
public static void Redraw (dynamic ctx) { | |
x += 2; | |
ctx.clearRect(0, 0, 300, 300); | |
ctx.fillStyle = "red"; | |
ctx.fillRect(x, y, 20, 20); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment