Esempio n. 1
0
/*! initialize console subsystem */
void
console_init(void)
{
  consoleInit(GFX_TOP, &status_console);
  consoleSetWindow(&status_console, 0, 0, 50, 1);

  consoleInit(GFX_TOP, &main_console);
  consoleSetWindow(&main_console, 0, 1, 50, 29);

  //consoleInit(GFX_BOTTOM, &tcp_console);	glitched image fix

  consoleSelect(&main_console);
}
Esempio n. 2
0
/*! initialize console subsystem */
void
console_init(void)
{
  consoleInit(GFX_TOP, &status_console);
  consoleSetWindow(&status_console, 0, 0, 50, 1);

  consoleInit(GFX_TOP, &main_console);
  consoleSetWindow(&main_console, 0, 1, 50, 29);

  consoleSelect(&main_console);

  consoleDebugInit(debugDevice_NULL);
}
Esempio n. 3
0
void Render::AttributeText(int atk, int def, int agi)
{
	consoleSetWindow(&bottomScreen, 18, 10, 35, 16);
	std::cout << "Atk: " << atk;
	std::cout << "\n\n\nDef: " << def;
	std::cout << "\n\n\nAgi: " << agi;
	std::cout << "\n\n\nRepair ";
}
Esempio n. 4
0
void Render::StatText(int s, int a, int h, int ms, int ma, int mh, int killCount, int untilBoss)
{
	consoleSetWindow(&bottomScreen, 6, 2, 15, 5);
	std::cout << "Shield: " << s << "/" << ms;
	std::cout << "\nArmor:  " << a << "/" << ma;
	std::cout << "\nHull:   " << h << "/" << mh;
	std::cout << "\n\nKills: " << killCount << "/" << untilBoss;
}
Esempio n. 5
0
void filePrintFileList(const char *dir, int first, int select, int count, bool cancel = false)
{
	if (select < first)
		select = first;

	consoleSelect(&lowerScreen);
	consoleSetWindow(&lowerScreen, 0, 0, 32, 19);
	consoleClear();

	char *buf = (char*)data;
	for (int i = 0; i < first; i++) {
		buf = strchr(buf, '\n') + 1;
	}

	for (int i = first; (i < first + 18) && (i < count); i++) {
		char *newline = strchr(buf, '\n');
		int linelen = newline - buf;
		
		*newline = 0;
		if (*buf == 'd') {
			if (i != select)		
				iprintf("[%.29s]\n", buf+1);
			else
				iprintf("-->[%.26s]\n", buf+1);
		} else {
			if (i != select)
				iprintf("%.31s\n", buf+1);
			else
				iprintf("-->%.28s\n", buf+1);
		}
		*newline = '\n';
		buf += linelen+1;
	}
	
	consoleSelect(&lowerScreen);
	consoleSetWindow(&lowerScreen, 0, 18, 32, 6);
	consoleClear();
	iprintf("================================");
	if (cancel)
		iprintf(stringsGetMessageString(STR_FS_WRITE));
	else
		iprintf(stringsGetMessageString(STR_FS_READ));
}
Esempio n. 6
0
void keyboard_draw()
{
	int i, h;
	sregion_t *region;
	int count;
	u16 width, height;

	if (keyboard_visible == 0)
	{
		return;
	}

	keyboard_screen = (u16*)gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, &width, &height);

	//see if the keyboard layout has changed
	if (keyboard_visible != keyboard_visible_last) {
		keyboard_vofs = 152;
		keyboard_hofs = 32;
		if (keyboard_visible == 2) {
			keyboard_vofs = 216;
		}
		//clear the console and set window size
		consoleClear();
		memset(keyboard_screen, 0, 320*240*2);
		h = keyboard_visible == 1 ? 19 : 24;
		consoleSetWindow(0, 0, 0, 40, h);

		//printf("full refresh: %d %d\n", keyboard_visible, keyboard_visible_last);
		keyboard_visible_last = keyboard_visible;
	}
	else {
		//the keyboard layout has not changed so no need to draw everything
		return;
	}

	region = key_array;
	count = sizeof(key_array) / sizeof(sregion_t);
	if (keyboard_visible == 2)
	{
		region = key_button_array;
		count = 2;
	}



	for (i = 0; i<count; i++)
	{
		keyboard_draw_region(&region[i], -1, keyboard_fg);
	}

}
Esempio n. 7
0
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
	Wifi_InitDefault(false);
	
	consoleDemoInit(); 

	Keyboard* kb = keyboardDemoInit();
	kb->OnKeyPressed = keyPressed;

	while(1) {
		int status = ASSOCSTATUS_DISCONNECTED;

		consoleClear();
		consoleSetWindow(NULL, 0,0,32,24);

		Wifi_AccessPoint* ap = findAP();

		consoleClear();
		consoleSetWindow(NULL, 0,0,32,10);

		iprintf("Connecting to %s\n", ap->ssid);

		//this tells the wifi lib to use dhcp for everything
		Wifi_SetIP(0,0,0,0,0);	
		char wepkey[64];
		int wepmode = WEPMODE_NONE;
		if (ap->flags & WFLAG_APDATA_WEP) {
			iprintf("Enter Wep Key\n");
			while (wepmode == WEPMODE_NONE) {
				scanf("%s",wepkey);
				if (strlen(wepkey)==13) {
					wepmode = WEPMODE_128BIT;
				} else if (strlen(wepkey) == 5) {
					wepmode = WEPMODE_40BIT;
				} else {
					iprintf("Invalid key!\n");
				}
			}
			Wifi_ConnectAP(ap, wepmode, 0, (u8*)wepkey);
		} else {
			Wifi_ConnectAP(ap, WEPMODE_NONE, 0, 0);
		}
		consoleClear();
		while(status != ASSOCSTATUS_ASSOCIATED && status != ASSOCSTATUS_CANNOTCONNECT) {

			status = Wifi_AssocStatus();
			int len = strlen(ASSOCSTATUS_STRINGS[status]);
			iprintf("\x1b[0;0H\x1b[K");
			iprintf("\x1b[0;%dH%s", (32-len)/2,ASSOCSTATUS_STRINGS[status]);

			scanKeys();

			if(keysDown() & KEY_B) break;
			
			swiWaitForVBlank();
		}

		char url[256];

		if(status == ASSOCSTATUS_ASSOCIATED) {
			u32 ip = Wifi_GetIP();

			iprintf("\nip: [%i.%i.%i.%i]\n", (ip ) & 0xFF, (ip >> 8) & 0xFF, (ip >> 16) & 0xFF, (ip >> 24) & 0xFF);
			while(1) {

				scanf("%s", url);

				if ( 0 == strcmp(url,"quit")) break;

				struct hostent *host = gethostbyname(url);

				if(host)
					iprintf("IP (%s) : %s\n",  url, inet_ntoa(*(struct in_addr *)host->h_addr_list[0]));
				else
					iprintf("Could not resolve\n");

				swiWaitForVBlank();
			}
		} else {
Esempio n. 8
0
void Display::set_window() const{
	consoleSelect(&_console[_screen]);
	consoleSetWindow(&_console[_screen], x(), y(), w(), h());
}
Esempio n. 9
0
void Render::StoryText(std::string text)
{
	consoleSetWindow(&bottomScreen, 0, 2, 32, 16);
	std::cout << text;
}
Esempio n. 10
0
void Render::GameOverText()
{
	consoleSetWindow(&bottomScreen, 0, 2, 32, 16);
	std::cout << "\n\nYou have lost the war,\n\nand Earth has been overrun... \n\n\n\n                     SAD DAY";
}
Esempio n. 11
0
void Render::ScoreText(int score)
{
	consoleSetWindow(&bottomScreen, 20, 2, 22, 5);
	std::cout << "Scrap " << score;
}
Esempio n. 12
0
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
	Wifi_InitDefault(false);
	
	consoleDemoInit(); 

	//Keyboard* kb = keyboardDemoInit();
	//kb->OnKeyPressed = keyPressed;

	while(1);

	{
		int status = ASSOCSTATUS_DISCONNECTED;

		consoleClear();

		Wifi_AccessPoint* ap = findAP();

		iprintf("Connecting to %s\n", ap->ssid);

		//this tells the wifi lib to use dhcp for everything
		Wifi_SetIP(0,0,0,0,0);	

		Wifi_ConnectAP(ap, WEPMODE_NONE, 0, 0);

		while(status != ASSOCSTATUS_ASSOCIATED && status != ASSOCSTATUS_CANNOTCONNECT) {
			int oldStatus = status;

			status = Wifi_AssocStatus();

			iprintf("%s", oldStatus != status ? ASSOCSTATUS_STRINGS[status] : ".");

			scanKeys();

			if(keysDown() & KEY_B) break;
			
			swiWaitForVBlank();
		}
		consoleClear();
		consoleSetWindow(NULL, 0,0,32,10);

		char url[256];

		if(status == ASSOCSTATUS_ASSOCIATED) {
			while(1) {
				u32 ip = Wifi_GetIP();

				iprintf("ip: [%i.%i.%i.%i]", (ip ) & 0xFF, (ip >> 8) & 0xFF, (ip >> 16) & 0xFF, (ip >> 24) & 0xFF);

				scanf("%s", url);

				struct hostent *host = gethostbyname(url);

				if(host)
					iprintf("IP (%s) : %s\n",  url, inet_ntoa(*(struct in_addr *)host->h_addr_list[0]));
				else
					iprintf("Could not resolve\n");

				scanKeys();

				if(keysDown() & KEY_B) break;

				swiWaitForVBlank();
			}
		}
	}
	return 0;
}