[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GScript widget for Mac OS X released
Wow, I am amazed!
Can I include your Lore routines as part of GScript BASIC (with
credits)? We can take out the Lores demo as part of GScript demo too.
On 8月28日, 上午1时25分, "John B. Matthews" <nos...@nospam.invalid> wrote:
> Excellent! Here's implementations for the lores functions plot(),
> hlin(), & vlin(), as well as a small demo:
>
> // Lores test by John B. Matthews
>
> blockWidth = 16; // screenWidth / 40
> blockHeight = 10; // screenHeight / 40
>
> hgr();
> print("Lores test");
> draw1();
> animate(draw2);
>
> function draw1() {
> for (p = 0; p < 39; p++) {
> hcolor = rnd(15) + 1;
> plot(0, p);
> plot(p, 0);
> plot(39, p);
> plot(p, 39);
> plot(p, p);
> plot(39 - p, p);
> }
>
> }
>
> function draw2() {
> x1 = rnd(40);
> y1 = rnd(40);
> x2 = rnd(40);
> y2 = rnd(40);
> hcolor = rnd(15) + 1;
> hlin(x1, x2, y1); hlin(x1, x2, y2);
> vlin(y1, y2, x1); vlin(y1, y2, x2);
>
> }
>
> function plot(x, y) {
> rect(x * blockWidth, y * blockHeight,
> blockWidth, blockHeight)
>
> }
>
> function hlin(x1, x2, y) {
> if (x1 <= x2) rect(x1 * blockWidth, y * blockHeight,
> (x2 - x1 + 1) * blockWidth, blockHeight);
> else rect(x2 * blockWidth, y * blockHeight,
> (x1 - x2 + 1) * blockWidth, blockHeight);
>
> }
>
> function vlin(y1, y2, x) {
> if (y1 <= y2) rect(x * blockWidth, y1 * blockHeight,
> blockWidth, (y2 - y1 + 1) * blockHeight);
> else rect(x * blockWidth, y2 * blockHeight,
> blockWidth, (y1 - y2 + 1) * blockHeight);
>
> }
>