-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init: simple workspace with completly separate components
- Loading branch information
0 parents
commit 6e893df
Showing
29 changed files
with
298 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
js/* |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
all: coreLib symbolLib editorLib testsLib | ||
|
||
|
||
coreLib: | ||
(cd components/Core; make all) | ||
|
||
symbolLib: | ||
(cd components/Symbol; make all) | ||
|
||
editorLib: | ||
(cd components/Editor; make all) | ||
|
||
testsLib: | ||
(cd components/Tests; make all) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
OutputName=coreLib | ||
SourceFiles=src/Core.ts src/Fragment.ts src/Paper.ts | ||
BaseDir=../.. | ||
OutputDir=$(BaseDir)/js | ||
Out=$(OutputDir)/$(OutputName).js | ||
|
||
all: $(Out) | ||
|
||
$(Out): lib.ts $(SourceFiles) | ||
tsc --declaration --sourceMap --out $@ lib.ts | ||
sed -i "/\/\/\/\ *<reference/d" $(OutputDir)/$(OutputName).d.ts #reused as source for other components | ||
cp -f $(OutputDir)/$(OutputName).d.ts ../declareFiles/ | ||
|
||
clean: | ||
rm $(OUT) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/// <reference path="src/Core.ts" /> | ||
/// <reference path="src/Fragment.ts" /> | ||
/// <reference path="src/Paper.ts" /> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
module Sanara.Core { | ||
export type SanaraContext = CanvasRenderingContext2D; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// <reference path="Paper.ts"/> | ||
|
||
module Sanara.Core { | ||
export interface Fragment { | ||
paint(paper: Paper) : void; | ||
paintMe(paper : Paper) : void; | ||
} | ||
export class BaseFragment implements Fragment { | ||
children : [Fragment]; | ||
constructor (children : [Fragment] = <[Fragment]>[]) { | ||
this.children = children; | ||
} | ||
paint(paper: Paper) { | ||
paper.context.save(); | ||
this.paintMe(paper); | ||
paper.context.restore(); | ||
} | ||
paintMe(paper : Paper) { | ||
this.children.forEach(function (v) { | ||
v.paint(paper); | ||
}) | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// <reference path="Fragment.ts" /> | ||
|
||
|
||
module Sanara.Core { | ||
export interface Paper { | ||
domElement : HTMLCanvasElement; | ||
context : SanaraContext; | ||
w : number; | ||
h : number; | ||
root : Fragment; | ||
repaint(time:number) : void; | ||
} | ||
export class BasicPaper implements Paper { | ||
domElement : HTMLCanvasElement; | ||
context : SanaraContext; | ||
w : number; | ||
h : number; | ||
root : Fragment; | ||
constructor (w:number = 100, h:number = 100) { | ||
this.w = w; | ||
this.h = h; | ||
|
||
this.domElement = <HTMLCanvasElement>document.createElement("canvas"); | ||
this.context = <SanaraContext>this.domElement.getContext("2d"); | ||
} | ||
repaint(time:number = 0) : void { | ||
this.root.paint(this); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compileOnSave": false, | ||
"version": "1.5.0-alpha", | ||
"compilerOptions": { | ||
"target": "es5" | ||
}, | ||
"filesGlob": [ | ||
"./**/*.ts", | ||
"!./node_modules/**/*.ts" | ||
], | ||
"files": [ | ||
"./lib.ts", | ||
"./src/Core.ts", | ||
"./src/Fragment.ts", | ||
"./src/Paper.ts" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
OutputName=editorLib | ||
SourceFiles=src/Editor.ts | ||
BaseDir=../.. | ||
OutputDir=$(BaseDir)/js | ||
Out=$(OutputDir)/$(OutputName).js | ||
|
||
all: $(Out) | ||
|
||
$(Out): lib.ts $(SourceFiles) | ||
tsc --removeComments --declaration --sourceMap --out $@ lib.ts | ||
sed -i "/\/\/\/\ *<reference/d" $(OutputDir)/$(OutputName).d.ts #reused as source for other components | ||
cp -f $(OutputDir)/$(OutputName).d.ts ../declareFiles/ | ||
|
||
clean: | ||
rm $(OUT) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../declareFiles/coreLib.d.ts |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference path="src/Editor.ts" /> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference path="../declareFiles/coreLib.d.ts"/> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compileOnSave": false, | ||
"version": "1.5.0-alpha", | ||
"compilerOptions": { | ||
"target": "es5" | ||
}, | ||
"filesGlob": [ | ||
"./**/*.ts", | ||
"!./node_modules/**/*.ts" | ||
], | ||
"files": [ | ||
"./declareFiles/coreLib.d.ts", | ||
"./lib.ts", | ||
"./src/Editor.ts" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
OutputName=symbolLib | ||
SourceFiles=src/Rect.ts | ||
|
||
BaseDir=../.. | ||
OutputDir=$(BaseDir)/js | ||
Out=$(OutputDir)/$(OutputName).js | ||
|
||
all: $(Out) | ||
|
||
$(Out): lib.ts $(SourceFiles) | ||
tsc --removeComments --declaration --sourceMap --out $@ lib.ts | ||
sed -i "/\/\/\/\ *<reference/d" $(OutputDir)/$(OutputName).d.ts #reused as source for other components | ||
cp -f $(OutputDir)/$(OutputName).d.ts ../declareFiles/ | ||
|
||
clean: | ||
rm $(OUT) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../declareFiles/coreLib.d.ts |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference path="src/Rect.ts"/> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// <reference path="../declareFiles/coreLib.d.ts" /> | ||
|
||
module Sanara.Symbol { | ||
export class Rect extends Sanara.Core.BaseFragment { | ||
w : number; | ||
h : number; | ||
constructor(w: number=100, h: number=100){ | ||
super(); | ||
this.w = w; | ||
this.h = h; | ||
} | ||
paintMe (paper : Sanara.Core.Paper) { | ||
paper.context.fillRect(0,0,this.w,this.h); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compileOnSave": false, | ||
"version": "1.5.0-alpha", | ||
"compilerOptions": { | ||
"target": "es5" | ||
}, | ||
"filesGlob": [ | ||
"./**/*.ts", | ||
"!./node_modules/**/*.ts" | ||
], | ||
"files": [ | ||
"./declareFiles/coreLib.d.ts", | ||
"./lib.ts", | ||
"./src/Rect.ts" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
OutputName=testsLib | ||
SourceFiles=src/simplePaper.ts | ||
|
||
BaseDir=../.. | ||
OutputDir=$(BaseDir)/js | ||
Out=$(OutputDir)/$(OutputName).js | ||
|
||
all: $(Out) | ||
|
||
$(Out): lib.ts $(SourceFiles) | ||
tsc --declaration --sourceMap --out $@ lib.ts | ||
cp -f $(OutputDir)/$(OutputName).d.ts ../declareFiles/ | ||
|
||
clean: | ||
rm $(OUT) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../declareFiles/coreLib.d.ts |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../declareFiles/symbolLib.d.ts |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference path="src/simplePaper.ts" /> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// <reference path="../declareFiles/coreLib.d.ts" /> | ||
/// <reference path="../declareFiles/symbolLib.d.ts" /> | ||
|
||
module Sanara.Tests { | ||
export var simplePaper = (function () { | ||
var paper = new Sanara.Core.BasicPaper(1000,1000); | ||
paper.root = new Sanara.Symbol.Rect(122,500); | ||
return paper; | ||
})(); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compileOnSave": false, | ||
"version": "1.5.0-alpha", | ||
"compilerOptions": { | ||
"target": "es5" | ||
}, | ||
"filesGlob": [ | ||
"./**/*.ts", | ||
"!./node_modules/**/*.ts" | ||
], | ||
"files": [ | ||
"./declareFiles/coreLib.d.ts", | ||
"./declareFiles/symbolLib.d.ts", | ||
"./lib.ts", | ||
"./src/simplePaper.ts" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
declare module Sanara.Core { | ||
type SanaraContext = CanvasRenderingContext2D; | ||
} | ||
declare module Sanara.Core { | ||
interface Paper { | ||
domElement: HTMLCanvasElement; | ||
context: SanaraContext; | ||
w: number; | ||
h: number; | ||
root: Fragment; | ||
repaint(time: number): void; | ||
} | ||
class BasicPaper implements Paper { | ||
domElement: HTMLCanvasElement; | ||
context: SanaraContext; | ||
w: number; | ||
h: number; | ||
root: Fragment; | ||
constructor(w?: number, h?: number); | ||
repaint(time?: number): void; | ||
} | ||
} | ||
declare module Sanara.Core { | ||
interface Fragment { | ||
paint(paper: Paper): void; | ||
paintMe(paper: Paper): void; | ||
} | ||
class BaseFragment implements Fragment { | ||
children: [Fragment]; | ||
constructor(children?: [Fragment]); | ||
paint(paper: Paper): void; | ||
paintMe(paper: Paper): void; | ||
} | ||
} |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare module Sanara.Symbol { | ||
class Rect extends Sanara.Core.BaseFragment { | ||
w: number; | ||
h: number; | ||
constructor(w?: number, h?: number); | ||
paintMe(paper: Sanara.Core.Paper): void; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference path="../components/Tests/declareFiles/coreLib.d.ts" /> | ||
/// <reference path="../components/Tests/declareFiles/symbolLib.d.ts" /> | ||
declare module Sanara.Tests { | ||
var simplePaper: Core.BasicPaper; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
<html> | ||
<body> | ||
<script src="js/coreLib.js"></script> | ||
<script src="js/symbolLib.js"></script> | ||
<script src="js/testsLib.js"></script> | ||
<script> | ||
document.body.appendChild(Sanara.Tests.simplePaper.domElement); | ||
Sanara.Tests.simplePaper.repaint(); | ||
</script> | ||
</body> | ||
</html> |