Exemple #1
0
int
main()
{
  Bdisp_AllClr_VRAM();
  Bdisp_EnableColor(1);
  DefineStatusAreaFlags(3, SAF_BATTERY | SAF_TEXT | SAF_GLYPH | SAF_ALPHA_SHIFT, 0, 0);
  // disable Catalog function throughout the add-in, as we don't know how to make use of it:
  Bkey_SetAllFlags(0x80);
  
  printf("Welcome to Eigenmath\n");
  printf("To see version information,\npress Shift then Menu.\n");
  run_startup_script();
  aborttimer = Timer_Install(0, check_execution_abort, 100);
  if (aborttimer > 0) { Timer_Start(aborttimer); }
  //in case we're running in a strip, check if this strip has a script to run.
  if(is_running_in_strip()) {
    int MCSsize;
    MCSGetDlen2(DIRNAME, SCRIPTFILE, &MCSsize);
    if (MCSsize > 0) {
      // there is a script to run...
      unsigned char* asrc = (unsigned char*)alloca(MCSsize*sizeof(unsigned char)+5); // 5 more bytes to make sure it fits...
      MCSGetData1(0, MCSsize, asrc); // read script from MCS
      execution_in_progress = 1;
      run((char*)asrc);
      execution_in_progress = 0;
    }
  }
  input_eval_loop(0);
}
Exemple #2
0
void main(void){
    Bdisp_EnableColor(0);//Use 3-bit mode.
    Bdisp_AllClr_VRAM();
    Bdisp_PutDisp_DD();
    for(;;){
        HourGlass();
        if(keyPressed(KEY_PRGM_MENU)){
            int key;
            GetKey(&key);
        }
    }
}
Exemple #3
0
void editRules(settings* sets) {


	Bdisp_AllClr_VRAM();
	Bdisp_EnableColor(1);

	switch(sets->sim_type) {
	case GOL:
		GoL_editRules(sets);
	case WW:
		WW_showRules(sets);
	
	}

}
Exemple #4
0
void main(void){
    Bdisp_EnableColor(0);//Use 3-bit mode. The progress bar looks the same in 16-bit mode.
    Bdisp_AllClr_VRAM();
    for(;;){
        int i;
        for(i=0;i<9001;++i){
            ProgressBar2("Acting busy",i,9001);
            if(keyPressed(KEY_PRGM_MENU)){
                int key;
                GetKey(&key);
                break;
            }
        }
        MsgBoxPop();
    }
}
Exemple #5
0
int main()
{
	Bdisp_AllClr_VRAM();
	Bdisp_EnableColor(1);
	
	// Initialize console 1.
	nio_console c1;

	// The screen can hold up to 64 columns and 27 rows
	// 64 columns, 14 rows. 0px offset for x/y. Background color 15 (white), foreground color 0 (black)
	nio_InitConsole(&c1,64,14,0,0, NIO_COLOR_BLACK, NIO_COLOR_WHITE);
	nio_DrawConsole(&c1);
	
	nio_console c2;
	nio_InitConsole(&c2,64,13,0,14*8, NIO_COLOR_BLACK, NIO_COLOR_WHITE);
	nio_DrawConsole(&c2);
	
	// Just showing printf
	nio_printf(&c1,"%s build at %s, %s\n",__FILE__,__DATE__,__TIME__);
	nio_printf(&c2,"256 text colors available! ");
	int i;
	for(i = 1; i<16; i++)
	{
		nio_SetColor(&c2, 0, i);
		nio_printf(&c2, "%d ", i);
	}
	nio_printf(&c2,"\n");

	// Press EXE to exit
	while(1)
	{
		char text[100];
		// If no text was entered, exit
		if(!nio_GetStr(&c1,text))
			break;
		// Write the text into 2nd console
		nio_printf(&c2,"%s\n",text);
		//Bdisp_PutDisp_DD();
	}
	
	nio_CleanUp(&c1);
	nio_CleanUp(&c2);
	
	return 0;
}
Exemple #6
0
void setup() {
	Bdisp_EnableColor(1);

	copter_speed = 2;
	cursor_speed = 4;
	man_speed = 4;
	
	copter_pos[0] = LCD_WIDTH_PX/2;
	copter_pos[1] = LCD_HEIGHT_PX/2;

	cursor_pos[0] = LCD_WIDTH_PX/2;
	cursor_pos[1] = LCD_HEIGHT_PX/2;

	man_pos[0] = 0;
	man_pos[1] = 0;

	cart_pos = 0;
	cart_counter = 70;
	cart_frame = 0;

	man_is_hanging = true;
	man_is_dead = false;
}
Exemple #7
0
void main(void){
	int x,y;
	char buf[1024];//In this example nothing is done with the buffer, I leave it as an exercise to the reader to do something with the inputted text.
	Bdisp_EnableColor(0);
	Bdisp_AllClr_VRAM();
	//Print the "explanation"
	PrintXY(1,1,"  Stop!",0,0);
	x=0;
	y=32;
	PrintMini(&x,&y,"Who would cross the Bridge of Death",0,0xFFFFFFFF,0,0,0,0xFFFF,1,0);
	x=0;
	y=56;
	PrintMini(&x,&y,"must answer me these questions three,",0,0xFFFFFFFF,0,0,0,0xFFFF,1,0);
	x=0;
	y=80;
	PrintMini(&x,&y,"ere the other side he see.",0,0xFFFFFFFF,0,0,0,0xFFFF,1,0);
	PrintXY(1,5,"  What... is",0,0);
	for(;;){
		askQ("  your name?",buf,1024);
		askQ("  your quest?",buf,1024);
		askQ("  your favorite color?",buf,1024);//The text fits by using American spelling. Yes I know Monty Python is a British show.
	}
}
Exemple #8
0
void engine(settings sets) {
	unsigned char done = 0;
	unsigned char* topTable;
	unsigned char* backTable;
	unsigned char* tableA = (unsigned char*)(malloc(sizeof(unsigned char) * sets.width * sets.height));
	unsigned char* tableB = (unsigned char*)(malloc(sizeof(unsigned char) * sets.width * sets.height));
	
	
	srandom(RTC_GetTicks());
	unsigned int numCells = sets.width*sets.height;
	for(unsigned int i =0; i<numCells; i++) {
		tableB[i] = random()%2;
		tableA[i] = tableB[i];
	}
	
	topTable = tableA; backTable = tableB;
	
	int decal = 0;
	int menu_vy = 0;
	while(!done) {
	
		if(KeyDown(68)) {//OPTN
			if(decal == 0)
				menu_vy = 2;
			else if(decal == 10)
				menu_vy = -2;
		}
		decal+= menu_vy;
		if(decal == 0 || decal == 10)
			menu_vy = 0;
		
		if(decal == 10)
			UI(&sets, topTable, backTable);
		
		if(KeyDown(47))
		done = 1;
		
		//switching tables
		unsigned char* temp;
		temp = backTable;
		backTable = topTable;
		topTable = temp;
		
		//operating
		switch(sets.sim_type) {
		case GOL:
			GoL_reaction(topTable, backTable, sets);
			break;
		case WW:
			WW_reaction(topTable, backTable, sets);
			break;
			
		}
		
		//drawing
		Bdisp_AllClr_VRAM();
		Bdisp_EnableColor(1);
		draw_grid(topTable, sets);
		drawMenu(decal);
		Bdisp_PutDisp_DD();	
		
	}
	
	free(tableA);
	free(tableB);
	
}