Skip to content

mitsuji/kawakudari_allegro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kawakudari_allegro

This project implements part of the std15.h API (from c4ij) with Allegro, and Kawakudari Game on top of it.

It will allow programming for IchigoJam-like targets that display IchigoJam FONT on screen using a C programming language.

  STD15 * std15 = ij_create_std15(512,384,32,24);
  unsigned int frame = 0;
  int x = 15;
  int running = TRUE;

  al_start_timer(timer);
  while(TRUE) {
    ALLEGRO_EVENT event;
    al_wait_for_event(queue, &event);
    switch(event.type) {
    case ALLEGRO_EVENT_TIMER: {
      if(al_is_event_queue_empty(queue)) {
        if (!running) break;
        if (frame % 5 == 0) {
          ij_locate(std15,x,5);
          ij_putc(std15,'0');
          ij_locate(std15,rand()%32,23);
          ij_putc(std15,'*');
          ij_scroll(std15, DIR_UP);
          if (ij_scr(std15,x,5) != '\0') {
	    ij_locate(std15,0,23);
	    ij_putstr(std15,"Game Over...");
	    ij_putnum(std15,frame);
	    running = FALSE;
	  }
        }
        ij_draw_screen(std15);
        ++ frame;
      }
      break;
    }
    case ALLEGRO_EVENT_KEY_DOWN: {
      ALLEGRO_KEYBOARD_STATE key_state;
      al_get_keyboard_state(&key_state);
      if(al_key_down(&key_state,ALLEGRO_KEY_LEFT))  --x;
      if(al_key_down(&key_state,ALLEGRO_KEY_RIGHT)) ++x;
      break;
    }
    case ALLEGRO_EVENT_DISPLAY_CLOSE: {
      goto SHUTDOWN;
      break;
    }
    }
  }

Prerequisite

Download and install Allegro suitable for your environment.

Download and install GNU Make suitable for your environment.

Download and install GCC suitable for your environment.

In Windows enviroment, you might need install and configure MinGW to build and run this project.

Preparation

Adjust contents of Makefile.* to suit your environment.

BREW_PATH=/Users/mitsuji/apps/homebrew

How to use

To build it (Linux,MinGW)

$ make -f Makefile.linux

To build it (macOS)

$ make -f Makefile.macOS

To run it

$ ./kawakudari

License

Creative Commons License CC BY mitsuji.org

This work is licensed under a Creative Commons Attribution 4.0 International License.

About

The project implements part of the std15.h API (from c4ij) with Allegro, and Kawakudari Game on top of it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages