コード例 #1
0
ファイル: main.c プロジェクト: Nemh/chip8
int init_gui()
{
	nio_InitConsole(&c1,64,27,0,0,0,15);
	nio_DrawConsole(&c1);
	nio_printf(&c1,"Chip8 Interpreter | Dev\n     Build of %s at %s\n\n\n > ",__DATE__,__TIME__);
	nio_printf(&c1,"Type \"fb\" to open the filebrowser. You can also directly type\n > the name of the file you want to play\n > ###############\n\n > ");
}
コード例 #2
0
ファイル: main.c プロジェクト: Nemh/chip8
int gui(Exec_info exec_info)
{
	unsigned char path[100] = {'\0'};
	int exec_time, exec_frequency;
	int key = 0;
	int handle = -1;
	nio_DrawConsole(&c1);

	if(exec_info.cycles_count != 0) {
		exec_time = (int)((exec_info.tick_end - exec_info.tick_start)/128);
		exec_frequency = exec_info.cycles_count/(exec_time * 1000);
		nio_printf(&c1, "Game terminated. Execution time : %d s.\n > Average execution frequency : %d kHz\n > ", exec_time, exec_frequency);
	}

#ifndef EMULATOR
	while(handle < 0) {
		nio_GetStr(&c1, path);
		if(!strcmp(path, "exit")) {
			while(1) {
				GetKey(&key);
			}
		}
		else if(!strcmp(path, "help")) nio_printf(&c1, "Type name of the file you want to load\n or, if you want to leave me , write 'exit' :(\n > ");
		else if(!strcmp(path, "fb")) {
#endif
			fileBrowser(path, (unsigned char*)"*.ch", (unsigned char*)"*.CH8", (unsigned char*)"*.ch8", "Files");
			nio_DrawConsole(&c1);
			if(strcmp(path, "")) {
				handle = CC_open_file(path+7);
				if(handle < 0) nio_printf(&c1, "Error opening %s ... Check if the file exists\n > ", path);
				else {
					return handle;
				}
			}
#ifndef EMULATOR
		}
		else {
			handle = CC_open_file(path);
			if(handle < 0) nio_printf(&c1, "Error opening %s ... Check if the file exists\n > ", path);
			else {
				return handle;
			}
		}	
	}
#endif
}
コード例 #3
0
ファイル: demo.c プロジェクト: juju2143/prizmio
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;
}
コード例 #4
0
ファイル: main.c プロジェクト: Nemh/chip8
int main()
{
	char filename[50] = {'\0'};
	//fileBrowser(filename, (unsigned char*)"*.lua", (unsigned char*)"*.lc", (unsigned char*)"*.txt", "Title"); //*.lua, *.lc, *.txt: filetypes to filter; "Title": small text to show in blue on the top left corner  
	Exec_info exec_info = {0,0,0};
	int key = 0, debug = 0, handle_program, i=0;
	char pc_s[10];
	Bdisp_AllClr_VRAM();

	srand(time_getTicks());

	init_gui();
	init_machine();
	while(1) {
		handle_program = gui(exec_info);
		if(handle_program > 0) {
			init_machine();
			load_game(handle_program);
			exec_info = play_game();
		} else {
			while(i < 10) {
				nio_DrawConsole(&c1);
				GetKey(&key);
				i++;
			}
			i=0;
		}
	}

	nio_CleanUp(&c1);

	while(1) {
		GetKey(&key);
	}
	return 1;
}
コード例 #5
0
ファイル: dconsole.c プロジェクト: AnderainLovelace/dPicoC-NS
void dConsoleRefresh()
{
	nio_DrawConsole(&csl);
}