dsn: debugger, play/stop, runtime (fixes)
This commit is contained in:
parent
bbba58297b
commit
f4dd8e1f9b
@ -24,42 +24,42 @@ fn abs_i(v: int) -> int
|
|||||||
fn frame() -> void
|
fn frame() -> void
|
||||||
{
|
{
|
||||||
ticks += 1;
|
ticks += 1;
|
||||||
let cx = SCREEN_W / 2;
|
let cx : int = SCREEN_W / 2;
|
||||||
let cy = SCREEN_H / 2;
|
let cy : int = SCREEN_H / 2;
|
||||||
let phase = ticks / 2;
|
let phase : int = ticks / 2;
|
||||||
|
|
||||||
Gfx.clear(new Color(33));
|
Gfx.clear(new Color(33));
|
||||||
|
|
||||||
for y: int from 0 until SCREEN_H step CELL {
|
for y: int from 0 until SCREEN_H step CELL {
|
||||||
let dy = y - cy;
|
let dy : int = y - cy;
|
||||||
for x: int from 0 until SCREEN_W step CELL {
|
for x: int from 0 until SCREEN_W step CELL {
|
||||||
let dx = x - cx;
|
let dx : int = x - cx;
|
||||||
let md = abs_i(dx) + abs_i(dy);
|
let md : int = abs_i(dx) + abs_i(dy);
|
||||||
let seed_x = dx / 3 + ((phase % 29) - 14);
|
let seed_x : int = dx / 3 + ((phase % 29) - 14);
|
||||||
let seed_y = dy / 3 + (((phase * 3) % 23) - 11);
|
let seed_y : int = dy / 3 + (((phase * 3) % 23) - 11);
|
||||||
|
|
||||||
let zx: int = seed_x;
|
let zx: int = seed_x;
|
||||||
let zy: int = seed_y;
|
let zy: int = seed_y;
|
||||||
let iter: int = 0;
|
let iter: int = 0;
|
||||||
|
|
||||||
while iter < 3 {
|
while iter < 3 {
|
||||||
let ax = abs_i(zx);
|
let ax : int = abs_i(zx);
|
||||||
let ay = abs_i(zy);
|
let ay : int = abs_i(zy);
|
||||||
let nx = ((zx * zx - zy * zy) / 48) + seed_x + ((ay * 3) / 8) - 9;
|
let nx : int = ((zx * zx - zy * zy) / 48) + seed_x + ((ay * 3) / 8) - 9;
|
||||||
let ny = ((ax * zy) / 24) + seed_y + ((phase + iter * 7) % 17) - 8;
|
let ny : int = ((ax * zy) / 24) + seed_y + ((phase + iter * 7) % 17) - 8;
|
||||||
zx = nx;
|
zx = nx;
|
||||||
zy = ny;
|
zy = ny;
|
||||||
iter += 1;
|
iter += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
let axf = abs_i(zx);
|
let axf : int = abs_i(zx);
|
||||||
let ayf = abs_i(zy);
|
let ayf : int = abs_i(zy);
|
||||||
let ripple = (md / 9 + phase + ((dx - dy) / 12)) % 64;
|
let ripple : int = (md / 9 + phase + ((dx - dy) / 12)) % 64;
|
||||||
let cloud = ((axf * 2) + (ayf * 3) + ripple + ((x - y + phase) % 29)) % 128;
|
let cloud : int = ((axf * 2) + (ayf * 3) + ripple + ((x - y + phase) % 29)) % 128;
|
||||||
let glow = ((abs_i(dx / 3) + abs_i(dy / 2)) / 8 + phase) % 32;
|
let glow : int = ((abs_i(dx / 3) + abs_i(dy / 2)) / 8 + phase) % 32;
|
||||||
let energy = (cloud + glow) % 128;
|
let energy : int = (cloud + glow) % 128;
|
||||||
|
|
||||||
let r = if energy > 95 {
|
let r : int = if energy > 95 {
|
||||||
6 + ((phase + x / CELL) % 6)
|
6 + ((phase + x / CELL) % 6)
|
||||||
} else if energy > 63 {
|
} else if energy > 63 {
|
||||||
4 + ((energy + phase) % 8)
|
4 + ((energy + phase) % 8)
|
||||||
@ -67,7 +67,7 @@ fn frame() -> void
|
|||||||
(energy / 24) % 3
|
(energy / 24) % 3
|
||||||
};
|
};
|
||||||
|
|
||||||
let g = if energy > 95 {
|
let g : int = if energy > 95 {
|
||||||
6 + ((phase + y / CELL) % 12)
|
6 + ((phase + y / CELL) % 12)
|
||||||
} else if energy > 63 {
|
} else if energy > 63 {
|
||||||
8 + ((energy + phase) % 14)
|
8 + ((energy + phase) % 14)
|
||||||
@ -75,7 +75,7 @@ fn frame() -> void
|
|||||||
2 + ((energy / 12) % 5)
|
2 + ((energy / 12) % 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
let b = if energy > 95 {
|
let b : int = if energy > 95 {
|
||||||
24 + ((phase + x / CELL + y / CELL) % 5)
|
24 + ((phase + x / CELL + y / CELL) % 5)
|
||||||
} else if energy > 63 {
|
} else if energy > 63 {
|
||||||
18 + ((energy + phase) % 10)
|
18 + ((energy + phase) % 10)
|
||||||
@ -83,45 +83,45 @@ fn frame() -> void
|
|||||||
7 + ((energy / 6) % 12)
|
7 + ((energy / 6) % 12)
|
||||||
};
|
};
|
||||||
|
|
||||||
let color_raw = r * 2048 + g * 32 + b;
|
let color_raw : int = r * 2048 + g * 32 + b;
|
||||||
Gfx.fill_rect(x, y, CELL, CELL, new Color(color_raw));
|
Gfx.fill_rect(x, y, CELL, CELL, new Color(color_raw));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let star_a = (phase * 3) % SCREEN_W;
|
let star_a : int = (phase * 3) % SCREEN_W;
|
||||||
let star_b = (phase * 5 + 37) % SCREEN_W;
|
let star_b : int = (phase * 5 + 37) % SCREEN_W;
|
||||||
let star_c = (phase * 7 + 91) % SCREEN_W;
|
let star_c : int = (phase * 7 + 91) % SCREEN_W;
|
||||||
let star_d = (phase * 11 + 143) % SCREEN_W;
|
let star_d : int = (phase * 11 + 143) % SCREEN_W;
|
||||||
let star_e = (phase * 13 + 211) % SCREEN_W;
|
let star_e : int = (phase * 13 + 211) % SCREEN_W;
|
||||||
let star_f = (phase * 17 + 17) % SCREEN_W;
|
let star_f : int = (phase * 17 + 17) % SCREEN_W;
|
||||||
|
|
||||||
let star_y0 = 18 + ((phase * 2) % 24);
|
let star_y0 : int = 18 + ((phase * 2) % 24);
|
||||||
let star_y1 = 42 + ((phase * 3) % 18);
|
let star_y1 : int = 42 + ((phase * 3) % 18);
|
||||||
let star_y2 = 70 + ((phase * 4) % 22);
|
let star_y2 : int = 70 + ((phase * 4) % 22);
|
||||||
let star_y3 = 104 + ((phase * 5) % 16);
|
let star_y3 : int = 104 + ((phase * 5) % 16);
|
||||||
let star_y4 = 132 + ((phase * 6) % 20);
|
let star_y4 : int = 132 + ((phase * 6) % 20);
|
||||||
let star_y5 = 154 + ((phase * 7) % 14);
|
let star_y5 : int = 154 + ((phase * 7) % 14);
|
||||||
|
|
||||||
let twinkle0 = phase % 6;
|
let twinkle0 : int = phase % 6;
|
||||||
let twinkle1 = (phase + 2) % 6;
|
let twinkle1 : int = (phase + 2) % 6;
|
||||||
let twinkle2 = (phase + 4) % 6;
|
let twinkle2 : int = (phase + 4) % 6;
|
||||||
let twinkle3 = (phase + 1) % 6;
|
let twinkle3 : int = (phase + 1) % 6;
|
||||||
let twinkle4 = (phase + 3) % 6;
|
let twinkle4 : int = (phase + 3) % 6;
|
||||||
let twinkle5 = (phase + 5) % 6;
|
let twinkle5 : int = (phase + 5) % 6;
|
||||||
|
|
||||||
let star_s0 = 1 + (twinkle0 / 4);
|
let star_s0 : int = 1 + (twinkle0 / 4);
|
||||||
let star_s1 = 1 + (twinkle1 / 4);
|
let star_s1 : int = 1 + (twinkle1 / 4);
|
||||||
let star_s2 = 1 + (twinkle2 / 4);
|
let star_s2 : int = 1 + (twinkle2 / 4);
|
||||||
let star_s3 = 1 + (twinkle3 / 4);
|
let star_s3 : int = 1 + (twinkle3 / 4);
|
||||||
let star_s4 = 1 + (twinkle4 / 4);
|
let star_s4 : int = 1 + (twinkle4 / 4);
|
||||||
let star_s5 = 1 + (twinkle5 / 4);
|
let star_s5 : int = 1 + (twinkle5 / 4);
|
||||||
|
|
||||||
let star_c0 = 57023 + twinkle0 * 1056;
|
let star_c0 : int = 57023 + twinkle0 * 1056;
|
||||||
let star_c1 = 48607 + twinkle1 * 1376;
|
let star_c1 : int = 48607 + twinkle1 * 1376;
|
||||||
let star_c2 = 44383 + twinkle2 * 1584;
|
let star_c2 : int = 44383 + twinkle2 * 1584;
|
||||||
let star_c3 = 61279 + twinkle3 * 704;
|
let star_c3 : int = 61279 + twinkle3 * 704;
|
||||||
let star_c4 = 40159 + twinkle4 * 1696;
|
let star_c4 : int = 40159 + twinkle4 * 1696;
|
||||||
let star_c5 = 52831 + twinkle5 * 992;
|
let star_c5 : int = 52831 + twinkle5 * 992;
|
||||||
|
|
||||||
Gfx.fill_rect(star_a, star_y0, star_s0, star_s0, new Color(star_c0));
|
Gfx.fill_rect(star_a, star_y0, star_s0, star_s0, new Color(star_c0));
|
||||||
Gfx.fill_rect(star_b, star_y1, star_s1, star_s1, new Color(star_c1));
|
Gfx.fill_rect(star_b, star_y1, star_s1, star_s1, new Color(star_c1));
|
||||||
@ -129,5 +129,7 @@ fn frame() -> void
|
|||||||
Gfx.fill_rect(star_d, star_y3, star_s3, star_s3, new Color(star_c3));
|
Gfx.fill_rect(star_d, star_y3, star_s3, star_s3, new Color(star_c3));
|
||||||
Gfx.fill_rect(star_e, star_y4, star_s4, star_s4, new Color(star_c4));
|
Gfx.fill_rect(star_e, star_y4, star_s4, star_s4, new Color(star_c4));
|
||||||
Gfx.fill_rect(star_f, star_y5, star_s5, star_s5, new Color(star_c5));
|
Gfx.fill_rect(star_f, star_y5, star_s5, star_s5, new Color(star_c5));
|
||||||
|
|
||||||
|
//Gfx.clear(new Color(33));
|
||||||
}
|
}
|
||||||
// Estimated frame cost: ~920 fills + ~2760 fractal-iteration steps + 6 twinkling parallax stars/frame at CELL=8.
|
// Estimated frame cost: ~920 fills + ~2760 fractal-iteration steps + 6 twinkling parallax stars/frame at CELL=8.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user