Esempio n. 1
0
//First Boot Message
void firstBootInitiation()
{	
	firstBoot = setFileDefaultsInt("system/settings/boot.bin", 1, firstBoot);

	iconPackLoad();

	//Loads our images into memory
	loadIcons();
	background = oslLoadImageFile(backgroundPath, OSL_IN_RAM, OSL_PF_8888);
	cursor = oslLoadImageFilePNG(cursorPath, OSL_IN_VRAM, OSL_PF_8888);
	navbar = oslLoadImageFile(navbarPath, OSL_IN_RAM, OSL_PF_8888);
	navbar2 = oslLoadImageFile(navbar2Path, OSL_IN_RAM, OSL_PF_8888);
	//notif = oslLoadImageFile("system/home/menu/notif.png", OSL_IN_RAM, OSL_PF_8888);
	welcome = oslLoadImageFilePNG("system/home/icons/welcome.png", OSL_IN_RAM, OSL_PF_8888);
	transbackground = oslLoadImageFilePNG("system/home/icons/transbackground.png", OSL_IN_RAM, OSL_PF_8888);
	control = oslLoadImageFilePNG("system/home/menu/brightnesscontrol.png", OSL_IN_VRAM, OSL_PF_8888);
	ic_launcher_apollo = oslLoadImageFilePNG(apolloPath, OSL_IN_RAM, OSL_PF_8888);
	ic_launcher_browser = oslLoadImageFile(browserPath, OSL_IN_RAM, OSL_PF_8888);
	ic_launcher_calculator = oslLoadImageFilePNG(calcPath, OSL_IN_RAM, OSL_PF_8888);
	ic_launcher_filemanager = oslLoadImageFilePNG(fmPath, OSL_IN_RAM, OSL_PF_8888);
	ic_launcher_gallery = oslLoadImageFilePNG(galleryPath, OSL_IN_RAM, OSL_PF_8888);
	ic_launcher_game = oslLoadImageFilePNG(gamePath, OSL_IN_RAM, OSL_PF_8888);
	ic_launcher_messenger = oslLoadImageFilePNG(messagesPath, OSL_IN_RAM, OSL_PF_8888);
	ic_launcher_settings = oslLoadImageFilePNG(settingsPath, OSL_IN_RAM, OSL_PF_8888);
	ic_launcher_umd = oslLoadImageFilePNG(umdPath, OSL_IN_RAM, OSL_PF_8888);
	usbdebug = oslLoadImageFilePNG("system/home/icons/usbdebug.png", OSL_IN_RAM, OSL_PF_8888);
	music = oslLoadImageFilePNG("system/home/icons/music.png", OSL_IN_RAM, OSL_PF_8888);
	
	
	//Debugger - Displays an error message if the following resources are missing.
	if (!background || !cursor || !ic_allapps || !ic_allapps_pressed || !navbar || !ic_launcher_apollo || !ic_launcher_settings || !ic_launcher_messenger || !ic_launcher_browser || !batt100 || !batt80 || !batt60 || !batt40 || !batt20 || !batt10 || !batt0 || !battcharge || !navbar2 || !usbdebug  || !music)
		debugDisplay();
		
	//Sets the cursor's original position on the screen
	cursor->x = 240;
	cursor->y = 136;	
	
	if (firstBoot!= 0)
	{
		while (!osl_quit)
		{		
			oslStartDrawing();

			controls();

			oslDrawImage(background);		
			oslDrawImageXY(ic_launcher_apollo, 105, 190);
			oslDrawImageXY(ic_launcher_browser, 276, 190);
			oslDrawImageXY(ic_launcher_settings, 331, 190);
			oslDrawImageXY(ic_launcher_messenger, 160, 190);
			oslSetTransparentColor(RGB(0,0,0));
			appDrawerIcon();
			oslDisableTransparentColor();
		
			oslIntraFontSetStyle(Roboto, 0.5f, WHITE, 0, INTRAFONT_ALIGN_LEFT);
			
			digitaltime(420,4,0,hrTime);
			volumeController();
			battery(370,2,1);
			navbarButtons(0);
			
			oslDrawImageXY(transbackground, 0, 0);
			oslDrawImageXY(welcome, 0, 0);
			
			oslIntraFontSetStyle(Roboto, 0.8f,BLACK,0,INTRAFONT_ALIGN_LEFT);
			oslDrawStringf(20,30, "%s", lang_welcome[language][0]);
			
			oslIntraFontSetStyle(Roboto, 0.6f,DARKGRAY,0,INTRAFONT_ALIGN_LEFT);
			oslDrawStringf(20,60, "%s", lang_welcome[language][1]);
			
			oslDrawStringf(20,80, "%s", lang_welcome[language][2]);
			
			oslIntraFontSetStyle(Roboto, 0.6f,WHITE,0,INTRAFONT_ALIGN_LEFT);
			oslDrawStringf(385,110, "%s", lang_welcome[language][3]);
			
			oslDrawImage(cursor);
	
			if (cursor->x >= 388 && cursor->x <= 464 && cursor->y >= 98 && cursor->y <= 132 && osl_keys->pressed.cross)
			{
				FILE * firstBootTxt = fopen("system/settings/boot.bin", "w"); 
				fprintf(firstBootTxt, "0");
				fclose(firstBootTxt);
				oslPlaySound(KeypressStandard, 1); 
				oslDeleteImage(welcome);
				oslDeleteImage(transbackground);
				unloadIcons();
				home();
			}
			
			captureScreenshot();
			
		oslEndDrawing(); 
        oslEndFrame(); 
		oslSyncFrame();	
		}
	}
		
	if (firstBoot == 0)
	{
		oslDeleteImage(welcome);
		oslDeleteImage(transbackground);
		unloadIcons();
		lockscreen();
		home();
	}
}
Esempio n. 2
0
int home()
{
	sf2d_set_clear_color(RGBA8(0, 0, 0, 0));

	ic_allapps_pressed = sf2d_create_texture_mem_RGBA8(ic_allapps_pressed_img.pixel_data, ic_allapps_pressed_img.width, ic_allapps_pressed_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM);
	
	ic_launcher_browser = sf2d_create_texture_mem_RGBA8(ic_launcher_browser_img.pixel_data, ic_launcher_browser_img.width, ic_launcher_browser_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM);
	ic_launcher_messenger = sf2d_create_texture_mem_RGBA8(ic_launcher_messenger_img.pixel_data, ic_launcher_messenger_img.width, ic_launcher_messenger_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM);
	ic_launcher_apollo = sf2d_create_texture_mem_RGBA8(ic_launcher_apollo_img.pixel_data, ic_launcher_apollo_img.width, ic_launcher_apollo_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM);
	ic_launcher_settings = sf2d_create_texture_mem_RGBA8(ic_launcher_settings_img.pixel_data, ic_launcher_settings_img.width, ic_launcher_settings_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM);
	
	// Main loop
	while (aptMainLoop())
	{

		//Scan all the inputs. This should be done once for each frame
		hidScanInput();
		
		//hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame)
		u32 kDown = hidKeysDown();
		//hidKeysUp returns information about which buttons have been just released
		//u32 kUp = hidKeysUp();
		
		sf2d_start_frame(GFX_TOP, GFX_LEFT);
		
		sf2d_draw_texture(background, 0, 0);
		
		sf2d_draw_texture(ic_launcher_browser, 49, 145);
		sf2d_draw_texture(ic_launcher_messenger, 114, 145);
		sf2d_draw_texture(ic_launcher_apollo, 241, 145);
		sf2d_draw_texture(ic_launcher_settings, 306, 145);
		appDrawerIcon();

		dayNightWidget();
		
		navbarControls(0); //Displays navbar
		digitalTime(350, 2); //Displays digital time
		batteryStatus(316, 2); //Displays battery status
		cursorController();
		
		sf2d_end_frame();
		
		if ((touch.px  >= 170 && touch.px  <= 210 && touch.py >= 148 && touch.py <= 190) && (kDown & KEY_A))
		{
			sf2d_free_texture(ic_allapps_pressed);
			appDrawer(); //Open app drawer
		}
		
		if ((touch.px  >= 306 && touch.px  <= 351 && touch.py >= 145 && touch.py <= 190) && (kDown & KEY_A))
		{
			sf2d_free_texture(ic_allapps_pressed);
			settingsMenu(); //Open settings menu
		}
		
		if (kDown & KEY_Y)
			powerMenu(); //Open power menu
		
		if (kDown & KEY_L)
			lockScreen(); //Locks the screen

		// Flush and swap framebuffers
		sf2d_swapbuffers();
	}

	sf2d_free_texture(ic_allapps_pressed);
	
	return 0;
}