Commits

izdubar committed 15a7bdb

* minor addition to have more transitions
* correction for the info page

Comments (0)

Files changed (3)

 #define GUI_SCREEN_MENU		1
 #define GUI_SCREEN_INFO		2
 
-void guiSwitchScreen(int target);
+#define TRANSITION_LEFT		0
+#define TRANSITION_RIGHT	1
+#define TRANSITION_UP		2
+#define TRANSITION_DOWN		3
+
+void guiSwitchScreen(int target, int transition);
 
 void guiReloadScreenExtents();
 
 
 static int screenWidth;
 static float wideScreenScale;
+static int screenHeight;
 
 // forward decl.
 static void guiShow();
 
 // screen transition handling
 static gui_screen_handler_t *screenHandlerTarget = NULL;
-static int transition = 0;
+static int transIndex, transMax, transitionX, transitionY;
 
 // Helper perlin noise data
 #define PLASMA_H 32
 								{ 0, 1, 1, 1 },	{ 0, -1, 1, 1 }, { 0, 1, -1, 1 }, { 0, -1, -1, 1 } };
 
 void guiReloadScreenExtents() {
-	int screenHeight;
 	rmGetScreenExtents(&screenWidth, &screenHeight);
 }
 
 		// advance the effect
 
 		// render the old screen, transposed
-		rmSetTransposition(-transition, 0);
+		rmSetTransposition(transIndex * transitionX, transIndex * transitionY);
 		screenHandler->renderScreen();
 
 		// render new screen transposed again
-		rmSetTransposition(screenWidth - transition, 0);
+		rmSetTransposition((transIndex - transMax) * transitionX, (transIndex - transMax) * transitionY);
 		screenHandlerTarget->renderScreen();
 
 		// reset transposition to zero
 		rmSetTransposition(0, 0);
 
 		// move the transition indicator forward
-		transition += min(transition / 2, (screenWidth - transition) / 2) + 1;
+		transIndex += (min(transIndex, transMax - transIndex) >> 1) + 1;
 
-		if (transition > screenWidth) {
-			transition = 0;
+		if (transIndex > transMax) {
+			transitionX = 0;
+			transitionY = 0;
 			screenHandler = screenHandlerTarget;
 			screenHandlerTarget = NULL;
 		}
 	gFrameHook = cback;
 }
 
-void guiSwitchScreen(int target) {
+void guiSwitchScreen(int target, int transition) {
+	if (transition == TRANSITION_LEFT) {
+		transitionX = 1;
+		transMax = screenWidth;
+	} else if (transition == TRANSITION_RIGHT) {
+		transitionX = -1;
+		transMax = screenWidth;
+	} else if (transition == TRANSITION_UP) {
+		transitionY = 1;
+		transMax = screenHeight;
+	} else if (transition == TRANSITION_DOWN) {
+		transitionY = -1;
+		transMax = screenHeight;
+	}
+	transIndex = 0;
+
 	screenHandlerTarget = &screenHandlers[target];
 }
 
 }
 
 static void menuRequestConfig() {
-	item_list_t* list = selected_item->item->userdata;
-	if (guiInactiveFrames < list->delay)
-		return;
-
 	WaitSema(menuSemaId);
 	if (itemIdConfig != selected_item->item->current->item.id) {
 		if (itemConfig) {
 			itemConfig = NULL;
 		}
 
-		itemIdConfig = selected_item->item->current->item.id;
+		item_list_t* list = selected_item->item->userdata;
+		if (guiInactiveFrames >= list->delay) {
+			itemIdConfig = selected_item->item->current->item.id;
 
-		load_config_request_t* req = malloc(sizeof(load_config_request_t));
-		req->itemId = itemIdConfig;
-		req->list = list;
-		ioPutRequest(IO_MENU_LOAD_CONFIG, req);
+			load_config_request_t* req = malloc(sizeof(load_config_request_t));
+			req->itemId = itemIdConfig;
+			req->list = list;
+			ioPutRequest(IO_MENU_LOAD_CONFIG, req);
+		}
 	}
 	SignalSema(menuSemaId);
 }
 
 	if(getKeyOn(KEY_START) || getKeyOn(KEY_CIRCLE)) {
 		if (gAPPStartMode || gETHStartMode || gUSBStartMode || gHDDStartMode)
-			guiSwitchScreen(GUI_SCREEN_MAIN);
+			guiSwitchScreen(GUI_SCREEN_MAIN, TRANSITION_LEFT);
 	}
 }
 
 		menuNextV();
 	} else if(getKeyOn(KEY_CROSS)) {
 		if (selected_item->item->current && gUseInfoScreen && gTheme->infoElems.first)
-			guiSwitchScreen(GUI_SCREEN_INFO);
+			guiSwitchScreen(GUI_SCREEN_INFO, TRANSITION_DOWN);
 		else
 			selected_item->item->execCross(selected_item->item);
 	} else if(getKeyOn(KEY_TRIANGLE)) {
 	} else if(getKeyOn(KEY_START)) {
 		// reinit main menu - show/hide items valid in the active context
 		menuInitMainMenu();
-		guiSwitchScreen(GUI_SCREEN_MENU);
+		guiSwitchScreen(GUI_SCREEN_MENU, TRANSITION_RIGHT);
 	} else if(getKeyOn(KEY_SELECT)) {
 		selected_item->item->refresh(selected_item->item);
 	} else if(getKey(KEY_L1)) {
 	} else if(getKey(KEY_DOWN)){
 		menuNextV();
 	} else if(getKeyOn(KEY_CIRCLE)) {
-		guiSwitchScreen(GUI_SCREEN_MAIN);
+		guiSwitchScreen(GUI_SCREEN_MAIN, TRANSITION_UP);
 	} else if(getKey(KEY_L1)) {
 		menuPrevPage();
 	} else if(getKey(KEY_R1)) {