예제 #1
0
파일: image.c 프로젝트: jtsiomb/shapeblobs
struct image *load_image(const char *fname)
{
	FILE *fp;
	struct image *img;

	if(!(fp = fopen(fname, "rb"))) {
		fprintf(stderr, "failed to load image %s: %s\n", fname, strerror(errno));
		return 0;
	}

	if(!check_tga(fp)) {
		fprintf(stderr, "file %s is not a valid (or supported) targa image\n", fname);
		fclose(fp);
		return 0;
	}

	if(!(img = malloc(sizeof *img))) {
		perror("failed to allocate memory");
		fclose(fp);
		return 0;
	}

	if(!(img->pixels = load_tga(fp, &img->width, &img->height))) {
		free(img);
		img = 0;
	}
	fclose(fp);
	return img;
}
예제 #2
0
파일: listing3.c 프로젝트: dk00/old-stuff
int main()
{
	tga_image tga;
	double dct_buf[8][8];
	int i, j, k, l;

	load_tga(&tga, "in.tga");

	k = 0;
	l = (tga.height / 8) * (tga.width / 8);
	for (j=0; j<tga.height/8; j++)
	for (i=0; i<tga.width/8; i++)
	{
		dct(&tga, dct_buf, i*8, j*8);
		quantize(dct_buf);
		idct(&tga, dct_buf, i*8, j*8);
		printf("processed %d/%d blocks.\r", ++k,l);
		fflush(stdout);
	}
	printf("\n");

	DONTFAIL( tga_write_mono("out.tga", tga.image_data,
		tga.width, tga.height) );

	tga_free_buffers(&tga);
	return EXIT_SUCCESS;
}
예제 #3
0
image_file::image_file( const string256& filename , file_type type  ) : _data(0)
{
	if( type == tga )
		load_tga( filename );
	else if( type == bmp )
		load_bmp( filename );
	else
		CRAP_ASSERT_ERROR( "Only TGA and BMP supported yet" );
}
/**
 * Load texture from file.
 * @param vfs - virtual filesystem where we can load files from
 * @param name - name of the file to be loaded
 * @param width - return width of the file
 * @param height - return height of the file
 * @return smart array containing data of the file
 */
shared_array<byte> nrCTextureLoader::load(nrCFileSystem* vfs, const string& name,int &width,int &height) {
  	
	if(strstr(name.c_str(),".tga") || strstr(name.c_str(),".TGA")) return load_tga(vfs,name,width,height);
	if(strstr(name.c_str(),".png") || strstr(name.c_str(),".PNG")) return load_png(vfs,name,width,height);
	if(strstr(name.c_str(),".jpg") || strstr(name.c_str(),".JPG")) return load_jpeg(vfs,name,width,height);
	if(strstr(name.c_str(),".dds") || strstr(name.c_str(),".DDS")) return load_dds(vfs,name,width,height);
	
	nrLog.Log(NR_LOG_ENGINE, "nrCTextureLoader::load():unknown format of '%s' file",name.c_str());
	return shared_array<byte>(NULL);
}
예제 #5
0
int main()
{
    inicia_allegro(500,450);
    inicia_audio(70,70);

    BITMAP *nave = load_bitmap("nave.bmp",NULL);
    BITMAP *nube = load_tga("Galaxy2.tga",NULL);
    BITMAP *bala = load_bitmap("Bala2.bmp", NULL);  // otra cosa
    BITMAP *buffer = create_bitmap(500,450);

    LOCK_VARIABLE(speed_counter);
    LOCK_FUNCTION(inc_speed_counter);

    install_int_ex(inc_speed_counter, BPS_TO_TIMER(30));

    int i = 450 , dsw = 0 , cont = 0;
    while(!key[KEY_ESC]){
        blit(nube,buffer,0,--i,0,0,500,450);
        if(i == 0)
        i=450;
        pintar_nave(nave,buffer,nav);

       if(key[KEY_UP]){
       nav.dir = 1;
       nav.y -= 1;
       }
       else if(key[KEY_DOWN]) {
       nav.dir = 1;
       nav.y += 2;
       }
       if(key[KEY_RIGHT]){
       nav.dir = 2;
       nav.x += 1;
       }
       else if(key[KEY_LEFT]){
       nav.dir = 0;
        nav.x -= 1;
        }
       else nav.dir = 1;

       blit(buffer,screen,0,0,0,0,500,450);
       rest(5);

    }

    destroy_bitmap(buffer);
    destroy_bitmap(nave);
    destroy_bitmap(nube);

    return 0;
}
예제 #6
0
unsigned int Resources::texture(const std::string &textureFile)
{
	std::string fullpath;
	if (textureMap.find(textureFile) == textureMap.end()) {
		DEBUG_PRINT("loading " << textureFile);
		if (search_path(textureFile, fullpath)) {
			textureMap[textureFile] = load_tga(fullpath);
		}
		else {
			DEBUG_ERROR("file " << textureFile << " doesnt exist or not reachable");
		}
	}
	else {
		DEBUG_PRINT("using already loaded " << textureFile);
	}
	return textureMap[textureFile];
}
예제 #7
0
파일: bniextract.c 프로젝트: Dibzz/bnetd
extern int main(int argc, char * argv[])
{
    char const * outdir=NULL;
    char const * bnifile=NULL;
    FILE *       fbni;
    struct stat  s;
    int          a;
    int          forcefile=0;
    char         dash[]="-"; /* unique address used as flag */
    
    if (argc<1 || !argv || !argv[0])
    {
	fprintf(stderr,"bad arguments\n");
	return STATUS_FAILURE;
    }
    
    for (a=1; a<argc; a++)
        if (forcefile && !bnifile)
            bnifile = argv[a];
        else if (strcmp(argv[a],"-")==0 && !bnifile)
            bnifile = dash;
        else if (argv[a][0]!='-' && !bnifile)
            bnifile = argv[a];
        else if (forcefile && !outdir)
            outdir = argv[a];
        else if (strcmp(argv[a],"-")==0 && !outdir)
            outdir = dash;
        else if (argv[a][0]!='-' && !outdir)
            outdir = argv[a];
        else if (forcefile || argv[a][0]!='-' || strcmp(argv[a],"-")==0)
        {
            fprintf(stderr,"%s: extra file argument \"%s\"\n",argv[0],argv[a]);
            usage(argv[0]);
        }
        else if (strcmp(argv[a],"--")==0)
            forcefile = 1;
        else if (strcmp(argv[a],"-v")==0 || strcmp(argv[a],"--version")==0)
        {
            printf("version "BNETD_VERSION"\n");
            return STATUS_SUCCESS;
        }
        else if (strcmp(argv[a],"-h")==0 || strcmp(argv[a],"--help")==0 || strcmp(argv[a],"--usage")
==0)
            usage(argv[0]);
        else
        {
            fprintf(stderr,"%s: unknown option \"%s\"\n",argv[0],argv[a]);
            usage(argv[0]);
        }
    
    if (!bnifile)
    {
	fprintf(stderr,"%s: BNI file not specified\n",argv[0]);
	usage(argv[0]);
    }
    if (!outdir)
    {
	fprintf(stderr,"%s: output directory not specified\n",argv[0]);
	usage(argv[0]);
    }
    
    if (bnifile==dash)
        fbni = stdin;
    else
	if (!(fbni = fopen(bnifile,"r")))
	{
	    fprintf(stderr,"%s: could not open BNI file \"%s\" for reading (fopen: %s)\n",argv[0],bnifile,strerror(errno));
	    return STATUS_FAILURE;
	}
    
    if (outdir==dash)
    {
	fprintf(stderr,"%s: can not write directory to <stdout>\n",argv[0]);
	if (bnifile!=dash && fclose(fbni)<0)
	    fprintf(stderr,"%s: could not close BNI file \"%s\" after reading (fclose: %s)\n",argv[0],bnifile,strerror(errno));
	return STATUS_FAILURE;
    }
    if (stat(outdir,&s)<0) {
	if (errno == ENOENT) {
	    fprintf(stderr,"Info: Creating directory \"%s\" ...\n",outdir);
	    if (p_mkdir(outdir,S_IRWXU+S_IRWXG+S_IRWXO)<0) {
		fprintf(stderr,"%s: could not create output directory \"%s\" (mkdir: %s)",argv[0],outdir,strerror(errno));
		if (bnifile!=dash && fclose(fbni)<0)
		    fprintf(stderr,"%s: could not close BNI file \"%s\" after reading (fclose: %s)\n",argv[0],bnifile,strerror(errno));
		return STATUS_FAILURE;
	    }
	} else {
	    fprintf(stderr,"%s: could not stat output directory \"%s\" (stat: %s)\n",argv[0],outdir,strerror(errno));
	    if (bnifile!=dash && fclose(fbni)<0)
		fprintf(stderr,"%s: could not close BNI file \"%s\" after reading (fclose: %s)\n",argv[0],bnifile,strerror(errno));
	    return STATUS_FAILURE;
	}
    }
    else
	if (S_ISDIR(s.st_mode) == 0) {
	    fprintf(stderr,"%s: \"%s\" is not a directory\n",argv[0],outdir);
	    if (bnifile!=dash && fclose(fbni)<0)
		fprintf(stderr,"%s: could not close BNI file \"%s\" after reading (fclose: %s)\n",argv[0],bnifile,strerror(errno));
	    return STATUS_FAILURE;
	}
    
    {
	unsigned int i;
	int          curry;
	t_tgaimg *   iconimg;
	t_bnifile *  bni;
	FILE *       indexfile;
	char *       indexfilename;
	
	fprintf(stderr,"Info: Loading \"%s\" ...\n",bnifile);
	bni = load_bni(fbni);
	if (bni == NULL) return STATUS_FAILURE;
	if (fseek(fbni,bni->dataoffset,SEEK_SET)<0) {
		fprintf(stderr,"%s: could not seek to TGA data offset %lu (fseek: %s)\n",argv[0],(unsigned long int)bni->dataoffset,strerror(errno));
		if (bnifile!=dash && fclose(fbni)<0)
			fprintf(stderr,"%s: could not close BNI file \"%s\" after reading (fclose: %s)\n",argv[0],bnifile,strerror(errno));
		return STATUS_FAILURE;
	}
	fprintf(stderr,"Info: Loading image ...\n");
	iconimg = load_tga(fbni);
	if (iconimg == NULL) return STATUS_FAILURE;
	
	fprintf(stderr,"Info: Extracting icons ...\n");
	indexfilename = malloc(strlen(outdir)+14);
	sprintf(indexfilename,"%s/bniindex.lst",outdir);
	fprintf(stderr,"Info: Writing Index to \"%s\" ... \n",indexfilename);
	indexfile = fopen(indexfilename , "w");
	if (indexfile == NULL) {
		fprintf(stderr,"%s: could not open index file \"%s\" for writing (fopen: %s)\n",argv[0],indexfilename,strerror(errno));
		if (bnifile!=dash && fclose(fbni)<0)
			fprintf(stderr,"%s: could not close BNI file \"%s\" after reading (fclose: %s)\n",argv[0],bnifile,strerror(errno));
		return STATUS_FAILURE;
	}
	fprintf(indexfile,"unknown1 %08x\n",bni->unknown1);
	fprintf(indexfile,"unknown2 %08x\n",bni->unknown2);
	curry = 0;
	for (i=0; i < bni->numicons; i++) {
		FILE *dsttga;
		char *name;
		t_tgaimg *icn;
		icn = area2img(iconimg,0,curry,bni->icons->icon[i].x,bni->icons->icon[i].y,tgaimgtype_uncompressed_truecolor);
		if (icn == NULL) {
			fprintf(stderr,"Error: area2img failed!\n");
			return STATUS_FAILURE;
		}
		if (bni->icons->icon[i].id == 0) {
			int tag = bni->icons->icon[i].tag;
			name = malloc(strlen(outdir)+10);
			sprintf(name,"%s/%c%c%c%c.tga",outdir,((tag >> 24) & 0xff),((tag >> 16) & 0xff),((tag >> 8) & 0xff),((tag >> 0) & 0xff));
		} else {
			name = malloc(strlen(outdir)+16);
			sprintf(name,"%s/%08x.tga",outdir,bni->icons->icon[i].id);
		}
		fprintf(stderr,"Info: Writing icon %u(%ux%u) to file \"%s\" ... \n",i+1,icn->width,icn->height,name);
		curry += icn->height;
		dsttga = fopen(name,"w");
		if (dsttga == NULL) {
			fprintf(stderr,"%s: could not open ouptut TGA file \"%s\" for writing (fopen: %s)\n",argv[0],name,strerror(errno));
		} else {
			if (write_tga(dsttga,icn) < 0) {
				fprintf(stderr,"Error: Writing to TGA failed.\n");
			} else {
				int tag = bni->icons->icon[i].tag;
				if (bni->icons->icon[i].id == 0) {
					fprintf(indexfile,"icon !%c%c%c%c %d %d %08x\n",((tag >> 24) & 0xff),((tag >> 16) & 0xff),((tag >> 8) & 0xff),((tag >> 0) & 0xff),bni->icons->icon[i].x,bni->icons->icon[i].y,bni->icons->icon[i].unknown);
				} else {
					fprintf(indexfile,"icon #%08x %d %d %08x\n",bni->icons->icon[i].id,bni->icons->icon[i].x,bni->icons->icon[i].y,bni->icons->icon[i].unknown);
				}
			}
예제 #8
0
파일: triple_buffer.c 프로젝트: zAvo/xylo
void triple_buffer(BITMAP **page) {
	int i = 0, w, repeat, active_page = 0;
	int time_diff, bar_number, *used_voices = NULL, hw_voices;
	int text_bar_height, half_bar_size;
	unsigned int radius;
	
	coord_t dot[2], dot_old[2], cal[2], cal_tmp[2];
	
	wiimote *wiimote;
	
	char *fonts[NUM_MAX_FONTS] = FONTS;
	FONT *font_msg, *font_notes;
	BITMAP *background;
	bars *bar;
	
	/* dot_old data initialization. dot_old's X coord is not used */
	dot_old[0].y = SCREEN_H;
	dot_old[1].y = SCREEN_H;
	
	/* Wiimote initialization*/
	wiimote = *wiiuse_init(1);
	
	/* Load fonts, size of font is related to SCREEN_W */
	do {
		font_msg = load_font(fonts[i], NULL, NULL);
		__ASSERT(font_msg, ERROR_CANT_LOAD_FONT(fonts[i]));
		w = text_length(font_msg, WIIMOTE_CONNECTION_MSG);
	} while (w >= SCREEN_W && ++i < (NUM_MAX_FONTS-1));
	
	/* Notes' font is smaller than messages' font */
	font_notes = load_font(fonts[i], NULL, NULL);
	__ASSERT(font_notes, ERROR_CANT_LOAD_FONT(fonts[i]));
	
	/* Initialize and calculate bars size, point radius, text bar height, and calculate half bar size for text output under bars */
	bar = bar_create(NUM_BARS);
	radius = RADIUS(bar);
	text_bar_height = TEXT_BAR_HEIGHT;
	half_bar_size = HALF_BAR_SIZE(bar);
	
	/* Control the max number of available hardware voices. Though ALSA driver voices are up to 64, max hardware voices generally are 8-16. Checking the allocated voices after the driver allocation seems to be the only way */
	hw_voices = get_mixer_voices();
	if (hw_voices < NUM_BARS)
		used_voices = reallocate_voices(bar, hw_voices);
	
	/* Install timer, 10 ticks a second */
	LOCK_VARIABLE(timer);
	LOCK_FUNCTION(inc_timer);
	install_int_ex(inc_timer, BPS_TO_TIMER(10));
	
	/* Load background from file */
	background = load_tga("images/back.tga", NULL);
	__ASSERT(background, ERROR_CANT_LOAD_IMAGE("back.tga"));
	
	/* Enables vertical syncronization*/
	vsync();
	
	i = 0;
	/* First frame, this lasts until wiimote is connected, the user is prompted to activate the wiimote by pressing 1 & 2 keys on the wiimote */
	while(i == 0 && !keypressed()) {
		active_page = start_credits3buf(page, active_page);
		
		clear_keybuf();
		
		title3buf(page, active_page, font_msg);
		
		clear_keybuf();
		
		repeat = 0;
		while(repeat++ < 8 && i == 0 && !keypressed()) {
			stretch_blit(background, page[active_page], 0, 0, background->w, background->h, 0, 0, SCREEN_W, SCREEN_H); // background
			if(repeat%2 == 1)
				textout_centre_ex(page[active_page], font_msg, WIIMOTE_CONNECTION_MSG, SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0), -1); // text prompt
			
			release_bitmap(page[active_page]);
			/* make sure the last flip request has actually happened */
			do {
			} while (poll_scroll());
			
			/* post a request to display the page we just drew */
			request_video_bitmap(page[active_page]);

			/* update counters to point to the next page */
			switch (active_page) {
				case 0: active_page = 1; break;
				case 1: active_page = 2; break;
				case 2: active_page = 0; break;
			}

			/* Search for a wiimote */
			i = wiiuse_find(&wiimote, 1, 1);
		}
	}
	
	/* Try to connect to the wiimote */
	__ASSERT(wiiuse_connect(&wiimote, 1) > 0, ERROR_CANT_OPEN_WIIMOTE);
	
	/* Activate the first led on the wiimote */
	wiiuse_set_leds(wiimote, WIIMOTE_LED_1);
	
	/* Activate the ir module on the wiimote */
	wiiuse_set_ir(wiimote, TRUE);
	
	wiiuse_motion_sensing(wiimote, FALSE);
	
	wiiuse_set_ir_sensitivity(wiimote, 1);
	wiiuse_set_flags(wiimote, WIIUSE_CONTINUOUS, 0);
	
	cal[0].x = 0;
	cal[0].y = 0;
	cal[1].x = 1023;
	cal[1].y = 767;
	
	/* CALIBRATION LOOP */
	for(repeat=0;repeat<2;repeat++) {
		clear_keybuf();
		
		while(!keypressed()) {
			if (wiiuse_poll(&wiimote, 1)) // if there are datas pending from/to wiimote or ESC is pressed
				if (key[KEY_ESC] || wiimote->event == WIIUSE_DISCONNECT || wiimote->event == WIIUSE_UNEXPECTED_DISCONNECT || IS_PRESSED(wiimote, WIIMOTE_BUTTON_HOME)) { // if ESC is pressed, if wiimote update fails, or if HOME key on wiimote is pressed
				wiiuse_disconnect(wiimote);
				destroy_bitmap(background);
				destroy_font(font_msg);
				destroy_font(font_notes);
				for (i=0;i<NUM_BARS;i++) {
					deallocate_voice(bar[i].voice);
					destroy_sample(bar[i].sound);
				}
				free(bar); // YO!! :-)
				free(used_voices);
				
				return;
				}
			/* background */
			stretch_blit(background, page[active_page], 0, 0, background->w, background->h, 0, 0, SCREEN_W, SCREEN_H);
			
			if (wiimote->ir.dot[0].visible) { // if ir source is visible
				/* Read coords from the wiimote's ir*/
				dot[0] = transpose(wiimote->ir.dot[0], cal, 0);
			}
			
			switch(repeat) {
				case 0:
					textout_centre_ex(page[active_page], font_msg, WIIMOTE_CAL_ASX, SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0), -1); // text prompt
					rect(page[active_page], dot[0].x, dot[0].y, SCREEN_W+1, SCREEN_H+1, makecol(0, 0, 0));
					break;
				case 1:
					textout_centre_ex(page[active_page], font_msg, WIIMOTE_CAL_BDX, SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0), -1); // text prompt
					
					rect(page[active_page], dot[1].x, dot[1].y, SCREEN_W+1, SCREEN_H+1, makecol(0, 0, 0));
					rect(page[active_page], -1, -1, dot[0].x, dot[0].y, makecol(0, 0, 0));
					break;
			}
			circlefill(page[active_page], dot[0].x, dot[0].y, radius, makecol(0, 0, 0));

			release_bitmap(page[active_page]);
			
			/* make sure the last flip request has actually happened */
			do {
			} while (poll_scroll());

			/* post a request to display the page we just drew */
			request_video_bitmap(page[active_page]);

			/* update counters to point to the next page */
			switch (active_page) {
				case 0: active_page = 1; break;
				case 1: active_page = 2; break;
				case 2: active_page = 0; break;
			}
		}
		
		cal_tmp[repeat].x = wiimote->ir.dot[0].x;
		cal_tmp[repeat].y = wiimote->ir.dot[0].y;
		dot[1] = dot[0];
	}
	
	__ASSERT((cal_tmp[0].x < cal_tmp[1].x && cal_tmp[0].y > cal_tmp[1].y), ERROR_WHILE_CALIBRATING);
	
	cal[0].x = cal_tmp[0].x;
	cal[0].y = 767-cal_tmp[0].y;
	cal[1].x = cal_tmp[1].x;
	cal[1].y = 767-cal_tmp[1].y;
	
	/* MAIN LOOP */
	while (TRUE) {
		/* Draw a frame */
		if (wiiuse_poll(&wiimote, 1) || key[KEY_ESC]) // if there are datas pending from/to wiimote or ESC is pressed
			if (key[KEY_ESC] || wiimote->event == WIIUSE_DISCONNECT || wiimote->event == WIIUSE_UNEXPECTED_DISCONNECT || IS_PRESSED(wiimote, WIIMOTE_BUTTON_HOME)) { // if ESC is pressed, if wiimote update fails, or if HOME key on wiimote is pressed
				wiiuse_disconnect(wiimote);
				destroy_bitmap(background);
				destroy_font(font_msg);
				destroy_font(font_notes);
				for (i=0;i<NUM_BARS;i++) {
					deallocate_voice(bar[i].voice);
					destroy_sample(bar[i].sound);
				}
				free(bar); // YO!! :-)
				free(used_voices);
				
				return;
			}
		
		/* background */
		stretch_blit(background, page[active_page], 0, 0, background->w, background->h, 0, 0, SCREEN_W, SCREEN_H);
		
		/* Xylophone's bars and notes names */
		for(i=0;i<NUM_BARS;i++) {
			if (bar[i].t_start != -1 && (time_diff = timer-bar[i].t_start) > TICKS_TO_BLACK) // if color animation ends
				bar[i].t_start = -1;
			if (bar[i].t_start == -1) // if no color animation
				bar[i].color = 0;
			else	bar[i].color = COLORVAL(time_diff); // if color animation is running
			
			/* Draw bar */
			rectfill(page[active_page], bar[i].min.x, bar[i].min.y, bar[i].max.x, bar[i].max.y, makecol(bar[i].color, bar[i].color, bar[i].color));
			/* Print bar's associated note */
			textout_centre_ex(page[active_page], font_notes, bar[i].note, (bar[i].min.x + half_bar_size), text_bar_height, makecol(0, 0, 0), -1);
		}
		
		// da normalizzare e da contenere nello schermo, ir
		for(i=0;i<MAX_IR_DOTS;i++) {
			if (wiimote->ir.dot[i].visible) { // if ir source is visible
				/* Read coords from the wiimote's ir*/
				dot[i] = transpose(wiimote->ir.dot[i], cal, radius);
				
				/* If the ir source is under the bars and in previous frame it was above the bars, then play the sound and start the animation */
				if (dot[i].y > bar[0].min.y-radius) {
					if(dot_old[i].y <= bar[0].min.y-radius) {
						/* This calculates on which bar the ir source actually is */
						bar_number = is_onbar(bar, dot[i].x, NUM_BARS);
						
						/* play bar_number's sound with specified volume */
						play_bar_voice(bar, bar_number, volume(dot[i].y-dot_old[i].y), used_voices, hw_voices);
					}
					
					/* The dot have not to go under the bars or out of the screen */
					circlefill(page[active_page], dot[i].x, bar[0].min.y-radius, radius, makecol(0, 0, 0));
				}
				else	circlefill(page[active_page], dot[i].x, dot[i].y, radius, makecol(0, 0, 0));
				
				dot_old[i].y = dot[i].y;
			}
			else dot_old[i].y = SCREEN_H;
		}

		release_bitmap(page[active_page]);

		/* make sure the last flip request has actually happened */
		do {
		} while (poll_scroll());

		/* post a request to display the page we just drew */
		request_video_bitmap(page[active_page]);

		/* update counters to point to the next page */
		switch (active_page) {
			case 0: active_page = 1; break;
			case 1: active_page = 2; break;
			case 2: active_page = 0; break;
		}
	}
}
예제 #9
0
void init(){
    allegro_init();
	set_color_depth(32);
    set_alpha_blender();
	set_gfx_mode(GFX_AUTODETECT_WINDOWED,SCREEN_LENG_X,SCREEN_LENG_Y,0,0);
	install_keyboard();
    install_mouse();
    BUFFER=create_bitmap(SCREEN_LENG_X,SCREEN_LENG_Y);
    PLAYER_SPRITE_ALIVE=load_tga("img/Player.tga",NULL);
    PLAYER_SPRITE_DEAD=load_tga("img/Explosion.tga",NULL);
    BLOCK_SPRITE=load_tga("img/Block.tga",NULL);
    GREEN_SPIKE_SPRITE=load_tga("img/Green_Spike.tga",NULL);
    RED_SPIKE_SPRITE=load_tga("img/Red_Spike.tga",NULL);
    GATE_SPRITE=load_tga("img/Gate.tga",NULL);
    KEY_SPRITE=load_tga("img/Key.tga",NULL);
    CHECK_POINT_SPRITE_VACANT=load_tga("img/Check_Point_Vacant.tga",NULL);
    CHECK_POINT_SPRITE_OCCUPIED=load_tga("img/Check_Point_Occupied.tga",NULL);
    EXIT_SPRITE=load_tga("img/Exit.tga",NULL);
    CURSOR_SPRITE=load_tga("img/Cursor.tga",NULL);
    blue=new Color(0,0,255);
    red=new Color(255,0,0);
    green=new Color(0,255,0);
    yellow=new Color(255,255,0);
    orange=new Color(255,100,0);
    purple=new Color(155,0,155);
    black=new Color(0,0,0);
    white=new Color(255,255,255);
    m_pressed=false;
    m_released=false;
}