www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/23/00:48:45

From: David Jenkins <me AT jenkinsdavid DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Problems with Scanf in Allegro.WAS -Problems with palette.
Date: Fri, 21 Feb 1997 03:26:53 +0000
Organization: None
Distribution: world
Message-ID: <lPKw+OA9XRDzEwY5@jenkinsdavid.demon.co.uk>
References: <nQgAZIAVUODzEwI3 AT jenkinsdavid DOT demon DOT co DOT uk>
NNTP-Posting-Host: jenkinsdavid.demon.co.uk
MIME-Version: 1.0
Lines: 70
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <nQgAZIAVUODzEwI3 AT jenkinsdavid DOT demon DOT co DOT uk>, David Jenkins
<me AT jenkinsdavid DOT demon DOT co DOT uk> writes


#include <stdlib.h>
#include <stdio.h>
#include <allegro.h>

void            main()
{



/* If I un // the next two lines and // the "int ns = 100;" line I
should be able to enter the number of stars.BUT I keep getting errors
during compiling.Any ideas???
*/


//    printf("How many stars shall I use???");
//    scanf("%d", ns);
    int             ns = 100;
    int             d = 1;
    int             o = 1;
    int             x[ns];
    int             y[ns];
    int             sp[ns];

    PALLETE         pal;

    for (d = 1; d < 4; d++) {

        pal[d].r = d*20;
        pal[d].g = d*20;
        pal[d].b = d*20;
    }


    allegro_init();
    set_gfx_mode(GFX_VGA, 320, 200, 0, 0);

    set_pallete(pal);


    install_keyboard();

    for (d = 0; d < ns; d++) {
        x[d] = rand() % SCREEN_W;
        y[d] = rand() % SCREEN_H;
        sp[d] = rand() % 3 + 1;
    }
    while (!keypressed()) {
        for (d = 1; d < ns; d++) {
            x[d] = x[d] - sp[d];
            if (x[d] <= 0)
                x[d] = SCREEN_W;

            putpixel(screen, x[d], y[d], sp[d]);
        }
        vsync();
        clear(screen);
    }

    exit(0);
}

-- 

David Jenkins

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019