From 00278d6aaab4ddcf5e8cde8c3b3db06358595b7b Mon Sep 17 00:00:00 2001
From: PoloNX <geyrecharlie@gmail.com>
Date: Fri, 3 Jun 2022 13:57:20 +0200
Subject: [PATCH] added circle cursor for icons under payload

---
 Makefile                 |  2 +-
 include/Cursor.hpp       |  1 +
 include/RenderWindow.hpp |  2 ++
 source/cursor.cpp        | 38 +++++++++++++++++++++++++++++++-------
 source/menu.cpp          |  1 -
 source/renderWindow.cpp  | 12 ++++++++++--
 6 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 4290dec..db70caf 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ CXXFLAGS	:= $(CFLAGS) -fexceptions -fno-rtti -fno-exceptions -std=gnu++17 -Wno-r
 ASFLAGS	:=	-g $(ARCH)
 LDFLAGS	=	-specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
 
-LIBS	:= -lminizip -lstdc++fs -lz -lfreetype -lSDL2_ttf -lSDL2_gfx -lSDL2_image -lSDL2 -lEGL -lGLESv2 -lglapi -ldrm_nouveau -lwebp -lpng -ljpeg `sdl2-config --libs` `freetype-config --libs` -lnx`
+LIBS	:= -lminizip -lstdc++fs -lz -lfreetype -lSDL2_ttf -lSDL2_gfx -lSDL2_image -lSDL2 -lEGL -lGLESv2 -lglapi -ldrm_nouveau -lwebp -lpng -ljpeg `sdl2-config --libs` `freetype-config --libs` -lnx
 
 #---------------------------------------------------------------------------------
 # list of directories containing libraries, this must be the top level containing
diff --git a/include/Cursor.hpp b/include/Cursor.hpp
index 380fc60..0e991fb 100644
--- a/include/Cursor.hpp
+++ b/include/Cursor.hpp
@@ -17,6 +17,7 @@ private:
     int column = 0;
     SDL_Rect rectCursor {0, 0, 0, 0};
     void moveCursorX(bool right);
+    void cursorRecenter();
 
     void refreshPos();
 public:
diff --git a/include/RenderWindow.hpp b/include/RenderWindow.hpp
index 2a7bf83..e78936c 100644
--- a/include/RenderWindow.hpp
+++ b/include/RenderWindow.hpp
@@ -36,6 +36,8 @@ public:
 	int horizontal = 0;
 	int vertical = 0;
 
+	void renderCursorCircle(int column);
+
 	void drawCircleBehindIcons();
 
 private:
diff --git a/source/cursor.cpp b/source/cursor.cpp
index 15f24c0..68cdb9d 100644
--- a/source/cursor.cpp
+++ b/source/cursor.cpp
@@ -87,17 +87,39 @@ bool Cursor::checkInputCursor(int value)
     return false;
 }
 
-void Cursor::printCursor(RenderWindow render)
+void Cursor::cursorRecenter()
 {
-    if (column > 3){
-        column = 0;
+    if (line == 0){
+        if (column > 3){
+            column = 0;
+        }
+        if (column < 0){
+            column = 3;
+        }
     }
-    if (column < 0){
-        column = 3;
+
+    if (line == 1){
+        if (column > 1){
+            column = 0;
+        }
+        if (column < 0){
+            column = 1;
+        }
     }
+}
+
+void Cursor::printCursor(RenderWindow render)
+{
+    cursorRecenter();
     refreshPos();
-    rectCursor = {posX, posY, cursorWandH, cursorWandH};
-    render.renderRect(rectCursor);
+    if (line == 0){
+        rectCursor = {posX, posY, cursorWandH, cursorWandH};
+        render.renderRect(rectCursor);
+    }
+
+    else if (line == 1){
+        render.renderCursorCircle(column);
+    }
 }
 
 void Cursor::refreshPos(){
@@ -113,3 +135,5 @@ void Cursor::refreshPos(){
 
 
 
+
+
diff --git a/source/menu.cpp b/source/menu.cpp
index a64af52..c937577 100644
--- a/source/menu.cpp
+++ b/source/menu.cpp
@@ -83,7 +83,6 @@ void Menu::printMenu()
     vEntity.push_back(Entity (Vector2f(horizontal / 2 + size.x * 0.5, 550), tInfo, size.x, size.y, 0, 0));
 
 
-
     for (auto i : vEntity)
     {
         window.render(i, 1);
diff --git a/source/renderWindow.cpp b/source/renderWindow.cpp
index 87755a1..b70e673 100644
--- a/source/renderWindow.cpp
+++ b/source/renderWindow.cpp
@@ -103,7 +103,7 @@ void RenderWindow::renderRect(SDL_Rect rect)
 		rectangleRGBA(renderer, cursor.getPosX() + 258 + i, cursor.getPosY() - i, cursor.getPosX() - i, cursor.getPosY() + 258 + i, 25, 145, 218, 255);
 	}*/
 
-	SDL_SetRenderDrawColor(renderer, 25, 145, 218, 255);
+	SDL_SetRenderDrawColor(renderer, 3, 194, 195, 255);
 	for (int i = 0; i < 5; ++i){
 		rect.w += 2;
 		rect.h += 2;
@@ -118,4 +118,12 @@ void RenderWindow::drawCircleBehindIcons()
 {
 	filledCircleRGBA(renderer, 1280 / 2 + 50, 575, 38, 80, 80, 80, 255);
 	filledCircleRGBA(renderer, 1280 / 2 - 50, 575, 38, 80, 80, 80, 255);
-}
\ No newline at end of file
+}
+
+void RenderWindow::renderCursorCircle(int column)
+{
+	for (int i = 0; i < 6; ++i){
+		circleRGBA(renderer, 552 + column * (100) + 38, 575, 38 + i, 3, 194, 195, 255);
+	}
+}
+
-- 
GitLab