Permalink
Browse files

Update/delete stuff that didn't go into the last commit b/c i'm a noob

  • Loading branch information...
1 parent 13b46cc commit 7c2071ce87dd4b0dc7d3f7c177cf08abdce6db45 @bisrael committed Mar 25, 2012
Showing with 58 additions and 2,091 deletions.
  1. +14 −8 Engine.dart
  2. +7 −17 Phart.dart
  3. +0 −1,993 Phart.dart.js
  4. +1 −1 Phart.html
  5. +0 −59 RK4.dart
  6. +36 −13 Vector.dart
View
@@ -1,7 +1,8 @@
-#library("Phart");
+#library ('Phart');
+
#import ('dart:html');
-#import ("RK4.dart");
-#import ('Vector.dart');
+#import ('Phart.dart');
+#import ("Cube.dart");
class Game {
CanvasElement canvas;
@@ -23,7 +24,7 @@ class Game {
List<int> xs;
List<int> ys;
- RkState particle;
+ List<Cube2d> particles;
Game() {
canvas = document.query("#game");
@@ -44,15 +45,20 @@ class Game {
}
void generateParticles() {
- particle = new RkState(new Vector(_viewW/2.0, _viewH/2.0), new Vector(0.0,0.0));
+ particles = new List<Cube2d>();
}
void updateParticles(double t, double dt) {
- particle = Rk4Integrator.integrate(particle, t, dt);
+ particles.forEach((p){ p.update(t, dt); });
+ if(particles.length < 150 && !(t%1)) particles.add(new Cube2d.random());
}
- void drawParticles() {
- _point(particle.x + _viewW/2.0, particle.y + _viewH/2.0, 9, 255, 0, 0, 1);
+ void drawParticles([final double alpha = 1.0]) {
+ context.save();
+ context.translate(_viewW/2, _viewH/2);
+ context.scale(30, 30);
+ particles.forEach((p){ p.render2d(context); });
+ context.restore();
}
void start() {
View
@@ -1,18 +1,8 @@
-#import('dart:html');
-#import('Engine.dart');
+#library ("Phart");
-class PhartTest {
- Game game;
-
- PhartTest() {
- game = new Game();
- }
-
- void run() {
- game.start();
- }
-}
-
-void main() {
- new PhartTest().run();
-}
+#source ("PMath.dart");
+#source ("Vector.dart");
+#source ("Quaternion.dart");
+#source ("RkState.dart");
+#source ("RkDerivative.dart");
+#source ("RkIntegrator.dart");
Oops, something went wrong.

0 comments on commit 7c2071c

Please sign in to comment.