Пример #1
0
compress_flc(char *name)
  {
  int x;

  Open_FLC (name);
  charcolors[0]=0;
  charcolors[1]=0x7fff;
	Get_first_frame ();
	Decompress_frame ();
  curcolor=0;bar(0,0,639,479);
  open_frame();
  create_mgif_lzw();
  reserve_track();
  close_frame();write_frame_size(last_frame_size,max_colors);
  show_screen();
  for (x=2; x<=h_flc.frames; x++)
     {
		Get_next_frame ();
		Decompress_frame ();
     open_frame();
        create_mgif_delta();
        reserve_track();
     close_frame();
     write_frame_size(last_frame_size,max_colors);
     if (last_frame_size>MAX_FRAME) hdiff++;
     else if (last_frame_size<MIN_FRAME && hranice>0) hdiff--;
     else if (hdiff>0) hdiff--;else if(hdiff<0) hdiff++;
     show_screen ();
     }
  Close_FLC();
  }
Пример #2
0
compress_pcx(char *name)
  {
  int x=0;

  get_palette_ptr=flc_paleta;
  curcolor=0;bar(0,0,639,479);
  //prepare_for_mjpg();
  while (get_pcx_frame(name,x))
     {
     open_frame();
     if (x) create_mgif_delta();else create_mgif_lzw();
     reserve_track();
     //create_jpg_frame();
     close_frame();
     curcolor=0;bar(0,400,639,430);
     write_frame_name(name,x);
     write_frame_size(last_frame_size,max_colors);
     if (last_frame_size>MAX_FRAME) {difdif=difdif<=0?1:difdif+1;hdiff+=difdif;}
     else if (last_frame_size<MIN_FRAME && hranice>0) {difdif=difdif>=0?-1:difdif-1;hdiff+=difdif;}
     else if (hdiff>0) {difdif=difdif>=0?-1:difdif-1;hdiff+=difdif;}else if(hdiff<0) hdiff=0;
     show_screen ();
     if (statpic) statpic--;else x+=frame_step;
     global_frame_counter++;
     }
  }
Пример #3
0
//wirte the main file
int main(void) {

    // Set the CPU speed to 8MHz (you must also be compiling at 8MHz)
    set_clock_speed(CPU_8MHz);

    //initialise the LCD screen
    LCDInitialise(LCD_DEFAULT_CONTRAST);

    //clear any characters that were written on the screen
    clear_screen();

    //fill a buffer (array) of charactes with the string "Microcontroller fun begins! - Happy Hacking", in the position x,y
    //array is too big for the screen size
    //draw_string(10,5, "Microcontroller fun begins! - Happy Hacking");

    ////array is too big for the screen size, so we break it into 3 parts
    draw_string(5,5,"Microcontroller");
    draw_string(5,15,"fun begins!");
    draw_string(5,25,"Happy Hacking");


    //write the string on the lcd
    show_screen();


    return 0;
}
Пример #4
0
frame_time_t vsync_busywait_end (int *flipdelay) {
#if 0
    printf("vsync_busywait_end\n");
    show_screen ();

    static int last_vblank = 0;
    while (fs_ml_get_vblank_count() == last_vblank) {

    }
    last_vblank++;// = fs_ml_get_vblank_count();

    if (!dooddevenskip) {
#if 0
        vsync_notvblank ();
        while (!vblank_found && vblankthread_mode == VBLANKTH_ACTIVE) {
            vsync_sleep (currprefs.m68k_speed < 0);
        }
#endif
    }
    //changevblankthreadmode_fast (VBLANKTH_ACTIVE_WAIT);
#if 0
    return thread_vblank_time;

    write_log("vsync_busywait_end\n");
#endif
#endif
    return read_processor_time();
}
Пример #5
0
void black_screen_now(void)
{
  if(prSDLScreen != NULL) {	
    SDL_FillRect(prSDLScreen, NULL, 0);
    render_screen(true);
	  show_screen(0);
  }
}
Пример #6
0
/**
 * Main - Run the main program which prints the system time and flashes the LEDs
 * if certain conditions are met
 */
int main() {
    // Setup the hardware
    set_clock_speed(CPU_8MHz);
    init_hardware();

    // Wait until the 'debugger' is attached...
    draw_centred(17, "Waiting for");
    draw_centred(24, "debugger...");
    show_screen();
    while(!usb_configured() || !usb_serial_get_control());
	send_debug_string("Debugger initialised. Debugging strings will appear below:");

    // Run the main loop displaying the system time @ ~10Hz...
    char buff[BUFF_LENGTH];
    unsigned long count = 0;
	send_debug_string("Entering main loop...");
    while (1) {
        // Draw the current system time on the screen
        clear_screen();
        sprintf(buff, "%7.4f", get_system_time());
        draw_centred(21, buff);
        if (count < 1) { send_debug_string("Calling show_screen()..."); }
		show_screen();
        if (count < 1) { send_debug_string("Finished show_screen()."); }
		_delay_ms(100);

        // Toggle LEDs if the conditions are met
        if ((count % 25) == 0) {
            PORTB ^= (1 << PB2);
			send_debug_string("LED0 was toggled.");
        }
        if ((count % 50) == 10) {
            PORTB ^= (1 << PB3);
			send_debug_string("LED1 was toggled.");
        }

        // Increment the loop count
        count++;
		
		enter_breakpoint(99);
    }

    // We'll never get here...
    return 0;
}
Пример #7
0
void GameOver(Game * game) {
	clear_screen();
	draw_string((screen_width()/2)-11,screen_height()/2-2,"----------------------");
    draw_string((screen_width()/2)-11,screen_height()/2-1,"|     You Died :(    |");
    draw_string((screen_width()/2)-11,screen_height()/2,  "|   Press Q to Quit  |");
    draw_string((screen_width()/2)-11,screen_height()/2+1,"| Press R to Restart |");
    draw_string((screen_width()/2)-11,screen_height()/2+2,"----------------------");
	show_screen();
}
Пример #8
0
//setup and initialise ports and LCD
void Init()
{
	DDRB |= (1<<PINB2)|(1<<PINB3);	//LED0 and LED1 as outputs
	DDRB &= ~((1<<PINB0)|(1<<PINB1));	//Switch0 and Switch1 as input
	PORTB = 0x00; 	// Turn everything off to start with
	LCDInitialise( LCD_DEFAULT_CONTRAST );
	clear_screen();
	show_screen();
}
Пример #9
0
void draws() {
        clear_screen();
        draw_sprite(bullet);
        draw_sprite(player);
        for (int i = 0; i < 10; i++) {
                draw_sprite(alien[i]);
        }
        show_screen();
}
Пример #10
0
int main(void) {
    
    //set clock speed to 8MhZ
    set_clock_speed(CPU_8MHz);

    //initialise ports and LCD screen
	Init();
    
    //initialiase timer
    TimerInit();

 
    //initial mesasge
    clear_screen();
    draw_string(4,4,"Simple Timer");
    show_screen();
    
    //stop for 2 sec
    _delay_ms(2000);
    
    //temp buffer
    char buffer[32];
    
    while (1)
    {
        if (TCNT0 >= 254)
        {
            
        clear_screen();
        PORTB ^= (1<<PINB3);        // toggle LED at a frequancy
        sprintf(buffer,"%u",TCNT0); //
        draw_string(20,20,buffer);  // print value of the counter
        show_screen();
            
        TCNT0 = 0; // reset counter
            
        }
       
    }
                

	return 0;
}	
Пример #11
0
bool show_screen_maybe (bool show)
{
	struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0];
	if (!ap->gfx_vflip || ap->gfx_vsyncmode == 0 || !ap->gfx_vsync) {
		if (show)
			show_screen (0);
		return false;
	}
	return false;
}
Пример #12
0
void info() {
        int x = screen_width()/2;
        draw_string(x - 5, screen_height() -1, "Level: 1" );
        draw_string(0, screen_height()-2, "Georgina Hine (n8872597)");
        draw_string(screen_width() - 9, screen_height() - 2, "Lives:");
        draw_string(screen_width()-18, screen_height() - 2, "Score:"); 
        draw_line(0, screen_height() - 3, screen_width(), screen_height() - 3, '-');
 
        show_screen();
}
Пример #13
0
void screencheck(int x, int y)
{
  int change = 0;
#ifdef CENTER_ON_PLAYER

  change = 1;
  ScreenOffset = y - (ScreenLength/2);
  ScreenXOffset = x - (ScreenWidth/2);


#else
#if 0
  int width = 0;
#endif

  if (((y-ScreenOffset) < (ScreenLength/8)) ||
      ((y-ScreenOffset) > (7*ScreenLength/8))) {
    change = 1;
    ScreenOffset = y - (ScreenLength/2);
  }

  if (((x-ScreenXOffset) < (ScreenWidth/8)) ||
      ((x-ScreenXOffset) > (7*ScreenWidth/8))) {

#if 0
    if ( Current_Environment == E_COUNTRYSIDE )
      width = COUNTRY_WIDTH;
    else
      width = Level->level_width;

    /*
      PGM: this code prevents scrolling when near the right edge of the level,
      but this unfortunately results in a badly placed view when, for examples,
      restoring a save near the edge of a level. Ideas on fixing this, or moving
      it, appreciated.  PGM July 1999.
    */
    if ( ( (x-ScreenXOffset) + (7*ScreenWidth/8) ) < width +( ScreenWidth/8 ) )
#endif
      {
        change = 1;
        ScreenXOffset = x - (ScreenWidth/2);
        if (ScreenXOffset < 0)
          ScreenXOffset = 0;
      }
  }

#endif
  if ( change == 1 ) {
    show_screen();
    if (Current_Environment != E_COUNTRYSIDE) 
      drawmonsters(TRUE);
    if (!offscreen(Player.x,Player.y))
      drawplayer();
  }
}
Пример #14
0
/**
* Main - Run through the steps of configuring, greeting, getting a name, thanking,
* and then quitting
*/
int main(void) {
	char buff[BUFF_LENGTH];

	// Setup the hardware
	init_hardware();

	// Wait until the USB port is configured and ready to go
	draw_centred(17, "Waiting for");
	draw_centred(24, "computer...");
	show_screen();
	while (!usb_configured() || !usb_serial_get_control());

	// Prompt the user for their name, and wait until they enter it
	clear_screen();
	draw_centred(17, "Waiting for");
	draw_centred(24, "username...");
	show_screen();
	send_line("Hello!");
	send_line("Could you please tell me your name:");
	recv_line(buff, BUFF_LENGTH);
	usb_serial_putchar('\n');

	// Display their name on the Teensy and prompt them to exit
	char buff2[BUFF_LENGTH + 8];
	sprintf(buff2, "Thanks %s!", buff);
	clear_screen();
	draw_centred(21, buff2);
	show_screen();
	send_line("Press 'q' to exit...");
	while (usb_serial_getchar() != 'q');

	// Display the finished information
	clear_screen();
	draw_centred(21, "Goodbye!");
	show_screen();
	send_line("\r");
	send_line("Done! Goodbye!");
	while (1);

	// We'll never get here...
	return 0;
}
Пример #15
0
void draw_paddles() {
	int width;
	int height;
	
	get_screen_size(width, height);
	
	draw_paddle(width, height, 2, 2, false, 8, '!');
	draw_paddle(width, height, 4, 4, true, 8, '!');

	show_screen();
}
Пример #16
0
void main(void)  {	
  initialize();
  while (1)
  {
//
 //   if (!tgi_busy())
 //   {
      show_screen();
//    }
  };
}
Пример #17
0
void screencheck(int y)
{
  if (((y-ScreenOffset) < (ScreenLength/8)) ||
      ((y-ScreenOffset) > (7*ScreenLength/8))) {
    ScreenOffset = y - (ScreenLength/2);
    show_screen();
    if (Current_Environment != E_COUNTRYSIDE) 
      drawmonsters(TRUE);
    if (!offscreen(Player.x,Player.y))
      drawplayer();
  }
}
Пример #18
0
// Generate coordinates, draw box.
void demo()
{
	int x = rand() % screen_width() / 2;
	int y = rand() % screen_height() / 2;
	int w = rand() % ( screen_width() - x );
	int h = rand() % ( screen_height() - y );
	char * chars = "~!@#$%^&*-+";
	char ch = chars[rand() % strlen( chars )];

	fill_rect( x, y, w, h, ch );
	
	show_screen();
}
Пример #19
0
int main( void ) {
	setup_screen();

	draw_string( 10, 10, "Hello CAB202!!!" );
	show_screen();

	while ( 1 ) {
		play_one_square();
		play_ten_squares();
		walk_the_walk();
	}

	return 0;
}
Пример #20
0
/* draw everything whether visible or not */
void drawscreen(void)
{
  int i,j;
  if (Current_Environment == E_COUNTRYSIDE)
    for (i=0;i<COUNTRY_WIDTH;i++)
      for(j=0;j<COUNTRY_LENGTH;j++)
        c_set(i, j, SEEN);
  else for (i=0;i<Level->level_width;i++)
    for(j=0;j<Level->level_length;j++)
      lset(i,j,SEEN);
  if (Current_Environment == E_CITY)
    for (i = 0; i < NUMCITYSITES; i++)
      CitySiteList[i][0] = 1;
  show_screen();
}
Пример #21
0
// --------- Do not submit the following functions --------- // 
void simple_timer() {
	Game game;
	setup_score(&game);
	
	while (!game.over) {
		if (update_score(&game)) {
			clear_screen();
			display_score(&game);
			show_screen();
		}
		
		timer_pause(100);
	}
	
	timer_pause(1500);
}
Пример #22
0
void objdet(int blessing)
{
    int i,j;
    for (i=0; i<Level->level_width; i++)
        for (j=0; j<Level->level_length; j++)
            if (Level->site[i][j].things != NULL) {
                if (blessing < 0)
                    putspot(random_range(Level->level_width),
                            random_range(Level->level_length),
                            Level->site[i][j].things->thing->objchar);
                else putspot(i,j,Level->site[i][j].things->thing->objchar);
            }
    levelrefresh();
    morewait();
    show_screen();
}
Пример #23
0
void mondet(int blessing)
{
    MonsterList* ml;
    for (ml=Level->mlist; ml!=NULL; ml=ml->next)
        if (ml->monster->hp > 0) /* FIXED 12/30/98 DG */
        {
            if (blessing > -1)
                plotmon(ml->monster);
            else
                putspot(random_range(Level->level_width), random_range(Level->level_length),
                        Monsters[random_range(NUMMONSTERS)].symbol);
        }
    levelrefresh();
    morewait();
    show_screen();
}
Пример #24
0
// This is my primary Event Loop. This is where most of the fun stuff happens ;)
void Megamaniac() {
    // WTF does this do? Something to do with my Data Structure I assume...
    Game game;

	while (true) {
	    // Let's run our initial setup to get everything for the game ready.
	    SetupGame(&game);

	    // Do we need to change the level? Not really but we should probably start at Level 1.
	    ChangeLevel(&game);

		// This is where the Event Loop actually starts. This will run repeatedly until our game is over.
	    while (!game.game_over) {
		    clear_screen();
		    GameStats(&game);
			int userInput = UserInput(&game);
		    MovementPlayer(&game, userInput);
			MovementMissiles(&game, userInput);
		    MovementAliens(&game);
			MovementBombs(&game);
			MovementBonuses(&game);

			CollisionMissiles(&game);
			CollisionAliens(&game);
		    CollisionBombs(&game);
			CollisionBonuses(&game);

			UpdateScreen(&game);
		    show_screen();
		    timer_pause(25);
	    }

		GameOver(&game);

		int userInput = wait_char();
		while (userInput != 'r' && userInput >= 0) {
			if (userInput == 'q') {
				exit(0);
			}
			if (userInput == 'r') {
				Megamaniac();
			}
			userInput = wait_char();
		}
	}
}
Пример #25
0
void do_blink() {
  int x,y;
  char flag;
  flag = ' ';
  while (flag == ' ') {
    x = player.x + u_random(12) - u_random(12);
    y = player.y + u_random(12) - u_random(12);
    if (x>1 && x<99 && y>1 && y<99 && player.map[x][y] == 7) flag = '*';
    }
  player.x = x; player.y = y;
  player.map_x = player.x-8;
  player.map_y = player.y-8;
  if (player.x<1) player.x = 1;
  if (player.y<1) player.y = 1;
  if (player.x>84) player.x = 84;
  if (player.y>84) player.y = 84;
  show_screen();
  }
Пример #26
0
bool show_screen_maybe (bool show) {
#ifdef DEBUG_SHOW_SCREEN
    printf("show_screen_maybe %d (picasso_on=%d)\n", show, picasso_on);
#endif

    struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0];
    if (!ap->gfx_vflip || ap->gfx_vsyncmode == 0 || !ap->gfx_vsync) {
        if (show) {
        //if (show && !picasso_on) {
            show_screen (0);
        }
        return false;
    }
#if 0
	if (ap->gfx_vflip < 0) {
		doflipevent ();
		return true;
	}
#endif
    return false;
}
Пример #27
0
void demo() {
	const int N = 5;
	const double X_MAX = screen_width();
	const double Y_MAX = screen_height();

	double p[] = {0.5, 1, 1.5, 2, 3};
	
	for (int i = 0; i < N; i++) {
		clear_screen();
		double x0 = X_MAX / 2;
		double y0 = Y_MAX / 2;
		double xr = X_MAX / 3;
		double yr = Y_MAX / 3;
		
		draw_ellipse_p(x0, y0, xr, yr, p[i], '*');
		draw_string(0, 0, "p = ");
		draw_double(4, 0, p[i]);
		show_screen();
		timer_pause(5000);
	}
}
Пример #28
0
void go_down() {
  char flag;
  if (player.d_level < bottom) {
    flag = ' ';
    player.d_level++;
    make_map();
    if (flag == ' ') {
      player.x = u_random(80)+10; player.y = u_random(80) + 10;
      while (player.map[player.x][player.y] != 7) {
        player.x = u_random(80)+10; player.y = u_random(80) + 10;
        }
      }
    player.map_x = player.x - 8;
    player.map_y = player.y - 8;
    if (player.map_x < 1) player.map_x = 1;
    if (player.map_y < 1) player.map_y = 1;
    if (player.map_x > 84) player.map_x = 84;
    if (player.map_y > 84) player.map_y = 84;
    show_screen();
    }
  }
Пример #29
0
int main(void)
{
    //set clock speed to 8MhZ
    set_clock_speed(CPU_8MHz);
    
    
    //call initialisation routines
	Init();	
	PinChangeInit();

	clear_screen();
	draw_string(10,10,"Interrupt Demo");
	show_screen();

    //stops for 2 secs
    _delay_ms(2000);
    
    //do nothing. stop main program from exiting
    while(1);
	
	
	return 0;
}
Пример #30
0
// Basic command interpreter for controlling port pins
int main(void)
{
	char rx_buf[8];// the buffer to store received characters
	uint8_t n = 0;  // to store the number of bytes read from the serial port
    uint8_t counter = 0; //keep count of the number of cycles in the while loop
    // coordinates of the middle of the screen
    int x=LCD_X/2; 
    int y=LCD_Y/2;

	//set clock speed to 8MhZ
    set_clock_speed(CPU_8MHz);
    
    
    //initialise LCD and ports
	Init();

	// initialize the USB, and then wait for the host
	// to set configuration.  If the Teensy is powered
	// without a PC connected to the USB port, this 
	// will wait forever.
	usb_init();
	while (!usb_configured()) /* wait */ ;
	  _delay_ms(1000);


   //keep looping until the character 'q' is received
	while (rx_buf[0]!='q') {
        counter++;
		// wait for the user to run their terminal emulator program
		// which sets DTR to indicate it is ready to receive.
		while (!(usb_serial_get_control() & USB_SERIAL_DTR)) /* wait */ ;

		// discard anything that was received prior.  Sometimes the
		// operating system or other software will send a modem
		// "AT command", which can still be buffered.
		usb_serial_flush_input();


		// and then listen for commands and process them
		while (1) {
            
            //send some characters to the other side
             //send_str(PSTR("> \n"));
            
            if (usb_serial_available())
			  n = recv_str(rx_buf, sizeof(rx_buf)); //read serial port
			else
			  break;	 
            
            
            parse_and_execute_command(rx_buf, n);
            
            
            clear_screen();
            draw_string(x-40,y,"receiving: ");
            show_screen();
            draw_char(x+20,y,rx_buf[0]);
            show_screen();
            
		}
		
	}	 
	return 0;
}